dispatchEnvelope method

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

Implementation

@override
Future<void> dispatchEnvelope(String url) async {
  final topic = WalletConnectUtils.getSearchParamFromURL(url, 'topic');
  final envelope = WalletConnectUtils.getSearchParamFromURL(url, 'wc_ev');

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

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

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