get_evm_block_time
Documentation for eth_defi.chain.get_evm_block_time function.
- get_evm_block_time(chain_id, block_number=None)
Get block time for a chain at a given block, tolerating unknown chains.
Unlike
get_block_time(), returnsNonefor chains missing fromEVM_BLOCK_TIMESinstead of crashing, so callers can degrade gracefully (e.g. skip a time-based confirmation wait).- Parameters
chain_id (int) – Chain id to get the block time for.
block_number (Optional[int]) –
Block at which the block time should be resolved.
Currently unused. Reserved for resolving the block time dynamically in the future: block times change over chain upgrades (e.g. Polygon shortening blocks, Arbitrum Nitro) and some chains have variable block types (HyperEVM dual-block architecture), so a static per-chain value is only an approximation.
- Returns
Block time in seconds, or
Noneif the chain is not in the lookup table.- Return type