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) })
|
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(
|
fun create(
|
||||||
authorPubKeyHex: String,
|
authorPubKeyHex: String,
|
||||||
relays: List<NormalizedRelayUrl>,
|
relays: List<NormalizedRelayUrl>,
|
||||||
|
|||||||
Reference in New Issue
Block a user