Skip to content
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

fix: merge fetchOptions from HttpRpcClient options with request-specific options #2193

Merged
merged 2 commits into from
Apr 28, 2024
Merged

Conversation

mlshv
Copy link
Contributor

@mlshv mlshv commented Apr 27, 2024

While integrating proxies in viem as per the recent fix, I noticed that the implementation was only considering request-specific fetchOptions and skipping those passed to the HTTP transport

This PR fixes it by merging the fetchOptions from the HttpRpcClient options with those from individual requests

For anyone facing this issue, you can use a temporary fix until the PR is merged:

  1. Install patch-package
  2. Add npm script "postinstall": "patch-package"
  3. Open node_modues/viem and go to folder that corresponds to module systems currently being used (_esm, _cjs)
  4. Edit getHttpRpcClient function from utils/rpc/http.js: add ...(options.fetchOptions || {}), at the first line of const init = { object.
  5. Run npx patch-package viem

PR-Codex overview

This PR fixes the declaration of fetchOptions on HTTP RPC.

Detailed summary

  • Fixed fetchOptions declaration on HTTP RPC in http.ts
  • Updated fetchOptions object merging logic to include both options and params properties.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Apr 27, 2024

🦋 Changeset detected

Latest commit: 3bd83cc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 27, 2024

@mlshv is attempting to deploy a commit to the wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom jxom merged commit 5fe7494 into wevm:main Apr 28, 2024
5 of 19 checks passed
@github-actions github-actions bot mentioned this pull request Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants