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.
Implements
Section titled “Implements”ChainClient
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new IndexerChain(
cfg,opts?):IndexerChain
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cfg |
NetworkConfig |
opts? |
{ indexer?: Indexer; submitter?: Submitter; timeoutMs?: number; } |
opts.indexer? |
Indexer |
opts.submitter? |
Submitter |
opts.timeoutMs? |
number |
Returns
Section titled “Returns”IndexerChain
Properties
Section titled “Properties”proofs
Section titled “proofs”
readonlyproofs:"proven"
The form of transaction the chain takes: the devnet proof-erased, a network proven.
Implementation of
Section titled “Implementation of”ChainClient.proofs
readonlyhrp:string
readonlycfg:NetworkConfig
Methods
Section titled “Methods”address()
Section titled “address()”address(
hex):string
An unshielded address (32 bytes, hex) as the network writes it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
hex |
string |
Returns
Section titled “Returns”string
status()
Section titled “status()”status():
Promise<ChainStatus>
Returns
Section titled “Returns”Promise<ChainStatus>
Implementation of
Section titled “Implementation of”ChainClient.status
blocks()
Section titled “blocks()”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.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
from |
number |
undefined |
waitMs? |
number |
0 |
limit? |
number |
100 |
Returns
Section titled “Returns”Promise<ChainBlock[]>
Implementation of
Section titled “Implementation of”ChainClient.blocks
snapshot()
Section titled “snapshot()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
addressHex |
string |
Returns
Section titled “Returns”Promise<TreeSnapshot>
Implementation of
Section titled “Implementation of”ChainClient.snapshot
submit()
Section titled “submit()”submit(
tx):Promise<{txHash:string;identifiers:string[]; }>
Submits a proven transaction; its hash is the hash of these bytes, as the indexer reports it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
tx |
Uint8Array |
Returns
Section titled “Returns”Promise<{ txHash: string; identifiers: string[]; }>
Implementation of
Section titled “Implementation of”ChainClient.submit
tx(
id):Promise<TxStatus>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<TxStatus>
Implementation of
Section titled “Implementation of”ChainClient.tx
waitForTx()
Section titled “waitForTx()”waitForTx(
ids,timeoutMs,pollMs?):Promise<TxStatus>
Waits until any of ids is finalized or failed (the indexer has finalized blocks only).
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
ids |
string[] |
undefined |
timeoutMs |
number |
undefined |
pollMs? |
number |
2_000 |
Returns
Section titled “Returns”Promise<TxStatus>
Implementation of
Section titled “Implementation of”ChainClient.waitForTx
spentNullifiers()
Section titled “spentNullifiers()”spentNullifiers(
nullifiers):Promise<string[]>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
nullifiers |
string[] |
Returns
Section titled “Returns”Promise<string[]>
Implementation of
Section titled “Implementation of”ChainClient.spentNullifiers
nightUtxos()
Section titled “nightUtxos()”nightUtxos(
addressHex):Promise<NightUtxo[]>
NIGHT (and other unshielded outputs) of an address given as 32 bytes of hex.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
addressHex |
string |
Returns
Section titled “Returns”Promise<NightUtxo[]>
Implementation of
Section titled “Implementation of”ChainClient.nightUtxos
close()
Section titled “close()”close():
Promise<void>
Returns
Section titled “Returns”Promise<void>