forked from Iguana-DEX/frontend-v4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
31 lines (27 loc) · 812 Bytes
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { ChainId } from '@pancakeswap/sdk'
import { CHAIN_QUERY_NAME } from 'config/chains'
import { multiChainPaths } from './constant'
import { InfoDataSource } from './types'
// TODO: refactor
// Params should be defined in object for future extension
export function getTokenInfoPath(
chainId: ChainId,
address: string,
dataSource: InfoDataSource = InfoDataSource.V3,
stableSwapPath = '',
) {
return `/info${dataSource === InfoDataSource.V3 ? '/v3' : ''}${multiChainPaths[chainId]}/tokens/${address}?chain=${
CHAIN_QUERY_NAME[chainId]
}${stableSwapPath.replace('?', '&')}`
}
// TODO: refactor
export function getChainName(chainId: ChainId) {
switch (chainId) {
case ChainId.BSC:
return 'BSC'
case ChainId.ETHEREUM:
return 'ETH'
default:
return 'BSC'
}
}