nwc support with amber

This commit is contained in:
greenart7c3
2023-09-13 16:23:56 -03:00
parent 1e7ffa365b
commit 52f17e9f46
@@ -526,16 +526,18 @@ class Account(
} }
fun sendZapPaymentRequestFor(bolt11: String, zappedNote: Note?, onResponse: (Response?) -> Unit) { fun sendZapPaymentRequestFor(bolt11: String, zappedNote: Note?, onResponse: (Response?) -> Unit) {
if (!isWriteable()) return if (!isWriteable() && !loginWithAmber) return
zapPaymentRequest?.let { nip47 -> zapPaymentRequest?.let { nip47 ->
val event = LnZapPaymentRequestEvent.create(bolt11, nip47.pubKeyHex, nip47.secret?.hexToByteArray() ?: keyPair.privKey!!) val privateKey = if (loginWithAmber) nip47.secret?.hexToByteArray() else nip47.secret?.hexToByteArray() ?: keyPair.privKey
if (privateKey == null) return
val event = LnZapPaymentRequestEvent.create(bolt11, nip47.pubKeyHex, privateKey)
val wcListener = NostrLnZapPaymentResponseDataSource( val wcListener = NostrLnZapPaymentResponseDataSource(
fromServiceHex = nip47.pubKeyHex, fromServiceHex = nip47.pubKeyHex,
toUserHex = event.pubKey, toUserHex = event.pubKey,
replyingToHex = event.id, replyingToHex = event.id,
authSigningKey = nip47.secret?.hexToByteArray() ?: keyPair.privKey!! authSigningKey = privateKey
) )
wcListener.start() wcListener.start()