Skip to content

@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 ​

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).

Inherited from ​

ReadOnlyWalletApi.address


capabilities ​

ts
readonly capabilities: WalletCapabilities;

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


chain ​

ts
readonly chain: ChainReader;

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

Narrow with supportsSigning / supportsAllowanceTransfer for adapter-specific reads.


keys ​

ts
readonly keys: SpendingWalletKeys;

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

Overrides ​

ReadOnlyWalletApi.keys


shape ​

ts
readonly shape: CircuitShape;

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

Inherited from ​

ReadOnlyWalletApi.shape


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.

Inherited from ​

ReadOnlyWalletApi.spentKnown

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>

Inherited from ​

ReadOnlyWalletApi.addressAt


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>

Inherited from ​

ReadOnlyWalletApi.asset


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[]>

Inherited from ​

ReadOnlyWalletApi.assets


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>

Inherited from ​

ReadOnlyWalletApi.awaitCommitments


awaitDeposit() ​

ts
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 ​

ParameterType
escrowDepositEscrow
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>

Inherited from ​

ReadOnlyWalletApi.balance


cancelDeposit() ​

ts
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 ​

ParameterType
targetCancelDepositTarget
opts?OpOptions<DepositPhase>

Returns ​

Promise<CancelDepositResult>


claimLinkKey() ​

ts
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 ​

ParameterType
indexnumber

Returns ​

Promise<ClaimLinkKey>


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; }>

Inherited from ​

ReadOnlyWalletApi.compact


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>

Inherited from ​

ReadOnlyWalletApi.confirmCommitment


deposit() ​

ts
deposit(args): Promise<DepositResult>;

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

Parameters ​

ParameterType
argsDepositOptions

Returns ​

Promise<DepositResult>


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>

Inherited from ​

ReadOnlyWalletApi.dispose


nameControllerKey() ​

ts
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() ​

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

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

Parameters ​

ParameterType
filter?NotesFilter

Returns ​

Promise<WalletNote[]>

Inherited from ​

ReadOnlyWalletApi.notes


paymentProof() ​

ts
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 ​

ParameterType
targetPaymentProofTarget

Returns ​

Promise<PaymentProof>


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>

Inherited from ​

ReadOnlyWalletApi.previewWithdraw


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>

Inherited from ​

ReadOnlyWalletApi.publishedAddress


quoteDeposit() ​

ts
quoteDeposit(args): Promise<DepositQuote>;

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

Parameters ​

ParameterType
argsDepositOptions

Returns ​

Promise<DepositQuote>


quoteFee() ​

ts
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 ​

ParameterType
kindFeeKind
opts?{ native?: boolean; signal?: AbortSignal; }
opts.native?boolean
opts.signal?AbortSignal

Returns ​

Promise<FeeQuote>


quoteSwap() ​

ts
quoteSwap(args): Promise<SwapQuote>;

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

Parameters ​

ParameterType
argsQuoteSwapOptions

Returns ​

Promise<SwapQuote>


redenominate() ​

ts
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 ​

ParameterType
assetAssetRef
opts?OpOptions<SpendPhase> & object

Returns ​

Promise<number>


registerName() ​

ts
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 ​

ParameterType
argsRegisterNameOptions

Returns ​

Promise<RegisterNameResult>


setupDepositAllowance() ​

ts
setupDepositAllowance(args): Promise<void>;

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

Parameters ​

ParameterType
argsAllowanceSetupOptions

Returns ​

Promise<void>


spendableMax() ​

ts
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 ​

ParameterType
assetAssetRef
opts?SpendableMaxOptions

Returns ​

Promise<SpendableMax>


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

Inherited from ​

ReadOnlyWalletApi.state


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

Inherited from ​

ReadOnlyWalletApi.subscribe


swap() ​

ts
swap(args): Promise<SwapResult>;

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

Parameters ​

ParameterType
argsSwapOptions

Returns ​

Promise<SwapResult>


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>

Inherited from ​

ReadOnlyWalletApi.sync


transfer() ​

ts
transfer(args): Promise<TransferResult>;

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

Parameters ​

ParameterType
argsTransferOptions

Returns ​

Promise<TransferResult>


warmProver() ​

ts
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 ​

ParameterType
opts?{ signal?: AbortSignal; }
opts.signal?AbortSignal

Returns ​

Promise<void>


withdraw() ​

ts
withdraw(args): Promise<WithdrawResult>;

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

Parameters ​

ParameterType
argsWithdrawOptions

Returns ​

Promise<WithdrawResult>


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[]>

Inherited from ​

ReadOnlyWalletApi.withdrawDenominations