Ejemplo n.º 1
0
        public static Transaction FromJson(JObject json)
        {
            Transaction tx = new Transaction();

            tx.Version         = byte.Parse(json["version"].AsString());
            tx.Nonce           = uint.Parse(json["nonce"].AsString());
            tx.Sender          = json["sender"].AsString().ToScriptHash();
            tx.SystemFee       = long.Parse(json["sys_fee"].AsString());
            tx.NetworkFee      = long.Parse(json["net_fee"].AsString());
            tx.ValidUntilBlock = uint.Parse(json["valid_until_block"].AsString());
            tx.Attributes      = ((JArray)json["attributes"]).Select(p => TransactionAttribute.FromJson(p)).ToArray();
            tx.Cosigners       = ((JArray)json["cosigners"]).Select(p => Cosigner.FromJson(p)).ToArray();
            tx.Script          = json["script"].AsString().HexToBytes();
            tx.Witnesses       = ((JArray)json["witnesses"]).Select(p => Witness.FromJson(p)).ToArray();
            return(tx);
        }