Lesson 5: const updatedNumber = await contract.retrieve(); Not working!! #2470
-
Hello dear Colleagues, I'm having a curious error when following the Lesson and deploying the Smart Contract to the Alchemy Testnet Blockchain. Issue: const currentFavoriteNumber = await contract.retrieve();
console.log(
`Default Favorite Number: ${currentFavoriteNumber.toString()}`
);
await contract.store("10");
const updatedNumber = await contract.retrieve();
console.log(`New Favorite Number: ${updatedNumber.toString()}`); This code is working perfectly on Ganache Local TestNet. When I change the setup to be connected to Alchemy Testnet, the same code do not work. After this piece of code Some Ideas or solution? Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@AGMASO Hey! Add a waiting condition after storing a number, because testnets takes time to update that. await contract.store("10");
await contract.deployTransaction.wait(1); |
Beta Was this translation helpful? Give feedback.
@AGMASO Hey! Add a waiting condition after storing a number, because testnets takes time to update that.