Ejemplo n.º 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);
            }
Ejemplo n.º 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;
			}
Ejemplo n.º 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();
		}