encodeNevent method

  1. @override
String encodeNevent({
  1. required String eventId,
  2. required String pubkey,
  3. List<String> userRelays = const [],
})
override

Generates a nprofile id from the given eventId, pubkey and relays. You can decode the generated nprofile id with decodeNeventToMap.

Example:

final nEventId = Nostr.instance.utilsService.encodeNevent(
eventId: "event id in hex format",
pubkey: "pubkey in hex format",
userRelays: ["relay1", "relay2"],
);

print(nEventId); // ...

Implementation

@override
String encodeNevent({
  required String eventId,
  required String pubkey,
  List<String> userRelays = const [],
}) {
  final map = <String, dynamic>{
    'pubkey': pubkey,
    'relays': userRelays,
    'eventId': eventId,
  };

  return _nEventMapToBech32(map);
}