From 540326de85d1704734b8d0ee4f70015ac518cfc5 Mon Sep 17 00:00:00 2001 From: Pegasus <83475418+0xp3gasus@users.noreply.github.com> Date: Mon, 20 May 2024 16:53:53 +0200 Subject: [PATCH] 1162 nonce bug (#1163) * Nonce bug fix * Changeset version file --- .changeset/thirty-chairs-wait.md | 5 +++++ packages/xchain-evm/src/clients/client.ts | 2 +- packages/xchain-evm/src/signers/keystoreSigner.ts | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/thirty-chairs-wait.md diff --git a/.changeset/thirty-chairs-wait.md b/.changeset/thirty-chairs-wait.md new file mode 100644 index 000000000..3ec635e75 --- /dev/null +++ b/.changeset/thirty-chairs-wait.md @@ -0,0 +1,5 @@ +--- +'@xchainjs/xchain-evm': patch +--- + +Bug fix related to the nonce at making approve and transfer transactions with Keystore clients diff --git a/packages/xchain-evm/src/clients/client.ts b/packages/xchain-evm/src/clients/client.ts index 9cc313bd3..277a79422 100644 --- a/packages/xchain-evm/src/clients/client.ts +++ b/packages/xchain-evm/src/clients/client.ts @@ -801,7 +801,7 @@ export class Client extends BaseXChainClient implements EVMClient { const tx = await ethers.utils.resolveProperties(transactionRequest) const signedTx = await this.getSigner().signApprove({ - sender: await this.getAddressAsync(), + sender, tx: { type: 1, chainId: tx.chainId, diff --git a/packages/xchain-evm/src/signers/keystoreSigner.ts b/packages/xchain-evm/src/signers/keystoreSigner.ts index 33023514f..6577b0837 100644 --- a/packages/xchain-evm/src/signers/keystoreSigner.ts +++ b/packages/xchain-evm/src/signers/keystoreSigner.ts @@ -111,6 +111,7 @@ export class KeystoreSigner extends Signer implements IKeystoreSigner { to: tx.to, data: tx.data, value: tx.value, + nonce: tx.nonce ? ethers.BigNumber.from(tx.nonce).toNumber() : undefined, gasLimit: tx.gasLimit, gasPrice: tx.gasPrice, maxPriorityFeePerGas: tx.maxPriorityFeePerGas, @@ -134,6 +135,7 @@ export class KeystoreSigner extends Signer implements IKeystoreSigner { to: tx.to, value: tx.value, data: tx.data, + nonce: tx.nonce ? ethers.BigNumber.from(tx.nonce).toNumber() : undefined, gasPrice: tx.gasPrice, gasLimit: tx.gasLimit, })