Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Neo Plugin RpcServer UT]Plugin rpcserver wallet UTs #3433

Merged
merged 12 commits into from
Jul 29, 2024
2 changes: 1 addition & 1 deletion src/Plugins/RpcServer/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class Result
/// <typeparam name="T">The return type</typeparam>
/// <returns>The execution result</returns>
/// <exception cref="RpcException">The Rpc exception</exception>
public static T Ok_Or<T>(this Func<T> function, RpcError err, bool withData = false)
public static T Ok_Or<T>(Func<T> function, RpcError err, bool withData = false)
shargon marked this conversation as resolved.
Show resolved Hide resolved
{
try
{
Expand Down
10 changes: 5 additions & 5 deletions src/Plugins/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private static Witness[] WitnessesFromJson(JArray _params)
}

[RpcMethod]
protected virtual JToken InvokeFunction(JArray _params)
protected internal virtual JToken InvokeFunction(JArray _params)
{
UInt160 script_hash = Result.Ok_Or(() => UInt160.Parse(_params[0].AsString()), RpcError.InvalidParams.WithData($"Invalid script hash {nameof(script_hash)}"));
string operation = Result.Ok_Or(() => _params[1].AsString(), RpcError.InvalidParams);
Expand All @@ -231,7 +231,7 @@ protected virtual JToken InvokeFunction(JArray _params)
}

[RpcMethod]
protected virtual JToken InvokeScript(JArray _params)
protected internal virtual JToken InvokeScript(JArray _params)
{
byte[] script = Result.Ok_Or(() => Convert.FromBase64String(_params[0].AsString()), RpcError.InvalidParams);
Signer[] signers = _params.Count >= 2 ? SignersFromJson((JArray)_params[1], system.Settings) : null;
Expand All @@ -241,7 +241,7 @@ protected virtual JToken InvokeScript(JArray _params)
}

[RpcMethod]
protected virtual JToken TraverseIterator(JArray _params)
protected internal virtual JToken TraverseIterator(JArray _params)
{
settings.SessionEnabled.True_Or(RpcError.SessionsDisabled);
Guid sid = Result.Ok_Or(() => Guid.Parse(_params[0].GetString()), RpcError.InvalidParams.WithData($"Invalid session id {nameof(sid)}"));
Expand All @@ -262,7 +262,7 @@ protected virtual JToken TraverseIterator(JArray _params)
}

[RpcMethod]
protected virtual JToken TerminateSession(JArray _params)
protected internal virtual JToken TerminateSession(JArray _params)
{
settings.SessionEnabled.True_Or(RpcError.SessionsDisabled);
Guid sid = Result.Ok_Or(() => Guid.Parse(_params[0].GetString()), RpcError.InvalidParams.WithData("Invalid session id"));
Expand All @@ -278,7 +278,7 @@ protected virtual JToken TerminateSession(JArray _params)
}

[RpcMethod]
protected virtual JToken GetUnclaimedGas(JArray _params)
protected internal virtual JToken GetUnclaimedGas(JArray _params)
{
string address = Result.Ok_Or(() => _params[0].AsString(), RpcError.InvalidParams.WithData($"Invalid address {nameof(address)}"));
JObject json = new();
Expand Down
188 changes: 169 additions & 19 deletions src/Plugins/RpcServer/RpcServer.Wallet.cs

Large diffs are not rendered by default.

Loading
Loading