@proto-kit/sequencer • Docs
Documentation / @proto-kit/sequencer / BlockExplorerQuery
Class: BlockExplorerQuery
Constructors
new BlockExplorerQuery()
new BlockExplorerQuery(
blockExplorer):BlockExplorerQuery
Parameters
• blockExplorer: BlockExplorerTransportModule
Returns
Defined in
packages/sequencer/src/helpers/query/BlockExplorerQuery.ts:18
Methods
fetchTxInclusion()
fetchTxInclusion(
txHash,interval,maxAttempts):Promise<object>
Waits for a transaction to be included in a block by polling at regular intervals.
Parameters
• txHash: string
Hash string of the transaction to search for
• interval: number = 1000
Polling interval in milliseconds (default: 1000)
• maxAttempts: number = 10
Maximum number of polling attempts (default: 10)
Returns
Promise<object>
Promise resolving to an object containing the transaction inclusion state
transactionState
transactionState:
InclusionStatus
Example
// Wait with default settings (1s interval, 10 attempts)
const result = await blockExplorer.fetchTxInclusion(txHash);
// Wait with custom interval (500ms) and more attempts (20)
const result = await blockExplorer.fetchTxInclusion(txHash, 500, 20);Defined in
packages/sequencer/src/helpers/query/BlockExplorerQuery.ts:40
getBlock()
getBlock(
param?):Promise<undefined|ClientBlock>
Retrieves a block by its hash or height.
Parameters
• param?: object | object
Block hash (string) or height (number). If omitted, returns the latest block.
Returns
Promise<undefined | ClientBlock>
Promise resolving to a ClientBlock object, or undefined if block is not found
Examples
// Get block by hash
const block = await blockExplorer.getBlock("216543...");// Get block by height
const block = await blockExplorer.getBlock(42);Defined in
packages/sequencer/src/helpers/query/BlockExplorerQuery.ts:83