Skip to content

@lelantos-org/sdk / advanced / SelectOpts

Interface: SelectOpts ​

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

Properties ​

bucketPct? ​

ts
optional bucketPct?: number;

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

Tiebreak width: covers of the chosen size summing within (1 ± bucketPct) of the smallest are equally likely. Default 0.05.


cooldownBlocks? ​

ts
optional cooldownBlocks?: number;

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

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/types.d.ts:15

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


fee? ​

ts
optional fee?: bigint;

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

Cover threshold becomes target + fee. Default 0.


maxInputs? ​

ts
optional maxInputs?: number;

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

Maximum notes a single spend may consume (the circuit's nIn). Defaults to DEFAULT_SHAPE.nIn; runSpend passes the configured shape's arity.


only? ​

ts
optional only?: readonly string[];

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

Restrict candidates to these note ids, on top of the other spendability rules: a named id that is spent, reserved or cooling down stays excluded.

Used by consolidation, because selecting by amount does not pin the notes: a single note valued between the target and the dust set's total is a smaller cover than the dust set, and SFRT would take it.


pick? ​

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

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

Injectable randomness for tests: returns a uniform integer in [0, n). Defaults to randomBelow from @lelantos-org/sdk/primitives.

An integer picker, because scaling a float over n buckets is non-uniform unless n is a power of two, and a skewed pick is the fingerprint the tiebreak defends against.

Parameters ​

ParameterType
nnumber

Returns ​

number


tipBlock? ​

ts
optional tipBlock?: number;

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

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