mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-04 19:24:18 +02:00
Adds a method to create nprofiles without creating a relay list first
This commit is contained in:
@@ -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<NormalizedRelayUrl>,
|
||||
|
Reference in New Issue
Block a user