コード例 #1
0
ファイル: IssueTransaction.cs プロジェクト: 0bsnetwork/ZbsCS
        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);
        }
コード例 #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);
        }
コード例 #3
0
ファイル: AddressEncoding.cs プロジェクト: 0bsnetwork/ZbsCS
        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()));
        }
コード例 #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);
        }