getAccountInfo method

Future<RPCResponse<GetAccountInfo>> getAccountInfo({
  1. String? pubkey,
})

get AccountInfo

Implementation

Future<RPCResponse<GetAccountInfo>> getAccountInfo({String? pubkey}) async {
  final body = json.encode({
    "jsonrpc": "2.0",
    "id": 1,
    "method": RPCMethod.getAccountInfo,
    "params": [
      pubkey ?? address,
      {"encoding": "jsonParsed"}
    ]
  });
  final response = await _httpClient.post(_url, data: body);
  return RPCResponse<GetAccountInfo>.fromJson(response.data,
      onData: (Map<String, dynamic> value) {
    return GetAccountInfo.fromJson(value);
  });
}