Skip to content

Commit

Permalink
deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Aug 29, 2023
1 parent cc34f0e commit 1a4923f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Fairy.Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected virtual JToken AwaitConfirmedTransaction(JArray _params)
UInt256 hash = UInt256.Parse(_params[0]!.AsString());
bool verbose = _params.Count >= 2 && _params[1]!.AsBoolean();
uint waitBlockCount = _params.Count >= 2 ? uint.Parse(_params[2]!.AsString()) : 2;
JToken json = GetConfirmedTransaction(hash, verbose);
JToken? json = GetConfirmedTransaction(hash, verbose);
if (json != null)
return json;
SemaphoreSlim signal = new SemaphoreSlim(0, 1);
Expand Down Expand Up @@ -181,6 +181,18 @@ protected virtual JObject FindStorageWithSession(JArray _params)
return json;
}

[RpcMethod]
protected virtual JToken Deserialize(JArray _params)
{
JArray json = new();
foreach (JToken? param in _params)
{
string dataBase64 = param!.AsString();
json.Add(BinarySerializer.Deserialize(Convert.FromBase64String(dataBase64), ExecutionEngineLimits.Default).ToJson());
}
return json;
}

[RpcMethod]
protected virtual JObject GetTime(JArray _params)
{
Expand Down

0 comments on commit 1a4923f

Please sign in to comment.