@lelantos-org/sdk / index / WalletApi
Interface: WalletApi
Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:174
A wallet holding spend authority. connect() returns it, whatever the chain layer.
Extends
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).
Inherited from
capabilities
readonly capabilities: WalletCapabilities;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:178
chain
readonly chain: ChainReader;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:177
Narrow with supportsSigning / supportsAllowanceTransfer for adapter-specific reads.
keys
readonly keys: SpendingWalletKeys;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:175
Overrides
shape
readonly shape: CircuitShape;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:116
Inherited from
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.
Inherited from
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>
Inherited from
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>
Inherited from
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[]>
Inherited from
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>
Inherited from
ReadOnlyWalletApi.awaitCommitments
awaitDeposit()
awaitDeposit(escrow, opts?): Promise<AwaitCommitmentsResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:197
Await the relayer's flush: awaitCommitments([escrow.commitment]).
Parameters
| Parameter | Type |
|---|---|
escrow | DepositEscrow |
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>
Inherited from
cancelDeposit()
cancelDeposit(target, opts?): Promise<CancelDepositResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:199
Reclaim an unflushed escrow once cancellable; routes native escrows through the adapter.
Parameters
| Parameter | Type |
|---|---|
target | CancelDepositTarget |
opts? | OpOptions<DepositPhase> |
Returns
Promise<CancelDepositResult>
claimLinkKey()
claimLinkKey(index): Promise<ClaimLinkKey>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:227
The spending key and address of this account's index-th claim link on this chain: a fresh account to fund and hand over as a bearer link. Derived from the seed, so a link the payee never opens can be recomputed and swept back from any device.
An index must fund at most one link: two links from one index share a key, so the holder of the first can take the second. Use the first index whose account has never held a note.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
Promise<ClaimLinkKey>
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; }>
Inherited from
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>
Inherited from
ReadOnlyWalletApi.confirmCommitment
deposit()
deposit(args): Promise<DepositResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:195
Parameters
| Parameter | Type |
|---|---|
args | DepositOptions |
Returns
Promise<DepositResult>
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>
Inherited from
nameControllerKey()
nameControllerKey(): Promise<NameControllerKey>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:246
The key that controls this account's handle. Its signature changes or clears the published value, and a cancelled escrow of a registration refunds to its address. Derived from the seed, so it is the same on every device.
Returns
Promise<NameControllerKey>
notes()
notes(filter?): Promise<WalletNote[]>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:146
Parameters
| Parameter | Type |
|---|---|
filter? | NotesFilter |
Returns
Promise<WalletNote[]>
Inherited from
paymentProof()
paymentProof(target): Promise<PaymentProof>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:218
A proof, for a third party, of one payment this wallet made. Whoever holds it and the payee's address learns that output's asset and value (verifyPaymentProof) and nothing else; give it only to them.
The target names the output and what it paid, each field from the spend's TransferResult: txHash, commitment (recipientCommitment), recipient, asset (amount.asset) and amount (amount.amount, circuit units). The proof is recomputed from those, the account's key and the chain, so it can be made at any time, on any device.
Rejects INVALID_ARGUMENT when the transaction did not publish commitment, which includes a transaction the node holds no receipt for, or when the account's key with recipient, asset and amount does not reproduce the output (another wallet made it, or it paid a different recipient, asset or amount). Rejects UNSUPPORTED_OPERATION unless the chain layer has both fetchNotePayload and txReceiptLogs.
Parameters
| Parameter | Type |
|---|---|
target | PaymentProofTarget |
Returns
Promise<PaymentProof>
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>
Inherited from
ReadOnlyWalletApi.previewWithdraw
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>
Inherited from
ReadOnlyWalletApi.publishedAddress
quoteDeposit()
quoteDeposit(args): Promise<DepositQuote>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:193
Parameters
| Parameter | Type |
|---|---|
args | DepositOptions |
Returns
Promise<DepositQuote>
quoteFee()
quoteFee(kind, opts?): Promise<FeeQuote>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:184
Relayer fee for kind and the assets it accepts. native prices the native path.
Parameters
| Parameter | Type |
|---|---|
kind | FeeKind |
opts? | { native?: boolean; signal?: AbortSignal; } |
opts.native? | boolean |
opts.signal? | AbortSignal |
Returns
Promise<FeeQuote>
quoteSwap()
quoteSwap(args): Promise<SwapQuote>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:194
Parameters
| Parameter | Type |
|---|---|
args | QuoteSwapOptions |
Returns
Promise<SwapQuote>
redenominate()
redenominate(asset, opts?): Promise<number>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:248
Re-split off-ladder notes onto the ladder; returns rounds run. Best-effort.
Parameters
| Parameter | Type |
|---|---|
asset | AssetRef |
opts? | OpOptions<SpendPhase> & object |
Returns
Promise<number>
registerName()
registerName(args): Promise<RegisterNameResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:240
Claim a handle, paid from shielded funds, publishing publishedAddress() under it.
The handle and the address become public and stay in chain history. No EVM account is named: the handle belongs to nameControllerKey(). Resolves once the relayer landed the transaction; registered says whether the handle was claimed or the input refunded.
Rejects INVALID_ARGUMENT (argument: "label") for a label that is malformed or already registered, and UNSUPPORTED_OPERATION without capabilities.registerName.
Parameters
| Parameter | Type |
|---|---|
args | RegisterNameOptions |
Returns
Promise<RegisterNameResult>
setupDepositAllowance()
setupDepositAllowance(args): Promise<void>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:200
Parameters
| Parameter | Type |
|---|---|
args | AllowanceSetupOptions |
Returns
Promise<void>
spendableMax()
spendableMax(asset, opts?): Promise<SpendableMax>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:192
The largest amount (transfer) or gross (withdraw, swap) one spend can cover, by the same rules the spend applies.
Parameters
| Parameter | Type |
|---|---|
asset | AssetRef |
opts? | SpendableMaxOptions |
Returns
Promise<SpendableMax>
state()
state(): WalletState;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:137
The current snapshot. Same object until the next change.
Returns
Inherited from
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
Inherited from
swap()
swap(args): Promise<SwapResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:229
Parameters
| Parameter | Type |
|---|---|
args | SwapOptions |
Returns
Promise<SwapResult>
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>
Inherited from
transfer()
transfer(args): Promise<TransferResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:201
Parameters
| Parameter | Type |
|---|---|
args | TransferOptions |
Returns
Promise<TransferResult>
warmProver()
warmProver(opts?): Promise<void>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:180
Fetch and warm the prover now rather than at the first spend.
Parameters
| Parameter | Type |
|---|---|
opts? | { signal?: AbortSignal; } |
opts.signal? | AbortSignal |
Returns
Promise<void>
withdraw()
withdraw(args): Promise<WithdrawResult>;Defined in: @lelantos-org/sdk/dist/wallet/api.d.ts:228
Parameters
| Parameter | Type |
|---|---|
args | WithdrawOptions |
Returns
Promise<WithdrawResult>
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[]>