Skip to content

@lelantos-org/sdk / index / SelectOpts

Interface: SelectOpts โ€‹

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:12

Properties โ€‹

bucketPct? โ€‹

ts
optional bucketPct?: number;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:29

Tiebreak shuffle width: notes within (1 ยฑ bucketPct) * pivot. Default 0.05.


cooldownBlocks? โ€‹

ts
optional cooldownBlocks?: number;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:22

Minimum age in blocks before a note is spendable. Defaults to DEFAULT_COOLDOWN_BLOCKS. Requires tipBlock and per-note firstSeenBlock; inert otherwise.


dustThreshold? โ€‹

ts
optional dustThreshold?: bigint;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:16

Notes with value < dustThreshold are excluded. Recommended: 2 * marginalFee.


fee? โ€‹

ts
optional fee?: bigint;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:14

Cover threshold becomes target + fee. Default 0.


maxInputs? โ€‹

ts
optional maxInputs?: number;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:34

Most notes a single spend may consume โ€” the circuit's nIn. Defaults to DEFAULT_SHAPE.nIn; prepareSpend passes the configured shape's arity.


only? โ€‹

ts
optional only?: readonly string[];

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:48

Restrict candidates to these note ids.

Consolidation is what needs it. Asking by amount does not name the notes: SFRT returns the smallest-sum cover of that amount, and any single note whose value falls between the target and the dust set's total is a cheaper cover than the dust set itself. When one exists the merge silently does nothing, and the retry fails for the same reason as the first attempt. Naming the ids removes the ambiguity.

Applied alongside the other spendability rules, not instead of them: an id named here that is spent, reserved or cooling down stays excluded.


pick? โ€‹

ts
optional pick?: (n) => number;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:57

Injectable randomness for tests: returns a uniform integer in [0, n).

An integer picker rather than a float, because the tiebreak's whole job is to be uniform โ€” scaling a float over n buckets makes them unequal unless n is a power of two, and the fingerprint this defends against is exactly a skew in which note gets picked. Defaults to randomBelow.

Parameters โ€‹

ParameterType
nnumber

Returns โ€‹

number


tipBlock? โ€‹

ts
optional tipBlock?: number;

Defined in: @lelantos-org/sdk/dist/wallet/selection.d.ts:27

Chain tip. prepareSpend supplies it from ChainAdapter.blockNumber(); an adapter without that method leaves the cooldown inert.

Lelantosno cookies ๐Ÿช ยท no tracking ๐Ÿ‘๏ธ ยท no accounts ๐Ÿ‘คwalletexplorer4536080GitHub