Skip to content

Commit

Permalink
[Fix] RpcStack in RpcClient (#3784)
Browse files Browse the repository at this point in the history
* Fixed RpcStack in RpcClient

* Added @shargon a test

---------

Co-authored-by: Jimmy <jinghui@wayne.edu>
  • Loading branch information
cschuchardt88 and Jim8y authored Feb 27, 2025
1 parent 2e2fbe9 commit f893989
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugins/RpcClient/Models/RpcInvokeResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class RpcStack
{
public string Type { get; set; }

public string Value { get; set; }
public JToken Value { get; set; }

public JObject ToJson()
{
Expand All @@ -94,7 +94,7 @@ public static RpcStack FromJson(JObject json)
return new RpcStack
{
Type = json["type"].AsString(),
Value = json["value"].AsString()
Value = json["value"]
};
}
}
Expand Down
15 changes: 15 additions & 0 deletions tests/Neo.Network.RPC.Tests/UT_RpcModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,20 @@ public void TestRpcVersion()
var item = RpcVersion.FromJson((JObject)json);
Assert.AreEqual(json.ToString(), item.ToJson().ToString());
}

[TestMethod]
public void TestRpcStack()
{
var stack = new RpcStack()
{
Type = "Boolean",
Value = true,
};

var expectedJsonString = "{\"type\":\"Boolean\",\"value\":true}";
var actualJsonString = stack.ToJson().ToString();

Assert.AreEqual(expectedJsonString, actualJsonString);
}
}
}

0 comments on commit f893989

Please sign in to comment.