diff --git a/ethers/contract.nim b/ethers/contract.nim index affc4f9..f55b00e 100644 --- a/ethers/contract.nim +++ b/ethers/contract.nim @@ -33,9 +33,8 @@ type nonce*: ?UInt256 chainId*: ?UInt256 gasPrice*: ?UInt256 - maxFee*: ?UInt256 - maxPriorityFee*: ?UInt256 maxPriorityFeePerGas*: ?UInt256 + maxFeePerGas*: ?UInt256 gasLimit*: ?UInt256 CallOverrides* = ref object of TransactionOverrides blockTag*: ?BlockTag @@ -81,8 +80,7 @@ proc createTransaction(contract: Contract, nonce: overrides.nonce, chainId: overrides.chainId, gasPrice: overrides.gasPrice, - maxFee: overrides.maxFee, - maxPriorityFee: overrides.maxPriorityFee, + maxFeePerGas: overrides.maxFeePerGas, maxPriorityFeePerGas: overrides.maxPriorityFeePerGas, gasLimit: overrides.gasLimit, ) diff --git a/ethers/signers/wallet/signing.nim b/ethers/signers/wallet/signing.nim index 18b73f3..7a05146 100644 --- a/ethers/signers/wallet/signing.nim +++ b/ethers/signers/wallet/signing.nim @@ -32,11 +32,11 @@ func toSignableTransaction(transaction: Transaction): SignableTransaction = signable.value = transaction.value signable.payload = transaction.data - if maxFee =? transaction.maxFee and - maxPriorityFee =? transaction.maxPriorityFee: + if maxFeePerGas =? transaction.maxFeePerGas and + maxPriorityFeePerGas =? transaction.maxPriorityFeePerGas: signable.txType = TxEip1559 - signable.maxFeePerGas = GasInt(maxFee.truncate(uint64)) - signable.maxPriorityFeePerGas = GasInt(maxPriorityFee.truncate(uint64)) + signable.maxFeePerGas = GasInt(maxFeePerGas.truncate(uint64)) + signable.maxPriorityFeePerGas = GasInt(maxPriorityFeePerGas.truncate(uint64)) elif gasPrice =? transaction.gasPrice: signable.txType = TxLegacy signable.gasPrice = GasInt(gasPrice.truncate(uint64)) diff --git a/ethers/transaction.nim b/ethers/transaction.nim index 6bd47f5..3bf454f 100644 --- a/ethers/transaction.nim +++ b/ethers/transaction.nim @@ -15,8 +15,6 @@ type nonce*: ?UInt256 chainId*: ?UInt256 gasPrice*: ?UInt256 - maxFee*: ?UInt256 - maxPriorityFee*: ?UInt256 maxPriorityFeePerGas*: ?UInt256 maxFeePerGas*: ?UInt256 gasLimit*: ?UInt256 diff --git a/testmodule/testContracts.nim b/testmodule/testContracts.nim index 023eb69..f1e70d1 100644 --- a/testmodule/testContracts.nim +++ b/testmodule/testContracts.nim @@ -107,17 +107,17 @@ for url in ["ws://" & providerUrl, "http://" & providerUrl]: check (await token.connect(provider).balanceOf(accounts[1])) == 25.u256 check (await token.connect(provider).balanceOf(accounts[2])) == 25.u256 - test "takes custom values for nonce, gasprice and gaslimit": + test "takes custom values for nonce, gasprice and maxPriorityFeePerGas": let overrides = TransactionOverrides( nonce: some 100.u256, - gasPrice: some 200.u256, + maxPriorityFeePerGas: some 200.u256, gasLimit: some 300.u256 ) let signer = MockSigner.new(provider) discard await token.connect(signer).mint(accounts[0], 42.u256, overrides) check signer.transactions.len == 1 check signer.transactions[0].nonce == overrides.nonce - check signer.transactions[0].gasPrice == overrides.gasPrice + check signer.transactions[0].maxPriorityFeePerGas == overrides.maxPriorityFeePerGas check signer.transactions[0].gasLimit == overrides.gasLimit test "can call functions for different block heights": diff --git a/testmodule/testWallet.nim b/testmodule/testWallet.nim index 6f1e105..39206ee 100644 --- a/testmodule/testWallet.nim +++ b/testmodule/testWallet.nim @@ -80,8 +80,8 @@ suite "Wallet": to: wallet.address, nonce: some 0.u256, chainId: some 31337.u256, - maxFee: some 2_000_000_000.u256, - maxPriorityFee: some 1_000_000_000.u256, + maxFeePerGas: some 2_000_000_000.u256, + maxPriorityFeePerGas: some 1_000_000_000.u256, gasLimit: some 21_000.u256 ) let signedTx = await wallet.signTransaction(tx) @@ -105,7 +105,7 @@ suite "Wallet": let wallet = !Wallet.new(pk_with_funds, provider) let overrides = TransactionOverrides( nonce: some 0.u256, - gasPrice: some 1_000_000_000.u256, + maxPriorityFeePerGas: some 1_000_000_000.u256, gasLimit: some 22_000.u256) let testToken = Erc20.new(wallet.address, wallet) await testToken.transfer(wallet.address, 24.u256, overrides) @@ -115,8 +115,8 @@ suite "Wallet": let wallet = !Wallet.new(pk_with_funds, provider) let overrides = TransactionOverrides( nonce: some 0.u256, - maxFee: some 1_000_000_000.u256, - maxPriorityFee: some 1_000_000_000.u256, + maxFeePerGas: some 1_000_000_000.u256, + maxPriorityFeePerGas: some 1_000_000_000.u256, gasLimit: some 22_000.u256) let testToken = Erc20.new(wallet.address, wallet) await testToken.transfer(wallet.address, 24.u256, overrides)