getBlockWithTransaction method

Future<BlockWithTransaction> getBlockWithTransaction(
  1. int blockNumber
)

Get the BlockWithTransaction at blockNumber from the network, where the BlockWithTransaction.transactions is an Array of TransactionResponse.


final block = await provider!.getBlockWithTransaction(2000000);

print(block);
// Block: 2000000 0x9d2e2d20 mined at 2020-11-06T21:22:24.000 with diff 2
print(block.transaction.first);
// Transaction: 0x99598d22 from 0xC5D2A96c with value 39090000000000000000 and data 0x7ff36ab500000...
print(block.transactions.first is TransactionResponse); // true

Implementation

Future<BlockWithTransaction> getBlockWithTransaction(int blockNumber) async =>
    BlockWithTransaction._(
      await call<_BlockWithTransactionImpl>(
        'getBlockWithTransactions',
        [blockNumber],
      ),
    );