@@ -17,7 +17,6 @@ import { WalletConnectV2 } from "../../../lib/connection/WalletConnectV2";
1717import { getChainInfo } from "../../../lib/constants/chainInfo" ;
1818import {
1919 getChainPriority ,
20- TESTNET_CHAIN_IDS ,
2120 UniWalletSupportedChains
2221} from "../../../lib/constants/chains" ;
2322import { getSupportedChainIdsFromWalletConnectSession } from "../../../lib/utils/getSupportedChainIdsFromWalletConnectSession" ;
@@ -85,30 +84,21 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
8584 const walletSupportsChain = useWalletSupportedChains ( ) ;
8685
8786 const [ supportedConfigs , unsupportedChains ] = useMemo ( ( ) => {
88- const { supported, unsupported } = NETWORK_SELECTOR_CHAINS . filter (
89- ( config ) => {
90- return (
91- // eslint-disable-next-line @typescript-eslint/no-explicit-any
92- TESTNET_CHAIN_IDS . includes ( config . chainId as any )
93- ) ;
94- }
95- )
96- . sort (
97- ( { chainId : a } , { chainId : b } ) =>
98- getChainPriority ( a as ChainId ) - getChainPriority ( b as ChainId )
99- )
100- . reduce (
101- ( acc , config ) => {
102- const { chainId : chain } = config ;
103- if ( walletSupportsChain . includes ( chain as ChainId ) ) {
104- acc . supported . push ( config ) ;
105- } else {
106- acc . unsupported . push ( config ) ;
107- }
108- return acc ;
109- } ,
110- { supported : [ ] , unsupported : [ ] } as Record < string , ProtocolConfig [ ] >
111- ) ;
87+ const { supported, unsupported } = NETWORK_SELECTOR_CHAINS . sort (
88+ ( { chainId : a } , { chainId : b } ) =>
89+ getChainPriority ( a as ChainId ) - getChainPriority ( b as ChainId )
90+ ) . reduce (
91+ ( acc , config ) => {
92+ const { chainId : chain } = config ;
93+ if ( walletSupportsChain . includes ( chain as ChainId ) ) {
94+ acc . supported . push ( config ) ;
95+ } else {
96+ acc . unsupported . push ( config ) ;
97+ }
98+ return acc ;
99+ } ,
100+ { supported : [ ] , unsupported : [ ] } as Record < string , ProtocolConfig [ ] >
101+ ) ;
112102 return [ supported , unsupported ] ;
113103 } , [ walletSupportsChain ] ) ;
114104
0 commit comments