rawRequest method

Future rawRequest(
  1. String method, {
  2. Object? params,
})

Sends a raw rpc request using the injected Ethereum client.

If possible, prefer using asRpcService to construct a high-level client instead.

See also:

Implementation

Future<dynamic> rawRequest(String method, {Object? params}) {
  // No, this can't be simplified. Metamask wants `params` to be undefined.
  final args = params == null
      ? RequestArguments(method: method)
      : RequestArguments(method: method, params: params);
  return promiseToFuture(request(args)).onError((error, stackTrace) {
    ExceptionUtils.analyzeException(error!);
  });
}