I'm attempting to upgrade to wagmi to V2, and am getting an error when i run my test suite:
TypeError: Cannot read properties of undefined (reading 'base16')
It's failing many tests and throws the error at the actual import statement defined in my test.tsx file:
import { mock, MockParameters } from 'wagmi/connectors'
My current setup looks like this:
export const mockConfig = createConfig({
chains: [mainnet, sepolia],
connectors: [
mock({
accounts: [
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
],
}),
],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
export const ProviderWrapper: FC<{ children: ReactNode; route?: string; overrideStore?: Store<any, any> }> = ({
children,
route = '/',
overrideStore,
}) => {
return (
<I18nextProvider i18n={i18n}>
<Provider store={isEmpty(overrideStore) ? store : (overrideStore as Store)}>
<TokenProvider value={tokenProvider}>
{/* Types as "any" because of the global declaration in the wagmiConfig file for increased type safety per the wagmi docs */}
<WagmiProvider config={mockConfig as any}>
<MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>
</WagmiProvider>
</TokenProvider>
</Provider>
</I18nextProvider>
)
}
Can anyone point me in the right direction? There is very little documentation available on mock connectors it seems
I've made sure all wagmi and viem have been upgraded to the latest versions, and double checked that my config is setup correctly.