Repository navigation
fix: port recent viem fixes to AbiItem, AbiEvent, Signature, TypedData, Hex, and RpcTransport - #526
Conversation
Ports wevm/viem#5240. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Ports wevm/viem#5283. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Ports wevm/viem#5279. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Ports wevm/viem#5281. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Ports wevm/viem#5280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Ports wevm/viem#5200. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
|
The
#523 has both changes in d95257b, with viem's tests. Happy to close it if you'd rather add them here. |
…m.fromAbi` overloads Syncs with the merged wevm/viem#5281: tuple object args are read by component name, and an empty array is ambiguous for `address[]` vs `string[]`/`bytes[]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
|
Thanks, confirmed against the merged wevm/viem#5281. f75afaa adds both changes here: tuple object args are now read by component name (as Generated by Claude Code |
…Transport.fromHttp` Matches the 0.x backport (#527): runtimes without `AbortSignal.any` (Node < 18.17, older browsers) use the caller signal alone instead of throwing. Also aligns the `AbiEvent.assertArgs` test and the `getComponentValue` comment with 0.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
Matches the main-branch test in #526. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b
…`, `Hex`, and `RpcTransport` (#527) * fix: keep empty `version` in `TypedData.extractEip712DomainTypes` Ports wevm/viem#5240. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * feat: add `even` option to `Hex.assert` and `Hex.validate` Ports wevm/viem#5283. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: array overload resolution in `AbiItem.fromAbi` Ports wevm/viem#5281. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: `AbiEvent.assertArgs` `string` and `bytes` matching Ports wevm/viem#5238 and wevm/viem#5280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: apply `RpcTransport.fromHttp` timeout to the response body and with a caller signal Ports wevm/viem#5200. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: keep first parameter after `( ` in normalizeSignature (#516) (cherry picked from commit 36dce4a) * test: format `Hex` and `RpcTransport` tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: read tuple object args by name and match empty arrays in `AbiItem.fromAbi` overloads Syncs with the merged wevm/viem#5281: tuple object args are read by component name, and an empty array is ambiguous for `address[]` vs `string[]`/`bytes[]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: use a line comment for `getComponentValue` to satisfy `check:tsdoc` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix(docgen): link to variables in API docs Ports the `Variable` case of `getLinkForApiItem` from `main` (#414). Without it, the `{@link ox#AccountConfig.maxSignatures}` reference added in #509 fails `docs:gen` and every `0.x` docs deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * fix: keep the caller signal when `AbortSignal.any` is missing in `RpcTransport.fromHttp` `AbortSignal.any` is missing on Node < 18.17 and older browsers, which the 0.x line supports. There, the transport now uses the caller signal alone, as it did before, instead of throwing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b * test: restore `AbortSignal.any` by property descriptor Matches the main-branch test in #526. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b --------- Co-authored-by: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88b61a22f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Runtimes without `AbortSignal.any` (e.g. Node < 18.17) keep | ||
| // only the caller's signal. | ||
| if (typeof AbortSignal.any !== 'function') return signals[0]! |
There was a problem hiding this comment.
Preserve the timeout signal in the fallback
When AbortSignal.any is unavailable and the caller supplies fetchOptions.signal, this fallback selects only the caller's signal and drops the timeout signal. Because withTimeout is invoked with signal: true, its timer merely aborts its internal controller rather than directly rejecting; a stalled fetch or response.text() therefore ignores the configured timeout and can hang until it eventually completes. The fallback needs to propagate both abort sources or otherwise ensure the timeout rejects independently.
Useful? React with 👍 / 👎.
| isArgOfType( | ||
| getComponentValue(arg, component, index), | ||
| component as AbiParameters.Parameter, |
There was a problem hiding this comment.
Prefer the tuple overload that consumes all supplied fields
For tuple overloads where one tuple is a prefix of another, reading object values by component name makes both candidates match even when the argument supplies the longer tuple's extra fields. Since fromAbi retains the last match, reversing the test's ABI order—such as foo((uint256[] a,uint256 b)) followed by foo((uint256[] a)) with { b: 2n, a: [1n] }—selects the shorter overload and subsequent encoding ignores b, producing the wrong selector and calldata. Tuple matching needs to reject or deprioritize candidates that leave supplied tuple fields unused.
Useful? React with 👍 / 👎.
Ports the viem fixes whose logic also lives in Ox, in sync with viem
mainat 2867b2a and with the0.xbackport in #527. One commit per fix, each with a changeset and regression tests that fail without it.TypedData.extractEip712DomainTypeskeeps an emptyversion(''), soencode/getSignPayload/hashDomainmatch viem (0xa437e12e…).Hex.assert/Hex.validateaccepteven: true, which rejects odd-length hex (Hex.InvalidLengthError).Signature.toHex/toBytesleft-padrandsshorter than 32 bytes. Before, a 31-bytesserialized to 64 bytes andfromHexmisread it.AbiItem.fromAbi: matches arrays with a0in the element size (uint160[]) and checks[M]lengths. Tuple object args are read by component name, and params after a tuple are still checked.address[]vsbytes20[]/string[]/bytes[]overloads, including empty arrays, now throwAmbiguityError.AbiEvent.assertArgs/extractLogsargsfilters match non-indexedstring/bytesby value (not hash), indexed args decoded from data in non-strict mode, andbytes/bytesNin either hex case.RpcTransport.fromHttpappliestimeoutto reading the response body, not only tofetchresolving. On runtimes withoutAbortSignal.any(Node < 18.17, Safari < 17.4), afetchOptions.signalis now used alone instead of throwing.Overlaps: #523 (
AbiItem) and #446 (Signature.toHexpadding). This PR includes both fixes.Not ported, since Ox already has them or has no matching code: indexed
stringUTF-8 hashing (wevm/viem#5238, already correct here),normalizeSignature(wevm/viem#5201, already #516),httpbatch errors (wevm/viem#5282,RpcTransporthas no batching), and request retries (wevm/viem#5286, wevm/viem#5288, Ox has no retry layer). Viem-only actions, chains, and Tempo client code are also out.Differences from #527 follow from the branches:
0.xhas noextractLogsand already padsSignaturer/s, whilemainalready has #516 and the docgenVariablelink fix.Validation:
pnpm check:typesandpnpm checkpass. The changed suites pass withSKIP_GLOBAL_SETUP=1 pnpm test --project core, except existing tests that need a local Anvil node, which wasn't available. Every new test was confirmed to fail on unpatched sources.🤖 Generated with Claude Code
https://claude.ai/code/session_0133zgX2g8oLCoH4KuY8tM9b