Esempio n. 1
0
        private void AddOutput(AssetDeltas balances, Types.Output output, bool isSpending = false)
        {
            if (!balances.ContainsKey(output.spend.asset))
            {
                balances[output.spend.asset] = 0;
            }

            balances[output.spend.asset] += isSpending ? -1 * (long)output.spend.amount : (long)output.spend.amount;
        }
Esempio n. 2
0
        void UpdateBalance()
        {
            if (SendInfo.Asset == null)
            {
                SendInfo.Asset = Consensus.Tests.zhash;
            }

            _AssetBalance = _AssetDeltas != null && _AssetDeltas.ContainsKey(SendInfo.Asset) ? _AssetDeltas[SendInfo.Asset] : 0;

            string value = SendInfo.Asset.SequenceEqual(Tests.zhash) ? new Zen(_AssetBalance).ToString() : String.Format(Formats.Money, _AssetBalance);

            labelBalance.Text = string.Format(Constants.Formats.Money, value);
            CheckAssetAmount();
        }
Esempio n. 3
0
        public AssetDeltas GetAssetTotals()
        {
            var assetDeltas = new AssetDeltas();

            TxDeltaList.ForEach(t =>
            {
                foreach (var item in t.AssetDeltas)
                {
                    if (!assetDeltas.ContainsKey(item.Key))
                    {
                        assetDeltas[item.Key] = 0;
                    }

                    assetDeltas[item.Key] += item.Value;
                }
            });

            return(assetDeltas);
        }