getBlockByNumber method
Signs the given transaction using the keys supplied in the cred
object to upload it to the client so that it can be executed.
Returns a hash of the transaction which, after the transaction has been included in a mined block, can be used to obtain detailed information about the transaction.
Implementation
// Future<String> sendTransaction(Credentials cred, Transaction transaction,
// {int? chainId = 1, bool fetchChainIdFromNetworkId = false}) async {
// if (cred is CustomTransactionSender) {
// return cred.sendTransaction(transaction);
// }
//
// var signed = await signTransaction(cred, transaction,
// chainId: chainId, fetchChainIdFromNetworkId: fetchChainIdFromNetworkId);
//
// if (transaction.isEIP1559) {
// signed = prependTransactionType(0x02, signed);
// }
//
// return sendRawTransaction(signed);
// }
Future<Block> getBlockByNumber({
BlockTag? blockTag,
bool? includeTransactions,
}) async {
final bt = blockTag?.toParam() ?? const BlockTag.latest().toParam();
final res = await _makeRPCCall<Map<String, dynamic>>(
'eth_getBlockByNumber',
[bt, includeTransactions ?? false],
);
return Block(transactions: res['transactions']);
}