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); }
public static void FillBase(JToken json, Transaction tx) { tx.Hash = (string)json["txid"]; tx.Size = (int)json["size"]; tx.Type = (TransactionType)Enum.Parse(typeof(TransactionType), (string)json["type"]); tx.Version = (byte)json["version"]; tx.SystemFee = (int)json["sys_fee"]; tx.NetworkFee = (int)json["net_fee"]; if (json["attributes"].Count() > 0) { tx.Attributes = new List <TransactionAttribute>(); foreach (var item in json["attributes"]) { tx.Attributes.Add(TransactionAttribute.FromJson(item)); } } if (json["vin"].Count() > 0) { tx.Inputs = new List <CoinReference>(); foreach (var item in json["vin"]) { tx.Inputs.Add(CoinReference.FromJson(item)); } } if (json["vout"].Count() > 0) { tx.Outputs = new List <TransactionOutput>(); foreach (var item in json["vout"]) { tx.Outputs.Add(TransactionOutput.FromJson(item)); } } foreach (var item in json["scripts"]) { tx.Scripts.Add(Witness.FromJson(item)); } }