Coinbase Wallet SDK
eth_estimateGas
Estimate gas needed for a transaction
Defined in the Ethereum JSON-RPC Specification
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
Parameters
The transaction call object.
Returns
The amount of gas used as a hexadecimal string.
Error Handling
Code | Message | Description |
---|---|---|
-32602 | Invalid params | Invalid transaction parameters |
-32000 | Execution reverted | Transaction would revert during execution |
4100 | Requested method not supported | The method is not supported by the wallet |
The estimate may not be accurate if the blockchain state changes between the estimation and actual execution.