Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2291e3ec20 | ||
|
|
28d8f0b0bb | ||
|
|
8bed3900ba | ||
|
|
a1000c6576 |
@@ -1,17 +0,0 @@
|
||||
describe('Warning', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/swap?outputCurrency=0x0a40f26d74274b7f22b28556a27b35d97ce08e0a')
|
||||
})
|
||||
|
||||
it('Check that warning is displayed', () => {
|
||||
cy.get('.token-warning-container').should('be.visible')
|
||||
})
|
||||
|
||||
it('Check that warning hides after button dismissal', () => {
|
||||
cy.get('.token-dismiss-button').should('be.disabled')
|
||||
cy.get('.understand-checkbox').click()
|
||||
cy.get('.token-dismiss-button').should('not.be.disabled')
|
||||
cy.get('.token-dismiss-button').click()
|
||||
cy.get('.token-warning-container').should('not.be.visible')
|
||||
})
|
||||
})
|
||||
@@ -117,5 +117,8 @@
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"license": "GPL-3.0-or-later"
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@uniswap/default-token-list": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({
|
||||
`}
|
||||
`
|
||||
|
||||
const StyledMenuButton = styled.button`
|
||||
export const StyledMenuButton = styled.button`
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function CurrencySearchModal({
|
||||
/>
|
||||
) : modalView === CurrencyModalView.importToken && importToken ? (
|
||||
<ImportToken
|
||||
token={importToken}
|
||||
tokens={[importToken]}
|
||||
onDismiss={onDismiss}
|
||||
onBack={() =>
|
||||
setModalView(prevView && prevView !== CurrencyModalView.importToken ? prevView : CurrencyModalView.search)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { CSSProperties } from 'react'
|
||||
import { Token } from '@uniswap/sdk'
|
||||
import { RowBetween, RowFixed, AutoRow } from 'components/Row'
|
||||
import { AutoRow, RowFixed } from 'components/Row'
|
||||
import { AutoColumn } from 'components/Column'
|
||||
import CurrencyLogo from 'components/CurrencyLogo'
|
||||
import { TYPE } from 'theme'
|
||||
@@ -13,9 +13,15 @@ import styled from 'styled-components'
|
||||
import { useIsUserAddedToken, useIsTokenActive } from 'hooks/Tokens'
|
||||
import { CheckCircle } from 'react-feather'
|
||||
|
||||
const TokenSection = styled.div`
|
||||
padding: 8px 20px;
|
||||
const TokenSection = styled.div<{ dim?: boolean }>`
|
||||
padding: 4px 20px;
|
||||
height: 56px;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(auto, 1fr) auto;
|
||||
grid-gap: 16px;
|
||||
align-items: center;
|
||||
|
||||
opacity: ${({ dim }) => (dim ? '0.6' : '1')};
|
||||
`
|
||||
|
||||
const CheckIcon = styled(CheckCircle)`
|
||||
@@ -61,48 +67,43 @@ export default function ImportRow({
|
||||
|
||||
return (
|
||||
<TokenSection style={style}>
|
||||
<RowBetween>
|
||||
<AutoRow style={{ opacity: dim ? '0.6' : '1' }}>
|
||||
<CurrencyLogo currency={token} size={'24px'} />
|
||||
<AutoColumn gap="4px">
|
||||
<AutoRow>
|
||||
<TYPE.body ml="8px" fontWeight={500}>
|
||||
{token.symbol}
|
||||
</TYPE.body>
|
||||
<TYPE.darkGray ml="8px" fontWeight={300}>
|
||||
<NameOverflow title={token.name}>{token.name}</NameOverflow>
|
||||
</TYPE.darkGray>
|
||||
</AutoRow>
|
||||
{list && list.logoURI && (
|
||||
<RowFixed style={{ marginLeft: '8px' }}>
|
||||
<TYPE.small mr="4px" color={theme.text3}>
|
||||
via {list.name}
|
||||
</TYPE.small>
|
||||
<ListLogo logoURI={list.logoURI} size="12px" />
|
||||
</RowFixed>
|
||||
)}
|
||||
</AutoColumn>
|
||||
<CurrencyLogo currency={token} size={'24px'} style={{ opacity: dim ? '0.6' : '1' }} />
|
||||
<AutoColumn gap="4px" style={{ opacity: dim ? '0.6' : '1' }}>
|
||||
<AutoRow>
|
||||
<TYPE.body fontWeight={500}>{token.symbol}</TYPE.body>
|
||||
<TYPE.darkGray ml="8px" fontWeight={300}>
|
||||
<NameOverflow title={token.name}>{token.name}</NameOverflow>
|
||||
</TYPE.darkGray>
|
||||
</AutoRow>
|
||||
{!isActive && !isAdded ? (
|
||||
<ButtonPrimary
|
||||
width="fit-content"
|
||||
padding="6px 12px"
|
||||
fontWeight={500}
|
||||
fontSize="14px"
|
||||
onClick={() => {
|
||||
setImportToken && setImportToken(token)
|
||||
showImportView()
|
||||
}}
|
||||
>
|
||||
Import
|
||||
</ButtonPrimary>
|
||||
) : (
|
||||
<RowFixed style={{ minWidth: 'fit-content' }}>
|
||||
<CheckIcon />
|
||||
<TYPE.main color={theme.green1}>Active</TYPE.main>
|
||||
{list && list.logoURI && (
|
||||
<RowFixed>
|
||||
<TYPE.small mr="4px" color={theme.text3}>
|
||||
via {list.name}
|
||||
</TYPE.small>
|
||||
<ListLogo logoURI={list.logoURI} size="12px" />
|
||||
</RowFixed>
|
||||
)}
|
||||
</RowBetween>
|
||||
</AutoColumn>
|
||||
{!isActive && !isAdded ? (
|
||||
<ButtonPrimary
|
||||
width="fit-content"
|
||||
padding="6px 12px"
|
||||
fontWeight={500}
|
||||
fontSize="14px"
|
||||
onClick={() => {
|
||||
setImportToken && setImportToken(token)
|
||||
showImportView()
|
||||
}}
|
||||
>
|
||||
Import
|
||||
</ButtonPrimary>
|
||||
) : (
|
||||
<RowFixed style={{ minWidth: 'fit-content' }}>
|
||||
<CheckIcon />
|
||||
<TYPE.main color={theme.green1}>Active</TYPE.main>
|
||||
</RowFixed>
|
||||
)}
|
||||
{/* </RowBetween> */}
|
||||
</TokenSection>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ const AddressText = styled(TYPE.blue)`
|
||||
`
|
||||
|
||||
interface ImportProps {
|
||||
token: Token
|
||||
onBack: () => void
|
||||
onDismiss: () => void
|
||||
handleCurrencySelect: (currency: Currency) => void
|
||||
tokens: Token[]
|
||||
onBack?: () => void
|
||||
onDismiss?: () => void
|
||||
handleCurrencySelect?: (currency: Currency) => void
|
||||
}
|
||||
|
||||
export function ImportToken({ token, onBack, onDismiss, handleCurrencySelect }: ImportProps) {
|
||||
export function ImportToken({ tokens, onBack, onDismiss, handleCurrencySelect }: ImportProps) {
|
||||
const theme = useTheme()
|
||||
|
||||
const { chainId } = useActiveWeb3React()
|
||||
@@ -57,86 +57,103 @@ export function ImportToken({ token, onBack, onDismiss, handleCurrencySelect }:
|
||||
// use for showing import source on inactive tokens
|
||||
const inactiveTokenList = useCombinedInactiveList()
|
||||
|
||||
const list = chainId && inactiveTokenList?.[chainId]?.[token.address]?.list
|
||||
// higher warning severity if either is not on a list
|
||||
const fromLists =
|
||||
(chainId && inactiveTokenList?.[chainId]?.[tokens[0]?.address]?.list) ||
|
||||
(chainId && inactiveTokenList?.[chainId]?.[tokens[1]?.address]?.list)
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<PaddedColumn gap="14px" style={{ width: '100%', flex: '1 1' }}>
|
||||
<RowBetween>
|
||||
<ArrowLeft style={{ cursor: 'pointer' }} onClick={onBack} />
|
||||
<TYPE.mediumHeader>Import Token</TYPE.mediumHeader>
|
||||
<CloseIcon onClick={onDismiss} />
|
||||
{onBack ? <ArrowLeft style={{ cursor: 'pointer' }} onClick={onBack} /> : <div></div>}
|
||||
<TYPE.mediumHeader>Import {tokens.length > 1 ? 'Tokens' : 'Token'}</TYPE.mediumHeader>
|
||||
{onDismiss ? <CloseIcon onClick={onDismiss} /> : <div></div>}
|
||||
</RowBetween>
|
||||
</PaddedColumn>
|
||||
<SectionBreak />
|
||||
<PaddedColumn gap="md">
|
||||
<Card backgroundColor={theme.bg2}>
|
||||
<AutoColumn gap="10px">
|
||||
<AutoRow align="center">
|
||||
<CurrencyLogo currency={token} size={'24px'} />
|
||||
<TYPE.body ml="8px" mr="8px" fontWeight={500}>
|
||||
{token.symbol}
|
||||
</TYPE.body>
|
||||
<TYPE.darkGray fontWeight={300}>{token.name}</TYPE.darkGray>
|
||||
</AutoRow>
|
||||
{chainId && (
|
||||
<ExternalLink href={getEtherscanLink(chainId, token.address, 'address')}>
|
||||
<AddressText>{token.address}</AddressText>
|
||||
</ExternalLink>
|
||||
)}
|
||||
{list !== undefined ? (
|
||||
<RowFixed>
|
||||
{list.logoURI && <ListLogo logoURI={list.logoURI} size="12px" />}
|
||||
<TYPE.small ml="6px" color={theme.text3}>
|
||||
via {list.name}
|
||||
</TYPE.small>
|
||||
</RowFixed>
|
||||
) : (
|
||||
<WarningWrapper borderRadius="4px" padding="4px" highWarning={true}>
|
||||
<RowFixed>
|
||||
<AlertTriangle stroke={theme.red1} size="10px" />
|
||||
<TYPE.body color={theme.red1} ml="4px" fontSize="10px" fontWeight={500}>
|
||||
Unkown Source
|
||||
{tokens.map(token => {
|
||||
const list = chainId && inactiveTokenList?.[chainId]?.[token.address]?.list
|
||||
return (
|
||||
<Card backgroundColor={theme.bg2} key={'import' + token.address} className=".token-warning-container">
|
||||
<AutoColumn gap="10px">
|
||||
<AutoRow align="center">
|
||||
<CurrencyLogo currency={token} size={'24px'} />
|
||||
<TYPE.body ml="8px" mr="8px" fontWeight={500}>
|
||||
{token.symbol}
|
||||
</TYPE.body>
|
||||
</RowFixed>
|
||||
</WarningWrapper>
|
||||
)}
|
||||
</AutoColumn>
|
||||
</Card>
|
||||
<Card style={{ backgroundColor: list ? transparentize(0.8, theme.yellow2) : transparentize(0.8, theme.red1) }}>
|
||||
<TYPE.darkGray fontWeight={300}>{token.name}</TYPE.darkGray>
|
||||
</AutoRow>
|
||||
{chainId && (
|
||||
<ExternalLink href={getEtherscanLink(chainId, token.address, 'address')}>
|
||||
<AddressText>{token.address}</AddressText>
|
||||
</ExternalLink>
|
||||
)}
|
||||
{list !== undefined ? (
|
||||
<RowFixed>
|
||||
{list.logoURI && <ListLogo logoURI={list.logoURI} size="12px" />}
|
||||
<TYPE.small ml="6px" color={theme.text3}>
|
||||
via {list.name}
|
||||
</TYPE.small>
|
||||
</RowFixed>
|
||||
) : (
|
||||
<WarningWrapper borderRadius="4px" padding="4px" highWarning={true}>
|
||||
<RowFixed>
|
||||
<AlertTriangle stroke={theme.red1} size="10px" />
|
||||
<TYPE.body color={theme.red1} ml="4px" fontSize="10px" fontWeight={500}>
|
||||
Unkown Source
|
||||
</TYPE.body>
|
||||
</RowFixed>
|
||||
</WarningWrapper>
|
||||
)}
|
||||
</AutoColumn>
|
||||
</Card>
|
||||
)
|
||||
})}
|
||||
|
||||
<Card
|
||||
style={{ backgroundColor: fromLists ? transparentize(0.8, theme.yellow2) : transparentize(0.8, theme.red1) }}
|
||||
>
|
||||
<AutoColumn justify="center" style={{ textAlign: 'center', gap: '16px', marginBottom: '12px' }}>
|
||||
<AlertTriangle stroke={list ? theme.yellow2 : theme.red1} size={32} />
|
||||
<TYPE.body fontWeight={600} fontSize={20} color={list ? theme.yellow2 : theme.red1}>
|
||||
<AlertTriangle stroke={fromLists ? theme.yellow2 : theme.red1} size={32} />
|
||||
<TYPE.body fontWeight={600} fontSize={20} color={fromLists ? theme.yellow2 : theme.red1}>
|
||||
Trade at your own risk!
|
||||
</TYPE.body>
|
||||
</AutoColumn>
|
||||
|
||||
<AutoColumn style={{ textAlign: 'center', gap: '16px', marginBottom: '12px' }}>
|
||||
<TYPE.body fontWeight={400} color={list ? theme.yellow2 : theme.red1}>
|
||||
<TYPE.body fontWeight={400} color={fromLists ? theme.yellow2 : theme.red1}>
|
||||
Anyone can create a token, including creating fake versions of existing tokens that claim to represent
|
||||
projects.
|
||||
</TYPE.body>
|
||||
<TYPE.body fontWeight={600} color={list ? theme.yellow2 : theme.red1}>
|
||||
<TYPE.body fontWeight={600} color={fromLists ? theme.yellow2 : theme.red1}>
|
||||
If you purchase this token, you may not be able to sell it back.
|
||||
</TYPE.body>
|
||||
</AutoColumn>
|
||||
<AutoRow justify="center" style={{ cursor: 'pointer' }} onClick={() => setConfirmed(!confirmed)}>
|
||||
<Checkbox name="confirmed" type="checkbox" checked={confirmed} onChange={() => setConfirmed(!confirmed)} />
|
||||
<TYPE.body ml="10px" fontSize="16px" color={list ? theme.yellow2 : theme.red1} fontWeight={500}>
|
||||
<Checkbox
|
||||
className=".understand-checkbox"
|
||||
name="confirmed"
|
||||
type="checkbox"
|
||||
checked={confirmed}
|
||||
onChange={() => setConfirmed(!confirmed)}
|
||||
/>
|
||||
<TYPE.body ml="10px" fontSize="16px" color={fromLists ? theme.yellow2 : theme.red1} fontWeight={500}>
|
||||
I understand
|
||||
</TYPE.body>
|
||||
</AutoRow>
|
||||
</Card>
|
||||
|
||||
<ButtonPrimary
|
||||
disabled={!confirmed}
|
||||
altDisabledStyle={true}
|
||||
borderRadius="20px"
|
||||
padding="10px 1rem"
|
||||
onClick={() => {
|
||||
addToken(token)
|
||||
handleCurrencySelect(token)
|
||||
tokens.map(token => addToken(token))
|
||||
handleCurrencySelect && handleCurrencySelect(tokens[0])
|
||||
}}
|
||||
className=".token-dismiss-button"
|
||||
>
|
||||
Import
|
||||
</ButtonPrimary>
|
||||
|
||||
@@ -25,7 +25,11 @@ const StyledMenuIcon = styled(Settings)`
|
||||
width: 20px;
|
||||
|
||||
> * {
|
||||
stroke: ${({ theme }) => theme.text3};
|
||||
stroke: ${({ theme }) => theme.text2};
|
||||
}
|
||||
|
||||
:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
`
|
||||
|
||||
@@ -50,7 +54,6 @@ const StyledMenuButton = styled.button`
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 35px;
|
||||
/* background-color: ${({ theme }) => theme.bg3}; */
|
||||
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
@@ -59,7 +62,6 @@ const StyledMenuButton = styled.button`
|
||||
:focus {
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
/* background-color: ${({ theme }) => theme.bg4}; */
|
||||
}
|
||||
|
||||
svg {
|
||||
@@ -93,7 +95,7 @@ const MenuFlyout = styled.span`
|
||||
flex-direction: column;
|
||||
font-size: 1rem;
|
||||
position: absolute;
|
||||
top: 2rem;
|
||||
top: 3rem;
|
||||
right: 0rem;
|
||||
z-index: 100;
|
||||
|
||||
|
||||
@@ -1,87 +1,7 @@
|
||||
import { Token } from '@uniswap/sdk'
|
||||
import { transparentize } from 'polished'
|
||||
import React, { useCallback, useMemo, useState } from 'react'
|
||||
import styled from 'styled-components'
|
||||
import { useActiveWeb3React } from '../../hooks'
|
||||
import { useAllTokens } from '../../hooks/Tokens'
|
||||
import { ExternalLink, TYPE } from '../../theme'
|
||||
import { getEtherscanLink, shortenAddress } from '../../utils'
|
||||
import CurrencyLogo from '../CurrencyLogo'
|
||||
import React, { useCallback } from 'react'
|
||||
import Modal from '../Modal'
|
||||
import { AutoRow, RowBetween } from '../Row'
|
||||
import { AutoColumn } from '../Column'
|
||||
import { AlertTriangle } from 'react-feather'
|
||||
import { ButtonError } from '../Button'
|
||||
|
||||
const Wrapper = styled.div<{ error: boolean }>`
|
||||
background: ${({ theme }) => transparentize(0.6, theme.bg3)};
|
||||
padding: 0.75rem;
|
||||
border-radius: 20px;
|
||||
`
|
||||
|
||||
const WarningContainer = styled.div`
|
||||
max-width: 420px;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
background: rgba(242, 150, 2, 0.05);
|
||||
border: 1px solid #f3841e;
|
||||
border-radius: 20px;
|
||||
overflow: auto;
|
||||
`
|
||||
|
||||
const StyledWarningIcon = styled(AlertTriangle)`
|
||||
stroke: ${({ theme }) => theme.red2};
|
||||
`
|
||||
|
||||
interface TokenWarningCardProps {
|
||||
token?: Token
|
||||
}
|
||||
|
||||
function TokenWarningCard({ token }: TokenWarningCardProps) {
|
||||
const { chainId } = useActiveWeb3React()
|
||||
|
||||
const tokenSymbol = token?.symbol?.toLowerCase() ?? ''
|
||||
const tokenName = token?.name?.toLowerCase() ?? ''
|
||||
|
||||
const allTokens = useAllTokens()
|
||||
|
||||
const duplicateNameOrSymbol = useMemo(() => {
|
||||
if (!token || !chainId) return false
|
||||
|
||||
return Object.keys(allTokens).some(tokenAddress => {
|
||||
const userToken = allTokens[tokenAddress]
|
||||
if (userToken.equals(token)) {
|
||||
return false
|
||||
}
|
||||
return userToken.symbol?.toLowerCase() === tokenSymbol || userToken.name?.toLowerCase() === tokenName
|
||||
})
|
||||
}, [token, chainId, allTokens, tokenSymbol, tokenName])
|
||||
|
||||
if (!token) return null
|
||||
|
||||
return (
|
||||
<Wrapper error={duplicateNameOrSymbol}>
|
||||
<AutoRow gap="6px">
|
||||
<AutoColumn gap="24px">
|
||||
<CurrencyLogo currency={token} size={'16px'} />
|
||||
<div> </div>
|
||||
</AutoColumn>
|
||||
<AutoColumn gap="10px" justify="flex-start">
|
||||
<TYPE.main>
|
||||
{token && token.name && token.symbol && token.name !== token.symbol
|
||||
? `${token.name} (${token.symbol})`
|
||||
: token.name || token.symbol}{' '}
|
||||
</TYPE.main>
|
||||
{chainId && (
|
||||
<ExternalLink style={{ fontWeight: 400 }} href={getEtherscanLink(chainId, token.address, 'token')}>
|
||||
<TYPE.blue title={token.address}>{shortenAddress(token.address)} (View on Etherscan)</TYPE.blue>
|
||||
</ExternalLink>
|
||||
)}
|
||||
</AutoColumn>
|
||||
</AutoRow>
|
||||
</Wrapper>
|
||||
)
|
||||
}
|
||||
import { ImportToken } from 'components/SearchModal/ImportToken'
|
||||
|
||||
export default function TokenWarningModal({
|
||||
isOpen,
|
||||
@@ -92,62 +12,11 @@ export default function TokenWarningModal({
|
||||
tokens: Token[]
|
||||
onConfirm: () => void
|
||||
}) {
|
||||
const [understandChecked, setUnderstandChecked] = useState(false)
|
||||
const toggleUnderstand = useCallback(() => setUnderstandChecked(uc => !uc), [])
|
||||
|
||||
const handleDismiss = useCallback(() => null, [])
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onDismiss={handleDismiss} maxHeight={90}>
|
||||
<WarningContainer className="token-warning-container">
|
||||
<AutoColumn gap="lg">
|
||||
<AutoRow gap="6px">
|
||||
<StyledWarningIcon />
|
||||
<TYPE.main color={'red2'}>Token imported</TYPE.main>
|
||||
</AutoRow>
|
||||
<TYPE.body color={'red2'}>
|
||||
Anyone can create an ERC20 token on Ethereum with <em>any</em> name, including creating fake versions of
|
||||
existing tokens and tokens that claim to represent projects that do not have a token.
|
||||
</TYPE.body>
|
||||
<TYPE.body color={'red2'}>
|
||||
This interface can load arbitrary tokens by token addresses. Please take extra caution and do your research
|
||||
when interacting with arbitrary ERC20 tokens.
|
||||
</TYPE.body>
|
||||
<TYPE.body color={'red2'}>
|
||||
If you purchase an arbitrary token, <strong>you may not be able to sell it back.</strong>
|
||||
</TYPE.body>
|
||||
{tokens.map(token => {
|
||||
return <TokenWarningCard key={token.address} token={token} />
|
||||
})}
|
||||
<RowBetween>
|
||||
<div>
|
||||
<label style={{ cursor: 'pointer', userSelect: 'none' }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="understand-checkbox"
|
||||
checked={understandChecked}
|
||||
onChange={toggleUnderstand}
|
||||
/>{' '}
|
||||
I understand
|
||||
</label>
|
||||
</div>
|
||||
<ButtonError
|
||||
disabled={!understandChecked}
|
||||
error={true}
|
||||
width={'140px'}
|
||||
padding="0.5rem 1rem"
|
||||
className="token-dismiss-button"
|
||||
style={{
|
||||
borderRadius: '10px'
|
||||
}}
|
||||
onClick={() => {
|
||||
onConfirm()
|
||||
}}
|
||||
>
|
||||
<TYPE.body color="white">Continue</TYPE.body>
|
||||
</ButtonError>
|
||||
</RowBetween>
|
||||
</AutoColumn>
|
||||
</WarningContainer>
|
||||
<ImportToken tokens={tokens} handleCurrencySelect={onConfirm} />
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ const WETH_ONLY: ChainTokenList = {
|
||||
// used to construct intermediary pairs for trading
|
||||
export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
|
||||
...WETH_ONLY,
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, COMP, MKR]
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, COMP, MKR, WBTC]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,13 +78,13 @@ export const CUSTOM_BASES: { [chainId in ChainId]?: { [tokenAddress: string]: To
|
||||
// used for display in the default list when adding liquidity
|
||||
export const SUGGESTED_BASES: ChainTokenList = {
|
||||
...WETH_ONLY,
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT]
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, WBTC]
|
||||
}
|
||||
|
||||
// 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,
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT]
|
||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, WBTC]
|
||||
}
|
||||
|
||||
export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } = {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// the Uniswap Default token list lives here
|
||||
export const DEFAULT_TOKEN_LIST_URL = 'tokens.uniswap.eth'
|
||||
|
||||
// used to mark unsupported tokens, these are hosted lists of unsupported tokens
|
||||
/**
|
||||
* @TODO add list from blockchain association
|
||||
@@ -19,6 +16,7 @@ const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json'
|
||||
const CMC_ALL_LIST = 'defi.cmc.eth'
|
||||
const CMC_STABLECOIN = 'stablecoin.cmc.eth'
|
||||
const KLEROS_LIST = 't2crtokens.eth'
|
||||
const GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json'
|
||||
|
||||
// lower index == higher priority for token import
|
||||
export const DEFAULT_LIST_OF_LISTS: string[] = [
|
||||
@@ -34,8 +32,9 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
|
||||
CMC_ALL_LIST,
|
||||
CMC_STABLECOIN,
|
||||
KLEROS_LIST,
|
||||
GEMINI_LIST,
|
||||
...UNSUPPORTED_LIST_URLS // need to load unsupported tokens as well
|
||||
]
|
||||
|
||||
// default lists to be 'active' aka searched across
|
||||
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [DEFAULT_TOKEN_LIST_URL]
|
||||
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [GEMINI_LIST]
|
||||
|
||||
@@ -1,406 +0,0 @@
|
||||
{
|
||||
"name": "Uniswap Default List",
|
||||
"timestamp": "2021-01-11T23:59:53.688Z",
|
||||
"version": {
|
||||
"major": 1,
|
||||
"minor": 6,
|
||||
"patch": 0
|
||||
},
|
||||
"tags": {},
|
||||
"logoURI": "ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir",
|
||||
"keywords": ["uniswap", "default"],
|
||||
"tokens": [
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
|
||||
"name": "Aave",
|
||||
"symbol": "AAVE",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/12645/thumb/AAVE.png?1601374110"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0xfF20817765cB7f73d4bde2e66e067E58D11095C2",
|
||||
"name": "Amp",
|
||||
"symbol": "AMP",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/12409/thumb/amp-200x200.png?1599625397"
|
||||
},
|
||||
{
|
||||
"name": "Aragon Network Token",
|
||||
"address": "0x960b236A07cf122663c4303350609A66A7B288C0",
|
||||
"symbol": "ANT",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x960b236A07cf122663c4303350609A66A7B288C0/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Balancer",
|
||||
"address": "0xba100000625a3754423978a60c9317c58a424e3D",
|
||||
"symbol": "BAL",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xba100000625a3754423978a60c9317c58a424e3D/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0xBA11D00c5f74255f56a5E366F4F77f5A186d7f55",
|
||||
"name": "Band Protocol",
|
||||
"symbol": "BAND",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/9545/thumb/band-protocol.png?1568730326"
|
||||
},
|
||||
{
|
||||
"name": "Bancor Network Token",
|
||||
"address": "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C",
|
||||
"symbol": "BNT",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Compound",
|
||||
"address": "0xc00e94Cb662C3520282E6f5717214004A7f26888",
|
||||
"symbol": "COMP",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc00e94Cb662C3520282E6f5717214004A7f26888/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Curve DAO Token",
|
||||
"address": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
||||
"symbol": "CRV",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xD533a949740bb3306d119CC777fa900bA034cd52/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x41e5560054824eA6B0732E656E3Ad64E20e94E45",
|
||||
"name": "Civic",
|
||||
"symbol": "CVC",
|
||||
"decimals": 8,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/788/thumb/civic.png?1547034556"
|
||||
},
|
||||
{
|
||||
"name": "Dai Stablecoin",
|
||||
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
||||
"symbol": "DAI",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x0AbdAce70D3790235af448C88547603b945604ea",
|
||||
"name": "district0x",
|
||||
"symbol": "DNT",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/849/thumb/district0x.png?1547223762"
|
||||
},
|
||||
{
|
||||
"name": "Gnosis Token",
|
||||
"address": "0x6810e776880C02933D47DB1b9fc05908e5386b96",
|
||||
"symbol": "GNO",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6810e776880C02933D47DB1b9fc05908e5386b96/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0xc944E90C64B2c07662A292be6244BDf05Cda44a7",
|
||||
"name": "The Graph",
|
||||
"symbol": "GRT",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/13397/thumb/Graph_Token.png?1608145566"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC",
|
||||
"name": "Keep Network",
|
||||
"symbol": "KEEP",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/3373/thumb/IuNzUb5b_400x400.jpg?1589526336"
|
||||
},
|
||||
{
|
||||
"name": "Kyber Network Crystal",
|
||||
"address": "0xdd974D5C2e2928deA5F71b9825b8b646686BD200",
|
||||
"symbol": "KNC",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "ChainLink Token",
|
||||
"address": "0x514910771AF9Ca656af840dff83E8264EcF986CA",
|
||||
"symbol": "LINK",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x514910771AF9Ca656af840dff83E8264EcF986CA/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Loom Network",
|
||||
"address": "0xA4e8C3Ec456107eA67d3075bF9e3DF3A75823DB0",
|
||||
"symbol": "LOOM",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA4e8C3Ec456107eA67d3075bF9e3DF3A75823DB0/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "LoopringCoin V2",
|
||||
"address": "0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD",
|
||||
"symbol": "LRC",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xBBbbCA6A901c926F240b89EacB641d8Aec7AEafD/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942",
|
||||
"name": "Decentraland",
|
||||
"symbol": "MANA",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/878/thumb/decentraland-mana.png?1550108745"
|
||||
},
|
||||
{
|
||||
"name": "Maker",
|
||||
"address": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2",
|
||||
"symbol": "MKR",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0xec67005c4E498Ec7f55E092bd1d35cbC47C91892",
|
||||
"name": "Melon",
|
||||
"symbol": "MLN",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/605/thumb/melon.png?1547034295"
|
||||
},
|
||||
{
|
||||
"name": "Numeraire",
|
||||
"address": "0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671",
|
||||
"symbol": "NMR",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x4fE83213D56308330EC302a8BD641f1d0113A4Cc",
|
||||
"name": "NuCypher",
|
||||
"symbol": "NU",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/3318/thumb/photo1198982838879365035.jpg?1547037916"
|
||||
},
|
||||
{
|
||||
"name": "Orchid",
|
||||
"address": "0x4575f41308EC1483f3d399aa9a2826d74Da13Deb",
|
||||
"symbol": "OXT",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x4575f41308EC1483f3d399aa9a2826d74Da13Deb/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Republic Token",
|
||||
"address": "0x408e41876cCCDC0F92210600ef50372656052a38",
|
||||
"symbol": "REN",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x408e41876cCCDC0F92210600ef50372656052a38/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Reputation Augur v1",
|
||||
"address": "0x1985365e9f78359a9B6AD760e32412f4a445E862",
|
||||
"symbol": "REP",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1985365e9f78359a9B6AD760e32412f4a445E862/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Reputation Augur v2",
|
||||
"address": "0x221657776846890989a759BA2973e427DfF5C9bB",
|
||||
"symbol": "REPv2",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x221657776846890989a759BA2973e427DfF5C9bB/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Synthetix Network Token",
|
||||
"address": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F",
|
||||
"symbol": "SNX",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Storj Token",
|
||||
"address": "0xB64ef51C888972c908CFacf59B47C1AfBC0Ab8aC",
|
||||
"symbol": "STORJ",
|
||||
"decimals": 8,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xB64ef51C888972c908CFacf59B47C1AfBC0Ab8aC/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa",
|
||||
"name": "tBTC",
|
||||
"symbol": "TBTC",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/11224/thumb/tBTC.png?1589620754"
|
||||
},
|
||||
{
|
||||
"name": "UMA Voting Token v1",
|
||||
"address": "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828",
|
||||
"symbol": "UMA",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Uniswap",
|
||||
"address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
||||
"symbol": "UNI",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped BTC",
|
||||
"address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
||||
"symbol": "WBTC",
|
||||
"decimals": 8,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped Ether",
|
||||
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
||||
"symbol": "WETH",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png"
|
||||
},
|
||||
{
|
||||
"chainId": 1,
|
||||
"address": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e",
|
||||
"name": "yearn finance",
|
||||
"symbol": "YFI",
|
||||
"decimals": 18,
|
||||
"logoURI": "https://assets.coingecko.com/coins/images/11849/thumb/yfi-192x192.png?1598325330"
|
||||
},
|
||||
{
|
||||
"name": "0x Protocol Token",
|
||||
"address": "0xE41d2489571d322189246DaFA5ebDe1F4699F498",
|
||||
"symbol": "ZRX",
|
||||
"decimals": 18,
|
||||
"chainId": 1,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xE41d2489571d322189246DaFA5ebDe1F4699F498/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Dai Stablecoin",
|
||||
"address": "0xaD6D458402F60fD3Bd25163575031ACDce07538D",
|
||||
"symbol": "DAI",
|
||||
"decimals": 18,
|
||||
"chainId": 3,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xaD6D458402F60fD3Bd25163575031ACDce07538D/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Uniswap",
|
||||
"address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
||||
"symbol": "UNI",
|
||||
"decimals": 18,
|
||||
"chainId": 3,
|
||||
"logoURI": "ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped Ether",
|
||||
"address": "0xc778417E063141139Fce010982780140Aa0cD5Ab",
|
||||
"symbol": "WETH",
|
||||
"decimals": 18,
|
||||
"chainId": 3,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc778417E063141139Fce010982780140Aa0cD5Ab/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Dai Stablecoin",
|
||||
"address": "0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735",
|
||||
"symbol": "DAI",
|
||||
"decimals": 18,
|
||||
"chainId": 4,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Maker",
|
||||
"address": "0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85",
|
||||
"symbol": "MKR",
|
||||
"decimals": 18,
|
||||
"chainId": 4,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Uniswap",
|
||||
"address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
||||
"symbol": "UNI",
|
||||
"decimals": 18,
|
||||
"chainId": 4,
|
||||
"logoURI": "ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped Ether",
|
||||
"address": "0xc778417E063141139Fce010982780140Aa0cD5Ab",
|
||||
"symbol": "WETH",
|
||||
"decimals": 18,
|
||||
"chainId": 4,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xc778417E063141139Fce010982780140Aa0cD5Ab/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Uniswap",
|
||||
"address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
||||
"symbol": "UNI",
|
||||
"decimals": 18,
|
||||
"chainId": 5,
|
||||
"logoURI": "ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped Ether",
|
||||
"address": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
|
||||
"symbol": "WETH",
|
||||
"decimals": 18,
|
||||
"chainId": 5,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Dai Stablecoin",
|
||||
"address": "0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa",
|
||||
"symbol": "DAI",
|
||||
"decimals": 18,
|
||||
"chainId": 42,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Maker",
|
||||
"address": "0xAaF64BFCC32d0F15873a02163e7E500671a4ffcD",
|
||||
"symbol": "MKR",
|
||||
"decimals": 18,
|
||||
"chainId": 42,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xAaF64BFCC32d0F15873a02163e7E500671a4ffcD/logo.png"
|
||||
},
|
||||
{
|
||||
"name": "Uniswap",
|
||||
"address": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
|
||||
"symbol": "UNI",
|
||||
"decimals": 18,
|
||||
"chainId": 42,
|
||||
"logoURI": "ipfs://QmXttGpZrECX5qCyXbBQiqgQNytVGeZW5Anewvh2jc4psg"
|
||||
},
|
||||
{
|
||||
"name": "Wrapped Ether",
|
||||
"address": "0xd0A1E359811322d97991E03f863a0C30C2cF029C",
|
||||
"symbol": "WETH",
|
||||
"decimals": 18,
|
||||
"chainId": 42,
|
||||
"logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xd0A1E359811322d97991E03f863a0C30C2cF029C/logo.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import SwapHeader from '../../components/swap/SwapHeader'
|
||||
import { INITIAL_ALLOWED_SLIPPAGE } from '../../constants'
|
||||
import { getTradeVersion } from '../../data/V1'
|
||||
import { useActiveWeb3React } from '../../hooks'
|
||||
import { useCurrency, useDefaultTokens } from '../../hooks/Tokens'
|
||||
import { useCurrency, useAllTokens } from '../../hooks/Tokens'
|
||||
import { ApprovalState, useApproveCallbackFromTrade } from '../../hooks/useApproveCallback'
|
||||
import useENSAddress from '../../hooks/useENSAddress'
|
||||
import { useSwapCallback } from '../../hooks/useSwapCallback'
|
||||
@@ -66,13 +66,13 @@ export default function Swap() {
|
||||
setDismissTokenWarning(true)
|
||||
}, [])
|
||||
|
||||
// dismiss warning if all imported tokens are in default list
|
||||
const defaultTokens = useDefaultTokens()
|
||||
// dismiss warning if all imported tokens are in active lists
|
||||
const defaultTokens = useAllTokens()
|
||||
const importTokensNotInDefault =
|
||||
urlLoadedTokens &&
|
||||
urlLoadedTokens.filter((token: Token) => {
|
||||
return !Boolean(token.address in defaultTokens)
|
||||
}).length > 0
|
||||
})
|
||||
|
||||
const { account } = useActiveWeb3React()
|
||||
const theme = useContext(ThemeContext)
|
||||
@@ -294,14 +294,13 @@ export default function Swap() {
|
||||
return (
|
||||
<>
|
||||
<TokenWarningModal
|
||||
isOpen={urlLoadedTokens.length > 0 && !dismissTokenWarning && importTokensNotInDefault}
|
||||
tokens={urlLoadedTokens}
|
||||
isOpen={importTokensNotInDefault.length > 0 && !dismissTokenWarning}
|
||||
tokens={importTokensNotInDefault}
|
||||
onConfirm={handleConfirmTokenWarning}
|
||||
/>
|
||||
<SwapPoolTabs active={'swap'} />
|
||||
<AppBody>
|
||||
<SwapHeader />
|
||||
{/* <Separator /> */}
|
||||
<Wrapper id="swap-page">
|
||||
<ConfirmSwapModal
|
||||
isOpen={showConfirm}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UNSUPPORTED_LIST_URLS } from './../../constants/lists'
|
||||
import DEFAULT_TOKEN_LIST from 'constants/tokenLists/uniswap-default.tokenlist.json'
|
||||
import DEFAULT_TOKEN_LIST from '@uniswap/default-token-list'
|
||||
import { ChainId, Token } from '@uniswap/sdk'
|
||||
import { Tags, TokenInfo, TokenList } from '@uniswap/token-lists'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DEFAULT_ACTIVE_LIST_URLS } from './../../constants/lists'
|
||||
import { createStore, Store } from 'redux'
|
||||
import { DEFAULT_LIST_OF_LISTS, DEFAULT_TOKEN_LIST_URL } from '../../constants/lists'
|
||||
import { DEFAULT_LIST_OF_LISTS } from '../../constants/lists'
|
||||
import { updateVersion } from '../global/actions'
|
||||
import { fetchTokenList, acceptListUpdate, addList, removeList, enableList } from './actions'
|
||||
import reducer, { ListsState } from './reducer'
|
||||
@@ -446,21 +446,12 @@ describe('list reducer', () => {
|
||||
it('all lists are empty', () => {
|
||||
const s = store.getState()
|
||||
Object.keys(s.byUrl).forEach(url => {
|
||||
if (url === DEFAULT_TOKEN_LIST_URL) {
|
||||
expect(s.byUrl[url]).toEqual({
|
||||
error: null,
|
||||
current: null,
|
||||
loadingRequestId: null,
|
||||
pendingUpdate: null
|
||||
})
|
||||
} else {
|
||||
expect(s.byUrl[url]).toEqual({
|
||||
error: null,
|
||||
current: null,
|
||||
loadingRequestId: null,
|
||||
pendingUpdate: null
|
||||
})
|
||||
}
|
||||
expect(s.byUrl[url]).toEqual({
|
||||
error: null,
|
||||
current: null,
|
||||
loadingRequestId: null,
|
||||
pendingUpdate: null
|
||||
})
|
||||
})
|
||||
})
|
||||
it('sets initialized lists', () => {
|
||||
@@ -507,10 +498,6 @@ describe('list reducer', () => {
|
||||
expect(store.getState().byUrl['https://unpkg.com/@uniswap/default-token-list@latest']).toBeUndefined()
|
||||
})
|
||||
|
||||
it('adds all the lists in the default list of lists', () => {
|
||||
expect(Object.keys(store.getState().byUrl)).toContain(DEFAULT_TOKEN_LIST_URL)
|
||||
})
|
||||
|
||||
it('each of those initialized lists is empty', () => {
|
||||
const byUrl = store.getState().byUrl
|
||||
// note we don't expect the uniswap default list to be prepopulated
|
||||
@@ -533,14 +520,6 @@ describe('list reducer', () => {
|
||||
it('sets default list to selected list', () => {
|
||||
expect(store.getState().activeListUrls).toEqual(DEFAULT_ACTIVE_LIST_URLS)
|
||||
})
|
||||
it('default list is initialized', () => {
|
||||
expect(store.getState().byUrl[DEFAULT_TOKEN_LIST_URL]).toEqual({
|
||||
error: null,
|
||||
current: null,
|
||||
loadingRequestId: null,
|
||||
pendingUpdate: null
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -74,6 +74,11 @@ export default createReducer(initialState, builder =>
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// activate if on default active
|
||||
if (DEFAULT_ACTIVE_LIST_URLS.includes(url)) {
|
||||
state.activeListUrls?.push(url)
|
||||
}
|
||||
|
||||
state.byUrl[url] = {
|
||||
...state.byUrl[url],
|
||||
loadingRequestId: null,
|
||||
|
||||
@@ -2691,6 +2691,11 @@
|
||||
semver "^7.3.2"
|
||||
tsutils "^3.17.1"
|
||||
|
||||
"@uniswap/default-token-list@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-2.0.0.tgz#095b4c22635e532c817c3ba70e8838d8bd699716"
|
||||
integrity sha512-P37PqBtUjEB9DIRFfmEsgougkV0555JQKiGPISeN9UFk1UgCQM5sg6+bBaShiyaqEpdtttAaBFI1QESCzPGvXw==
|
||||
|
||||
"@uniswap/governance@^1.0.2":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@uniswap/governance/-/governance-1.0.2.tgz#7371ab54dea9a5c045275001e2d5325ff2c11a93"
|
||||
|
||||
Reference in New Issue
Block a user