Skip to content

IndexerChain

A public network as a ChainClient, for the wallets the solvers, matcher and treasury build on: blocks with their transactions' ledger events (in event order) and the trees' roots after each, transaction status, NIGHT UTXOs and spent nullifiers from the indexer; submission through the node. A new wallet starts at the head (snapshot): replaying Preprod's history takes the ledger's WASM about a millisecond an event, over a million of them.

  • ChainClient

new IndexerChain(cfg, opts?): IndexerChain

Parameter Type
cfg NetworkConfig
opts? { indexer?: Indexer; submitter?: Submitter; timeoutMs?: number; }
opts.indexer? Indexer
opts.submitter? Submitter
opts.timeoutMs? number

IndexerChain

readonly proofs: "proven"

The form of transaction the chain takes: the devnet proof-erased, a network proven.

ChainClient.proofs


readonly hrp: string


readonly cfg: NetworkConfig

address(hex): string

An unshielded address (32 bytes, hex) as the network writes it.

Parameter Type
hex string

string


status(): Promise<ChainStatus>

Promise<ChainStatus>

ChainClient.status


blocks(from, waitMs?, limit?): Promise<ChainBlock[]>

Finalized blocks from from: at most limit (and 50) at a time, waiting up to waitMs for the next one. A wallet CATCH_UP_GAP or more behind gets LIGHT_BATCH blocks for one light query, and only those with transactions are read in full: most of Preprod's blocks are empty, and a block a request would cost a day's quota over a week of history. An empty block changes no tree, so it carries no roots to check.

Parameter Type Default value
from number undefined
waitMs? number 0
limit? number 100

Promise<ChainBlock[]>

ChainClient.blocks


snapshot(addressHex): Promise<TreeSnapshot>

The trees at the head (or at startHeight), for a wallet with no saved state. Refused when the wallet's address already has history (received outputs before startHeight), unless skipHistory: what it received before would not be seen.

Parameter Type
addressHex string

Promise<TreeSnapshot>

ChainClient.snapshot


submit(tx): Promise<{ txHash: string; identifiers: string[]; }>

Submits a proven transaction; its hash is the hash of these bytes, as the indexer reports it.

Parameter Type
tx Uint8Array

Promise<{ txHash: string; identifiers: string[]; }>

ChainClient.submit


tx(id): Promise<TxStatus>

Parameter Type
id string

Promise<TxStatus>

ChainClient.tx


waitForTx(ids, timeoutMs, pollMs?): Promise<TxStatus>

Waits until any of ids is finalized or failed (the indexer has finalized blocks only).

Parameter Type Default value
ids string[] undefined
timeoutMs number undefined
pollMs? number 2_000

Promise<TxStatus>

ChainClient.waitForTx


spentNullifiers(nullifiers): Promise<string[]>

Parameter Type
nullifiers string[]

Promise<string[]>

ChainClient.spentNullifiers


nightUtxos(addressHex): Promise<NightUtxo[]>

NIGHT (and other unshielded outputs) of an address given as 32 bytes of hex.

Parameter Type
addressHex string

Promise<NightUtxo[]>

ChainClient.nightUtxos


close(): Promise<void>

Promise<void>