Skip to content

@lelantos-org/sdk / advanced / ChainReader

Interface: ChainReader ​

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:129

Everything a chain can answer without a signing key, which is all the spend path uses.

fetchAsset is required because every amount the wallet formats, every fee it quotes and every asset it names resolves through the registry.

Implementations must be deterministic w.r.t. constructor inputs (no hidden global state).

Extends ​

  • RegistryReads.TreeReads.TokenReads.ReceiptReads.NameReads

Extended by ​

Properties ​

isKnownRoot? ​

ts
optional isKnownRoot?: IsKnownRoot;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:45

Whether the pool would accept a proof against root, from the ring of recent roots it keeps. Authoritative; the commitment mirror approximates it. Optional: without it the mirror decides.

Inherited from ​

ts
TreeReads.isKnownRoot

Methods ​

blockNumber()? ​

ts
optional blockNumber(): Promise<number>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:51

Current chain tip. Feeds SelectOpts.tipBlock, without which the selector's spend cooldown is inert. The request names no address and no topic. Optional.

Returns ​

Promise<number>

Inherited from ​

ts
TreeReads.blockNumber

cancelDelay()? ​

ts
optional cancelDelay(): Promise<number>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:34

Blocks, in the EVM's block.number, after submittedAt before cancelDeposit is allowed. Optional.

Returns ​

Promise<number>

Inherited from ​

ts
RegistryReads.cancelDelay

chainId() ​

ts
chainId(): Promise<bigint>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:7

Returns ​

Promise<bigint>

Inherited from ​

ts
RegistryReads.chainId

fetchAsset() ​

ts
fetchAsset(id): Promise<AssetEntry>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:20

The registry entry, including the asset's protocol fee rates, which are per-asset and per-leg. 0 bps disables a leg's fee.

Parameters ​

ParameterType
idAssetId

Returns ​

Promise<AssetEntry>

Inherited from ​

ts
RegistryReads.fetchAsset

fetchDepositEscrowed()? ​

ts
optional fetchDepositEscrowed(id, fromBlock?): Promise<DepositEscrowedRecord | null>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:29

The decoded DepositEscrowed log for escrow id, or null when none is found from fromBlock (default: an adapter-chosen recent window) to the tip. cancelDeposit({ depositId }) rebuilds its cancel inputs from it. Optional.

Parameters ​

ParameterType
idbigint
fromBlock?bigint

Returns ​

Promise<DepositEscrowedRecord | null>

Inherited from ​

ts
RegistryReads.fetchDepositEscrowed

fetchNotePayload()? ​

ts
optional fetchNotePayload(txHash, cm): Promise<PublishedNote | null>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:117

The decoded NotePayload the pool emitted for commitment cm in mined transaction txHash, or null when that transaction carries none from the pool. A payment proof needs the output's published clue, ephPub and ciphertext. Optional.

A transaction the node holds no receipt for (unknown, or not yet mined) is "not found": resolve null without waiting for it. verifyPaymentProof passes a hash from a proof it has not checked, and reports null as not-published. Reject only when the node could not be asked, so an RPC failure is not read as "no such payment".

Parameters ​

ParameterType
txHashHex32
cmHex32

Returns ​

Promise<PublishedNote | null>

Inherited from ​

ts
ReceiptReads.fetchNotePayload

getEscrowed()? ​

ts
optional getEscrowed(id): Promise<EscrowedDepositView | null>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:22

MASP.escrowed(id); null if flushed or cancelled. Optional.

Parameters ​

ParameterType
idbigint

Returns ​

Promise<EscrowedDepositView | null>

Inherited from ​

ts
RegistryReads.getEscrowed

maspAddress() ​

ts
maspAddress(): Promise<EvmAddress>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:9

Used as the Permit2 spender.

Returns ​

Promise<EvmAddress>

Inherited from ​

ts
RegistryReads.maspAddress

nameAvailable()? ​

ts
optional nameAvailable(registrar, label): Promise<boolean>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:80

Whether label is valid and unregistered.

Parameters ​

ParameterType
registrarEvmAddress
labelstring

Returns ​

Promise<boolean>

Inherited from ​

ts
NameReads.nameAvailable

nameFee()? ​

ts
optional nameFee(registrar): Promise<NameFee>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:81

Parameters ​

ParameterType
registrarEvmAddress

Returns ​

Promise<NameFee>

