Exemplo n.º 1
0
        public static string JsonRpcRequest(string method, params object[] args)
        {
            var client = new JsonRpcClient(RpcName, RpcPassword, NodeIp, NodePort, ChainName);

            return(client.JsonRpcRequest(method, args));


            //Dictionary<string, object> mcArgs = new Dictionary<string, object>()
            //{
            //    { "method",method },
            //    { "chain_name",ChainName },
            //    { "params", args }
            //};

            //try
            //{
            //    string jsonRpcRequest = JsonConvert.SerializeObject(mcArgs);
            //    string jsonRpcResponse = "";
            //    using (var handler = new HttpClientHandler() { Credentials = new NetworkCredential(RpcName, RpcPassword) })
            //    using (var client = new HttpClient(handler))
            //    using (var response = client.PostAsync(string.Format("http://{0}:{1}/", NodeIp, NodePort), new StringContent(jsonRpcRequest, Encoding.UTF8, "text/plain")).Result)
            //    using (var content = response.Content)
            //    {
            //        jsonRpcResponse = content.ReadAsStringAsync().Result;
            //    }
            //    Check(jsonRpcResponse);
            //    return jsonRpcResponse;
            //}
            //catch (AggregateException ae)
            //{
            //    var err = "";
            //    foreach (var e in ae.InnerExceptions)
            //    {
            //        Exception e2 = e;
            //        while (e2 != null)
            //        {
            //            err += e2.Message + ";";
            //            e2 = e2.InnerException;
            //        }
            //        err += "\n";
            //    }
            //    throw new Exception(err);
            //}
        }
 public ServiceBase(JsonRpcClient c)
 {
     jsonRpcClient = c;
 }
 public AddressManager(JsonRpcClient c) : base(c)
 {
 }
 public PermissionManager(JsonRpcClient c) : base(c)
 {
 }
Exemplo n.º 5
0
 public Admin(JsonRpcClient c) : base(c)
 {
 }
 public TransactionManager(JsonRpcClient c) : base(c)
 {
 }
Exemplo n.º 7
0
 public AssetManager(JsonRpcClient c) : base(c)
 {
 }
 public StreamManager(JsonRpcClient c) : base(c)
 {
 }