예제 #1
0
        public async Task GetPaymentInfoInMemPool()
        {
            MemoryPool pool = new MemoryPool();

            PaymentOM[] result = await pool.GetPaymentInfoInMemPool("1D6B63D8294162000D7B4FB2035053482A3D14E228E8543ED4CDE39A93FA1561");

            Assert.IsNotNull(result);
        }
예제 #2
0
        public static async Task <ApiResponse> GetPaymentInfoInMemPool(string txid)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                MemoryPool     pool   = new MemoryPool();
                List <Payment> list   = new List <Payment>();
                PaymentOM[]    result = await pool.GetPaymentInfoInMemPool(txid);

                if (result != null && result.Length > 0)
                {
                    for (int i = 0; i < result.Length; i++)
                    {
                        list.Add(new Payment()
                        {
                            Account       = result[i].Account,
                            Address       = result[i].Address,
                            Amount        = result[i].Amount,
                            BlockHash     = result[i].BlockHash,
                            BlockIndex    = result[i].BlockIndex,
                            BlockTime     = result[i].BlockTime,
                            Category      = result[i].Category,
                            Comment       = result[i].Comment,
                            Confirmations = result[i].Confirmations,
                            Fee           = result[i].Fee,
                            Size          = result[i].Size,
                            Time          = result[i].Time,
                            TotalInput    = result[i].TotalInput,
                            TotalOutput   = result[i].TotalOutput,
                            TxId          = result[i].TxId,
                            Vout          = result[i].Vout
                        });
                    }
                    response.Result = Newtonsoft.Json.Linq.JToken.FromObject(result.ToList());
                }
                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);
        }