Skip to content

Commit

Permalink
decode reverts too and return raw data if fail
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFirekeeper committed Apr 10, 2024
1 parent 567e25a commit f8c4d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Thirdweb/Thirdweb.RPC/RpcError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class RpcError
public string Message { get; set; }

[JsonProperty("data")]
public object Data { get; set; }
public string Data { get; set; }
}
}
5 changes: 3 additions & 2 deletions Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ private async Task SendBatchAsync(List<RpcRequest> batch)
{
try
{
revertMsg = new Nethereum.ABI.FunctionEncoding.FunctionCallDecoder().DecodeFunctionErrorMessage(Utils.StringToHex(rpcResponse.Error.Data.ToString()));
revertMsg = new Nethereum.ABI.FunctionEncoding.FunctionCallDecoder().DecodeFunctionErrorMessage(rpcResponse.Error.Data);
revertMsg = string.IsNullOrWhiteSpace(revertMsg) ? rpcResponse.Error.Data : revertMsg;
}
catch
{
revertMsg = rpcResponse.Error.Data.ToString();
revertMsg = rpcResponse.Error.Data;
}
}
tcs.SetException(new Exception($"RPC Error for request {rpcResponse.Id}: {rpcResponse.Error.Message} {revertMsg}"));
Expand Down

0 comments on commit f8c4d6a

Please sign in to comment.