getTransactionReceipt method

Future<EtherScanTxReceiptModel> getTransactionReceipt({
  1. required String? txhash,
})

Returns the receipt of a transaction by transaction hash

txhash - Transaction hash

Example

var res = eth.getTransactionReceipt(
    txhash: '0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1'
);

Implementation

Future<EtherScanTxReceiptModel> getTransactionReceipt({
  required String? txhash,
}) async {
  const module = 'proxy';
  const action = 'eth_getTransactionReceipt';

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

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