refactor: some clean up of the common bases code, add WETH
This commit is contained in:
parent
679a58daf4
commit
bc243e1c07
@ -3,7 +3,7 @@ import { Text } from 'rebass'
|
||||
import { Currency } from '@uniswap/sdk-core'
|
||||
import styled from 'styled-components/macro'
|
||||
|
||||
import { SUGGESTED_BASES } from '../../constants/routing'
|
||||
import { COMMON_BASES } from '../../constants/routing'
|
||||
import { currencyId } from '../../utils/currencyId'
|
||||
import { AutoColumn } from '../Column'
|
||||
import QuestionHelper from '../QuestionHelper'
|
||||
@ -35,7 +35,9 @@ export default function CommonBases({
|
||||
selectedCurrency?: Currency | null
|
||||
onSelect: (currency: Currency) => void
|
||||
}) {
|
||||
return (
|
||||
const bases = typeof chainId !== 'undefined' ? COMMON_BASES[chainId] ?? [] : []
|
||||
|
||||
return bases.length > 0 ? (
|
||||
<AutoColumn gap="md">
|
||||
<AutoRow>
|
||||
<Text fontWeight={500} fontSize={14}>
|
||||
@ -44,7 +46,7 @@ export default function CommonBases({
|
||||
<QuestionHelper text="These tokens are commonly paired with other tokens." />
|
||||
</AutoRow>
|
||||
<AutoRow gap="4px">
|
||||
{(typeof chainId === 'number' ? SUGGESTED_BASES[chainId] ?? [] : []).map((currency: Currency) => {
|
||||
{bases.map((currency: Currency) => {
|
||||
const isSelected = selectedCurrency?.equals(currency)
|
||||
return (
|
||||
<BaseWrapper
|
||||
@ -61,5 +63,5 @@ export default function CommonBases({
|
||||
})}
|
||||
</AutoRow>
|
||||
</AutoColumn>
|
||||
)
|
||||
) : null
|
||||
}
|
||||
|
@ -66,10 +66,18 @@ export const CUSTOM_BASES: { [chainId: number]: { [tokenAddress: string]: Token[
|
||||
[AMPL.address]: [DAI, WETH9[1]],
|
||||
},
|
||||
}
|
||||
// used for display in the default list when adding liquidity
|
||||
export const SUGGESTED_BASES: ChainCurrencyList = {
|
||||
[1]: [Ether.onChain(1), DAI, USDC, USDT, WBTC],
|
||||
|
||||
/**
|
||||
* Shows up in the currency select for swap and add liquidity
|
||||
*/
|
||||
export const COMMON_BASES: ChainCurrencyList = {
|
||||
[1]: [Ether.onChain(1), DAI, USDC, USDT, WBTC, WETH9[1]],
|
||||
[3]: [Ether.onChain(3), WETH9[3]],
|
||||
[4]: [Ether.onChain(4), WETH9[4]],
|
||||
[5]: [Ether.onChain(5), WETH9[5]],
|
||||
[42]: [Ether.onChain(42), WETH9[42]],
|
||||
}
|
||||
|
||||
// used to construct the list of all pairs we consider by default in the frontend
|
||||
export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = {
|
||||
...WETH_ONLY,
|
||||
|
Loading…
Reference in New Issue
Block a user