In ethers.js,
provider.sendTransaction(rawTransaction).then((transaction) => {
// A full Transaction Response is returned
// - from
// - to
// - gasLimit, gasPrice
// - nonce
// - r, s, v
// - wait() => Promise that resolves the Transaction Receipt once mined
// and rejects with an error is the stats is 0; the error
// will have a transactionHash property as well as a
// transaction property.
let hash = transaction.hash;
});
Here it will return the receipt after wait()
how can I write the wait in my code?
I use:
.then(function(tx){
wait()=>{}
})
This will not work.
Best Answer
In this way you can write a wait in your code.