rpc static method

Future rpc(
  1. String method,
  2. List params
)

Implementation

static Future<dynamic> rpc(String method, List<dynamic> params) async {
  final req = RequestBodyEntity();
  req.chainId = await ParticleAuth.getChainId();
  req.jsonrpc = "2.0";
  req.id = getCurrentTimestamp();
  req.method = method;
  req.params = params;
  final result = await SolanaRpcApi.getClient().rpc(req);
  RpcResponse response = RpcResponse.fromJson(jsonDecode(result));
  if (response.error != null) {
    return Future.error(response.error!);
  } else {
    return response.result;
  }
}