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

Computing L1 + L2 fees on Base and Manta

Open zhanghuize-git opened this issue 9 months ago • 4 comments

Ethers Version

6.11.1

Search Terms

yes

Describe the Problem

When I use the method getTransactionReceipt to fetch the transaction by hash, the value of the fee for the transaction is not the same as the value of the fee that I get when I look it up in the blockchain browser directly

For example 0x10674dff8d304e3b49e50a7a5dd43470d2fd782a9a297062be043ea74f519151 The fee for this transaction is 0.00000589436349832 ETH, but in the blockchain browser it is 0.000006060525121534 ETH

why is that? Is there a good solution?

Code Snippet

protected async getTransactionFee(
    transactionReceipt: TransactionReceipt,
  ): Promise<string> {
    return transactionReceipt.fee.toString(10);
  }


  const testTransaction = await rpcClient.getTransactionReceipt(
    '0x10674dff8d304e3b49e50a7a5dd43470d2fd782a9a297062be043ea74f519151',
  );
  console.log('testTransaction: ', testTransaction.fee.toString());

Contract ABI

No response

Errors

No response

Environment

node.js (v12 or newer)

Environment (Other)

No response

zhanghuize-git avatar Apr 30 '24 09:04 zhanghuize-git