waitForTransaction method
Future<SuiTransactionBlockResponse>
waitForTransaction(
- TransactionDigest digest, {
- SuiTransactionBlockResponseOptions? options,
- int timeout = 60 * 1000,
- int pollInterval = 2 * 1000,
Implementation
Future<SuiTransactionBlockResponse> waitForTransaction(
TransactionDigest digest, {
SuiTransactionBlockResponseOptions? options,
int timeout = 60 * 1000,
int pollInterval = 2 * 1000
}) async {
SuiTransactionBlockResponse? resp;
final timeoutDuration = Duration(milliseconds: timeout);
await Future.doWhile(() async {
try {
resp = await getTransactionBlock(digest, options: options);
return false;
} catch (e) {
await Future.delayed(Duration(milliseconds: pollInterval));
return true;
}
}).timeout(timeoutDuration);
return resp ?? (throw TimeoutException('Operation timed out', timeoutDuration));
}