waitForTxReceipt method
Wait for tx receipt, for several seconds Returns the receipt or Null
Implementation
Future<Map?> waitForTxReceipt(String txId, {int timeout = 20}) async {
int rounds = timeout; //how many attempts
Map? receipt;
for (var i = 0; i < rounds; i++) {
receipt = await getTransactionReceipt(txId);
if (receipt != null) {
return receipt;
} else {
sleep(const Duration(seconds: 3)); // interval
}
}
return null;
}