Skip to content

Commit

Permalink
Fix but in JsonRpcClient.call
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed Apr 3, 2024
1 parent 2f62a48 commit 084c29d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/src/internal/execution/jsonrpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,16 @@ export class EIP1193JsonRpcClient implements JsonRpcClient {
};
} catch (error) {
if (error instanceof Error) {
if ("data" in error && typeof error.data === "string") {
const errorWithData = error as { data?: string | { data?: string } };
const data =
typeof errorWithData.data === "string"
? errorWithData.data
: errorWithData.data?.data;

if (data !== undefined) {
return {
success: false,
returnData: error.data,
returnData: data,
customErrorReported: isCustomErrorError(error),
};
}
Expand Down

0 comments on commit 084c29d

Please sign in to comment.