Skip to content

feat: add nipcash + nipcw packages (NIP-CASH, NIP-CW client SDK) - #9

Merged
naliyi merged 1 commit into
ohstr:mainfrom
git-nostr:feat/nipcash-nipcw-sdk
Sep 3, 2026
Merged

feat: add nipcash + nipcw packages (NIP-CASH, NIP-CW client SDK)#9
naliyi merged 1 commit into
ohstr:mainfrom
git-nostr:feat/nipcash-nipcw-sdk

Conversation

@git-nostr

Copy link
Copy Markdown
Contributor

Summary

  • New nipcash/nipcash/client packages implementing NIP-CASH (Cash Hub): mint, hold, redeem, transfer, split, and consolidate cash tokens (lokicash1.../satscash1...), built on nipAZ/nipIC for Web-Identity recipients and relay/client.NWCClient for transport. Defines kind 23198 (its own per-call proof, deliberately not NIP-IC's kind 35521).
  • New nipcw/nipcw/client packages implementing NIP-CW (Circle Wallet): self-service create_circle_wallet. Defines kind 23199.
  • README "Implemented NIPs" + a new Quick Start example (verified to actually compile against the real API), CHANGELOG entries.
  • A new relay regression test, case_tags_zero_at_subscribe_then_live (relay/store_test.go): a kind+tag subscription whose filter matches nothing at subscribe time, then gains exactly one live match after EOSE — the shape every NIP-47 request/response round trip has, since each proof/request event ID is freshly generated and can never have pre-existed. Passes against current source.

Context on that last test

While live-testing nipcash/client against a real, independently-running deployment, every NWC call hung forever even though the wallet side had already published its reply. I isolated it to exactly the scenario the new test covers, then reproduced it in-process against current main — where it passes. The actual live deployment turned out to be running a relay binary built ~1 month before this branch's base commit, so the hang was a stale-deployment issue, not a defect in this code. The test is included anyway since that exact scenario (subscribe on a filter with zero current matches, then a live match arrives) had no prior coverage despite being NIP-47's normal shape.

Test plan

  • go build ./..., go vet ./..., go test -race ./... — all green
  • gofmt -l . clean, go mod tidy produces no diff
  • golangci-lint run ./... (v2.13) — 0 issues
  • govulncheck ./... — 0 vulnerabilities
  • New README quick-start example extracted and compiled standalone against the real API

New nipcash/nipcash-client and nipcw/nipcw-client packages let any
nmilat-based app mint/hold/redeem/transfer/split/consolidate cash
tokens or self-serve a Circle Wallet, without hand-rolling either
protocol on top of raw nip47. Built on nipAZ/nipIC for Web-Identity
recipients, reuses relay/client's NWCClient for transport. Defines
kind 23198 (NIP-CASH's per-call proof) and kind 23199 (NIP-CW's),
both deliberately distinct from NIP-IC's kind 35521.

Also adds a relay regression test (case_tags_zero_at_subscribe_then_live)
covering a kind+tag subscription whose filter matches nothing at
subscribe time and only gains a match after EOSE -- the shape every
NIP-47 request/response round trip has, since each proof/request event
ID is freshly generated. Passes against current source; added after
live-testing nipcash/client against a real deployment surfaced what
turned out to be a stale relay binary (a month behind HEAD), not a
current bug -- this closes the coverage gap that let it go unnoticed.
@naliyi
naliyi merged commit 9866fb9 into ohstr:main Sep 3, 2026
3 checks passed
naliyi added a commit that referenced this pull request Sep 3, 2026
changelog: add (#9)/(#10) PR backrefs, trim relay PoW entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants