wevm / viem

TypeScript Interface for Ethereum
https://viem.sh
Other
2.44k stars 729 forks source link

getChainId produces malformatted rpc requests #2542

Closed tadad closed 1 month ago

tadad commented 1 month ago

Check existing issues

Viem Version

2.18.2

Current Behavior

when you call getChainId it formats the rpc request as

    {
      method: 'eth_chainId',
    },

which is incorrect and causes issues with most rpc providers I'm aware of

Expected Behavior

should succeed by adding jsonrpc: '2.0' to the request

Steps To Reproduce

I'm running this against alchemyplatform/rundler and it's failing

Link to Minimal Reproducible Example

No response

Anything else?

No response

jxom commented 1 month ago

We already do this https://github.com/wevm/viem/blob/main/src/utils/rpc/http.ts#L92.

Please provide a minimal reproducible example of the issue you are facing and I will reopen the issue.

github-actions[bot] commented 1 month ago

Hello @tadad.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

github-actions[bot] commented 4 weeks ago

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.