rawRequest method
Sends a raw rpc request using the injected Ethereum client.
If possible, prefer using asRpcService to construct a high-level client instead.
See also:
- the rpc documentation under https://docs.metamask.io/guide/rpc-api.html
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!);
});
}