Exemple #1
0
        public new static Transaction FromJson(JToken json)
        {
            var transaction = new RegisterTransaction()
            {
                Asset = Asset.FromJson(json["asset"])
            };

            transaction.Asset.Id = transaction.Hash;
            FillBase(json, transaction);
            return(transaction);
        }
Exemple #2
0
        public static Transaction FromJson(JToken json)
        {
            TransactionType txType = (TransactionType)Enum.Parse(typeof(TransactionType), (string)json["type"]);

            if (txType == TransactionType.MinerTransaction)
            {
                return(MinerTransaction.FromJson(json));
            }
            if (txType == TransactionType.ClaimTransaction)
            {
                return(ClaimTransaction.FromJson(json));
            }
            if (txType == TransactionType.ContractTransaction)
            {
                return(ContractTransaction.FromJson(json));
            }
            if (txType == TransactionType.EnrollmentTransaction)
            {
                return(EnrollmentTransaction.FromJson(json));
            }
            if (txType == TransactionType.InvocationTransaction)
            {
                return(InvocationTransaction.FromJson(json));
            }
            if (txType == TransactionType.IssueTransaction)
            {
                return(IssueTransaction.FromJson(json));
            }
            if (txType == TransactionType.PublishTransaction)
            {
                return(PublishTransaction.FromJson(json));
            }
            if (txType == TransactionType.RegisterTransaction)
            {
                return(RegisterTransaction.FromJson(json));
            }
            return(null);
        }