public DictionaryObject GetJson() { var json = new DictionaryObject { { "amount", AmountAsset.AmountToLong(Amount) }, { "price", Asset.PriceToLong(AmountAsset, PriceAsset, Price) }, { "timestamp", Timestamp.ToLong() }, { "expiration", Expiration.ToLong() }, { "senderPublicKey", SenderPublicKey.ToBase58() }, { "matcherPublicKey", MatcherPublicKey.ToBase58() }, { "matcherFee", Assets.BCT.AmountToLong(MatcherFee) }, { "assetPair", new DictionaryObject { { "amountAsset", AmountAsset.IdOrNull }, { "priceAsset", PriceAsset.IdOrNull } } }, { "orderType", Side.ToString().ToLower() }, { "version", Version } }; var proofs = Proofs .Take(Array.FindLastIndex(Proofs, p => p != null && p.Length > 0) + 1) .Select(p => p == null ? "" : p.ToBase58()) .ToArray(); if (SupportsProofs()) { json.Add("proofs", proofs); } else { if (proofs.Length == 0) { throw new InvalidOperationException("Order is not signed"); } if (proofs.Length > 1) { throw new InvalidOperationException("Order version doesn't support multiple proofs"); } json.Add("signature", proofs.Single()); } return(json); }
public DictionaryObject GetJson() { return(new DictionaryObject { { "amount", AmountAsset.AmountToLong(Amount) }, { "price", Asset.PriceToLong(AmountAsset, PriceAsset, Price) }, { "timestamp", Timestamp.ToLong() }, { "expiration", Expiration.ToLong() }, { "senderPublicKey", SenderPublicKey.ToBase58() }, { "matcherPublicKey", MatcherPublicKey.ToBase58() }, { "matcherFee", Assets.ZBS.AmountToLong(MatcherFee) }, { "assetPair", new DictionaryObject { { "amountAsset", AmountAsset.IdOrNull }, { "priceAsset", PriceAsset.IdOrNull } } }, { "orderType", Side.ToString().ToLower() }, { "signature", Signature.ToBase58() }, { "version", Version } }); }