Skip to content

Commit 05c8c89

Browse files
committed
fix non standard node data
1 parent ff2b864 commit 05c8c89

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Thirdweb/Thirdweb.RPC/RpcError.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ public class RpcError
2323
/// Gets or sets additional data about the error.
2424
/// </summary>
2525
[JsonProperty("data")]
26-
public string Data { get; set; }
26+
public object Data { get; set; }
2727
}

Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ private async Task SendBatchAsync(List<RpcRequest> batch)
182182
}
183183

184184
var responseJson = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
185+
Console.WriteLine(responseJson);
185186
var responses = JsonConvert.DeserializeObject<List<RpcResponse<object>>>(responseJson);
186187

187188
foreach (var rpcResponse in responses)
@@ -197,12 +198,12 @@ private async Task SendBatchAsync(List<RpcRequest> batch)
197198
{
198199
try
199200
{
200-
revertMsg = new Nethereum.ABI.FunctionEncoding.FunctionCallDecoder().DecodeFunctionErrorMessage(rpcResponse.Error.Data);
201-
revertMsg = string.IsNullOrWhiteSpace(revertMsg) ? rpcResponse.Error.Data : revertMsg;
201+
revertMsg = new Nethereum.ABI.FunctionEncoding.FunctionCallDecoder().DecodeFunctionErrorMessage(rpcResponse.Error.Data.ToString());
202+
revertMsg = string.IsNullOrWhiteSpace(revertMsg) ? rpcResponse.Error.Data.ToString() : revertMsg;
202203
}
203204
catch
204205
{
205-
revertMsg = rpcResponse.Error.Data;
206+
revertMsg = JsonConvert.SerializeObject(rpcResponse.Error.Data);
206207
}
207208
}
208209
tcs.SetException(new Exception($"RPC Error for request {rpcResponse.Id}: {rpcResponse.Error.Message} {revertMsg}"));

0 commit comments

Comments
 (0)