From 2c4fd48c96f79e688d327935cdc347e20637ebdd Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 14:58:51 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_011SapGdtAc1j7woifoCZ9fY --- .../kotlin/com/vitorpamplona/amethyst/cli/Context.kt | 11 +++++++++++ .../cli/commands/cashu/CashuWalletCommands.kt | 9 +++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt index f135e6b407..36cc92a817 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt @@ -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 = + 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. diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/cashu/CashuWalletCommands.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/cashu/CashuWalletCommands.kt index 3d0a9d32d2..88e2fb40ba 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/cashu/CashuWalletCommands.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/cashu/CashuWalletCommands.kt @@ -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)