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 889c363698..99771c6420 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt @@ -204,7 +204,11 @@ class Context( fun cashuOps(): CashuWalletOps = CashuWalletOps( signer = signer, - publish = { event -> publish(event, outboxRelays()) }, + // Amethyst publishes cashu events via sendLiterallyEverywhere + // (all the user's relays). anyRelays() — outbox + inbox + + // keypackage — is the CLI's closest analog, so the wallet lands + // on the same broad relay set the app would use, not just outbox. + publish = { event -> publish(event, anyRelays()) }, okHttpClient = { okhttp }, secretFactory = DeterministicSecretFactory( @@ -228,6 +232,9 @@ class Context( */ suspend fun cashuSnapshot(): CashuWalletReader.WalletSnapshot { val pk = identity.pubKeyHex + // Mirror commons' CashuWalletFilterAssembler exactly: authored wallet + // kinds by authors=[pk], inbound nutzaps by #p — so amy projects the + // same event set the Android app subscribes to. val authored = store.query( Filter( @@ -235,11 +242,10 @@ class Context( kinds = listOf( CashuWalletEvent.KIND, - NutzapInfoEvent.KIND, CashuTokenEvent.KIND, CashuSpendingHistoryEvent.KIND, CashuMintQuoteEvent.KIND, - NutzapEvent.KIND, + NutzapInfoEvent.KIND, MintRecommendationEvent.KIND, ), ), 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 19efab438f..3d0a9d32d2 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 @@ -68,10 +68,14 @@ object CashuWalletCommands { val mints = (args.csv("mint") + args.csv("mints") + args.positional.toList()).distinct() if (mints.isEmpty()) return Output.error("bad_args", "at least one --mint URL is required") val privkey = args.flag("privkey") - val nutzapRelays = args.csv("relay").mapNotNull { RelayUrlNormalizer.normalizeOrNull(it) } + val explicitRelays = args.csv("relay").mapNotNull { RelayUrlNormalizer.normalizeOrNull(it) } 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() } val created = try { ctx.cashuOps().publishWalletEvents(mints, privkey, nutzapRelays)