Block range parameters for filtering blockchain events and transactions.
Remarks
Used to specify a range of blocks when querying blockchain data.
Both parameters are optional - omitting fromBlock starts from genesis,
omitting toBlock goes to the latest block. Be cautious with large ranges
as they may result in heavy RPC loads or timeouts.
Example
// Get events from the last 1000 blocks constcurrentBlock = awaitvana.protocol.getBlockNumber(); constevents = awaitvana.protocol.getEvents({ blockRange: { fromBlock:currentBlock - 1000n, toBlock:currentBlock } });
// Get all historical events (use with caution) constallEvents = awaitvana.protocol.getEvents({ blockRange: { fromBlock:0n // toBlock omitted = up to latest } });
Block range parameters for filtering blockchain events and transactions.
Remarks
Used to specify a range of blocks when querying blockchain data. Both parameters are optional - omitting fromBlock starts from genesis, omitting toBlock goes to the latest block. Be cautious with large ranges as they may result in heavy RPC loads or timeouts.
Example