Example #1
0
        public ActionResult AddressTransactions(string address, string draw, int start)
        {
            var  addressInfo  = mainCoins.GetAddressInfo(address);
            var  transactions = mainCoins.GetAddressTransactions(address, start, ON_PAGE);
            long count        = 0;

            if (addressInfo != null)
            {
                count = Convert.ToInt64(Math.Round(addressInfo.AddressInfo.Transactions));
            }
            else
            {
                count = mainCoins.GetAddressTransactionsCount(address);
            }
            var json = new AddressTransactionJson();

            json.draw            = draw;
            json.recordsTotal    = count;
            json.recordsFiltered = count;
            json.data            = new List <string[]>();
            foreach (var tr in transactions)
            {
                json.data.Add(new string[7]
                {
                    tr.BlockTime.ToString("yyyy-MM-dd HH:mm"),
                    tr.Height.ToString(),
                    tr.Transaction.ToString(),
                    tr.Amount.ToString(),
                    tr.Total.ToString(),
                    tr.Type.ToString(),
                    tr.Valid.ToString()
                });
            }
            var str = JsonConvert.SerializeObject(json);

            return(Content(str, "application/json"));
        }