Ch. 5 Error: the tx doesn't have the correct nonce. account has nonce of: 26 tx has nonce of: 25 #5123
-
I have this code, pretty much the same as Patrick does. const currentFavoriteNumber = await contract.retrieve();
console.log(`Current Favorite Number: ${currentFavoriteNumber.toString()}`);
const transactionResponse = await contract.store("7");
console.log(`Tx response: ${transactionResponse}`); and the output of running
I would assume the contract object would be robust enough in 2023 to update the nonce after each call, but maybe not. Somehow Patrick doesn't have this issue, but it's not auto updating the wallet nonce for me. Any ideas on a solution here, without me having to go down the rabbit hole on some custom solution? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
If you could drop link to your github repo or share your files in thread here easier to see where you're at. And if you're using metamask at this time, perhaps you need to go to accounts in metamask (the round icon ) go to Settings/ Advanced / Reset Account |
Beta Was this translation helpful? Give feedback.
-
Same problem here. I guess it comes from the huge overhaul that the version 6 of ethersJS was from version 5. I managed to follow through Patrick's entire video using version 6 (while Patrick uses v5) though and I really don't wanna downgrade just to fix this... Have been digging the documentation and can't find solution... |
Beta Was this translation helpful? Give feedback.
-
I run into the exact same error just like you ! I saw other fellows in the comment area say that downgrade version of ethers from 6 to 5 is an option , however , I find another way to achieve the function of wait(1) mentioned in the vedio ! const contract = await contractfactory.deploy(deploymentOptions);
await contract.waitForDeployment(1); the code upside can actually finish the same job ! |
Beta Was this translation helpful? Give feedback.
-
I also had the same issue. This is how I fixed it. Patricks Code const contract = await contractFactory.deploy()
const deploymentReceipt = await contract.deployTransaction.wait(1) My Code const contract = await contractFactory.deploy();
await contract.waitForDeployment(1);``` |
Beta Was this translation helpful? Give feedback.
Same problem here. I guess it comes from the huge overhaul that the version 6 of ethersJS was from version 5. I managed to follow through Patrick's entire video using version 6 (while Patrick uses v5) though and I really don't wanna downgrade just to fix this... Have been digging the documentation and can't find solution...