You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this section, following the tutorial should return the number 1, but I got the wrong text instead
CODE
functionlistenForTransactionMine(transactionResponse,provider){console.log(`Mining ${transactionResponse.hash}...`)// create a listener for the blockchainreturnnewPromise((resolve,reject)=>{provider.once(transactionResponse.hash,(transactionReceipt)=>{console.log(`Completed with ${transactionReceipt.confirmations} confirmations..`)resolve()})})}
functionlistenForTransactionToBeMined(txResponse,provider){console.log(`Mining ${txResponse.hash}...`);returnnewPromise((resolve,reject)=>{provider.once(txResponse.hash,async(txReceipt)=>{awaittxResponse.wait(1);console.log(`Completed with ${awaittxReceipt.confirmations()} confirmations!`);resolve();});})}
So basically transactionReceipt.confirmations is a method which means it should be written like this: transactionReceipt.confirmations()
and it also returns a promise so you should use await and since the listenForTransactionToBeMined isn't async and we want it to stay like this(for some reason idk why), i added the async keyword before the anonymous function in the second argument of provider.once: provider.once(txResponse.hash, async (txReceipt) => {
and i also figured out if i don't add the await txResponse.wait(1); line, it logs with 0 confirmations.
In this section, following the tutorial should return the number 1, but I got the wrong text instead
The text was updated successfully, but these errors were encountered: