Пример #1
0
            public WalletTransaction ToWalletTransaction(ChainBase chain, string wallet)
            {
                var chainHeight = chain.Height;
                var tx          = new WalletTransaction()
                {
                    Proof           = Proof,
                    Transaction     = Transaction,
                    UnconfirmedSeen = UnconfirmedSeen,
                    AddedDate       = AddedDate
                };

                tx.ReceivedCoins = GetCoins(ReceivedCoins, _TrackedScripts, wallet);
                tx.SpentCoins    = GetCoins(SpentCoins, _TrackedScripts, wallet);

                if (BlockId != null)
                {
                    var header = chain.GetBlock(BlockId);
                    if (header != null)
                    {
                        tx.BlockInformation = new BlockInformation()
                        {
                            Confirmations = chainHeight - header.Height + 1,
                            Height        = header.Height,
                            Header        = header.Header
                        };
                    }
                }
                return(tx);
            }
Пример #2
0
			public WalletTransaction ToWalletTransaction(ChainBase chain, ConcurrentDictionary<string, TrackedScript> trackedScripts, string wallet)
			{
				var chainHeight = chain.Height;
				var tx = new WalletTransaction()
				{
					Proof = Proof,
					Transaction = Transaction,
					UnconfirmedSeen = UnconfirmedSeen,
					AddedDate = AddedDate
				};

				tx.ReceivedCoins = GetCoins(ReceivedCoins, trackedScripts, wallet);
				tx.SpentCoins = GetCoins(SpentCoins, trackedScripts, wallet);

				if(BlockId != null)
				{
					var header = chain.GetBlock(BlockId);
					if(header != null)
					{
						tx.BlockInformation = new BlockInformation()
						{
							Confirmations = chainHeight - header.Height + 1,
							Height = header.Height,
							Header = header.Header
						};
					}
				}
				return tx;
			}
Пример #3
0
		public WalletSummaryDetails(WalletTransaction[] transactions)
		{
			TransactionCount = transactions.Length;
			Amount = transactions.SelectMany(s => s.ReceivedCoins).Select(s => s.Amount).Sum() - transactions.SelectMany(s => s.SpentCoins).Select(s => s.Amount).Sum();
		}