Applesauce v6.2

cleaner shutdowns, better wallet sync, and stronger NIP-46 support

Applesauce v6.2 is out, and this release is mostly about making production Nostr apps more reliable: fewer memory leaks, fewer hanging timers, stronger wallet primitives, improved sync, and a smoother NIP-46 remote signer experience.

Runtime and memory fixes

A big focus in v6.2 was cleanup. Long-running apps, bots, servers, tests, and CLIs should all behave better after this release.

The event stores now clean up after themselves properly. EventStore and AsyncEventStore have dispose() methods, with Symbol.dispose support, so apps can complete event streams, release model keep-warm timers, dispose attached loaders, stop internal listeners, and cancel pending expiration timers.

Relay cleanup is tighter too. Relay.close() now cancels reconnect timers, keep-alive timers, and internal subscriptions that could previously keep the event loop alive. RelayPool.close() closes and removes every relay in the pool.

Several memory leaks were fixed as well. Pubkey and user casts are now held weakly so unused casts can be garbage collected. EventMemory drops empty index entries when the last matching event is removed. TimelineModel forgets removed events from its seen map instead of growing forever.

The batched event, address, tag-value, and unified loaders also stop cleanly now. They support signal, stop(), and Symbol.dispose, and their internal batch engine only runs while a loader observable is subscribed, fixing a bufferTime interval that could hang the process on exit.

New sync loader

applesauce-loaders now includes createSyncLoader, which loads event sets from multiple relays using NIP-77 negentropy sync, with paginated requests as a fallback.

This gives apps a higher-level tool for backfilling data across relays without hand-rolling sync logic.

Example: https://applesauce.build/examples/#/example/loader/sync-loader

NutWallet for NIP-60

The wallet package got a large upgrade in v6.2 with a new NutWallet class in applesauce-wallet/wallet for loading and managing a NIP-60 Cashu wallet.

Examples:

  • https://applesauce.build/examples/#/example/wallet/wallet
  • https://applesauce.build/examples/#/example/wallet/admin

Token minting

MintTokens makes it easier to mint tokens into a wallet from a paid bolt11 mint quote.

Token actions can now receive an optional getCashuWallet provider, so apps can supply a cached Cashu Wallet instead of recreating one for every action.

Example: https://applesauce.build/examples/#/example/wallet/wallet

Deleted token cleanup

v6.2 adds CleanupDeletedTokens, WalletDeletedTokensModel, WalletDeletedTokenIdsModel, and getTokenDeletedIds for detecting and removing token events that newer token events have marked as deleted.

Token del ids are mirrored to public tags, so deleted token events can be computed without decrypting content first.

Wallet delete event control

NutWallet now has a useDeleteEvents option, plus setUseDeleteEvents, and token actions have a createDeleteEvents option.

This lets a wallet choose whether to load, subscribe to, and publish NIP-09 delete events, or completely ignore kind 5 delete events with a single flag.

Wallet backfills

Wallet backfills now use the shared sync loader and can automatically back up loaded wallet events to missing relays.

WalletTokensModel and WalletBalanceModel also better handle replaced token events and delete chains, fixing double-counting issues.

Example: https://applesauce.build/examples/#/example/wallet/wallet

Cashu v4

@cashu/cashu-ts has been upgraded to v4 in the wallet and content packages.

If you work directly with Cashu proofs, note that proof amounts are now Amount value objects, and getDecodedToken requires keyset ids.

Better NIP-46 sessions

applesauce-signers adds nbunksec import/export helpers for NIP-46 remote signer sessions.

NostrConnectSigner now has a logout method, and NostrConnectProvider can handle logout requests with an optional onLogout callback.

The NIP-46 secret fields have clearer names now: connectSecret for nostrconnect:// and bunkerSecret for bunker://. The older secret field remains as a deprecated alias.

applesauce-accounts also persists the NIP-46 bunkerSecret for serialized remote signer sessions.

Nostr Web Tokens

applesauce-common adds helpers and a factory for creating and validating Nostr Web Tokens.

Example: https://applesauce.build/examples/#/example/search/open-ranking

Open Ranking

applesauce-extra now includes an OpenRanking client for profile search against Open Ranking providers, including optional Nostr Web Token authentication.

Tokens are cached so scoring many pubkeys does not require repeated signatures until the token expires.

Examples:

  • https://applesauce.build/examples/#/example/search/open-ranking
  • https://applesauce.build/examples/#/example/contacts/open-ranking

Wallet Connect invoice waiting

applesauce-wallet-connect adds waitForPaid, making it easier to wait for generated invoices to settle or expire.

Example: https://applesauce.build/examples/#/example/wallet/multiple-wallets

External pointers

applesauce-common adds support for generic blockchain address and transaction external pointers, plus ISO country external pointers.

ActionRunner store updates

ActionRunner now saves newly created events to the store immediately before publishing, so local state updates sooner.

Dependency upgrades

Noble and Scure crypto dependencies were upgraded across the packages that use them.

Upgrade

Install the latest packages with your package manager:

pnpm add applesauce-core@latest applesauce-common@latest

And update any companion packages you use, such as applesauce-relay, applesauce-loaders, applesauce-wallet, applesauce-signers, or applesauce-wallet-connect.

v6.2 is especially worth upgrading for long-running apps, bots, test suites, wallet clients, and anything using NIP-46 remote signers.


Write a comment