private string MakeRawRequestClient(string rpcMethod, params object[] parameters) { var jsonRpcRequest = new JsonRpcRequest(1, rpcMethod, parameters); try { var request_json = jsonRpcRequest.GetJson(); var content = new StringContent(request_json, Encoding.UTF8, "application/json"); var result = client.PostAsync(_coinService.Parameters.SelectedDaemonUrl, content).Result; var result_string = result.Content.ReadAsStringAsync().Result; var resp = JsonConvert.DeserializeObject <JsonRpcResponse <object> >(result_string); return(resp.Result.ToString()); } catch (AggregateException aggregate) { foreach (var e in aggregate.Flatten().InnerExceptions) { if (e is HttpRequestException) { throw new ConnectionException(e.Message, 1); } else { throw; } } throw aggregate; } catch (JsonException jsonException) { throw new RpcResponseDeserializationException("There was a problem deserializing the response from the wallet", jsonException); } catch (ProtocolViolationException protocolViolationException) { throw new RpcException("Unable to connect to the server", protocolViolationException); } catch (Exception exception) { var queryParameters = jsonRpcRequest.Parameters.Cast <string>().Aggregate(string.Empty, (current, parameter) => current + (parameter + " ")); throw new Exception($"A problem was encountered while calling MakeRpcRequest() for: {jsonRpcRequest.Method} with parameters: {queryParameters}. \nException: {exception.Message}"); } }