コード例 #1
0
ファイル: BlockBase.cs プロジェクト: pavan1215316305/neo
 public void FromJson(JObject json)
 {
     Version       = (uint)json["version"].AsNumber();
     PrevHash      = UInt256.Parse(json["previousblockhash"].AsString());
     MerkleRoot    = UInt256.Parse(json["merkleroot"].AsString());
     Timestamp     = (ulong)json["time"].AsNumber();
     Index         = (uint)json["index"].AsNumber();
     NextConsensus = json["nextconsensus"].AsString().ToScriptHash();
     Witness       = ((JArray)json["witnesses"]).Select(p => Witness.FromJson(p)).FirstOrDefault();
 }
コード例 #2
0
ファイル: Transaction.cs プロジェクト: pavan1215316305/neo
        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.Script          = json["script"].AsString().HexToBytes();
            tx.Witnesses       = ((JArray)json["witnesses"]).Select(p => Witness.FromJson(p)).ToArray();
            return(tx);
        }