processJson method

  1. @override
Future<String> processJson(
  1. String jsonString
)
override

Implementation-specific: take the unsigned transaction JSON, compute the signing digests, and return the result transaction JSON string.

Implementation

@override
Future<String> processJson(String jsonString) {
  _checkNotDisposed();
  final wasmBytes = _wasmBytes;
  if (wasmBytes == null) {
    throw StateError('SC WASM bridge was disposed');
  }

  final task = _queue.then<String>((_) {
    final currentBytes = _wasmBytes;
    if (currentBytes == null) {
      throw StateError('SC WASM bridge was disposed');
    }
    final wasmTransfer = TransferableTypedData.fromList(<Uint8List>[
      currentBytes,
    ]);
    return _runScWasmInNewIsolate(wasmTransfer, jsonString);
  });

  // Keep the queue usable after a failed request while preserving the
  // original error for the caller awaiting [task].
  _queue = task.then<void>((_) {}, onError: (Object _, StackTrace __) {});
  return task;
}