Skip to content

Commit

Permalink
Fix RpcNativeContract (#851)
Browse files Browse the repository at this point in the history
* Fix RpcNativeContract

Close #850

* Fix UT
  • Loading branch information
shargon authored Nov 29, 2023
1 parent 64a1ae4 commit 0a3f812
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
7 changes: 2 additions & 5 deletions src/RpcClient/Models/RpcNativeContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class RpcNativeContract
public UInt160 Hash { get; set; }
public NefFile Nef { get; set; }
public ContractManifest Manifest { get; set; }
public uint[] UpdateHistory { get; set; }

public static RpcNativeContract FromJson(JObject json)
{
Expand All @@ -30,8 +29,7 @@ public static RpcNativeContract FromJson(JObject json)
Id = (int)json["id"].AsNumber(),
Hash = UInt160.Parse(json["hash"].AsString()),
Nef = RpcNefFile.FromJson((JObject)json["nef"]),
Manifest = ContractManifest.FromJson((JObject)json["manifest"]),
UpdateHistory = ((JArray)json["updatehistory"]).Select(u => (uint)u.GetInt32()).ToArray()
Manifest = ContractManifest.FromJson((JObject)json["manifest"])
};
}

Expand All @@ -42,8 +40,7 @@ public JObject ToJson()
["id"] = Id,
["hash"] = Hash.ToString(),
["nef"] = Nef.ToJson(),
["manifest"] = Manifest.ToJson(),
["updatehistory"] = new JArray(UpdateHistory.Select(u => new JNumber(u)).ToArray())
["manifest"] = Manifest.ToJson()
};
}
}
Expand Down
24 changes: 8 additions & 16 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -2,
Expand Down Expand Up @@ -1300,8 +1299,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -3,
Expand Down Expand Up @@ -1505,8 +1503,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -4,
Expand Down Expand Up @@ -1614,8 +1611,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -5,
Expand Down Expand Up @@ -1796,8 +1792,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -6,
Expand Down Expand Up @@ -1860,8 +1855,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -7,
Expand Down Expand Up @@ -1969,8 +1963,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
},
{
"id": -8,
Expand Down Expand Up @@ -2263,8 +2256,7 @@
],
"trusts": [],
"extra": null
},
"updatehistory": [ 0 ]
}
}
]
}
Expand Down

0 comments on commit 0a3f812

Please sign in to comment.