mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 00:52:34 +02:00
Uses NIP-65 preferably for zap requests.
This commit is contained in:
@@ -730,7 +730,9 @@ class Account(
|
|||||||
note.event?.let { event ->
|
note.event?.let { event ->
|
||||||
LnZapRequestEvent.create(
|
LnZapRequestEvent.create(
|
||||||
event,
|
event,
|
||||||
userProfile().latestContactList?.relays()?.keys?.ifEmpty { null }
|
relays =
|
||||||
|
getNIP65RelayList()?.readRelays()?.toSet()
|
||||||
|
?: userProfile().latestContactList?.relays()?.keys?.ifEmpty { null }
|
||||||
?: localRelays.map { it.url }.toSet(),
|
?: localRelays.map { it.url }.toSet(),
|
||||||
signer,
|
signer,
|
||||||
pollOption,
|
pollOption,
|
||||||
|
@@ -54,6 +54,34 @@ class AdvertisedRelayListEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun readRelays(): List<String>? {
|
||||||
|
return tags.mapNotNull {
|
||||||
|
if (it.size > 1 && it[0] == "r") {
|
||||||
|
when (it.getOrNull(2)) {
|
||||||
|
"read" -> it[1]
|
||||||
|
"write" -> null
|
||||||
|
else -> it[1]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}.ifEmpty { null }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun writeRelays(): List<String> {
|
||||||
|
return tags.mapNotNull {
|
||||||
|
if (it.size > 1 && it[0] == "r") {
|
||||||
|
when (it.getOrNull(2)) {
|
||||||
|
"read" -> null
|
||||||
|
"write" -> it[1]
|
||||||
|
else -> it[1]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val KIND = 10002
|
const val KIND = 10002
|
||||||
const val FIXED_D_TAG = ""
|
const val FIXED_D_TAG = ""
|
||||||
|
Reference in New Issue
Block a user