Esempio n. 1
0
        public async Task <TData> Query <TData>(String method, Object parameters)
        {
            var para = new RPCRequest {
                Method  = method,
                JsonRPC = "2.0",
                Params  = parameters,
                ID      = this.ID++
            };
            RPCResponse <TData> result = await Handler.PostJsonAsync <RPCResponse <TData> >(this.EntryPoint, para);

#if DEBUG
            //Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
#endif
            return(await Task.FromResult <TData>(result.Result));
        }
Esempio n. 2
0
        public async Task <TData> Broadcast <TData>(object tx)
        {
            var para = new RPCRequest
            {
                Method  = "call",
                JsonRPC = "2.0",
                Params  = new object[] { 2, "broadcast_transaction_synchronous", new object[] { tx } },
                ID      = this.ID++
            };
            RPCResponse <TData> result = await Handler.PostJsonAsync <RPCResponse <TData> >(this.EntryPoint, para);

#if DEBUG
            //Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
#endif
            if (result.Error != null)
            {
                throw result.Error;
            }
            return(result.Result);
        }