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
When using the WagmiAdapter, we can access the wagmi config by doing wagmiAdapter.wagmiConfigas stated in the documentation . However, wagmiAdapter.wagmiConfig doesn't leverage generics from wagmi's createConfig.
import{WagmiAdapter}from'@reown/appkit-adapter-wagmi';import{createConfig,http}from'wagmi';import{arbitrum,sepolia}from'viem/chains';constwagmiAdapter=newWagmiAdapter({projectId: process.env.NEXT_PUBLIC_REOWN_PROJECT_ID!,networks: [arbitrum,sepolia],});// Poorly typed: ConfigwagmiAdapter.wagmiConfig;constconfig=createConfig({chains: [arbitrum,sepolia],transports: {[arbitrum.id]: http(),[sepolia.id]: http(),},});// Strongly typed: Config<chains, transport>config;declare module 'wagmi'{interfaceRegister{config: typeofwagmiAdapter.wagmiConfig;// Won't work because the type is not correctly inferred}}
Link to minimal reproducible example
https://stackblitz.com/edit/viem-getting-started-dqqqdr?file=index.ts
Summary
When using the
WagmiAdapter
, we can access the wagmi config by doingwagmiAdapter.wagmiConfig
as stated in the documentation . However,wagmiAdapter.wagmiConfig
doesn't leverage generics from wagmi'screateConfig
.Doing so prevent strong type-safety as stated in wagmi's documentation.
Could it be possible for the
WagmiAdapter
to take those in consideration ?List of related npm package versions
@reown/appkit: ^1.3.1
@reown/appkit-adapter-wagmi: ^1.3.1
viem: 2.21.44
wagmi: 2.12.29
The text was updated successfully, but these errors were encountered: