Skip to content

Commit 7be3451

Browse files
committed
refactor: find the correct mainnet chain rather than relying on it being the first element of an array
1 parent b4cee4d commit 7be3451

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/curve-ui-kit/src/features/connect-wallet/lib/wagmi/useWagmiConfig.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Chain } from 'viem'
33
import { generatePrivateKey } from 'viem/accounts'
44
import { mapRecord, recordValues } from '@curvefi/prices-api/objects.util'
55
import type { NetworkMapping } from '@ui/utils'
6-
import { isCypress } from '@ui-kit/utils'
6+
import { Chain as ChainEnum, isCypress } from '@ui-kit/utils'
77
import { createChainFromNetwork } from './chains'
88
import { defaultGetRpcUrls } from './rpc'
99
import { createTransportFromNetwork } from './transports'
@@ -23,7 +23,12 @@ export const useWagmiConfig = <T extends NetworkMapping>(networks: T | undefined
2323
chains,
2424
transports: mapRecord(networks, (_, network) => createTransportFromNetwork(network, defaultGetRpcUrls)),
2525
...(isCypress && {
26-
connectors: [createTestConnector({ privateKey: generatePrivateKey(), chain: chains[0] })],
26+
connectors: [
27+
createTestConnector({
28+
privateKey: generatePrivateKey(),
29+
chain: chains.find((chain) => chain.id === ChainEnum.Ethereum)!,
30+
})!,
31+
],
2732
}),
2833
})
2934
}, [networks])

0 commit comments

Comments
 (0)