Creates a kind type alias
This commit is contained in:
@@ -34,7 +34,7 @@ open class Event(
|
|||||||
val id: HexKey,
|
val id: HexKey,
|
||||||
val pubKey: HexKey,
|
val pubKey: HexKey,
|
||||||
val createdAt: Long,
|
val createdAt: Long,
|
||||||
val kind: Int,
|
val kind: Kind,
|
||||||
val tags: TagArray,
|
val tags: TagArray,
|
||||||
val content: String,
|
val content: String,
|
||||||
val sig: HexKey,
|
val sig: HexKey,
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025 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.core
|
||||||
|
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent
|
||||||
|
import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent
|
||||||
|
|
||||||
|
typealias Kind = Int
|
||||||
|
|
||||||
|
fun Kind.isEphemeral() = this >= 20_000 && this < 30_000
|
||||||
|
|
||||||
|
fun Kind.isReplaceable() = this == MetadataEvent.KIND || this == ContactListEvent.KIND || (this >= 10_000 && this < 20_000)
|
||||||
|
|
||||||
|
fun Kind.isAddressable() = this >= 30_000 && this < 40_000
|
||||||
+2
-1
@@ -22,6 +22,7 @@ package com.vitorpamplona.quartz.nip01Core.tags.addressables
|
|||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
|
import com.vitorpamplona.quartz.nip01Core.core.Kind
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.Nip19Parser
|
import com.vitorpamplona.quartz.nip19Bech32.Nip19Parser
|
||||||
import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress
|
import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress
|
||||||
import com.vitorpamplona.quartz.utils.Hex
|
import com.vitorpamplona.quartz.utils.Hex
|
||||||
@@ -29,7 +30,7 @@ import com.vitorpamplona.quartz.utils.bytesUsedInMemory
|
|||||||
import com.vitorpamplona.quartz.utils.pointerSizeInBytes
|
import com.vitorpamplona.quartz.utils.pointerSizeInBytes
|
||||||
|
|
||||||
data class Address(
|
data class Address(
|
||||||
val kind: Int,
|
val kind: Kind,
|
||||||
val pubKeyHex: HexKey,
|
val pubKeyHex: HexKey,
|
||||||
val dTag: String = "",
|
val dTag: String = "",
|
||||||
) : Comparable<Address> {
|
) : Comparable<Address> {
|
||||||
|
|||||||
Reference in New Issue
Block a user