txList method

Future<EtherScanTxListModel> txList({
  1. required String? address,
  2. Object startblock = 0,
  3. String? endblock,
  4. int page = 1,
  5. int offset = 100,
  6. EtherSort sort = EtherSort.asc,
})

Get a list of transactions for a specfic address

address - Transaction address

startblock - start looking here

endblock - end looking there

int page - Page number

int offset - Max records to return

sort - Sort asc/desc

Example

var txlist = eth.txList(address:
  '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
);

Implementation

Future<EtherScanTxListModel> txList({
  required String? address,
  Object startblock = 0,
  String? endblock,
  int page = 1,
  int offset = 100,
  EtherSort sort = EtherSort.asc,
}) async {
  const module = 'account';
  const action = 'txlist';

  if (endblock != null) {
    endblock = 'latest';
  }

  final query = {
    'module': module,
    'action': action,
    'startblock': startblock,
    'endblock': endblock,
    'page': page,
    'offset': offset,
    'sort': sort.str,
    'address': address,
    'apiKey': apiKey
  };

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