ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Add arbitrum specific fields to tx receipt type

Open spalladino opened this issue 3 years ago • 2 comments

Arbitrum adds two fields to each tx receipt, l1BlockNumber and gasUsedForL1. This commit adds them as optional to the TransactionReceipt type, and registers them as allowNull in the formatter.

Example from a local devnet:

> await p.getTransactionReceipt('0x9640ab3c8f0fa8968c15a23ff81d031b64ecae75c68c4b91f4f672c611052412')
{
  to: '0x683642c22feDE752415D4793832Ab75EFdF6223c',
  from: '0x683642c22feDE752415D4793832Ab75EFdF6223c',
  contractAddress: null,
  transactionIndex: 1,
  gasUsed: BigNumber { _hex: '0x0d8dcd', _isBigNumber: true },
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  blockHash: '0x60a72b63a7dc8a1b3bf6613718f2e72f9d412eb22af45331dcbb71c089faf178',
  transactionHash: '0x9640ab3c8f0fa8968c15a23ff81d031b64ecae75c68c4b91f4f672c611052412',
  logs: [],
  blockNumber: 35,
  confirmations: 2,
  cumulativeGasUsed: BigNumber { _hex: '0x0d8dcd', _isBigNumber: true },
  effectiveGasPrice: BigNumber { _hex: '0x05f5e100', _isBigNumber: true },
  status: 1,
  type: 2,
  l1BlockNumber: 479,
  gasUsedForL1: BigNumber { _hex: '0x0d3bc5', _isBigNumber: true },
  byzantium: true
}

spalladino avatar Nov 09 '22 23:11 spalladino

Hey there, I'm from Offchain Labs, this PR would help our users out if it's possible to be included. Thanks!

chrisco512 avatar Jan 23 '23 17:01 chrisco512

(for future reference) There is a similar issue about arbitrary transaction types here:

  • https://github.com/ethers-io/ethers.js/issues/3747

arthurgousset avatar Oct 27 '23 12:10 arthurgousset