send method

Future<JavaScriptMessage> send({
  1. required MagicRPCRequest request,
  2. required Completer<JavaScriptMessage> completer,
})

Sends message to relayer

Implementation

Future<JavaScriptMessage> send(
    {required MagicRPCRequest request,
    required Completer<JavaScriptMessage> completer}) async {
  var msgType = OutboundMessageType.MAGIC_HANDLE_REQUEST;
  var encodedParams = await URLBuilder.instance.encodedParams;

  var relayerRequest = RelayerRequest(
      msgType: '${msgType.toString().split('.').last}-$encodedParams',
      payload: request);

  _overlay.enqueue(
      relayerRequest: relayerRequest, id: request.id, completer: completer);

  return completer.future;
}