fix(desktop): wire gift wrap broadcast for DM reactions

The sendWrappedReaction function was creating NIP-17 gift wraps via
NIP17Factory but never broadcasting them. Added sendGiftWraps() to
IAccount interface with implementations in both Desktop and Android.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
nrobi144
2026-02-19 09:34:33 +02:00
parent 3f5ad8f7be
commit 5d983c5d27
4 changed files with 33 additions and 5 deletions
@@ -39,6 +39,7 @@ import com.vitorpamplona.quartz.nip47WalletConnect.Request
import com.vitorpamplona.quartz.nip47WalletConnect.Response
import com.vitorpamplona.quartz.nip57Zaps.IPrivateZapsDecryptionCache
import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent
import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent
import com.vitorpamplona.quartz.utils.DualCase
/**
@@ -140,4 +141,24 @@ class DesktopIAccount(
relayManager.send(wrap, targetRelays)
}
}
override suspend fun sendGiftWraps(wraps: List<GiftWrapEvent>) {
wraps.forEach { wrap ->
val recipientKey = wrap.recipientPubKey()
val targetRelays =
if (recipientKey != null) {
val dmRelays =
localCache
.getOrCreateUser(recipientKey)
.dmInboxRelays()
?.toSet()
dmRelays?.ifEmpty { null }
?: relayManager.connectedRelays.value
} else {
relayManager.connectedRelays.value
}
relayManager.send(wrap, targetRelays)
}
}
}
@@ -383,11 +383,7 @@ private suspend fun sendWrappedReaction(
signer = account.signer,
)
// Send each gift wrap as a NIP-17 message
result.wraps.forEach { wrap ->
// Broadcast through the account's NIP-17 send path
// The wraps are already gift-wrapped, so we broadcast directly
}
account.sendGiftWraps(result.wraps)
}
/**