You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
I got started with the create-wagmi next.js project and am running into an issue configuring a new chain.
Returning an error configuring new chains 'canto' and 'goerli' which is preventing from connecting to the desired chains.
Here's the code:
import { getDefaultClient } from 'connectkit'
import { createClient, configureChains } from 'wagmi'
import { canto, goerli } from '@wagmi/chains'
import { publicProvider } from 'wagmi/providers/public'
const { chains, provider } = configureChains(
[canto, goerli],
[publicProvider()]
)
Here's the error (also same for goerli
Type '{ readonly id: 7700; readonly name: "Canto"; readonly network: "canto"; readonly nativeCurrency: { readonly decimals: 18; readonly name: "Canto"; readonly symbol: "CANTO"; }; readonly rpcUrls: { readonly default: { ...; }; readonly public: { ...; }; }; readonly blockExplorers: { ...; }; }' is not assignable to type 'Chain'.
The types of 'rpcUrls.default.http' are incompatible between these types.
The type 'readonly ["https://canto.slingshot.finance"]' is 'readonly' and cannot be assigned to the mutable type 'string[]'.
When I try to change the import to import { canto, goerli } from 'wagmi/chains' then 'canto' doesn't exist and I receive the following error:
Module '"wagmi/chains"' has no exported member 'canto'.
So in the docs it says the below:
But if that were the case I wouldn't need to do
Entirely possible this is a configuration error on my side but couldn't be more confused.
I tried creating a new variable canto and making it type Chain but I circle back to the read only error when I do that.
My current workaround is just doing the work in here but this should just be handled out of the box or I'm possibly ridiculous
Expected Behavior
The chains that I configure should connect out of the box based on the documentation. On connecting wallet, all chains in my configureChains() hook should function properly and connect/switch networks automatically.
Steps To Reproduce
*assumes you have metamask set up
open a new directory
run npm init wagmi -- --template next-connectkit
copy-paste the code in the description into the 'wagmi.ts' file
run npm run dev
try and connect the wallet to the canto chain -- can be imported by going to chainlist and finding canto and importing it to your wallet
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
mutedcase
changed the title
bug: Incompatible types
bug: Incompatible read only type cannot be assigned to the mutable type string[] - Configuring chains
Jan 30, 2023
Is there an existing issue for this?
Current Behavior
I got started with the create-wagmi next.js project and am running into an issue configuring a new chain.
Returning an error configuring new chains 'canto' and 'goerli' which is preventing from connecting to the desired chains.
Here's the code:
Here's the error (also same for goerli
When I try to change the import to
import { canto, goerli } from 'wagmi/chains'
then 'canto' doesn't exist and I receive the following error:So in the docs it says the below:
But if that were the case I wouldn't need to do
Entirely possible this is a configuration error on my side but couldn't be more confused.
I tried creating a new variable canto and making it type Chain but I circle back to the read only error when I do that.
My current workaround is just doing the work in here but this should just be handled out of the box or I'm possibly ridiculous
Expected Behavior
The chains that I configure should connect out of the box based on the documentation. On connecting wallet, all chains in my configureChains() hook should function properly and connect/switch networks automatically.
Steps To Reproduce
*assumes you have metamask set up
npm init wagmi -- --template next-connectkit
npm run dev
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: