waitForTransaction method

Future<TransactionReceipt> waitForTransaction(
  1. String transactionHash, [
  2. int confirms = 1,
  3. Duration? timeout
])

Returns a Future of TransactionReceipt which will not resolve until transactionHash is mined.

If confirms is 0, this method is non-blocking and if the transaction has not been mined returns null.

Otherwise, this method will block until the transaction has confirms blocks mined on top of the block in which is was mined.


final transaction = await provider!.waitForTransaction('0x4e04def628cfd0c7786febaef8fbe832fc30eae54a4fba25bf46022c439ab39d');

print(transaction); // TransactionReceipt: 0x4e04def6 from 0x1dFCD06a with 618 confirmations and 8 logs
print(transaction is TransactionReceipt); // true

Implementation

Future<TransactionReceipt> waitForTransaction(
  String transactionHash, [
  int confirms = 1,
  Duration? timeout,
]) async =>
    TransactionReceipt._(
      await call<_TransactionReceiptImpl>(
        'waitForTransaction',
        timeout != null
            ? [transactionHash, confirms, timeout.inSeconds]
            : [transactionHash, confirms],
      ),
    );