public TransferTransaction(DictionaryObject tx) : base(tx) { var node = new Node(tx.GetChar("chainId")); Asset = Assets.ZBS; if (tx.ContainsKey("assetId") && tx.GetString("assetId") != null) { Asset = node.GetAsset(tx.GetString("assetId")); } FeeAsset = Assets.ZBS; if (tx.ContainsKey("feeAssetId") && tx.GetString("feeAssetId") != null && tx.GetString("feeAssetId") != "") { FeeAsset = node.GetAsset(tx.GetString("feeAssetId")); } Amount = Asset.LongToAmount(tx.GetLong("amount")); Fee = FeeAsset.LongToAmount(tx.GetLong("fee")); Recipient = tx.GetString("recipient"); Attachment = tx.ContainsKey("attachment") ? tx.GetString("attachment").FromBase58() : new byte[0]; }
public void CreateWithoutAsset(Dictionary <string, object> tx) { DappAddress = tx.GetString("dApp"); FunctionHeader = tx.ContainsKey("call") ? tx.GetString("call.function") : null; FunctionCallArguments = tx.GetObjects("call.args") .Select(Node.DataValue) .ToList(); Payment = tx.GetObjects("payment") .ToDictionary(o => new Asset(o.GetString("assetId"), "", 0), o => Convert.ToDecimal(o.GetLong("amount"))); FeeAsset = tx.ContainsKey("feeAssetId") && tx.GetString("feeAssetId") != null ? new Asset(tx.GetString("feeAssetId"), "", 0) : Assets.WAVES; Fee = FeeAsset.LongToAmount(tx.GetLong("fee")); }