callRPCv1 method
Implementation
@override
Future<JRPC1Response> callRPCv1(JRPC1Request req,
{String? pathSuffix, Uri? uri}) async {
uri ??= this.uri;
if (pathSuffix != null) {
uri = uri.replace(path: uri.path + pathSuffix);
}
final body = json.encode(req.toJson());
final headers = {
HttpHeaders.contentTypeHeader: 'application/json-rpc',
HttpHeaders.acceptHeader: 'application/json-rpc'
};
if (basicAuth != null) {
headers[HttpHeaders.authorizationHeader] = 'Basic $basicAuth';
}
final resp = await client.post(uri, headers: headers, body: body);
return JRPC1Response.fromMap(json.decode(resp.body));
}