diff --git a/Thirdweb/Thirdweb.RPC/RpcError.cs b/Thirdweb/Thirdweb.RPC/RpcError.cs index 1d98691..88dc07f 100644 --- a/Thirdweb/Thirdweb.RPC/RpcError.cs +++ b/Thirdweb/Thirdweb.RPC/RpcError.cs @@ -11,6 +11,6 @@ public class RpcError public string Message { get; set; } [JsonProperty("data")] - public object Data { get; set; } + public string Data { get; set; } } } diff --git a/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs b/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs index 6d545d5..c38f7b4 100644 --- a/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs +++ b/Thirdweb/Thirdweb.RPC/ThirdwebRPC.cs @@ -175,11 +175,12 @@ private async Task SendBatchAsync(List 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}"));