Inherited from ​

ts
NameReads.nameFee

nameRecord()? ​

ts
optional nameRecord(registrar, label): Promise<NameRecord>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:78

Parameters ​

ParameterType
registrarEvmAddress
labelstring

Returns ​

Promise<NameRecord>

Inherited from ​

ts
NameReads.nameRecord

nativeAdapterAddress()? ​

ts
optional nativeAdapterAddress(): EvmAddress | undefined;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:15

NativeAdapter address, or undefined where none is deployed: the payer a native deposit names. Also read by withdraw({ native }). Optional.

Returns ​

EvmAddress | undefined

Inherited from ​

ts
RegistryReads.nativeAdapterAddress

nativeBalance()? ​

ts
optional nativeBalance(account): Promise<bigint>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:70

Wei. Optional.

Parameters ​

ParameterType
accountEvmAddress

Returns ​

Promise<bigint>

Inherited from ​

ts
TokenReads.nativeBalance

permit2Address()? ​

ts
optional permit2Address(): EvmAddress;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:36

Optional: omitted by adapters that do not use Permit2.

Returns ​

EvmAddress

Inherited from ​

ts
RegistryReads.permit2Address

permit2Allowance()? ​

ts
optional permit2Allowance(
   token, 
   owner, 
   spender
): Promise<{
  amount: TokenAmount;
  expiration: number;
  nonce: number;
}>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:56

IAllowanceTransfer.allowance: cap, expiry, nonce. Optional.

Parameters ​

ParameterType
tokenEvmAddress
ownerEvmAddress
spenderEvmAddress

Returns ​

Promise<{ amount: TokenAmount; expiration: number; nonce: number; }>

Inherited from ​

ts
TokenReads.permit2Allowance

permit2Nonce()? ​

ts
optional permit2Nonce(): Promise<bigint>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:65

Free slot in Permit2's unordered nonce bitmap. Optional: omitted by adapters returning a deterministic nonce.

Returns ​

Promise<bigint>

Inherited from ​

ts
TokenReads.permit2Nonce

tokenAllowance()? ​

ts
optional tokenAllowance(
   tokenAddr, 
   owner, 
   spender
): Promise<TokenAmount>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:71

Parameters ​

ParameterType
tokenAddrEvmAddress
ownerEvmAddress
spenderEvmAddress

Returns ​

Promise<TokenAmount>

Inherited from ​

ts
TokenReads.tokenAllowance

tokenBalanceOf()? ​

ts
optional tokenBalanceOf(tokenAddr, account): Promise<TokenAmount>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:68

Parameters ​

ParameterType
tokenAddrEvmAddress
accountEvmAddress

Returns ​

Promise<TokenAmount>

Inherited from ​

ts
TokenReads.tokenBalanceOf

tokenMeta()? ​

ts
optional tokenMeta(tokenAddr): Promise<TokenMeta>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:67

Optional; callers feature-check before calling.

Parameters ​

ParameterType
tokenAddrEvmAddress

Returns ​

Promise<TokenMeta>

Inherited from ​

ts
TokenReads.tokenMeta

txReceiptLogs()? ​

ts
optional txReceiptLogs(txHash): Promise<readonly TxLog[]>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:104

Every log of a mined transaction's receipt, in receipt order.

Read after a relayed spend to find the wallet's own operation in a transaction the relayer may have bundled with others', and by a payment proof to find an output's slot. Only the hash is sent; matching against the wallet's commitments happens locally. Optional: without it a spend result carries no operation and paymentProof is unsupported.

Its callers pass a hash they have reason to believe mined, so an implementation may wait briefly for a node that lags, and rejects when no receipt arrives. A transaction the node does not know is not an empty list.

Parameters ​

ParameterType
txHashHex32

Returns ​

Promise<readonly TxLog[]>

Inherited from ​

ts
ReceiptReads.txReceiptLogs

waitTxReceipt()? ​

ts
optional waitTxReceipt(txHash, confirmations?): Promise<{
  blockNumber: number;
  status: number;
}>;

Defined in: @lelantos-org/sdk/dist/chain/port.d.ts:86

Block number and receipt status (1 = success, 0 = revert).

Parameters ​

ParameterType
txHashHex32
confirmations?number

Returns ​

Promise<{ blockNumber: number; status: number; }>

Inherited from ​

ts
ReceiptReads.waitTxReceipt