@lelantos-org/sdk / internal / NoteLeases
Interface: NoteLeases
Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:1
Accessors
size
Get Signature
get size(): number;Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:27
Notes currently held.
Returns
number
Methods
available()
available<N>(notes): N[];Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:12
notes without the ones an in-flight spend holds.
Type Parameters
| Type Parameter |
|---|
N extends object |
Parameters
| Parameter | Type |
|---|---|
notes | readonly N[] |
Returns
N[]
has()
has(id): boolean;Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:25
Whether an in-flight spend holds id.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
boolean
lease()
lease(ids): void;Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:21
Take ids for one spend.
Throws when any is already held: a selection that saw only available notes cannot pick one, so a clash is an SDK bug, and continuing would double-spend.
Parameters
| Parameter | Type |
|---|---|
ids | readonly string[] |
Returns
void
release()
release(ids): void;Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:23
Return ids to selection. Unknown ids are ignored, so a double release is harmless.
Parameters
| Parameter | Type |
|---|---|
ids | readonly string[] |
Returns
void
select()
select<T>(op): Promise<T>;Defined in: @lelantos-org/sdk/dist/wallet/notes/leases.d.ts:10
Run a selection exclusively: nothing else selects or leases until op settles.
Keep op short (read the tip, select, lease). Consolidation and proving run outside it, or a spend's own consolidation would wait on itself.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
op | () => Promise<T> |
Returns
Promise<T>