Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

bug: Ethereum-provider throws error on empty array for optional chains #395

Closed
1 task done
glitch-txs opened this issue Jul 3, 2023 · 2 comments
Closed
1 task done

Comments

@glitch-txs
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

It seems in the latest version of ethereum-provider now it won't allow you to set optionalChains as an empty array, which wagmi does when setting only one chain in the connector's config.
I wonder if the connector should be refactored? As we've also seen some wallets will "break" if the optionalChains is an empty array as well.

Expected Behavior

no errors

Steps To Reproduce

This error comes from ethereum-provider version 2.8.6. I've tested using only this package and also with wagmi, both will throw an error when trying to open the modal.

the code for testing in ethereum-provider:

    const client = await EthereumProvider.init({
      projectId: process.env.NEXT_PUBLIC_PROJECT_ID,
      showQrModal: true,
      chains: [1],
      optionalChains:[], // <-- adding an empty array will throw an error
    });

Error on console:

Unsupported chains. connect() optionalNamespaces, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://github.com/glitch-txs/wagmi-test

Anything else?

pinging @0xasimetriq for more insight

@wildlifechorus
Copy link

When will this be released?

@olegshilov
Copy link
Contributor

@wildlifechorus

When will this be released?

Its already released. Try wagmi:1.3.7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants