fromRelayMessage static method

NostrEventOkCommand fromRelayMessage(
  1. String data
)

Implementation

static NostrEventOkCommand fromRelayMessage(String data) {
  assert(canBeDeserialized(data));

  final decoded = jsonDecode(data) as List;
  final eventId = decoded[1] as String;
  final isEventAccepted = decoded.length > 2 ? decoded[2] as bool : null;
  final message = decoded.length > 3 ? decoded[3] as String : null;

  return NostrEventOkCommand(
    eventId: eventId,
    isEventAccepted: isEventAccepted,
    message: message,
  );
}