@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
[key: number]: () => Promise<void>Properties
address
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
readonly keys: WalletKeys;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:113
shape
readonly shape: CircuitShape;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:116
spentKnown
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()
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
| Parameter | Type |
|---|---|
index | number |
Returns
Promise<ShieldedAddress>
asset()
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
| Parameter | Type |
|---|---|
ref | AssetRef |
opts? | { refresh?: boolean; } |
opts.refresh? | boolean |
Returns
Promise<AssetInfo>
assets()
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()
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
| Parameter | Type |
|---|---|
cms | readonly (string | Hex32)[] |
opts? | AwaitCommitmentsOptions |
Returns
Promise<AwaitCommitmentsResult>
balance()
balance(asset): Promise<Balance>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:145
Parameters
| Parameter | Type |
|---|---|
asset | AssetRef |
Returns
Promise<Balance>
compact()
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()
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
| Parameter | Type |
|---|---|
commitment | string | Hex32 |
txHash | string | Hex32 |
Returns
Promise<boolean>
dispose()
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()
notes(filter?): Promise<WalletNote[]>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:146
Parameters
| Parameter | Type |
|---|---|
filter? | NotesFilter |
Returns
Promise<WalletNote[]>
previewWithdraw()
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
| Parameter | Type |
|---|---|
args | object & OutAmount |
Returns
Promise<WithdrawPreview>
publishedAddress()
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()
state(): WalletState;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:137
The current snapshot. Same object until the next change.
Returns
subscribe()
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
| Parameter | Type |
|---|---|
listener | StateListener |
Returns
() => void
sync()
sync(opts?): Promise<SyncReport>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:118
Queued behind a sync in progress.
Parameters
| Parameter | Type |
|---|---|
opts? | SyncOptions |
Returns
Promise<SyncReport>
withdrawDenominations()
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
| Parameter | Type |
|---|---|
asset | AssetRef |
Returns
Promise<DenominationChoice[]>