toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  if (_sessionData != null) {
    return _sessionData!.toJson();
  }

  final sessionData = SessionData(
    topic: topic ?? '',
    pairingTopic: pairingTopic ?? '',
    relay: relay ?? Relay(ReownConstants.RELAYER_DEFAULT_PROTOCOL),
    expiry: expiry ?? 0,
    acknowledged: acknowledged ?? false,
    controller: controller ?? '',
    namespaces: _namespaces() ?? {},
    self: self!,
    peer: peer!,
    requiredNamespaces: _sessionData?.requiredNamespaces,
    optionalNamespaces: _sessionData?.optionalNamespaces,
    sessionProperties: _sessionData?.sessionProperties,
    authentication: _sessionData?.authentication,
    transportType: _sessionData?.transportType ?? TransportType.relay,
  );
  return sessionData.toJson();
}