confirm method
Implementation
Future<Transaction> confirm(
{String? txHash, int? maxAttempts = 20, int? interval = 1000}) async {
this.status = TxStatus.Pending;
int attempt = 0;
do {
try {
if (await this.trackTx(txHash)) {
return this;
}
} catch (err) {
this.status = TxStatus.Rejected;
rethrow;
}
if (attempt < maxAttempts! - 1) {
sleep(ms: interval! * attempt, callback: () => attempt += 1);
} else
break;
} while (attempt < maxAttempts);
this.status = TxStatus.Rejected;
throw 'The transaction is still not confirmed after ${maxAttempts} attemps.';
}