public static ColoredBalance CreateEmpty(string assetId, IReadOnlyDictionary <string, IAssetDefinition> assetDictionary)
            {
                var asset = assetDictionary.GetValueOrDefault(assetId, null);

                var assetViewModel = asset != null
                    ? AssetViewModel.Create(asset)
                    : AssetViewModel.CreateNotFoundAsset(assetId);

                return(new ColoredBalance
                {
                    AssetId = assetId,
                    Quantity = 0,
                    UnconfirmedQuantityDelta = 0,
                    Asset = assetViewModel,
                });
            }
        protected OffchainGroupViewModel(IGroup group, IReadOnlyDictionary <string, IAssetDefinition> assetDictionary)
        {
            AssetViewModel asset;

            if (group.IsColored)
            {
                asset = assetDictionary.ContainsKey(group.AssetId) ?
                        AssetViewModel.Create(assetDictionary[group.AssetId]) :
                        AssetViewModel.CreateNotFoundAsset(group.AssetId);
            }
            else
            {
                asset = AssetViewModel.BtcAsset.Value;
            }

            var offchainTransactions = group.Transactions.Where(p => p.OffchainTransactionData != null).Select(p => OffchainTransactionViewModel.Create(p.OffchainTransactionData));

            this.OffChainTransactions = offchainTransactions;
            this.Asset = asset;
        }
        public static OffChainTransactionViewModel Create(IOffchainTransaction tx,
                                                          IReadOnlyDictionary <string, IAssetDefinition> assetDictionary)
        {
            if (tx == null)
            {
                return(null);
            }


            AssetViewModel asset;

            if (tx.IsColored)
            {
                asset = assetDictionary.ContainsKey(tx.AssetId) ?
                        AssetViewModel.Create(assetDictionary[tx.AssetId]) :
                        AssetViewModel.CreateNotFoundAsset(tx.AssetId);
            }
            else
            {
                asset = AssetViewModel.BtcAsset.Value;
            }



            return(OffChainTransactionViewModel.Create(
                       transactionId: tx.TransactionId,
                       address1: tx.Address1,
                       asset: asset,
                       dateTime: tx.DateTime,
                       hubAddress: tx.HubAddress,
                       address2: tx.Address2,
                       address1Quantity: tx.Address1Quantity,
                       address1QuantityDiff: tx.Address1QuantityDiff,
                       address2Quantity: tx.Address2Quantity,
                       address2QuantityDiff: tx.Address2QuantityDiff,
                       type: tx.Type));
        }