Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5625a1f8 | ||
|
|
d425ff64b4 | ||
|
|
2f47fdf71d | ||
|
|
9f8719f2a5 | ||
|
|
77b640c41b | ||
|
|
d2f98bc9b4 | ||
|
|
e4dd4f9283 | ||
|
|
7798443919 | ||
|
|
392d78b9da | ||
|
|
231289732c | ||
|
|
140ff7a674 |
38
.github/workflows/integration-tests.yaml
vendored
Normal file
38
.github/workflows/integration-tests.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Integration Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
integration-tests:
|
||||||
|
name: Cypress
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
registry-url: https://registry.npmjs.org
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- run: yarn cypress install
|
||||||
|
- run: yarn build
|
||||||
|
env:
|
||||||
|
CI: false
|
||||||
|
REACT_APP_NETWORK_URL: "https://mainnet.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847"
|
||||||
|
|
||||||
|
- run: yarn integration-test
|
||||||
|
env:
|
||||||
|
CYPRESS_INTEGRATION_TEST_PRIVATE_KEY: ${{ secrets.CYPRESS_INTEGRATION_TEST_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
|
||||||
21
.github/workflows/lint.yml
vendored
21
.github/workflows/lint.yml
vendored
@@ -14,33 +14,20 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up node
|
- name: Set up node
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 12
|
node-version: 14
|
||||||
always-auth: true
|
|
||||||
registry-url: https://registry.npmjs.org
|
registry-url: https://registry.npmjs.org
|
||||||
|
|
||||||
- name: Set output of cache
|
|
||||||
id: yarn-cache
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
|
|
||||||
- name: Node dependency cache
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
|
||||||
key: yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
yarn-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run linters
|
- name: Run linters
|
||||||
uses: wearerequired/lint-action@77d70b9a07ecb93bc98dc46dc27d96c4f004d035
|
uses: wearerequired/lint-action@b98b0918aa71490373d2eca9e8e39a9bc1cc2517
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.github_token }}
|
github_token: ${{ secrets.github_token }}
|
||||||
eslint: true
|
eslint: true
|
||||||
|
|||||||
10
.github/workflows/release.yaml
vendored
10
.github/workflows/release.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
changelog: ${{ steps.github_tag_action.outputs.changelog }}
|
changelog: ${{ steps.github_tag_action.outputs.changelog }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Bump version and push tag
|
- name: Bump version and push tag
|
||||||
id: github_tag_action
|
id: github_tag_action
|
||||||
@@ -31,12 +31,12 @@ jobs:
|
|||||||
if: ${{ needs.bump_version.outputs.new_tag != null }}
|
if: ${{ needs.bump_version.outputs.new_tag != null }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions/setup-node@v1
|
- name: Set up node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '12'
|
node-version: 14
|
||||||
always-auth: true
|
|
||||||
registry-url: https://registry.npmjs.org
|
registry-url: https://registry.npmjs.org
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
65
.github/workflows/tests.yaml
vendored
65
.github/workflows/tests.yaml
vendored
@@ -1,65 +0,0 @@
|
|||||||
name: Tests
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
integration-tests:
|
|
||||||
name: Integration tests
|
|
||||||
runs-on: ubuntu-16.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '12'
|
|
||||||
always-auth: true
|
|
||||||
registry-url: https://registry.npmjs.org
|
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
- run: yarn install --frozen-lockfile
|
|
||||||
- run: yarn cypress install
|
|
||||||
- run: yarn build
|
|
||||||
env:
|
|
||||||
CI: false
|
|
||||||
REACT_APP_NETWORK_URL: "https://mainnet.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847"
|
|
||||||
- run: yarn integration-test
|
|
||||||
|
|
||||||
unit-tests:
|
|
||||||
name: Unit tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '12'
|
|
||||||
always-auth: true
|
|
||||||
registry-url: https://registry.npmjs.org
|
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
|
||||||
id: yarn-cache-dir-path
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
- run: yarn install --frozen-lockfile
|
|
||||||
- run: yarn test
|
|
||||||
|
|
||||||
28
.github/workflows/unit-tests.yaml
vendored
Normal file
28
.github/workflows/unit-tests.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Unit Tests
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-tests:
|
||||||
|
name: Unit tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 14
|
||||||
|
registry-url: https://registry.npmjs.org
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
|
run: yarn test
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
# Uniswap Interface
|
# Uniswap Interface
|
||||||
|
|
||||||
[](https://github.com/Uniswap/uniswap-interface/actions?query=workflow%3ALint)
|
[](https://github.com/Uniswap/uniswap-interface/actions/workflows/unit-tests.yaml)
|
||||||
[](https://github.com/Uniswap/uniswap-interface/actions?query=workflow%3ATests)
|
[](https://github.com/Uniswap/uniswap-interface/actions/workflows/integration-tests.yaml)
|
||||||
[](https://prettier.io/)
|
[](https://github.com/Uniswap/uniswap-interface/actions/workflows/lint.yml)
|
||||||
|
[](https://github.com/Uniswap/uniswap-interface/actions/workflows/release.yaml)
|
||||||
|
|
||||||
An open source interface for Uniswap -- a protocol for decentralized exchange of Ethereum tokens.
|
An open source interface for Uniswap -- a protocol for decentralized exchange of Ethereum tokens.
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,15 @@ import { JsonRpcProvider } from '@ethersproject/providers'
|
|||||||
import { Wallet } from '@ethersproject/wallet'
|
import { Wallet } from '@ethersproject/wallet'
|
||||||
import { _Eip1193Bridge } from '@ethersproject/experimental/lib/eip1193-bridge'
|
import { _Eip1193Bridge } from '@ethersproject/experimental/lib/eip1193-bridge'
|
||||||
|
|
||||||
// never send real ether to this, obviously
|
const TEST_PRIVATE_KEY = Cypress.env('INTEGRATION_TEST_PRIVATE_KEY')
|
||||||
const PRIVATE_KEY_TEST_NEVER_USE = '0xad20c82497421e9784f18460ad2fe84f73569068e98e270b3e63743268af5763'
|
|
||||||
|
|
||||||
// address of the above key
|
// address of the above key
|
||||||
export const TEST_ADDRESS_NEVER_USE = '0x0fF2D1eFd7A57B7562b2bf27F3f37899dB27F4a5'
|
export const TEST_ADDRESS_NEVER_USE = new Wallet(TEST_PRIVATE_KEY).address
|
||||||
|
|
||||||
export const TEST_ADDRESS_NEVER_USE_SHORTENED = '0x0fF2...F4a5'
|
export const TEST_ADDRESS_NEVER_USE_SHORTENED = `${TEST_ADDRESS_NEVER_USE.substr(
|
||||||
|
0,
|
||||||
|
6
|
||||||
|
)}...${TEST_ADDRESS_NEVER_USE.substr(-4, 4)}`
|
||||||
|
|
||||||
class CustomizedBridge extends _Eip1193Bridge {
|
class CustomizedBridge extends _Eip1193Bridge {
|
||||||
async sendAsync(...args) {
|
async sendAsync(...args) {
|
||||||
@@ -75,7 +77,7 @@ Cypress.Commands.overwrite('visit', (original, url, options) => {
|
|||||||
options && options.onBeforeLoad && options.onBeforeLoad(win)
|
options && options.onBeforeLoad && options.onBeforeLoad(win)
|
||||||
win.localStorage.clear()
|
win.localStorage.clear()
|
||||||
const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847', 4)
|
const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847', 4)
|
||||||
const signer = new Wallet(PRIVATE_KEY_TEST_NEVER_USE, provider)
|
const signer = new Wallet(TEST_PRIVATE_KEY, provider)
|
||||||
win.ethereum = new CustomizedBridge(signer, provider)
|
win.ethereum = new CustomizedBridge(signer, provider)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -94,9 +94,6 @@
|
|||||||
"workbox-routing": "^6.1.0",
|
"workbox-routing": "^6.1.0",
|
||||||
"workbox-strategies": "^6.1.0"
|
"workbox-strategies": "^6.1.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"@walletconnect/web3-provider": "1.1.1-alpha.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"start:service-worker": "yarn build && yarn serve -s build",
|
"start:service-worker": "yarn build && yarn serve -s build",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.6 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 14 KiB |
@@ -14,13 +14,16 @@ type ChainTokenList = {
|
|||||||
readonly [chainId in ChainId]: Token[]
|
readonly [chainId in ChainId]: Token[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const AMPL = new Token(ChainId.MAINNET, '0xD46bA6D942050d489DBd938a2C909A5d5039A161', 9, 'AMPL', 'Ampleforth')
|
||||||
export const DAI = new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin')
|
export const DAI = new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin')
|
||||||
export const USDC = new Token(ChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD//C')
|
export const USDC = new Token(ChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD//C')
|
||||||
export const USDT = new Token(ChainId.MAINNET, '0xdAC17F958D2ee523a2206206994597C13D831ec7', 6, 'USDT', 'Tether USD')
|
export const USDT = new Token(ChainId.MAINNET, '0xdAC17F958D2ee523a2206206994597C13D831ec7', 6, 'USDT', 'Tether USD')
|
||||||
export const COMP = new Token(ChainId.MAINNET, '0xc00e94Cb662C3520282E6f5717214004A7f26888', 18, 'COMP', 'Compound')
|
|
||||||
export const MKR = new Token(ChainId.MAINNET, '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', 18, 'MKR', 'Maker')
|
|
||||||
export const AMPL = new Token(ChainId.MAINNET, '0xD46bA6D942050d489DBd938a2C909A5d5039A161', 9, 'AMPL', 'Ampleforth')
|
|
||||||
export const WBTC = new Token(ChainId.MAINNET, '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 8, 'WBTC', 'Wrapped BTC')
|
export const WBTC = new Token(ChainId.MAINNET, '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 8, 'WBTC', 'Wrapped BTC')
|
||||||
|
export const FEI = new Token(ChainId.MAINNET, '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', 18, 'FEI', 'Fei USD')
|
||||||
|
export const TRIBE = new Token(ChainId.MAINNET, '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B', 18, 'TRIBE', 'Tribe')
|
||||||
|
export const FRAX = new Token(ChainId.MAINNET, '0x853d955aCEf822Db058eb8505911ED77F175b99e', 18, 'FRAX', 'Frax')
|
||||||
|
export const FXS = new Token(ChainId.MAINNET, '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', 18, 'FXS', 'Frax Share')
|
||||||
|
export const renBTC = new Token(ChainId.MAINNET, '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D', 8, 'renBTC', 'renBTC')
|
||||||
|
|
||||||
// Block time here is slightly higher (~1s) than average in order to avoid ongoing proposals past the displayed time
|
// Block time here is slightly higher (~1s) than average in order to avoid ongoing proposals past the displayed time
|
||||||
export const AVERAGE_BLOCK_TIME_IN_SECS = 13
|
export const AVERAGE_BLOCK_TIME_IN_SECS = 13
|
||||||
@@ -62,7 +65,20 @@ const WETH_ONLY: ChainTokenList = {
|
|||||||
// used to construct intermediary pairs for trading
|
// used to construct intermediary pairs for trading
|
||||||
export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
|
export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
|
||||||
...WETH_ONLY,
|
...WETH_ONLY,
|
||||||
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, COMP, MKR, WBTC]
|
[ChainId.MAINNET]: [...WETH_ONLY[ChainId.MAINNET], DAI, USDC, USDT, WBTC]
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ADDITIONAL_BASES: { [chainId in ChainId]?: { [tokenAddress: string]: Token[] } } = {
|
||||||
|
[ChainId.MAINNET]: {
|
||||||
|
'0xA948E86885e12Fb09AfEF8C52142EBDbDf73cD18': [new Token(ChainId.MAINNET, UNI_ADDRESS, 18, 'UNI', 'Uniswap')],
|
||||||
|
'0x561a4717537ff4AF5c687328c0f7E90a319705C0': [new Token(ChainId.MAINNET, UNI_ADDRESS, 18, 'UNI', 'Uniswap')],
|
||||||
|
[FEI.address]: [TRIBE],
|
||||||
|
[TRIBE.address]: [FEI],
|
||||||
|
[FRAX.address]: [FXS],
|
||||||
|
[FXS.address]: [FRAX],
|
||||||
|
[WBTC.address]: [renBTC],
|
||||||
|
[renBTC.address]: [WBTC]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,12 @@ import { Currency, CurrencyAmount, Pair, Token, Trade } from '@uniswap/sdk'
|
|||||||
import flatMap from 'lodash.flatmap'
|
import flatMap from 'lodash.flatmap'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
|
|
||||||
import { BASES_TO_CHECK_TRADES_AGAINST, CUSTOM_BASES, BETTER_TRADE_LESS_HOPS_THRESHOLD } from '../constants'
|
import {
|
||||||
|
BASES_TO_CHECK_TRADES_AGAINST,
|
||||||
|
CUSTOM_BASES,
|
||||||
|
BETTER_TRADE_LESS_HOPS_THRESHOLD,
|
||||||
|
ADDITIONAL_BASES
|
||||||
|
} from '../constants'
|
||||||
import { PairState, usePairs } from '../data/Reserves'
|
import { PairState, usePairs } from '../data/Reserves'
|
||||||
import { wrappedCurrency } from '../utils/wrappedCurrency'
|
import { wrappedCurrency } from '../utils/wrappedCurrency'
|
||||||
|
|
||||||
@@ -14,17 +19,22 @@ import { useUserSingleHopOnly } from 'state/user/hooks'
|
|||||||
function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): Pair[] {
|
function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): Pair[] {
|
||||||
const { chainId } = useActiveWeb3React()
|
const { chainId } = useActiveWeb3React()
|
||||||
|
|
||||||
const bases: Token[] = chainId ? BASES_TO_CHECK_TRADES_AGAINST[chainId] : []
|
|
||||||
|
|
||||||
const [tokenA, tokenB] = chainId
|
const [tokenA, tokenB] = chainId
|
||||||
? [wrappedCurrency(currencyA, chainId), wrappedCurrency(currencyB, chainId)]
|
? [wrappedCurrency(currencyA, chainId), wrappedCurrency(currencyB, chainId)]
|
||||||
: [undefined, undefined]
|
: [undefined, undefined]
|
||||||
|
|
||||||
|
const bases: Token[] = useMemo(() => {
|
||||||
|
if (!chainId) return []
|
||||||
|
|
||||||
|
const common = BASES_TO_CHECK_TRADES_AGAINST[chainId] ?? []
|
||||||
|
const additionalA = tokenA ? ADDITIONAL_BASES[chainId]?.[tokenA.address] ?? [] : []
|
||||||
|
const additionalB = tokenB ? ADDITIONAL_BASES[chainId]?.[tokenB.address] ?? [] : []
|
||||||
|
|
||||||
|
return [...common, ...additionalA, ...additionalB]
|
||||||
|
}, [chainId, tokenA, tokenB])
|
||||||
|
|
||||||
const basePairs: [Token, Token][] = useMemo(
|
const basePairs: [Token, Token][] = useMemo(
|
||||||
() =>
|
() => flatMap(bases, (base): [Token, Token][] => bases.map(otherBase => [base, otherBase])),
|
||||||
flatMap(bases, (base): [Token, Token][] => bases.map(otherBase => [base, otherBase])).filter(
|
|
||||||
([t0, t1]) => t0.address !== t1.address
|
|
||||||
),
|
|
||||||
[bases]
|
[bases]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -46,10 +56,9 @@ function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): Pair[] {
|
|||||||
.filter(([tokenA, tokenB]) => {
|
.filter(([tokenA, tokenB]) => {
|
||||||
if (!chainId) return true
|
if (!chainId) return true
|
||||||
const customBases = CUSTOM_BASES[chainId]
|
const customBases = CUSTOM_BASES[chainId]
|
||||||
if (!customBases) return true
|
|
||||||
|
|
||||||
const customBasesA: Token[] | undefined = customBases[tokenA.address]
|
const customBasesA: Token[] | undefined = customBases?.[tokenA.address]
|
||||||
const customBasesB: Token[] | undefined = customBases[tokenB.address]
|
const customBasesB: Token[] | undefined = customBases?.[tokenB.address]
|
||||||
|
|
||||||
if (!customBasesA && !customBasesB) return true
|
if (!customBasesA && !customBasesB) return true
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,8 @@ function combineMaps(map1: TokenAddressMap, map2: TokenAddressMap): TokenAddress
|
|||||||
// merge tokens contained within lists from urls
|
// merge tokens contained within lists from urls
|
||||||
function useCombinedTokenMapFromUrls(urls: string[] | undefined): TokenAddressMap {
|
function useCombinedTokenMapFromUrls(urls: string[] | undefined): TokenAddressMap {
|
||||||
const lists = useAllLists()
|
const lists = useAllLists()
|
||||||
|
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
if (!urls) return EMPTY_LIST
|
if (!urls) return EMPTY_LIST
|
||||||
|
|
||||||
return (
|
return (
|
||||||
urls
|
urls
|
||||||
.slice()
|
.slice()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { useFetchListCallback } from '../../hooks/useFetchListCallback'
|
|||||||
import useInterval from '../../hooks/useInterval'
|
import useInterval from '../../hooks/useInterval'
|
||||||
import useIsWindowVisible from '../../hooks/useIsWindowVisible'
|
import useIsWindowVisible from '../../hooks/useIsWindowVisible'
|
||||||
import { AppDispatch } from '../index'
|
import { AppDispatch } from '../index'
|
||||||
import { acceptListUpdate } from './actions'
|
import { acceptListUpdate, removeList } from './actions'
|
||||||
import { useActiveListUrls } from './hooks'
|
import { useActiveListUrls } from './hooks'
|
||||||
import { useAllInactiveTokens } from 'hooks/Tokens'
|
import { useAllInactiveTokens } from 'hooks/Tokens'
|
||||||
import { UNSUPPORTED_LIST_URLS } from 'constants/lists'
|
import { UNSUPPORTED_LIST_URLS } from 'constants/lists'
|
||||||
@@ -35,6 +35,13 @@ export default function Updater(): null {
|
|||||||
// fetch all lists every 10 minutes, but only after we initialize library
|
// fetch all lists every 10 minutes, but only after we initialize library
|
||||||
useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null)
|
useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null)
|
||||||
|
|
||||||
|
// hot fix for fetching error
|
||||||
|
useEffect(() => {
|
||||||
|
if (lists['https://tokens.coingecko.com/uniswap/all.json']) {
|
||||||
|
dispatch(removeList('https://tokens.coingecko.com/uniswap/all.json'))
|
||||||
|
}
|
||||||
|
}, [dispatch, lists])
|
||||||
|
|
||||||
// whenever a list is not loaded and not loading, try again to load it
|
// whenever a list is not loaded and not loading, try again to load it
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Object.keys(lists).forEach(listUrl => {
|
Object.keys(lists).forEach(listUrl => {
|
||||||
|
|||||||
Reference in New Issue
Block a user