dispatchEnvelope method

  1. @override
Future<void> dispatchEnvelope(
  1. String url
)
override

Implementation

@override
Future<void> dispatchEnvelope(String url) async {
  final topic = ReownCoreUtils.getSearchParamFromURL(url, 'topic');
  final envelope = ReownCoreUtils.getSearchParamFromURL(url, 'wc_ev');
  core.logger.d('[$runtimeType] dispatchEnvelope $url');

  if (envelope.isEmpty) {
    throw ReownSignError(code: 0, message: 'Envelope not found');
  }
  if (topic.isEmpty) {
    throw ReownSignError(code: 0, message: 'Topic not found');
  }

  final session = sessions.get(topic);
  if (session != null) {
    core.logger.d('[$runtimeType] sessions.update $topic to linkMode');
    await sessions.update(
      session.topic,
      transportType: TransportType.linkMode,
    );
  }

  core.pairing.dispatchEnvelope(
    topic: topic,
    envelope: envelope,
  );
}