I've noticed that when testing with a locally deployed contract, I can use await
just fine and see the updated contract variables.
But when running on a contract deployed to mumbai-polygon using alchemy, when I set a variable in my contract and then await the getter, it displays the previously set value (because it just takes longer when running on testnet)
here's an example code snipppet:
await contract.connect(signer).setBaseURI('foobar');
const result = await contract.getBaseURI()
console.log('Base uri: ', result);
Is there some workaround/best practice for this?
If I figure that it takes a couple seconds for the tx to exist on the mumbai testnet, should I just wrap my getBaseURI
in a timeout?
OR is there a way to get notified using a listener that the setter completed? that would be ideal. Would events be useful here? Feels like overkill for something so simple.