Fully Deprecates note1, removing the last usages of the standard

This commit is contained in:
Vitor Pamplona
2024-11-19 09:22:37 -05:00
parent 72f317717b
commit 248848799c
6 changed files with 10 additions and 13 deletions
@@ -56,11 +56,11 @@ data class ATag(
fun toQTagArray() = removeTrailingNullsAndEmptyOthers("q", toTag(), relay)
fun toNAddr(): String =
fun toNAddr(overrideRelay: String? = relay): String =
TlvBuilder()
.apply {
addString(Nip19Bech32.TlvTypes.SPECIAL, dTag)
addStringIfNotNull(Nip19Bech32.TlvTypes.RELAY, relay)
addStringIfNotNull(Nip19Bech32.TlvTypes.RELAY, overrideRelay)
addHex(Nip19Bech32.TlvTypes.AUTHOR, pubKeyHex)
addInt(Nip19Bech32.TlvTypes.KIND, kind)
}.build()
@@ -45,8 +45,6 @@ data class ETag(
fun toNEvent(): String = Nip19Bech32.createNEvent(eventId, authorPubKeyHex, null, relay)
fun toNote(): String = Nip19Bech32.createNote(eventId)
fun toETagArray() = removeTrailingNullsAndEmptyOthers("e", eventId, relay, authorPubKeyHex)
fun toQTagArray() = removeTrailingNullsAndEmptyOthers("q", eventId, relay, authorPubKeyHex)
@@ -270,6 +270,7 @@ object Nip19Bech32 {
}.build()
.toNEvent()
@Deprecated("Use nevent instead")
fun createNote(eventId: HexKey): String = eventId.hexToByteArray().toNote()
fun createNPub(authorPubKeyHex: HexKey): String = authorPubKeyHex.hexToByteArray().toNpub()
@@ -303,6 +304,7 @@ fun ByteArray.toNsec() = Bech32.encodeBytes(hrp = "nsec", this, Bech32.Encoding.
fun ByteArray.toNpub() = Bech32.encodeBytes(hrp = "npub", this, Bech32.Encoding.Bech32)
@Deprecated("Prefer nevent1 instead")
fun ByteArray.toNote() = Bech32.encodeBytes(hrp = "note", this, Bech32.Encoding.Bech32)
fun ByteArray.toNEvent() = Bech32.encodeBytes(hrp = "nevent", this, Bech32.Encoding.Bech32)