reown-com / appkit

The full stack toolkit to build onchain app UX

Home Page:https://reown.com/appkit

Repository from Github https://github.comreown-com/appkitRepository from Github https://github.comreown-com/appkit

[bug] Type issue on `networks` with `createAppKit` from the example

Tbaut opened this issue · comments

Link to minimal reproducible example

https://github.com/Tbaut/react-sprinter/blob/main/src/AppKitProvider.tsx

Summary

When using the example from the appkit dashboard, there's a type issue on networks:

Type '({ blockExplorers: { readonly default: { readonly name: "Etherscan"; readonly url: "https://sepolia.etherscan.io"; readonly apiUrl: "https://api-sepolia.etherscan.io/api"; }; }; contracts: { ...; }; ... 9 more ...; serializers?: ChainSerializers<...> | undefined; } | { ...; } | { ...; })[]' is not assignable to type '[AppKitNetwork, ...AppKitNetwork[]]'.
Source provides no match for required element at position 0 in target.ts(2322)
TypesUtil.d.ts(43, 5): The expected type comes from property 'networks' which is declared here on type 'CreateAppKit'

// 3. Set the networks
const networks = [sepolia, b3Sepolia, baseSepolia]

// 4. Create Wagmi Adapter
const wagmiAdapter = new WagmiAdapter({
  networks,
  projectId,
  ssr: false
})

// 5. Create modal
createAppKit({
  adapters: [wagmiAdapter],
  networks, // <------------------------------- The type error appears here
  projectId,
  metadata,
  features: {
    analytics: false // Optional - defaults to your Cloud configuration
  }
})

List of related npm package versions

   "@reown/appkit": "^1.6.0",
   "@reown/appkit-adapter-wagmi": "^1.6.0",

Node.js Version

v22

Package Manager

pnpm@9.15.0

thanks type assertion as [AppKitNetwork, ...AppKitNetwork[]] solves the issue.