Add NIP-47 (Nostr Wallet Connect) support #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/nip47-nwc-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
pay_invoice,make_invoice,get_balance,get_info,lookup_invoice,list_transactionsArchitecture
NWC fits into the existing event routing architecture. NWC clients send kind 23194 requests addressed to the app's existing Nostr pubkey via
#ptag, so no new relay subscriptions are needed. The connection URI uses the app's pubkey and a randomsecretthat becomes the client's private key. The wallet identifies connections by the client's derived pubkey stored in a newNwcConnectiontable.Key design decisions:
max_amountandtotal_spentper connectionNew files
src/services/storage/entity/NwcConnection.ts— TypeORM entitysrc/services/storage/migrations/1770000000000-nwc_connection.ts— DB migrationsrc/services/storage/nwcStorage.ts— Storage layer for connection CRUDsrc/services/main/nwcManager.ts— Core NIP-47 handlerModified files
src/services/nostr/nostrPool.ts— Subscribe to kind 23194 eventssrc/nostrMiddleware.ts— Route kind 23194 to NwcManagersrc/services/main/index.ts— Wire NwcManager, publish kind 13194 infosrc/services/storage/db/db.ts— Register NwcConnection entitysrc/services/storage/index.ts— Wire NwcStoragesrc/services/storage/migrations/runner.ts— Register migrationTest plan
tsccompiles with zero errorsnwc_connectiontablenwcManager.createConnection()nostr+walletconnect://...URI into NWC-compatible wallet (e.g., Alby)get_balancerequest → returns user balance in msatspay_invoicerequest → pays from user balance, returns preimagemake_invoicerequest → creates invoice for user🤖 Generated with Claude Code
f1d0c521b8to52d727e6c552d727e6c5to6037dbe6006037dbe600to5a26676a24View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.