Skip to content

Commit 511c233

Browse files
Some method renaming to match PR documentation.
1 parent c2d8444 commit 511c233

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

Sources/Core/Transaction/CodableTransaction.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct CodableTransaction {
1919

2020
/// storage container for additional metadata returned by the node
2121
/// when a transaction is decoded form a JSON stream
22-
public var meta: EthereumMetadata?
22+
public var meta: TransactionMetadata?
2323

2424
// MARK: - Properties that always sends to a Node
2525

@@ -243,7 +243,7 @@ extension CodableTransaction: Codable {
243243
maxPriorityFeePerGasPolicy = .automatic
244244

245245
// capture any metadata that might be present
246-
self.meta = try EthereumMetadata(from: decoder)
246+
self.meta = try TransactionMetadata(from: decoder)
247247
}
248248

249249
public func encode(to encoder: Encoder) throws {
@@ -312,7 +312,7 @@ extension CodableTransaction {
312312
case manual(BigUInt)
313313
}
314314

315-
public func resolveNonce(provider: Web3Provider) async throws -> BigUInt {
315+
func resolveNonce(provider: Web3Provider) async throws -> BigUInt {
316316
switch noncePolicy {
317317
case .pending, .latest, .earliest:
318318
guard let address = from ?? sender else { throw Web3Error.valueError }
@@ -324,7 +324,7 @@ extension CodableTransaction {
324324
}
325325
}
326326

327-
public func resolveGasPrice(provider: Web3Provider) async throws -> BigUInt {
327+
func resolveGasPrice(provider: Web3Provider) async throws -> BigUInt {
328328
let oracle = Oracle(provider)
329329
switch gasPricePolicy {
330330
case .automatic, .withMargin:
@@ -334,7 +334,7 @@ extension CodableTransaction {
334334
}
335335
}
336336

337-
public func resolveGasLimit(provider: Web3Provider) async throws -> BigUInt {
337+
func resolveGasLimit(provider: Web3Provider) async throws -> BigUInt {
338338
let request: APIRequest = .estimateGas(self, self.callOnBlock ?? .latest)
339339
let response: APIResponse<BigUInt> = try await APIRequest.sendRequest(with: provider, for: request)
340340
switch gasLimitPolicy {
@@ -351,7 +351,7 @@ extension CodableTransaction {
351351
}
352352
}
353353

354-
public func resolveMaxFeePerGas(provider: Web3Provider) async throws -> BigUInt {
354+
func resolveMaxFeePerGas(provider: Web3Provider) async throws -> BigUInt {
355355
let oracle = Oracle(provider)
356356
switch maxFeePerGasPolicy {
357357
case .automatic:
@@ -361,7 +361,7 @@ extension CodableTransaction {
361361
}
362362
}
363363

364-
public func resolveMaxPriorityFeePerGas(provider: Web3Provider) async throws -> BigUInt {
364+
func resolveMaxPriorityFeePerGas(provider: Web3Provider) async throws -> BigUInt {
365365
let oracle = Oracle(provider)
366366
switch maxPriorityFeePerGasPolicy {
367367
case .automatic:

Sources/Core/Transaction/EthereumMetadata.swift renamed to Sources/Core/Transaction/TransactionMetadata.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import BigInt
1111
/// returned by nodes when reading a transaction
1212
/// from the blockchain. The data here is not
1313
/// part of the transaction itself
14-
public struct EthereumMetadata {
14+
public struct TransactionMetadata {
1515

1616
/// hash for the block that contains this transaction on chain
1717
public var blockHash: Data?
@@ -34,7 +34,7 @@ public struct EthereumMetadata {
3434
public var gasPrice: BigUInt?
3535
}
3636

37-
public extension EthereumMetadata {
37+
public extension TransactionMetadata {
3838
private enum CodingKeys: String, CodingKey {
3939
case blockHash
4040
case blockNumber

Sources/web3swift/Web3/Web3+Contract.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension web3 {
5151
/// If extraData is supplied it is appended to encoded bytecode and constructor parameters.
5252
///
5353
/// Returns a "Transaction intermediate" object.
54-
public func deploy(bytecode: Data,
54+
public func prepareDeploy(bytecode: Data,
5555
constructor: ABI.Element.Constructor? = nil,
5656
parameters: [AnyObject]? = nil,
5757
extraData: Data? = nil) -> WriteOperation? {

Tests/web3swiftTests/localTests/AdvancedABIv2Tests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AdvancedABIv2Tests: LocalTestCase {
2121
var contract = web3.contract(abiString, at: nil, abiVersion: 2)!
2222

2323
// MARK: Writing Data flow
24-
let deployTx = contract.deploy(bytecode: bytecode)!
24+
let deployTx = contract.prepareDeploy(bytecode: bytecode)!
2525
deployTx.transaction.from = allAddresses[0]
2626
deployTx.transaction.gasLimitPolicy = .manual(3000000)
2727
// MARK: Sending Data flow
@@ -59,7 +59,7 @@ class AdvancedABIv2Tests: LocalTestCase {
5959

6060
let parameters = [] as [AnyObject]
6161
// MARK: Writing Data flow
62-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
62+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
6363
deployTx.transaction.from = allAddresses[0]
6464
deployTx.transaction.gasLimitPolicy = .manual(3000000)
6565
let result = try await deployTx.writeToChain(password: "web3swift")
@@ -96,7 +96,7 @@ class AdvancedABIv2Tests: LocalTestCase {
9696

9797
let parameters = [] as [AnyObject]
9898
// MARK: Writing Data flow
99-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
99+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
100100
deployTx.transaction.from = allAddresses[0]
101101
deployTx.transaction.gasLimitPolicy = .manual(3000000)
102102
let result = try await deployTx.writeToChain(password: "web3swift")
@@ -132,7 +132,7 @@ class AdvancedABIv2Tests: LocalTestCase {
132132

133133
let parameters = [] as [AnyObject]
134134
// MARK: Writing Data flow
135-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
135+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
136136
deployTx.transaction.from = allAddresses[0]
137137
deployTx.transaction.gasLimitPolicy = .manual(3000000)
138138
let result = try await deployTx.writeToChain(password: "web3swift")
@@ -169,7 +169,7 @@ class AdvancedABIv2Tests: LocalTestCase {
169169

170170
let parameters = [] as [AnyObject]
171171
// MARK: Writing Data flow
172-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
172+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
173173
deployTx.transaction.from = allAddresses[0]
174174
deployTx.transaction.gasLimitPolicy = .manual(3000000)
175175
let result = try await deployTx.writeToChain(password: "web3swift")

Tests/web3swiftTests/localTests/BasicLocalNodeTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BasicLocalNodeTests: LocalTestCase {
2323

2424
let parameters = [] as [AnyObject]
2525
// MARK: Writing Data flow
26-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
26+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
2727
deployTx.transaction.from = allAddresses[0]
2828
deployTx.transaction.gasLimitPolicy = .manual(3000000)
2929

Tests/web3swiftTests/localTests/PersonalSignatureTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PersonalSignatureTests: XCTestCase {
3838
let bytecode = Data.fromHex("0x608060405234801561001057600080fd5b506105ba806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632785e93714610051578063d01ec9a514610123575b600080fd5b34801561005d57600080fd5b506100e1600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506101a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561012f57600080fd5b5061018a600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610258565b60405180826000191660001916815260200191505060405180910390f35b6000806101b486610258565b9050601b8560ff1610156101c957601b850194505b600181868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610240573d6000803e3d6000fd5b50505060206040510351915081915050949350505050565b600080825190506040805190810160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a00000000000081525061029e826103b4565b846040518084805190602001908083835b6020831015156102d457805182526020820191506020810190506020830392506102af565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831015156103275780518252602082019150602081019050602083039250610302565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b60208310151561037a5780518252602082019150602081019050602083039250610355565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040518091039020915081915050919050565b606060006060600080600060649450846040519080825280601f01601f1916602001820160405280156103f65781602001602082028038833980820191505090505b509350600092505b60008714151561049557600a8781151561041457fe5b069150600a8781151561042357fe5b049650816030017f010000000000000000000000000000000000000000000000000000000000000002848480600101955081518110151561046057fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506103fe565b826040519080825280601f01601f1916602001820160405280156104c85781602001602082028038833980820191505090505b509550600090505b8281101561058157838160018503038151811015156104eb57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002868281518110151561054457fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506104d0565b85955050505050509190505600a165627a7a723058204b567e6628d988bde2e19a4e9a457bf84bbeac15069a74fe993aba215fb024330029")!
3939

4040
var contract = web3.contract(abiString, at: nil, abiVersion: 2)!
41-
let deployTx = contract.deploy(bytecode: bytecode)!
41+
let deployTx = contract.prepareDeploy(bytecode: bytecode)!
4242
let allAddresses = try await web3.eth.ownedAccounts()
4343
deployTx.transaction.from = allAddresses[0]
4444
deployTx.transaction.gasLimitPolicy = .manual(3000000)

Tests/web3swiftTests/localTests/TestHelpers.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TestHelpers {
2828
EthereumAddress("0xe22b8979739D724343bd002F9f432F5990879901")!,
2929
1024
3030
] as [AnyObject]
31-
let deployTx = contract.deploy(bytecode: bytecode,
31+
let deployTx = contract.prepareDeploy(bytecode: bytecode,
3232
constructor: contract.contract.constructor,
3333
parameters: parameters)!
3434
deployTx.transaction.from = allAddresses[0]

Tests/web3swiftTests/localTests/UserCases.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class UserCases: XCTestCase {
7777
let contract = web3.contract(Web3.Utils.estimateGasTestABI, at: nil, abiVersion: 2)!
7878

7979
let parameters = [] as [AnyObject]
80-
let deployTx = contract.deploy(bytecode: bytecode, parameters: parameters)!
80+
let deployTx = contract.prepareDeploy(bytecode: bytecode, parameters: parameters)!
8181
deployTx.transaction.from = allAddresses[0]
8282
deployTx.transaction.gasLimitPolicy = .manual(3000000)
8383
let result = try await deployTx.writeToChain(password: "web3swift")

0 commit comments

Comments
 (0)