public new static Transaction FromJson(JToken json)
        {
            var tx         = new ClaimTransaction();
            var claimCount = json["claims"].Count();

            for (int i = 0; i < claimCount; i++)
            {
                tx.Claims.Add(CoinReference.FromJson(json["claims"][i]));
            }
            FillBase(json, tx);
            return(tx);
        }
Example #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);
        }