serialized method

String serialized()

Serialize the request to send it to the remote relays websockets.

Implementation

String serialized() {
  subscriptionId =
      subscriptionId ?? Nostr.instance.utilsService.random64HexChars();

  String decodedFilters =
      jsonEncode(filters.map((item) => item.toMap()).toList());

  String header = jsonEncode([NostrConstants.request, subscriptionId]);

  final result =
      '${header.substring(0, header.length - 1)},${decodedFilters.substring(1, decodedFilters.length)}';

  return result;
}