fix(cli): realign amy nutzap relays with upstream NIP-65 inbox model

Upstream reworked kind:10019 to advertise the account's NIP-65 inbox (read)
relays as nutzap-receiving relays (was outbox). Realign amy:
`cashu wallet create` now defaults nutzapRelays to a new
Context.nip65ReadRelays() (kind:10002 read relays, falling back to outbox)
instead of outboxRelays(), so amy's kind:10019 matches the Android wallet's
again. The event's publish destination (anyRelays / sendLiterallyEverywhere)
is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SapGdtAc1j7woifoCZ9fY
This commit is contained in:
Claude
2026-06-22 14:58:51 +00:00
parent a5eabbf1a2
commit 2c4fd48c96
2 changed files with 16 additions and 4 deletions
@@ -330,6 +330,17 @@ class Context(
relaysOf(identity.pubKeyHex)?.writeRelaysNorm()?.takeIf { it.isNotEmpty() }?.toSet()
?: DefaultNIP65RelaySet
/**
* NIP-65 *read* (inbox) relays for this account — "where others reach me".
* Mirrors the Android app's NIP-65 inbox set (the `notificationRelays`
* flow). Used as the default `relay` tags advertised in a kind:10019
* nutzap-info event. Falls back to [outboxRelays] when no read relays are
* marked.
*/
suspend fun nip65ReadRelays(): Set<NormalizedRelayUrl> =
relaysOf(identity.pubKeyHex)?.readRelaysNorm()?.takeIf { it.isNotEmpty() }?.toSet()
?: outboxRelays()
/**
* DM inbox relays (NIP-17 kind:10050) for this account. Falls back
* to [DefaultDMRelayList] when no kind:10050 has been seen.
@@ -72,10 +72,11 @@ object CashuWalletCommands {
Context.open(dataDir).use { ctx ->
ctx.prepare()
// Match Amethyst: kind:10019 advertises the account's outbox
// relays as nutzap-receiving relays unless the caller overrides
// with --relay, so senders publish nutzaps where we actually read.
val nutzapRelays = explicitRelays.ifEmpty { ctx.outboxRelays().toList() }
// Match Amethyst: kind:10019 advertises the account's NIP-65
// inbox (read) relays as nutzap-receiving relays unless the caller
// overrides with --relay, so senders publish kind:9321 where we
// read incoming events.
val nutzapRelays = explicitRelays.ifEmpty { ctx.nip65ReadRelays().toList() }
val created =
try {
ctx.cashuOps().publishWalletEvents(mints, privkey, nutzapRelays)