From 1b043603f988d5997eafefc05c2e035907560016 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 6 Aug 2025 17:54:34 -0400 Subject: [PATCH] Adds a method to create nprofiles without creating a relay list first --- .../quartz/nip19Bech32/entities/NProfile.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/nip19Bech32/entities/NProfile.kt b/quartz/src/main/java/com/vitorpamplona/quartz/nip19Bech32/entities/NProfile.kt index 55c84758f..fe62fd4be 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/nip19Bech32/entities/NProfile.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/nip19Bech32/entities/NProfile.kt @@ -51,6 +51,19 @@ data class NProfile( return NProfile(hex, relay.mapNotNull { RelayUrlNormalizer.normalizeOrNull(it) }) } + fun create( + authorPubKeyHex: String, + relay: NormalizedRelayUrl?, + ): String = + TlvBuilder() + .apply { + addHex(TlvTypes.SPECIAL, authorPubKeyHex) + if (relay != null) { + addStringIfNotNull(TlvTypes.RELAY, relay.url) + } + }.build() + .toNProfile() + fun create( authorPubKeyHex: String, relays: List,