示例#1
0
        public static async Task <ApiResponse> ListSinceBlock(string blockHash, long confirmations)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                Transaction      trans  = new Transaction();
                List <Payment>   list   = new List <Payment>();
                ListSinceBlockOM result = await trans.ListSinceBlock(blockHash, confirmations);

                if (result != null)
                {
                    response.Result = Newtonsoft.Json.Linq.JToken.FromObject(result);
                }
                else
                {
                    response.Result = null;
                }
            }
            catch (ApiCustomException ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.ErrorCode, ex.ToString());
            }
            catch (Exception ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.HResult, ex.ToString());
            }
            return(response);
        }
示例#2
0
        public async Task <ListSinceBlockOM> ListSinceBlock(string blockHash, long confirmations)
        {
            AuthenticationHeaderValue authHeaderValue = null;
            RpcClient  client  = new RpcClient(new Uri(WalletNetwork.NetWork), authHeaderValue, null, null, "application/json");
            RpcRequest request = RpcRequest.WithParameterList("ListSinceBlock", new List <object> {
                blockHash, confirmations
            }, 1);
            RpcResponse response = await client.SendRequestAsync(request);

            if (response.HasError)
            {
                throw new ApiCustomException(response.Error.Code, response.Error.Message);
            }
            ListSinceBlockOM responseValue = response.GetResult <ListSinceBlockOM>();

            return(responseValue);
        }