naddr property
String?
get
naddr
Encode this event as an naddr (NIP-19 addressable event coordinate)
Only works for addressable/replaceable events (kind >= 10000 or kind 0, 3, 41) Requires a "d" tag to identify the event.
Returns a bech32-encoded naddr string or null if:
- Event is not addressable/replaceable
- Event doesn't have a "d" tag
Usage: final naddr = event.naddr;
Implementation
String? get naddr {
// Check if this is an addressable event
if (!_isAddressableKind(kind)) {
return null;
}
// Get the "d" tag identifier
final identifier = getDtag();
if (identifier == null) {
return null;
}
return Nip19.encodeNaddr(
identifier: identifier,
pubkey: pubKey,
kind: kind,
relays: sources.isEmpty ? null : sources,
);
}