getUncleByBlockNumberAndIndex method

Future<EtherScanBlockByNumberModel> getUncleByBlockNumberAndIndex({
  1. required String? tag,
  2. required String? index,
})

Returns information about a uncle by block number.

tag - Tag to look up

index - Index

Example

var res = eth.getUncleByBlockNumberAndIndex(
   tag: '0x210A9B',
   index: '0x0'
);

Implementation

Future<EtherScanBlockByNumberModel> getUncleByBlockNumberAndIndex({
  required String? tag,
  required String? index,
}) async {
  const module = 'proxy';
  const action = 'eth_getUncleByBlockNumberAndIndex';

  Map<String, dynamic>? query = {
    'tag': tag,
    'module': module,
    'action': action,
    'index': index,
    'apiKey': apiKey,
  };

  return (await get(query)).fold(
    (l) => EtherScanBlockByNumberModel.empty(),
    (r) => EtherScanBlockByNumberModel.fromJson(r),
  );
}