예제 #1
0
파일: Tracker.cs 프로젝트: zzms/NBitcoin
            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
파일: Tracker.cs 프로젝트: xcrash/NBitcoin
			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();
		}