1
- import { config as configs } from '@streamr/config'
1
+ import { Chain , config as configs } from '@streamr/config'
2
2
import { produce } from 'immer'
3
3
import { useMemo } from 'react'
4
4
import { useSearchParams } from 'react-router-dom'
5
+ import { ethereumNetworks } from '~/shared/utils/constants'
6
+ import { defaultChainKey } from '~/consts'
5
7
import {
6
8
ChainConfigExtension ,
7
9
fallbackChainConfigExtension ,
8
10
parsedChainConfigExtension ,
9
11
} from '~/utils/chainConfigExtension'
10
- import { Chain } from '~/types'
11
- import { ethereumNetworks } from '~/shared/utils/constants'
12
12
import formatConfigUrl from './formatConfigUrl'
13
13
14
14
function getPreferredChainName ( chainName : string ) {
@@ -24,12 +24,12 @@ function getChainConfigWithFallback(chainName: string): Chain {
24
24
return getChainConfig ( chainName )
25
25
} catch ( _ ) { }
26
26
27
- return getChainConfig ( 'polygon' )
27
+ return getChainConfig ( defaultChainKey )
28
28
}
29
29
30
30
export function getCurrentChain ( ) {
31
31
return getChainConfigWithFallback (
32
- new URLSearchParams ( window . location . search ) . get ( 'chain' ) || 'polygon' ,
32
+ new URLSearchParams ( window . location . search ) . get ( 'chain' ) || defaultChainKey ,
33
33
)
34
34
}
35
35
@@ -38,7 +38,7 @@ export function getCurrentChainId() {
38
38
}
39
39
40
40
export function useCurrentChain ( ) {
41
- const chainName = useSearchParams ( ) [ 0 ] . get ( 'chain' ) || 'polygon'
41
+ const chainName = useSearchParams ( ) [ 0 ] . get ( 'chain' ) || defaultChainKey
42
42
43
43
return useMemo ( ( ) => getChainConfigWithFallback ( chainName ) , [ chainName ] )
44
44
}
0 commit comments