Handler called with { keysetId, start, count }.
Optionalopts: SubscribeOptsA function that unsubscribes the handler.
Create a composite canceller that can collect many subscriptions and dispose them all in one call.
Accepts both a SubscriptionCanceller and a Promise<SubscriptionCanceller>. When the
composite canceller is called, all collected cancellations are invoked. Errors from individual
cancellers are caught and ignored.
The returned function also has an .add() method to register more cancellers, and a
.cancelled boolean property for debugging.
Composite canceller function with .add() and .cancelled members.
Register a callback fired whenever NUT-08 blanks are created during a melt.
Called synchronously right after blanks are prepared (before the melt request), and the wallet does not await your handler.
Typical use: persist payload so you can later call wallet.completeMelt(payload).
Optionalopts: SubscribeOptsRegister a callback to be called when a single melt quote gets paid.
Optionalopts: SubscribeOptsRegister a callback to be called whenever a melt quote’s state changes.
Optionalopts: SubscribeOptsRegister a callback to be called when a single mint quote gets paid.
Optionalopts: SubscribeOptsRegister a callback to be called whenever a mint quote's state changes.
Optionalopts: SubscribeOptsResolve when ANY of several mint quotes is PAID, cancelling the rest.
Subscribes to all distinct ids, resolves with { id, quote } for the first PAID, and cancels
all remaining subscriptions.
Errors from individual subscriptions are ignored by default so a single noisy stream does not
abort the whole race. Set failOnError: true to reject on the first error instead. If all
subscriptions error and none paid, the promise rejects with the last seen error.
Array of mint quote ids (duplicates are ignored).
Optionalopts: { failOnError?: boolean; signal?: AbortSignal; timeoutMs?: number }Optional controls.
OptionalfailOnError?: booleanWhen true, reject on first error. Default false.
Optionalsignal?: AbortSignalAbortSignal to cancel the wait early.
OptionaltimeoutMs?: numberMilliseconds to wait before rejecting with a timeout error.
A promise resolving to the id that won and its MintQuoteResponse.
Resolve once a melt quote transitions to PAID, with automatic unsubscription, optional abort signal, and optional timeout.
Mirrors onceMintPaid, but for melts.
Melt quote id to watch.
Optionalopts: { signal?: AbortSignal; timeoutMs?: number }Optional controls.
Optionalsignal?: AbortSignalAbortSignal to cancel the wait early.
OptionaltimeoutMs?: numberMilliseconds to wait before rejecting with a timeout error.
A promise that resolves with the MeltQuoteResponse once PAID.
Resolve once a mint quote transitions to PAID, with automatic unsubscription, optional abort signal, and optional timeout.
The underlying subscription is always cancelled after resolution or rejection, including on timeout or abort.
Mint quote id to watch.
Optionalopts: { signal?: AbortSignal; timeoutMs?: number }Optional controls.
Optionalsignal?: AbortSignalAbortSignal to cancel the wait early.
OptionaltimeoutMs?: numberMilliseconds to wait before rejecting with a timeout error.
A promise that resolves with the latest MintQuoteResponse once PAID.
const ac = new AbortController();
// Cancel if the user navigates away
window.addEventListener('beforeunload', () => ac.abort(), { once: true });
try {
const paid = await wallet.on.onceMintPaid(quoteId, {
signal: ac.signal,
timeoutMs: 60_000,
});
console.log('Mint paid, amount', paid.amount);
} catch (e) {
if ((e as Error).name === 'AbortError') {
console.log('User aborted');
} else {
console.error('Mint not paid', e);
}
}
Async iterable that yields proof state updates for the provided proofs.
Adds a bounded buffer option:
maxBuffer is set and the queue is full when a new payload arrives, either drop the oldest
queued payload (drop: 'oldest', default) or the incoming payload (drop: 'newest'). In
both cases onDrop is invoked with the dropped payload.The stream ends and cleans up on abort or on the wallet error callback. Errors from the wallet are treated as a graceful end for this iterator.
The proofs to subscribe to. Only secret is required.
Optionalopts: {Optional controls.
Optionaldrop?: "oldest" | "newest"Overflow strategy when maxBuffer is reached, 'oldest' | 'newest'. Default
'oldest'.
OptionalmaxBuffer?: numberMaximum number of queued items before applying the drop strategy.
OptionalonDrop?: (payload: T) => voidCallback invoked with the payload that was dropped.
Optionalsignal?: AbortSignalAbortSignal that stops the stream when aborted.
An async iterable of update payloads.
const ac = new AbortController();
try {
for await (const update of wallet.on.proofStatesStream(myProofs)) {
if (update.state === CheckStateEnum.SPENT) {
console.warn('Spent proof', update.proof.id);
}
}
} catch (e) {
if ((e as Error).name !== 'AbortError') {
console.error('Stream error', e);
}
}
Register a callback to be called whenever a subscribed proof state changes.
List of proofs that should be subscribed to.
Optionalopts: SubscribeOpts
Register a callback that fires whenever deterministic counters are reserved.
Timing: the callback is invoked synchronously after a successful reservation and before the enclosing wallet method returns. The wallet does not await your callback, it is fire-and-forget.
Responsibility for async work is on the consumer. If your handler calls an async function (e.g. persisting
start + countto storage), make sure to handle errors inside it to avoid unhandled rejections.Typical use: persist
start + countfor thekeysetIdso counters survive restarts.