diff --git a/README.md b/README.md index bad466d7..6ae264b3 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,9 @@ targets: [ .target( name: "MyProject", dependencies: [ - .product(name: "Web3", package: "Web3"), - .product(name: "Web3PromiseKit", package: "Web3"), - .product(name: "Web3ContractABI", package: "Web3"), + .product(name: "Web3", package: "Web3.swift"), + .product(name: "Web3PromiseKit", package: "Web3.swift"), + .product(name: "Web3ContractABI", package: "Web3.swift"), ] ), .testTarget( @@ -333,12 +333,16 @@ let myPrivateKey = try EthereumPrivateKey(hexPrivateKey: "...") firstly { web3.eth.getTransactionCount(address: myPrivateKey.address, block: .latest) }.then { nonce in - try contract.transfer(to: EthereumAddress(hex: "0x3edB3b95DDe29580FFC04b46A68a31dD46106a4a", eip55: true), value: 100000).createTransaction( + try contract.transfer(to: EthereumAddress(hex: "0x3edB3b95DDe29580FFC04b46A68a31dD46106a4a", eip55: true), value: 100000).createTransaction( nonce: nonce, + gasPrice: EthereumQuantity(quantity: 21.gwei), + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 100000, from: myPrivateKey.address, value: 0, - gas: 100000, - gasPrice: EthereumQuantity(quantity: 21.gwei) + accessList: [:], + transactionType: .legacy )!.sign(with: myPrivateKey).promise }.then { tx in web3.eth.sendRawTransaction(transaction: tx) @@ -353,12 +357,16 @@ let myAddress = try EthereumAddress(hex: "0x1f04ef7263804fafb839f0d04e2b5a6a1a57 firstly { web3.eth.getTransactionCount(address: myAddress, block: .latest) }.then { nonce in - try contract.transfer(to: EthereumAddress(hex: "0x3edB3b95DDe29580FFC04b46A68a31dD46106a4a", eip55: true), value: 100000).send( + try contract.transfer(to: EthereumAddress(hex: "0x3edB3b95DDe29580FFC04b46A68a31dD46106a4a", eip55: true), value: 100000).send( nonce: nonce, + gasPrice: EthereumQuantity(quantity: 21.gwei), + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 150000, from: myAddress, value: 0, - gas: 150000, - gasPrice: EthereumQuantity(quantity: 21.gwei) + accessList: [:], + transactionType: .legacy ) }.done { txHash in print(txHash) @@ -394,7 +402,17 @@ firstly { // Send some tokens to another address (locally signing the transaction) let myPrivateKey = try EthereumPrivateKey(hexPrivateKey: "...") -guard let transaction = contract["transfer"]?(EthereumAddress.testAddress, BigUInt(100000)).createTransaction(nonce: 0, from: myPrivateKey.address, value: 0, gas: 150000, gasPrice: EthereumQuantity(quantity: 21.gwei)) else { +guard let transaction = contract["transfer"]?(EthereumAddress.testAddress, BigUInt(100000)).createTransaction( + nonce: 0, + gasPrice: EthereumQuantity(quantity: 21.gwei), + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 150000, + from: myPrivateKey.address, + value: 0, + accessList: [:], + transactionType: .legacy +)) else { return } let signedTx = try transaction.sign(with: myPrivateKey) diff --git a/Sources/ContractABI/Contract/SolidityInvocation.swift b/Sources/ContractABI/Contract/SolidityInvocation.swift index 53c0d018..6d22df62 100644 --- a/Sources/ContractABI/Contract/SolidityInvocation.swift +++ b/Sources/ContractABI/Contract/SolidityInvocation.swift @@ -6,6 +6,7 @@ // import Foundation +import Collections #if !Web3CocoaPods import Web3 #endif @@ -32,13 +33,34 @@ public protocol SolidityInvocation { func createCall() -> EthereumCall? /// Generates an EthereumTransaction object - func createTransaction(nonce: EthereumQuantity?, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> EthereumTransaction? + func createTransaction( + nonce: EthereumQuantity?, + gasPrice: EthereumQuantity?, + maxFeePerGas: EthereumQuantity?, + maxPriorityFeePerGas: EthereumQuantity?, + gasLimit: EthereumQuantity?, + from: EthereumAddress?, + value: EthereumQuantity?, + accessList: OrderedDictionary, + transactionType: EthereumTransaction.TransactionType + ) -> EthereumTransaction? /// Read data from the blockchain. Only available for constant functions. func call(block: EthereumQuantityTag, completion: @escaping ([String: Any]?, Error?) -> Void) /// Write data to the blockchain. Only available for non-constant functions. - func send(nonce: EthereumQuantity?, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?, completion: @escaping (EthereumData?, Error?) -> Void) + func send( + nonce: EthereumQuantity?, + gasPrice: EthereumQuantity?, + maxFeePerGas: EthereumQuantity?, + maxPriorityFeePerGas: EthereumQuantity?, + gasLimit: EthereumQuantity?, + from: EthereumAddress, + value: EthereumQuantity?, + accessList: OrderedDictionary, + transactionType: EthereumTransaction.TransactionType, + completion: @escaping (EthereumData?, Error?) -> Void + ) /// Estimate how much gas is needed to execute this transaction. func estimateGas(from: EthereumAddress?, gas: EthereumQuantity?, value: EthereumQuantity?, completion: @escaping (EthereumQuantity?, Error?) -> Void) @@ -78,7 +100,18 @@ public struct SolidityReadInvocation: SolidityInvocation { handler.call(call, outputs: outputs, block: block, completion: completion) } - public func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?, completion: @escaping (EthereumData?, Error?) -> Void) { + public func send( + nonce: EthereumQuantity?, + gasPrice: EthereumQuantity?, + maxFeePerGas: EthereumQuantity?, + maxPriorityFeePerGas: EthereumQuantity?, + gasLimit: EthereumQuantity?, + from: EthereumAddress, + value: EthereumQuantity?, + accessList: OrderedDictionary, + transactionType: EthereumTransaction.TransactionType, + completion: @escaping (EthereumData?, Error?) -> Void + ) { completion(nil, InvocationError.invalidInvocation) } @@ -88,7 +121,17 @@ public struct SolidityReadInvocation: SolidityInvocation { return EthereumCall(from: nil, to: to, gas: nil, gasPrice: nil, value: nil, data: data) } - public func createTransaction(nonce: EthereumQuantity?, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> EthereumTransaction? { + public func createTransaction( + nonce: EthereumQuantity?, + gasPrice: EthereumQuantity?, + maxFeePerGas: EthereumQuantity?, + maxPriorityFeePerGas: EthereumQuantity?, + gasLimit: EthereumQuantity?, + from: EthereumAddress?, + value: EthereumQuantity?, + accessList: OrderedDictionary, + transactionType: EthereumTransaction.TransactionType + ) -> EthereumTransaction? { return nil } @@ -109,11 +152,34 @@ public struct SolidityPayableInvocation: SolidityInvocation { self.parameters = zip(parameters, method.inputs).map { SolidityWrappedValue(value: $0, type: $1.type) } self.handler = handler } - - public func createTransaction(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> EthereumTransaction? { + + public func createTransaction( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress? = nil, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy + ) -> EthereumTransaction? { guard let data = encodeABI() else { return nil } guard let to = handler.address else { return nil } - return EthereumTransaction(nonce: nonce, gasPrice: gasPrice, gasLimit: gas, from: from, to: to, value: value ?? 0, data: data) + + return EthereumTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + to: to, + value: value, + data: data, + accessList: accessList, + transactionType: transactionType + ) } public func createCall() -> EthereumCall? { @@ -124,12 +190,33 @@ public struct SolidityPayableInvocation: SolidityInvocation { completion(nil, InvocationError.invalidInvocation) } - public func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?, completion: @escaping (EthereumData?, Error?) -> Void) { + public func send( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy, + completion: @escaping (EthereumData?, Error?) -> Void + ) { guard handler.address != nil else { completion(nil, InvocationError.contractNotDeployed) return } - guard let transaction = createTransaction(nonce: nonce, from: from, value: value, gas: gas, gasPrice: gasPrice) else { + guard let transaction = createTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + value: value, + accessList: accessList, + transactionType: transactionType + ) else { completion(nil, InvocationError.encodingError) return } @@ -152,10 +239,33 @@ public struct SolidityNonPayableInvocation: SolidityInvocation { self.handler = handler } - public func createTransaction(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> EthereumTransaction? { + public func createTransaction( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress? = nil, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy + ) -> EthereumTransaction? { guard let data = encodeABI() else { return nil } guard let to = handler.address else { return nil } - return EthereumTransaction(nonce: nonce, gasPrice: gasPrice, gasLimit: gas, from: from, to: to, value: value ?? 0, data: data) + + return EthereumTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + to: to, + value: value, + data: data, + accessList: accessList, + transactionType: transactionType + ) } public func createCall() -> EthereumCall? { @@ -166,12 +276,33 @@ public struct SolidityNonPayableInvocation: SolidityInvocation { completion(nil, InvocationError.invalidInvocation) } - public func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?, completion: @escaping (EthereumData?, Error?) -> Void) { + public func send( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy, + completion: @escaping (EthereumData?, Error?) -> Void + ) { guard handler.address != nil else { completion(nil, InvocationError.contractNotDeployed) return } - guard let transaction = createTransaction(nonce: nonce, from: from, value: value, gas: gas, gasPrice: gasPrice) else { + guard let transaction = createTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + value: value, + accessList: accessList, + transactionType: transactionType + ) else { completion(nil, InvocationError.encodingError) return } @@ -225,18 +356,62 @@ public struct SolidityConstructorInvocation { self.handler = handler self.payable = payable } - - public func createTransaction(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity = 0, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> EthereumTransaction? { + + public func createTransaction( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress? = nil, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy + ) -> EthereumTransaction? { guard let data = encodeABI() else { return nil } - return EthereumTransaction(nonce: nonce, gasPrice: gasPrice, gasLimit: gas, from: from, to: nil, value: value, data: data) + + return EthereumTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + to: nil, + value: value, + data: data, + accessList: accessList, + transactionType: transactionType + ) } - public func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity = 0, gas: EthereumQuantity, gasPrice: EthereumQuantity?, completion: @escaping (EthereumData?, Error?) -> Void) { - guard payable == true || value == 0 else { + public func send( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy, + completion: @escaping (EthereumData?, Error?) -> Void + ) { + guard payable == true || value == nil || value == 0 else { completion(nil, InvocationError.invalidInvocation) return } - guard let transaction = createTransaction(nonce: nonce, from: from, value: value, gas: gas, gasPrice: gasPrice) else { + guard let transaction = createTransaction( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + value: value, + accessList: accessList, + transactionType: transactionType + ) else { completion(nil, InvocationError.encodingError) return } diff --git a/Sources/Core/Web3/Web3.swift b/Sources/Core/Web3/Web3.swift index 02c83d87..99bbf4db 100644 --- a/Sources/Core/Web3/Web3.swift +++ b/Sources/Core/Web3/Web3.swift @@ -305,12 +305,12 @@ public struct Web3 { public func sendRawTransaction( transaction: EthereumSignedTransaction, response: @escaping Web3ResponseCompletion - ) { - let req = BasicRPCRequest( + ) throws { + let req = try BasicRPCRequest( id: properties.rpcId, jsonrpc: Web3.jsonrpc, method: "eth_sendRawTransaction", - params: [transaction.rlp()] + params: [transaction.rawTransaction()] ) properties.provider.send(request: req, response: response) diff --git a/Sources/PromiseKit/ContractPromiseExtensions.swift b/Sources/PromiseKit/ContractPromiseExtensions.swift index 4ece77ee..658eb165 100644 --- a/Sources/PromiseKit/ContractPromiseExtensions.swift +++ b/Sources/PromiseKit/ContractPromiseExtensions.swift @@ -9,6 +9,7 @@ import Web3ContractABI import PromiseKit +import Collections #if !Web3CocoaPods import Web3 @@ -24,9 +25,30 @@ public extension SolidityInvocation { } } - func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity?, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> Promise { + func send( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy + ) -> Promise { return Promise { seal in - self.send(nonce: nonce, from: from, value: value, gas: gas, gasPrice: gasPrice, completion: seal.resolve) + self.send( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + value: value, + accessList: accessList, + transactionType: transactionType, + completion: seal.resolve + ) } } @@ -39,9 +61,30 @@ public extension SolidityInvocation { public extension SolidityConstructorInvocation { - func send(nonce: EthereumQuantity? = nil, from: EthereumAddress, value: EthereumQuantity = 0, gas: EthereumQuantity, gasPrice: EthereumQuantity?) -> Promise { + func send( + nonce: EthereumQuantity? = nil, + gasPrice: EthereumQuantity? = nil, + maxFeePerGas: EthereumQuantity? = nil, + maxPriorityFeePerGas: EthereumQuantity? = nil, + gasLimit: EthereumQuantity? = nil, + from: EthereumAddress, + value: EthereumQuantity? = nil, + accessList: OrderedDictionary = [:], + transactionType: EthereumTransaction.TransactionType = .legacy + ) -> Promise { return Promise { seal in - self.send(nonce: nonce, from: from, value: value, gas: gas, gasPrice: gasPrice, completion: seal.resolve) + self.send( + nonce: nonce, + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasLimit: gasLimit, + from: from, + value: value, + accessList: accessList, + transactionType: transactionType, + completion: seal.resolve + ) } } } diff --git a/Sources/PromiseKit/Web3+PromiseKit.swift b/Sources/PromiseKit/Web3+PromiseKit.swift index d91b2106..c61ecbfc 100644 --- a/Sources/PromiseKit/Web3+PromiseKit.swift +++ b/Sources/PromiseKit/Web3+PromiseKit.swift @@ -169,8 +169,12 @@ public extension Web3.Eth { func sendRawTransaction(transaction: EthereumSignedTransaction) -> Promise { return Promise { seal in - self.sendRawTransaction(transaction: transaction) { response in - response.sealPromise(seal: seal) + do { + try self.sendRawTransaction(transaction: transaction) { response in + response.sealPromise(seal: seal) + } + } catch let err { + seal.reject(err) } } } diff --git a/Tests/Web3Tests/ContractTests/ContractTests.swift b/Tests/Web3Tests/ContractTests/ContractTests.swift index c5e2703e..e115ba18 100644 --- a/Tests/Web3Tests/ContractTests/ContractTests.swift +++ b/Tests/Web3Tests/ContractTests/ContractTests.swift @@ -101,7 +101,7 @@ class ContractTests: QuickSpec { describe("Constructor method") { it("should be able to be deployed") { waitUntil { done in - contract.deploy(name: "Test Instance").send(from: .testAddress, value: 0, gas: 15000, gasPrice: nil).done { hash in + contract.deploy(name: "Test Instance").send(gasPrice: nil, gasLimit: 15000, from: .testAddress, value: 0).done { hash in done() }.catch { error in fail() @@ -127,7 +127,17 @@ class ContractTests: QuickSpec { it("should fail with send") { waitUntil { done in - invocation.send(from: .testAddress, value: nil, gas: 0, gasPrice: 0).catch { error in + invocation.send( + nonce: nil, + gasPrice: 0, + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 0, + from: .testAddress, + value: nil, + accessList: [:], + transactionType: .legacy + ).catch { error in expect(error as? InvocationError).to(equal(InvocationError.invalidInvocation)) done() } @@ -156,7 +166,17 @@ class ContractTests: QuickSpec { let expectedHash = try! EthereumData(ethereumValue: "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331") waitUntil { done in firstly { - invocation.send(from: .testAddress, value: EthereumQuantity(quantity: 1.eth), gas: 21000, gasPrice: nil) + invocation.send( + nonce: nil, + gasPrice: nil, + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 21000, + from: .testAddress, + value: EthereumQuantity(quantity: 1.eth), + accessList: [:], + transactionType: .legacy + ) }.done { hash in expect(hash).to(equal(expectedHash)) done() @@ -184,7 +204,17 @@ class ContractTests: QuickSpec { it("should succeed with send") { let expectedHash = try! EthereumData(ethereumValue: "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331") waitUntil { done in - invocation.send(from: .testAddress, value: nil, gas: 12000, gasPrice: 700000).done { hash in + invocation.send( + nonce: nil, + gasPrice: 700000, + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 12000, + from: .testAddress, + value: nil, + accessList: [:], + transactionType: .legacy + ).done { hash in expect(hash).to(equal(expectedHash)) done() }.catch { error in diff --git a/Tests/Web3Tests/ContractTests/JSONContractTests.swift b/Tests/Web3Tests/ContractTests/JSONContractTests.swift index bcb199b9..e71b874f 100644 --- a/Tests/Web3Tests/ContractTests/JSONContractTests.swift +++ b/Tests/Web3Tests/ContractTests/JSONContractTests.swift @@ -64,7 +64,7 @@ class DynamicContractTests: QuickSpec { } it("should be able to create a valid transaction") { - let transaction = invocation.createTransaction(from: .testAddress, gas: 0, gasPrice: 0) + let transaction = invocation.createTransaction(gasPrice: 0, gasLimit: 0, from: .testAddress) let generatedHexString = transaction?.data.hex() expect(generatedHexString).notTo(beNil()) } @@ -72,7 +72,7 @@ class DynamicContractTests: QuickSpec { it("should deploy") { let expectedHash = try? EthereumData(ethereumValue: "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331") waitUntil { done in - invocation.send(from: .testAddress, gas: 15000, gasPrice: nil) { (hash, error) in + invocation.send(gasPrice: nil, gasLimit: 15000, from: .testAddress) { (hash, error) in expect(error).to(beNil()) expect(hash).to(equal(expectedHash)) done() @@ -82,7 +82,17 @@ class DynamicContractTests: QuickSpec { it("should fail to deploy when including a value") { waitUntil { done in - invocation.send(from: .testAddress, value: EthereumQuantity(quantity: 1.eth), gas: 15000, gasPrice: nil) { (hash, error) in + invocation.send( + nonce: nil, + gasPrice: nil, + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 15000, + from: .testAddress, + value: EthereumQuantity(quantity: 1.eth), + accessList: [:], + transactionType: .legacy + ) { (hash, error) in expect(error as? InvocationError).to(equal(.invalidInvocation)) done() } @@ -129,7 +139,17 @@ class DynamicContractTests: QuickSpec { describe("Sends") { it("should be able to send non-payable method") { - guard let transaction = contract["transfer"]?(EthereumAddress.testAddress, BigUInt(1)).createTransaction(nonce: 0, from: .testAddress, value: nil, gas: 12000, gasPrice: nil) else { + guard let transaction = contract["transfer"]?(EthereumAddress.testAddress, BigUInt(1)).createTransaction( + nonce: 0, + gasPrice: nil, + maxFeePerGas: nil, + maxPriorityFeePerGas: nil, + gasLimit: 12000, + from: .testAddress, + value: nil, + accessList: [:], + transactionType: .legacy + ) else { fail("Could not generate transaction") return }