public new static Transaction FromJson(JToken json)
        {
            var transaction = new EnrollmentTransaction()
            {
                PublicKey = (string)json["pubkey"]
            };

            FillBase(json, transaction);
            return(transaction);
        }
Пример #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);
        }