/// <summary>
        /// Fill the following fields for a transaction block:
        ///     1. Status
        ///     2. PartnerAddress
        /// </summary>
        /// <param name="transaction"></param>
        public static void FillTransactionData(string walletAddress, XDagTransaction transaction)
        {
            XDagExplorerClient client    = new XDagExplorerClient();
            GetBlockResponse   tResponse = client.GetBlock(transaction.BlockAddress);

            transaction.SetStatus(tResponse.State);
            transaction.PartnerAddress = GetPartnerAddress(walletAddress, tResponse, transaction.Direction.ToString());
        }
Esempio n. 2
0
        public void MergeWith(XDagTransaction another)
        {
            this.Status = another.Status;
            this.Amount = another.Amount;

            if (!string.IsNullOrWhiteSpace(another.PartnerAddress))
            {
                this.PartnerAddress = another.PartnerAddress;
            }
        }
Esempio n. 3
0
        public static List <XDagTransaction> GetTransactionHistory(string walletAddress)
        {
            if (string.IsNullOrEmpty(walletAddress))
            {
                return(null);
            }

            XDagExplorerClient client   = new XDagExplorerClient();
            GetBlockResponse   response = client.GetBlock(walletAddress);

            if (response == null || response.TransactionsList == null)
            {
                return(null);
            }

            List <XDagTransaction> transactionList = new List <XDagTransaction>();

            foreach (TransactionData data in response.TransactionsList)
            {
                XDagTransaction transaction = new XDagTransaction();

                double amountValue = 0;
                if (double.TryParse(data.Amount, out amountValue))
                {
                    transaction.Amount = amountValue;
                }

                transaction.BlockAddress = data.Address;

                DateTime dateTime = DateTime.MinValue;
                if (DateTime.TryParse(data.TimeStamp, out dateTime))
                {
                    transaction.TimeStamp = dateTime;
                }

                transaction.SetDirection(data.Direction);

                /*
                 * GetBlockResponse tResponse = client.GetBlock(transaction.BlockAddress);
                 * transaction.SetStatus(tResponse.State);
                 * transaction.PartnerAddress = GetPartnerAddress(walletAddress, tResponse, data.Direction);
                 */
                transaction.Remark = data.Remark;

                transactionList.Add(transaction);
            }

            return(transactionList);
        }
Esempio n. 4
0
 public void MergeWith(XDagTransaction another)
 {
     this.Status         = another.Status;
     this.Amount         = another.Amount;
     this.PartnerAddress = another.PartnerAddress;
 }