Skip to content

Parse error -32000 #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions packages/permissionless/actions/public/getSenderAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
InvalidInputRpcError,
type OneOf,
type Prettify,
RawContractError,
RpcRequestError,
UnknownRpcError,
concat,
Expand Down Expand Up @@ -179,20 +180,22 @@
}

if (revertError instanceof InvalidInputRpcError) {
const hexStringRegex = /0x[a-fA-F0-9]+/
// biome-ignore lint/suspicious/noExplicitAny:
const match = (revertError as unknown as any).cause.data.match(
hexStringRegex
)
const { data: data_ } = (
e instanceof RawContractError
? e
: e instanceof BaseError
? e.walk((err) => "data" in (err as Error)) || e.walk()
: {}
) as RawContractError

Check warning on line 189 in packages/permissionless/actions/public/getSenderAddress.ts

View check run for this annotation

Codecov / codecov/patch

packages/permissionless/actions/public/getSenderAddress.ts#L183-L189

Added lines #L183 - L189 were not covered by tests

if (!match) {
const data = typeof data_ === "string" ? data_ : data_?.data

if (data === undefined) {

Check warning on line 193 in packages/permissionless/actions/public/getSenderAddress.ts

View check run for this annotation

Codecov / codecov/patch

packages/permissionless/actions/public/getSenderAddress.ts#L191-L193

Added lines #L191 - L193 were not covered by tests
throw new Error(
"Failed to parse revert bytes from RPC response"
)
}

const data: Hex = match[0]

const error = decodeErrorResult({
abi: [
{
Expand Down
Loading