コード例 #1
0
 public override Dictionary <string, object> GetJson() => new Dictionary <string, object>
 {
     { "type", TransactionType.SponsoredFee },
     { "version", Version },
     { "senderPublicKey", Base58.Encode(SenderPublicKey) },
     { "assetId", Asset.IdOrNull },
     { "fee", Assets.TN.AmountToLong(Fee) },
     { "timestamp", Timestamp.ToLong() },
     { "minSponsoredAssetFee", Asset.AmountToLong(MinimalFeeInAssets) }
 };
コード例 #2
0
        public static string GetAddressFromPublicKey(byte[] publicKey, char scheme)
        {
            var stream = new MemoryStream(26);
            var hash   = SecureHash(publicKey, 0, publicKey.Length);
            var writer = new BinaryWriter(stream);

            writer.Write((byte)1);
            writer.Write((byte)scheme);
            writer.Write(hash, 0, 20);
            var checksum = SecureHash(stream.ToArray(), 0, 22);

            writer.Write(checksum, 0, 4);
            return(Base58.Encode(stream.ToArray()));
        }
コード例 #3
0
ファイル: IssueTransaction.cs プロジェクト: bulentustbas/TNCS
 public override Dictionary <string, object> GetJson()
 {
     return(new Dictionary <string, object>
     {
         { "type", TransactionType.Issue },
         { "senderPublicKey", Base58.Encode(SenderPublicKey) },
         { "name", Name },
         { "description", Description },
         { "quantity", Asset.AmountToLong(Quantity) },
         { "decimals", Decimals },
         { "reissuable", Reissuable },
         { "fee", Assets.TN.AmountToLong(Fee) },
         { "timestamp", Timestamp.ToLong() }
     });
 }
コード例 #4
0
 public override Dictionary <string, object> GetJson()
 {
     return(new Dictionary <string, object>
     {
         { "type", TransactionType.MassTransfer },
         { "version", Version },
         { "senderPublicKey", Base58.Encode(SenderPublicKey) },
         { "transfers", Transfers.Select(t => new Dictionary <string, object>()
             {
                 { "recipient", t.Recipient },
                 { "amount", Asset.AmountToLong(t.Amount) }
             }).ToArray() },
         { "assetId", Asset.IdOrNull },
         { "fee", Assets.TN.AmountToLong(Fee) },
         { "timestamp", Timestamp.ToLong() },
         { "attachment", Attachment.ToBase58() }
     });
 }
コード例 #5
0
ファイル: Matcher.cs プロジェクト: bulentustbas/TNCS
        public static DictionaryObject MakeOrder(PrivateKeyAccount sender, string matcherKey, OrderSide side,
                                                 Asset amountAsset, Asset priceAsset, decimal price, decimal amount, DateTime expiration, decimal matcherFee)
        {
            long timestamp = Utils.CurrentTimestamp();

            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            writer.Write(sender.PublicKey);
            writer.Write(Base58.Decode(matcherKey));
            writer.WriteAsset(amountAsset.Id);
            writer.WriteAsset(priceAsset.Id);
            writer.Write((byte)(side == OrderSide.Buy ? 0x0 : 0x1));
            writer.WriteLong(Asset.PriceToLong(amountAsset, priceAsset, price));
            writer.WriteLong(amountAsset.AmountToLong(amount));
            writer.WriteLong(timestamp);
            writer.WriteLong(expiration.ToLong());
            writer.WriteLong(Assets.TN.AmountToLong(matcherFee));
            var signature = sender.Sign(stream);

            return(new DictionaryObject {
                { "senderPublicKey", Base58.Encode(sender.PublicKey) },
                { "matcherPublicKey", matcherKey },
                { "assetPair", new DictionaryObject {
                      { "amountAsset", amountAsset.IdOrNull },
                      { "priceAsset", priceAsset.IdOrNull }
                  } },
                { "orderType", side.ToString().ToLower() },
                { "price", Asset.PriceToLong(amountAsset, priceAsset, price) },
                { "amount", amountAsset.AmountToLong(amount) },
                { "timestamp", timestamp },
                { "expiration", expiration.ToLong() },
                { "matcherFee", Assets.TN.AmountToLong(matcherFee) },
                { "signature", signature.ToBase58() }
            });
        }