Reverses ATag Generalization (It just made things more complicated)
This commit is contained in:
@@ -55,7 +55,7 @@ class BlossomServersEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun createTagArray(servers: List<String>): Array<Array<String>> =
|
fun createTagArray(servers: List<String>): Array<Array<String>> =
|
||||||
servers
|
servers
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ class PrivateOutboxRelayListEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun encryptTags(
|
fun encryptTags(
|
||||||
privateTags: Array<Array<String>>? = null,
|
privateTags: Array<Array<String>>? = null,
|
||||||
|
|||||||
+6
-5
@@ -26,6 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
|||||||
import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.dTags.dTag
|
import com.vitorpamplona.quartz.nip01Core.tags.dTags.dTag
|
||||||
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
@@ -43,16 +44,16 @@ class InteractiveStoryPrologueEvent(
|
|||||||
const val KIND = 30296
|
const val KIND = 30296
|
||||||
const val ALT = "The prologue of an interactive story called "
|
const val ALT = "The prologue of an interactive story called "
|
||||||
|
|
||||||
|
fun createAddress(
|
||||||
|
pubKey: HexKey,
|
||||||
|
dtag: String,
|
||||||
|
): String = Address.assemble(KIND, pubKey, dtag)
|
||||||
|
|
||||||
fun createAddressATag(
|
fun createAddressATag(
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
dtag: String,
|
dtag: String,
|
||||||
): ATag = ATag(KIND, pubKey, dtag, null)
|
): ATag = ATag(KIND, pubKey, dtag, null)
|
||||||
|
|
||||||
fun createAddressTag(
|
|
||||||
pubKey: HexKey,
|
|
||||||
dtag: String,
|
|
||||||
): String = ATag.assembleATagId(KIND, pubKey, dtag)
|
|
||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
baseId: String,
|
baseId: String,
|
||||||
title: String,
|
title: String,
|
||||||
|
|||||||
+1
-1
@@ -78,7 +78,7 @@ class InteractiveStoryReadingStateEvent(
|
|||||||
fun createAddressTag(
|
fun createAddressTag(
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
dtag: String,
|
dtag: String,
|
||||||
): String = ATag.assembleATagId(KIND, pubKey, dtag)
|
): String = Address.assemble(KIND, pubKey, dtag)
|
||||||
|
|
||||||
fun update(
|
fun update(
|
||||||
base: InteractiveStoryReadingStateEvent,
|
base: InteractiveStoryReadingStateEvent,
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.HexKey
|
|||||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.dTags.dTag
|
import com.vitorpamplona.quartz.nip01Core.tags.dTags.dTag
|
||||||
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
import com.vitorpamplona.quartz.nip22Comments.RootScope
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
@@ -50,7 +51,7 @@ class InteractiveStorySceneEvent(
|
|||||||
fun createAddressTag(
|
fun createAddressTag(
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
dtag: String,
|
dtag: String,
|
||||||
): String = ATag.assembleATagId(KIND, pubKey, dtag)
|
): String = Address.assemble(KIND, pubKey, dtag)
|
||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
baseId: String,
|
baseId: String,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.HexKey
|
|||||||
import com.vitorpamplona.quartz.nip01Core.core.match
|
import com.vitorpamplona.quartz.nip01Core.core.match
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.name
|
import com.vitorpamplona.quartz.nip01Core.core.name
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.value
|
import com.vitorpamplona.quartz.nip01Core.core.value
|
||||||
|
import com.vitorpamplona.quartz.utils.arrayOfNotNull
|
||||||
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
|
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
|
||||||
import com.vitorpamplona.quartz.utils.pointerSizeInBytes
|
import com.vitorpamplona.quartz.utils.pointerSizeInBytes
|
||||||
import com.vitorpamplona.quartz.utils.removeTrailingNullsAndEmptyOthers
|
import com.vitorpamplona.quartz.utils.removeTrailingNullsAndEmptyOthers
|
||||||
@@ -45,7 +46,7 @@ data class ATag(
|
|||||||
dTag.bytesUsedInMemory() +
|
dTag.bytesUsedInMemory() +
|
||||||
(relay?.bytesUsedInMemory() ?: 0)
|
(relay?.bytesUsedInMemory() ?: 0)
|
||||||
|
|
||||||
fun toTag() = assembleATagId(kind, pubKeyHex, dTag)
|
fun toTag() = Address.assemble(kind, pubKeyHex, dTag)
|
||||||
|
|
||||||
fun toATagArray() = removeTrailingNullsAndEmptyOthers(TAG_NAME, toTag(), relay)
|
fun toATagArray() = removeTrailingNullsAndEmptyOthers(TAG_NAME, toTag(), relay)
|
||||||
|
|
||||||
@@ -65,68 +66,73 @@ data class ATag(
|
|||||||
fun isTagged(
|
fun isTagged(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
addressId: String,
|
addressId: String,
|
||||||
) = ATagParser.isTagged(tag, TAG_NAME, addressId)
|
) = tag.size >= TAG_SIZE && tag[0] == TAG_NAME && tag[1] == addressId
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isTagged(
|
fun isTagged(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
address: ATag,
|
address: ATag,
|
||||||
) = ATagParser.isTagged(tag, TAG_NAME, address.toTag())
|
) = tag.size >= TAG_SIZE && tag[0] == TAG_NAME && tag[1] == address.toTag()
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isIn(
|
fun isIn(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
addressIds: Set<String>,
|
addressIds: Set<String>,
|
||||||
) = ATagParser.isIn(tag, TAG_NAME, addressIds)
|
) = tag.size >= TAG_SIZE && tag[0] == TAG_NAME && tag[1] in addressIds
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isTaggedWithKind(
|
fun isTaggedWithKind(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
kind: String,
|
kind: String,
|
||||||
) = ATagParser.isTaggedWithKind(tag, TAG_NAME, kind)
|
) = tag.size >= TAG_SIZE && tag[0] == TAG_NAME && Address.isOfKind(tag[1], kind)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun assembleATagId(
|
|
||||||
kind: Int,
|
|
||||||
pubKey: HexKey,
|
|
||||||
dTag: String,
|
|
||||||
) = ATagParser.assembleATagId(kind, pubKey, dTag)
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parseIfOfKind(
|
fun parseIfOfKind(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
kind: String,
|
kind: String,
|
||||||
) = ATagParser.parseIfOfKind(tag, TAG_NAME, kind)
|
) = if (isTaggedWithKind(tag, kind)) parse(tag[1], tag.getOrNull(2)) else null
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parseIfIsIn(
|
fun parseIfIsIn(
|
||||||
tag: Array<String>,
|
tag: Array<String>,
|
||||||
addresses: Set<String>,
|
addresses: Set<String>,
|
||||||
) = ATagParser.parseIfIsIn(tag, TAG_NAME, addresses)
|
) = if (isIn(tag, addresses)) parse(tag[1], tag.getOrNull(2)) else null
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parse(
|
fun parse(
|
||||||
aTagId: String,
|
aTagId: String,
|
||||||
relay: String?,
|
relay: String?,
|
||||||
) = ATagParser.parse(aTagId, relay)
|
) = Address.parse(aTagId)?.let { ATag(it.kind, it.pubKeyHex, it.dTag, relay) }
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parse(tag: Array<String>) = ATagParser.parse(TAG_NAME, tag)
|
fun parse(tag: Array<String>): ATag? {
|
||||||
|
if (tag.size < TAG_SIZE || tag[0] != TAG_NAME) return null
|
||||||
|
return parse(tag[1], tag.getOrNull(2))
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parseValidAddress(tag: Array<String>) = ATagParser.parseValidAddress(TAG_NAME, tag)
|
fun parseValidAddress(tag: Array<String>): String? {
|
||||||
|
if (tag.size < TAG_SIZE || tag[0] != TAG_NAME) return null
|
||||||
|
return Address.parse(tag[1])?.toValue()
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parseAddress(tag: Array<String>) = ATagParser.parseAddress(TAG_NAME, tag)
|
fun parseAddress(tag: Array<String>): Address? {
|
||||||
|
if (tag.size < TAG_SIZE || tag[0] != TAG_NAME) return null
|
||||||
|
return Address.parse(tag[1])
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun parseAddressId(tag: Array<String>) = ATagParser.parseAddressId(TAG_NAME, tag)
|
fun parseAddressId(tag: Array<String>): String? {
|
||||||
|
if (tag.size < TAG_SIZE || tag[0] != TAG_NAME) return null
|
||||||
|
return tag[1]
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun assemble(
|
fun assemble(
|
||||||
aTagId: HexKey,
|
aTagId: HexKey,
|
||||||
relay: String?,
|
relay: String?,
|
||||||
) = ATagParser.assemble(TAG_NAME, aTagId, relay)
|
) = arrayOfNotNull(TAG_NAME, aTagId, relay)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun assemble(
|
fun assemble(
|
||||||
@@ -134,6 +140,6 @@ data class ATag(
|
|||||||
pubKey: String,
|
pubKey: String,
|
||||||
dTag: String,
|
dTag: String,
|
||||||
relay: String?,
|
relay: String?,
|
||||||
) = ATagParser.assemble(TAG_NAME, kind, pubKey, dTag, relay)
|
) = assemble(Address.assemble(kind, pubKey, dTag), relay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-132
@@ -1,132 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2024 Vitor Pamplona
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to use,
|
|
||||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
||||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
package com.vitorpamplona.quartz.nip01Core.tags.addressables
|
|
||||||
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.HexKey
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.isNotName
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.match
|
|
||||||
import com.vitorpamplona.quartz.utils.arrayOfNotNull
|
|
||||||
|
|
||||||
class ATagParser {
|
|
||||||
companion object {
|
|
||||||
const val TAG_SIZE = 2
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun isTagged(
|
|
||||||
tag: Array<String>,
|
|
||||||
tagName: String,
|
|
||||||
addressId: String,
|
|
||||||
) = tag.match(tagName, addressId, TAG_SIZE)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun isIn(
|
|
||||||
tag: Array<String>,
|
|
||||||
tagName: String,
|
|
||||||
addressIds: Set<String>,
|
|
||||||
) = tag.match(tagName, addressIds, TAG_SIZE)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun isTaggedWithKind(
|
|
||||||
tag: Array<String>,
|
|
||||||
tagName: String,
|
|
||||||
kind: String,
|
|
||||||
) = tag.match(tagName, TAG_SIZE) && Address.isOfKind(tag[1], kind)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun assembleATagId(
|
|
||||||
kind: Int,
|
|
||||||
pubKeyHex: HexKey,
|
|
||||||
dTag: String,
|
|
||||||
) = Address.assemble(kind, pubKeyHex, dTag)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parseIfOfKind(
|
|
||||||
tag: Array<String>,
|
|
||||||
tagName: String,
|
|
||||||
kind: String,
|
|
||||||
) = if (isTaggedWithKind(tag, tagName, kind)) parse(tag[1], tag.getOrNull(2)) else null
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parseIfIsIn(
|
|
||||||
tag: Array<String>,
|
|
||||||
tagName: String,
|
|
||||||
addresses: Set<String>,
|
|
||||||
) = if (isIn(tag, tagName, addresses)) parse(tag[1], tag.getOrNull(2)) else null
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parse(
|
|
||||||
aTagId: String,
|
|
||||||
relay: String?,
|
|
||||||
) = Address.parse(aTagId)?.let { ATag(it.kind, it.pubKeyHex, it.dTag, relay) }
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parse(
|
|
||||||
tagName: String,
|
|
||||||
tag: Array<String>,
|
|
||||||
): ATag? {
|
|
||||||
if (tag.isNotName(tagName, TAG_SIZE)) return null
|
|
||||||
return parse(tag[1], tag.getOrNull(2))
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parseValidAddress(
|
|
||||||
tagName: String,
|
|
||||||
tag: Array<String>,
|
|
||||||
): String? {
|
|
||||||
if (tag.isNotName(tagName, TAG_SIZE)) return null
|
|
||||||
return Address.parse(tag[1])?.toValue()
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parseAddress(
|
|
||||||
tagName: String,
|
|
||||||
tag: Array<String>,
|
|
||||||
): Address? {
|
|
||||||
if (tag.isNotName(tagName, TAG_SIZE)) return null
|
|
||||||
return Address.parse(tag[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun parseAddressId(
|
|
||||||
tagName: String,
|
|
||||||
tag: Array<String>,
|
|
||||||
): String? {
|
|
||||||
if (tag.isNotName(tagName, TAG_SIZE)) return null
|
|
||||||
return tag[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun assemble(
|
|
||||||
tagName: String,
|
|
||||||
aTagId: HexKey,
|
|
||||||
relay: String?,
|
|
||||||
) = arrayOfNotNull(tagName, aTagId, relay)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun assemble(
|
|
||||||
tagName: String,
|
|
||||||
kind: Int,
|
|
||||||
pubKeyHex: String,
|
|
||||||
dTag: String,
|
|
||||||
relay: String?,
|
|
||||||
) = arrayOfNotNull(tagName, assembleATagId(kind, pubKeyHex, dTag), relay)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -55,7 +55,7 @@ class ChatMessageRelayListEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun createTagArray(relays: List<String>): Array<Array<String>> =
|
fun createTagArray(relays: List<String>): Array<Array<String>> =
|
||||||
relays
|
relays
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import addString
|
|||||||
import addStringIfNotNull
|
import addStringIfNotNull
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.TlvTypes
|
import com.vitorpamplona.quartz.nip19Bech32.TlvTypes
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes
|
import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.tlv.Tlv
|
import com.vitorpamplona.quartz.nip19Bech32.tlv.Tlv
|
||||||
@@ -40,7 +40,7 @@ data class NAddress(
|
|||||||
val dTag: String,
|
val dTag: String,
|
||||||
val relay: List<String>,
|
val relay: List<String>,
|
||||||
) : Entity {
|
) : Entity {
|
||||||
fun aTag(): String = ATag.assembleATagId(kind, author, dTag)
|
fun aTag(): String = Address.assemble(kind, author, dTag)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun parse(naddr: String): NAddress? {
|
fun parse(naddr: String): NAddress? {
|
||||||
|
|||||||
+1
-2
@@ -27,7 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.core.BaseReplaceableEvent
|
|||||||
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.eventUpdate
|
import com.vitorpamplona.quartz.nip01Core.signers.eventUpdate
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.taggedATags
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.taggedATags
|
||||||
import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent
|
import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent
|
||||||
@@ -52,7 +51,7 @@ class EmojiPackSelectionEvent(
|
|||||||
|
|
||||||
fun createAddress(pubKey: HexKey) = Address(KIND, pubKey, FIXED_D_TAG)
|
fun createAddress(pubKey: HexKey) = Address(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey) = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey) = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun add(
|
fun add(
|
||||||
currentSelection: EmojiPackSelectionEvent,
|
currentSelection: EmojiPackSelectionEvent,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.HexKey
|
|||||||
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.addressables.ATag
|
import com.vitorpamplona.quartz.nip01Core.tags.addressables.Address
|
||||||
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
||||||
import com.vitorpamplona.quartz.nip22Comments.CommentEvent
|
import com.vitorpamplona.quartz.nip22Comments.CommentEvent
|
||||||
import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent
|
import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent
|
||||||
@@ -125,7 +125,7 @@ class DraftEvent(
|
|||||||
fun createAddressTag(
|
fun createAddressTag(
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
dTag: String,
|
dTag: String,
|
||||||
): String = ATag.assembleATagId(KIND, pubKey, dTag)
|
): String = Address.assemble(KIND, pubKey, dTag)
|
||||||
|
|
||||||
fun create(
|
fun create(
|
||||||
dTag: String,
|
dTag: String,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class SearchRelayListEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun createTagArray(relays: List<String>): Array<Array<String>> =
|
fun createTagArray(relays: List<String>): Array<Array<String>> =
|
||||||
relays
|
relays
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ class AdvertisedRelayListEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun updateRelayList(
|
fun updateRelayList(
|
||||||
earlierVersion: AdvertisedRelayListEvent,
|
earlierVersion: AdvertisedRelayListEvent,
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ class FileServersEvent(
|
|||||||
|
|
||||||
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
fun createAddressATag(pubKey: HexKey): ATag = ATag(KIND, pubKey, FIXED_D_TAG, null)
|
||||||
|
|
||||||
fun createAddressTag(pubKey: HexKey): String = ATag.assembleATagId(KIND, pubKey, FIXED_D_TAG)
|
fun createAddressTag(pubKey: HexKey): String = Address.assemble(KIND, pubKey, FIXED_D_TAG)
|
||||||
|
|
||||||
fun replaceServers(
|
fun replaceServers(
|
||||||
earlierVersion: FileServersEvent,
|
earlierVersion: FileServersEvent,
|
||||||
|
|||||||
Reference in New Issue
Block a user