Skip to content

@lelantos-org/sdk / index / ReadOnlyWalletApi

Interface: ReadOnlyWalletApi ​

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:92

The read surface: what a viewing key can do. connectWatch() returns it; WalletApi extends it.

Amounts are branded circuit units; format with formatAmount(x, await wallet.asset(ref)).

Extended by ​

Indexable ​

ts
[key: number]: () => Promise<void>

Properties ​

address ​

ts
readonly address: ShieldedAddress;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:94

The account's address at index 0, lelantos1…. Equal to addressAt(0).


keys ​

ts
readonly keys: WalletKeys;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:113


shape ​

ts
readonly shape: CircuitShape;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:116


spentKnown ​

ts
readonly spentKnown: boolean;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:115

false for an incoming-tier key: every note reads unspent; balances are gross received.

Methods ​

addressAt() ​

ts
addressAt(index): Promise<ShieldedAddress>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:106

The account's address at index. A function of the viewing key and the index, so it is the same on every device and on a watch wallet of the account.

Every address receives into this wallet with nothing to register: sync() finds a note sent to any of them. Addresses of one account are unlinkable to anyone holding neither its viewing key nor its detection key, so giving each payer its own index keeps payers from recognising a shared payee.

Rejects INVALID_ARGUMENT unless index is an integer in [0, 2^32).

Parameters ​

ParameterType
indexnumber

Returns ​

Promise<ShieldedAddress>


asset() ​

ts
asset(ref, opts?): Promise<AssetInfo>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:148

Chain-verified registry entry; cached briefly, refresh re-reads.

Parameters ​

ParameterType
refAssetRef
opts?{ refresh?: boolean; }
opts.refresh?boolean

Returns ​

Promise<AssetInfo>


assets() ​

ts
assets(): Promise<AssetInfo[]>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:152

Every registered asset, for display: the relayer's list, not verified against the chain.

Returns ​

Promise<AssetInfo[]>


awaitCommitments() ​

ts
awaitCommitments(cms, opts?): Promise<AwaitCommitmentsResult>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:120

Sync until every commitment is stored. Resolves a status; see throwOnTimeout.

Parameters ​

ParameterType
cmsreadonly (string | Hex32)[]
opts?AwaitCommitmentsOptions

Returns ​

Promise<AwaitCommitmentsResult>


balance() ​

ts
balance(asset): Promise<Balance>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:145

Parameters ​

ParameterType
assetAssetRef

Returns ​

Promise<Balance>


compact() ​

ts
compact(): Promise<{
  removed: number;
}>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:160

Drop spent notes from the store.

Returns ​

Promise<{ removed: number; }>


confirmCommitment() ​

ts
confirmCommitment(commitment, txHash): Promise<boolean>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:135

Whether the pool itself published commitment in the mined transaction txHash, read from that transaction's receipt over the wallet's own RPC.

Notes come from an indexer, and anyone who knows an address can encrypt a well-formed note to it, so a note in notes() shows what the indexer served, not what the pool holds. A payee crediting a payment on a receipt ({ txHash, commitment }) should require both: the note, for its asset and value, and this, for its existence. false for a transaction that does not carry it, including a deposit's escrow, which is not in the tree until flushed.

With the default reader, a hash the node holds no receipt for is waited on for a bounded time (15 s) and then rejects TX_MINING, which is retryable; it never resolves false. Rejects UNSUPPORTED_OPERATION when the wallet has no chain layer that reads receipts.

Parameters ​

ParameterType
commitmentstring | Hex32
txHashstring | Hex32

Returns ​

Promise<boolean>


dispose() ​

ts
dispose(): Promise<void>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:170

Release what the SDK built for this wallet: the scanner workers and prover it created from a ScannerOption / ProverConfig. A Scanner or Prover instance passed to connect / createWallet is not disposed (the caller owns it and may share it across wallets), and stores and persistence backends are never closed. Idempotent; every method but state / subscribe / dispose then rejects UNSUPPORTED_OPERATION.

Returns ​

Promise<void>


notes() ​

ts
notes(filter?): Promise<WalletNote[]>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:146

Parameters ​

ParameterType
filter?NotesFilter

Returns ​

Promise<WalletNote[]>


previewWithdraw() ​

ts
previewWithdraw(args): Promise<WithdrawPreview>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:154

What a withdrawal would publish, charge and deliver. Pure over the asset.

Parameters ​

ParameterType
argsobject & OutAmount

Returns ​

Promise<WithdrawPreview>


publishedAddress() ​

ts
publishedAddress(): Promise<ShieldedAddress>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:112

The address this account publishes under its handle: addressAt(PUBLISHED_DIVERSIFIER_INDEX). Hand out any other index for everything else, so nothing given to a payer can be matched to the published address.

Returns ​

Promise<ShieldedAddress>


state() ​

ts
state(): WalletState;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:137

The current snapshot. Same object until the next change.

Returns ​

WalletState


subscribe() ​

ts
subscribe(listener): () => void;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:144

Called with each new snapshot after a change commits (sync start/end, notes added, spent, pending or compacted, an op starting, changing phase or settling, dispose), coalesced to one call per microtask. Not called on subscribe. Returns an idempotent unsubscribe. A throwing listener is logged and swallowed.

Parameters ​

ParameterType
listenerStateListener

Returns ​

() => void


sync() ​

ts
sync(opts?): Promise<SyncReport>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:118

Queued behind a sync in progress.

Parameters ​

ParameterType
opts?SyncOptions

Returns ​

Promise<SyncReport>


withdrawDenominations() ​

ts
withdrawDenominations(asset): Promise<DenominationChoice[]>;

Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:158

The asset's denominations, labelled for a picker; [] without a ladder.

Parameters ​

ParameterType
assetAssetRef

Returns ​

Promise<DenominationChoice[]>