This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
Contract Call Methods
Methods for executing contract calls and transaction simulations.
eth_call
Execute a read-only contract call without creating a transaction.
Parameters:
callParams: CallParams - Transaction call parameters
from?: Address - Sender address (optional)
to: Address - Contract address
data: Hex - Encoded function call
gas?: Quantity - Gas limit (optional)
gasPrice?: Quantity - Gas price (optional)
value?: Quantity - ETH value (optional)
blockTag: BlockTag - Block to execute against ('latest', 'earliest', 'pending', or block number/hash)
Returns: Response<Hex> - Encoded return data
Common use cases:
- Call contract view functions
- Query contract state
- Validate transaction execution before sending
- Simulate complex contract interactions
eth_estimateGas
Estimate gas required for a transaction.
Parameters:
callParams: CallParams - Transaction parameters (same as eth_call)
Returns: Response<Quantity> - Estimated gas amount
Best practices:
- Always add a buffer (10-20%) to estimates
- Handle estimation failures gracefully
- Consider network congestion in final gas limits
- Test with realistic transaction data
Estimating with Buffer Pattern
eth_createAccessList
Generate an access list for a transaction to optimize gas costs (EIP-2930).
Parameters:
callParams: CallParams - Transaction parameters
blockTag: BlockTag - Block to execute against
Returns: Response<AccessListResult>
accessList: AccessList - Generated access list
gasUsed: Quantity - Gas that would be used
error?: string - Optional error message
Benefits:
- Reduces gas costs for complex transactions
- Makes gas costs more predictable
- Required for some contract interactions post-EIP-2930
When to use:
- Multi-contract interactions
- Transactions touching many storage slots
- Gas optimization for frequent operations
eth_simulateV1
Simulate multiple transactions in sequence (EIP-not-yet-finalized).
Parameters:
params: SimulationParams - Simulation configuration
blockStateCalls: BlockStateCall[] - Transactions to simulate
validation: boolean - Enable validation
returnFullTransactionObjects?: boolean - Include full tx objects
Returns: Response<SimulationResult> - Simulation results for each transaction
Use cases:
- Test transaction sequences
- Validate multi-step operations
- Debug complex contract interactions
- Estimate total gas for batched transactions
eth_simulateV1 is from an EIP that’s not yet finalized. The API may change and not all providers support it.