From a1f66a2d02bd079c6322bbc0961b3d322a35bc42 Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Thu, 30 May 2024 13:21:37 +0100 Subject: [PATCH] fix build --- src/executor/utils.ts | 2 +- src/utils/helpers.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/executor/utils.ts b/src/executor/utils.ts index ddcf0ecb..9c6235d4 100644 --- a/src/executor/utils.ts +++ b/src/executor/utils.ts @@ -16,6 +16,7 @@ import { } from "@alto/types" import type { Logger } from "@alto/utils" import { + getRevertErrorData, isVersion06, parseViemError, toPackedUserOperation, @@ -39,7 +40,6 @@ import { hexToBytes, numberToHex } from "viem" -import { getRevertErrorData } from "viem/_types/actions/public/call" export function simulatedOpsToResults( simulatedOps: { diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index e55d1ff0..d71d3794 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -1,6 +1,18 @@ -import { type Address, getAddress } from "viem" +import { + type Address, + getAddress, + BaseError, + type RawContractError +} from "viem" /// Ensure proper equality by converting both addresses into their checksum type export const areAddressesEqual = (a: Address, b: Address) => { return getAddress(a) === getAddress(b) } + +export function getRevertErrorData(err: unknown) { + // biome-ignore lint/style/useBlockStatements: + if (!(err instanceof BaseError)) return undefined + const error = err.walk() as RawContractError + return typeof error?.data === "object" ? error.data?.data : error.data +}