Exemple #1
0
        public override DictionaryObject GetJson()
        {
            var result = new DictionaryObject
            {
                { "type", (byte)TransactionType.Issue },
                { "senderPublicKey", Base58.Encode(SenderPublicKey) },
                { "name", Name },
                { "description", Description },
                { "quantity", Asset.AmountToLong(Quantity) },
                { "decimals", Decimals },
                { "reissuable", Reissuable },
                { "fee", Assets.ZBS.AmountToLong(Fee) },
                { "timestamp", Timestamp.ToLong() },
                { "script", Script?.ToBase64() },
                { "scripted", Scripted }
            };

            if (Version > 1)
            {
                result.Add("version", Version);
            }

            if (Sender != null)
            {
                result.Add("sender", Sender);
            }

            return(result);
        }
Exemple #2
0
        public override DictionaryObject GetJson()
        {
            var result = new DictionaryObject
            {
                { "type", (byte)TransactionType.MassTransfer },
                { "version", Version },
                { "senderPublicKey", Base58.Encode(SenderPublicKey) },
                { "transfers", Transfers.Select(t => new DictionaryObject()
                    {
                        { "recipient", t.Recipient },
                        { "amount", Asset.AmountToLong(t.Amount) }
                    }).ToArray() },
                { "assetId", Asset.IdOrNull },
                { "fee", Assets.ZBS.AmountToLong(Fee) },
                { "timestamp", Timestamp.ToLong() },
                { "attachment", Attachment.ToBase58() }
            };

            if (Sender != null)
            {
                result.Add("sender", Sender);
            }

            return(result);
        }
Exemple #3
0
        public static string GetAddressFromPublicKey(byte[] publicKey, char chainId)
        {
            var stream = new MemoryStream(26);
            var hash   = SecureHash(publicKey, 0, publicKey.Length);
            var writer = new BinaryWriter(stream);

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

            writer.Write(checksum, 0, 4);
            return(Base58.Encode(stream.ToArray()));
        }
Exemple #4
0
        public override DictionaryObject GetJson()
        {
            var result = new DictionaryObject
            {
                { "type", (byte)TransactionType.SponsoredFee },
                { "version", Version },
                { "senderPublicKey", Base58.Encode(SenderPublicKey) },

                { "assetId", Asset.IdOrNull },
                { "fee", Assets.ZBS.AmountToLong(Fee) },
                { "timestamp", Timestamp.ToLong() },
                { "minSponsoredAssetFee", Asset.AmountToLong(MinimalFeeInAssets) }
            };

            if (Sender != null)
            {
                result.Add("sender", Sender);
            }

            return(result);
        }