getBalance method

Future<RPCResponse<GetBalance>> getBalance({
  1. String? pubkey,
})

get Balance

Implementation

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