mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
fix(nutzaps): advertise inbox+dm relays in kind:10019, not outbox
Complete the NIP-65 outbox-model alignment for NIP-61: the `relay` tags in our kind:10019 are, per spec, the relays where the recipient *reads* incoming token events — i.e. inbox-side relays others publish to. We were advertising our outbox (write) relays there. Both publish paths (initial wallet creation in CashuWalletViewModel and P2PK key rotation in CashuWalletState.recreateNutzapKey) now advertise the union of our NIP-65 inbox + DM relays. This mirrors the relay set the wallet subscribes to for inbound kind:9321, so senders following our kind:10019 publish exactly where we listen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JHcZ2gv8ro9Q2bEiTSiHD8
This commit is contained in:
+5
-3
@@ -153,9 +153,11 @@ class CashuWalletOps(
|
||||
val walletEvent = signer.sign(walletTemplate)
|
||||
publish(walletEvent)
|
||||
|
||||
// Populate `relay` tags so senders know where to publish nutzaps —
|
||||
// without these, they fall back to NIP-65 outbox and may miss our
|
||||
// subscription scope on relays we don't read from.
|
||||
// Populate `relay` tags so senders know where to publish nutzaps.
|
||||
// Per NIP-61 these are the relays where the recipient reads incoming
|
||||
// token events, so callers pass our inbox-side relays here (NIP-65
|
||||
// outbox model). Without them, senders fall back to NIP-65 and may
|
||||
// publish where we don't subscribe for inbound nutzaps.
|
||||
val nutzapInfoTemplate =
|
||||
NutzapInfoEvent.build(
|
||||
mints = mints.map { NutzapMintTag(it, listOf("sat")) },
|
||||
|
||||
+4
-1
@@ -895,7 +895,10 @@ class CashuWalletState(
|
||||
ops.publishWalletEvents(
|
||||
mints = currentMints,
|
||||
p2pkPrivkeyHex = manualPrivkeyHex?.takeIf { it.isNotBlank() },
|
||||
nutzapRelays = outboxRelaysFlow.value.toList(),
|
||||
// Advertise our inbox + DM relays as the nutzap relays (NIP-65
|
||||
// outbox model): senders publish kind:9321 where we read inbound
|
||||
// events, matching the wallet's inbound-nutzap subscription set.
|
||||
nutzapRelays = (inboxRelaysFlow.value + dmRelaysFlow.value).toList(),
|
||||
)
|
||||
// The NUT-13 seed (derived from the P2PK key) is invalidated by
|
||||
// applyEvents when the new kind:17375 round-trips in, so it re-derives
|
||||
|
||||
+5
-1
@@ -500,8 +500,12 @@ class CashuWalletViewModel : ViewModel() {
|
||||
ops.publishWalletEvents(
|
||||
mints = mints,
|
||||
p2pkPrivkeyHex = privkey,
|
||||
// Advertise our inbox + DM relays as the nutzap relays, so
|
||||
// senders publish kind:9321 where we read incoming events
|
||||
// (NIP-65 outbox model). Mirrors the relay set the wallet
|
||||
// subscribes to for inbound nutzaps.
|
||||
nutzapRelays =
|
||||
acc.outboxRelays.flow.value
|
||||
(acc.notificationRelays.flow.value + acc.dmRelays.flow.value)
|
||||
.toList(),
|
||||
)
|
||||
_createState.value = CashuWalletCreateState.Success
|
||||
|
||||
Reference in New Issue
Block a user