public static ContractState ContractStateFromJson(JObject json) { return(new ContractState { Id = (int)json["id"].AsNumber(), UpdateCounter = (ushort)json["updatecounter"].AsNumber(), Hash = UInt160.Parse(json["hash"].AsString()), Nef = RpcNefFile.FromJson(json["nef"]), Manifest = ContractManifest.FromJson(json["manifest"]) }); }
public void TestGetContractState() { JObject json = TestUtils.RpcTestCases.Find(p => p.Name == nameof(RpcClient.GetContractStateAsync).ToLower()).Response.Result; var item = RpcContractState.FromJson(json); Assert.AreEqual(json.ToString(), item.ToJson().ToString()); var nef = RpcNefFile.FromJson(json["nef"]); Assert.AreEqual(json["nef"].ToString(), nef.ToJson().ToString()); }