GET fees
Calculating required gas to execute given calldata can be confusing in a multi-chain context. This endpoint knows the best way to calculate L1 + L2 fees for all chains.
Last updated
Calculating required gas to execute given calldata can be confusing in a multi-chain context. This endpoint knows the best way to calculate L1 + L2 fees for all chains.
Last updated
For L1s and sidechains, the RPC method get_gasEstimate
is sufficient. But L2s like Optimism and Base have both a L2 and L1 component to . Arbitrum does too, but returns the sum over get_gasEstimate
.
Instead of worrying about those details, use our HTTP endpoint.
/fees
chainId (number): EVM chainId that tx will be sent on.
calldata (string): Calldata of tx to get fees for. Construct on client-side with ethers or similar tool.
contractAddress (string: 0x...): Contract address to send calldata to.
fromAddress (string: 0x...): Address of wallet that will sign the transaction.
amountUsd (string): Total USD cost of sending the tx.
amountNative (string): Total native ETH cost of sending the tx.
parts (IPart[]): Array of all the components of the fee.
name (string):
gas-native: When gas corresponds to a L1 or L2 and the only gas component is native. Eg. ETH and MATIC.
gas-l1: When gas corresponds to a L2 and there is a L1 component. Eg. OP and Base.
gas-l2: When gas corresponds to a L2 and there is a L2 component. Eg. OP and Base.
gas-all: When gas corresponds to a L2 and L1 and L2 components are reported together. Eg. Arbitrum.
amountUsd (string): Total USD cost of sending the tx.
amountNative (string): Total native ETH cost of sending the tx.
amountCurrency (ICurrency): Currency corresponding to amountNative. Eg. ETH and MATIC.
Get the cost to send USDC on Base.