wallet.on exposes event subscriptions for counters, quotes, melts, and proof states. Each method returns a canceller function. You can bind an AbortSignal, set a timeout, or group cancellers and dispose them together.
Subscriptions:
wallet.on.countersReserved(cb, { signal }) – deterministic counter reservationswallet.on.mintQuoteUpdates(ids, onUpdate, onErr, { signal }) – live mint quote updateswallet.on.meltQuoteUpdates(ids, onUpdate, onErr, { signal }) – live melt quote updateswallet.on.proofStateUpdates(proofs, onUpdate, onErr, { signal }) – push updateswallet.on.proofStatesStream(proofs, opts) – async iterator with bounded bufferNote: For the 'Updates' subscriptions, the first call auto-establishes a mint WebSocket and errors surface via the onErr callback.
Teardown: cancelling a subscription only stops its callbacks. The socket the first subscription opened stays up and keeps a Node or Deno process alive, so on shutdown cancel every subscription, then call wallet.mint.disconnectWebSocket(). Cancellers can be grouped (below) so this is two calls.
One-shot helpers:
wallet.on.onceMintPaid(id, { signal, timeoutMs }) – resolve once quote paidwallet.on.onceMeltPaid(id, { signal, timeoutMs }) – resolve once melt paidwallet.on.onceAnyMintPaid(ids, { signal, timeoutMs }) – resolve when any paidGrouping:
wallet.on.group() – collect many cancellers, dispose all at once