From d292b749ba7eea35a17a4f514645629765a810c2 Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Wed, 31 Mar 2021 13:06:50 +0300 Subject: [PATCH 1/6] add default list exchanges for ethereum --- src/components/SearchModal/ListSelect.tsx | 3 +- src/constants/lists.ts | 39 ++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/components/SearchModal/ListSelect.tsx b/src/components/SearchModal/ListSelect.tsx index 2d8d7a1df6d..99b33e1dbd6 100644 --- a/src/components/SearchModal/ListSelect.tsx +++ b/src/components/SearchModal/ListSelect.tsx @@ -151,7 +151,8 @@ const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; on }} > - + {/* */} + {list.tokens.length} tokens diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 4ffd2ff9a5d..2b90818f1cc 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -1,4 +1,41 @@ // the Uniswap Default token list lives here export const DEFAULT_TOKEN_LIST_URL = 'tokens.uniswap.eth' -export const DEFAULT_LIST_OF_LISTS: string[] = [] +const COMPOUND_LIST = 'https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json' +const UMA_LIST = 'https://umaproject.org/uma.tokenlist.json' +const AAVE_LIST = 'tokenlist.aave.eth' +const SYNTHETIX_LIST = 'synths.snx.eth' +const WRAPPED_LIST = 'wrapped.tokensoft.eth' +const SET_LIST = 'https://raw.githubusercontent.com/SetProtocol/uniswap-tokenlist/main/set.tokenlist.json' +const OPYN_LIST = 'https://raw.githubusercontent.com/opynfinance/opyn-tokenlist/master/opyn-v1.tokenlist.json' +const ROLL_LIST = 'https://app.tryroll.com/tokens.json' +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' +const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json' + +// used to mark unsupported tokens, these are hosted lists of unsupported tokens +export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST] + +// lower index == higher priority for token import +export const DEFAULT_LIST_OF_LISTS: string[] = [ + COMPOUND_LIST, + AAVE_LIST, + SYNTHETIX_LIST, + UMA_LIST, + WRAPPED_LIST, + SET_LIST, + OPYN_LIST, + ROLL_LIST, + COINGECKO_LIST, + 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[] = [GEMINI_LIST] From 1282152eac73b95a5af9949bdac17dbb4711ecb2 Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Thu, 1 Apr 2021 11:53:17 +0300 Subject: [PATCH 2/6] add coingeco default list --- src/components/SearchModal/CurrencySearch.tsx | 33 ++++++++- src/constants/lists.ts | 74 +++++++++++++------ src/state/lists/reducer.ts | 12 ++- src/state/lists/updater.ts | 2 +- 4 files changed, 94 insertions(+), 27 deletions(-) diff --git a/src/components/SearchModal/CurrencySearch.tsx b/src/components/SearchModal/CurrencySearch.tsx index 018c2bea086..ce7054d1f66 100644 --- a/src/components/SearchModal/CurrencySearch.tsx +++ b/src/components/SearchModal/CurrencySearch.tsx @@ -24,6 +24,7 @@ import { useSelectedListInfo } from '../../state/lists/hooks' import { useToken } from '../../hooks/Tokens' import { useTokenComparator } from './sorting' import { useTranslation } from 'react-i18next' +import { TokenList } from '@uniswap/token-lists' interface CurrencySearchProps { isOpen: boolean @@ -97,7 +98,7 @@ export function CurrencySearch({ ) }, [isAddressSearch, searchToken, searchQuery, defaultTokenList, chainId, availableTokensArray]) - const filteredSortedTokens: Token[] = useMemo(() => { + let filteredSortedTokens: Token[] = useMemo(() => { if (searchToken) return [searchToken] const sorted = filteredTokens.sort(tokenComparator) const symbolMatch = searchQuery @@ -154,7 +155,33 @@ export function CurrencySearch({ [filteredSortedTokens, handleCurrencySelect, searchQuery] ) - const selectedListInfo = useSelectedListInfo() + let selectedListInfo = useSelectedListInfo() + if(selectedListInfo === undefined ) { + selectedListInfo = {} as { current: TokenList | null; pending: TokenList | null; loading: boolean; } + } + let newList = filteredSortedTokens; + if(selectedListInfo ) { + selectedListInfo?.current?.tokens?.map(token => { + const index = filteredSortedTokens.findIndex(function(tk, index) { + if(tk.address == token.address && chainId === token.chainId) { + return true; + } else { + return false; + } + + + }); + console.log('indexc :>> ', index); + if(index === -1) { + const newToken = new Token( token.chainId, token.address, token.decimals, token.symbol, token.name ) + filteredSortedTokens.push(newToken) + } + + + }) + filteredSortedTokens = filteredSortedTokens.filter(token => token.chainId !== chainId) + + } return ( @@ -197,7 +224,7 @@ export function CurrencySearch({ { From 091afc9ecee3c7cb0c8289bf69f8bad227c79dc9 Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Thu, 1 Apr 2021 11:53:20 +0300 Subject: [PATCH 3/6] add coingeco default list --- src/components/SearchModal/CurrencySearch.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/SearchModal/CurrencySearch.tsx b/src/components/SearchModal/CurrencySearch.tsx index ce7054d1f66..fd803a9b756 100644 --- a/src/components/SearchModal/CurrencySearch.tsx +++ b/src/components/SearchModal/CurrencySearch.tsx @@ -171,7 +171,6 @@ export function CurrencySearch({ }); - console.log('indexc :>> ', index); if(index === -1) { const newToken = new Token( token.chainId, token.address, token.decimals, token.symbol, token.name ) filteredSortedTokens.push(newToken) From a2c1c74cb13cd67af7ecdd576e9d33e8f580c2ac Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Fri, 2 Apr 2021 13:26:02 +0300 Subject: [PATCH 4/6] set filter for new tokens --- src/components/SearchModal/ListSelect.tsx | 43 ++++++------- src/constants/lists.ts | 23 ++++--- src/state/crosschain/hooks.ts | 4 ++ src/state/lists/actions.ts | 3 +- src/state/lists/reducer.ts | 73 +++++++++++++++-------- src/state/lists/updater.ts | 2 +- src/state/swap/hooks.ts | 4 +- 7 files changed, 91 insertions(+), 61 deletions(-) diff --git a/src/components/SearchModal/ListSelect.tsx b/src/components/SearchModal/ListSelect.tsx index 99b33e1dbd6..b2f30a0b55d 100644 --- a/src/components/SearchModal/ListSelect.tsx +++ b/src/components/SearchModal/ListSelect.tsx @@ -10,7 +10,7 @@ import { useOnClickOutside } from '../../hooks/useOnClickOutside' import useToggle from '../../hooks/useToggle' import { AppDispatch, AppState } from '../../state' -import { acceptListUpdate, removeList, selectList } from '../../state/lists/actions' +import { acceptListUpdate, removeList, selectList} from '../../state/lists/actions' import { useSelectedListUrl } from '../../state/lists/hooks' import { CloseIcon, ExternalLink, LinkStyledButton, TYPE } from '../../theme' import listVersionLabel from '../../utils/listVersionLabel' @@ -89,9 +89,10 @@ function listUrlRowHTMLId(listUrl: string) { } const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; onBack: () => void }) { + const dispatch = useDispatch() const listsByUrl = useSelector(state => state.lists.byUrl) const selectedListUrl = useSelectedListUrl() - const dispatch = useDispatch() + const { current: list, pendingUpdate: pending } = listsByUrl[listUrl] const isSelected = listUrl === selectedListUrl @@ -133,8 +134,8 @@ const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; on {list.logoURI ? ( ) : ( -
- )} +
+ )} ) : ( - <> - - Select + <> + + Select - - )} + + )} ) }) @@ -279,8 +280,8 @@ export function ListSelect({ onDismiss, onBack }: { onDismiss: () => void; onBac return l1.name.toLowerCase() < l2.name.toLowerCase() ? -1 : l1.name.toLowerCase() === l2.name.toLowerCase() - ? 0 - : 1 + ? 0 + : 1 } if (l1) return -1 if (l2) return 1 diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 938be74588f..65f37070bf9 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -1,14 +1,19 @@ - + const ls = localStorage.getItem('redux_localstorage_simple_crosschain') -let nameCurrentMainCurrency = 'ETH' +export let MAIN_CURRENCY = 'ETH' +export let CHAIN_ID = 1 if(ls) { - nameCurrentMainCurrency = JSON.parse(ls).currentChain.symbol + MAIN_CURRENCY = JSON.parse(ls).currentChain.symbol } -export function getListTokensByChain(chainId: string) { -console.log("🚀 ~ file: lists.ts ~ line 10 ~ getListTokensByChain ~ chainId", chainId) - +export const DEFAULT_ACTIVE_LIST_URLS: string[] = [] +export function getListTokensByChain(currency: string, chainId: number) { +console.log("🚀 ~ file: lists.ts ~ line 11 ~ getListTokensByChain ~ chainId", chainId) +CHAIN_ID = chainId +const DEFAULT_LIST_OF_LISTS: string[] = listTokensFomChains[`${currency}List`] +MAIN_CURRENCY = currency +return {DEFAULT_LIST_OF_LISTS, DEFAULT_TOKEN_LIST_URL, DEFAULT_ACTIVE_LIST_URLS, MAIN_CURRENCY, CHAIN_ID} } @@ -65,9 +70,3 @@ const listTokensFomChains = { ], BNBList: [] } -// lower index == higher priority for token import - -export const DEFAULT_LIST_OF_LISTS: string[] = listTokensFomChains[`${nameCurrentMainCurrency}List`] - -// default lists to be 'active' aka searched across -export const DEFAULT_ACTIVE_LIST_URLS: string[] = [DEFAULT_LIST_OF_LISTS[0]] diff --git a/src/state/crosschain/hooks.ts b/src/state/crosschain/hooks.ts index 5284bb27424..292906f15aa 100644 --- a/src/state/crosschain/hooks.ts +++ b/src/state/crosschain/hooks.ts @@ -30,6 +30,7 @@ import { initialState } from './reducer' import { useActiveWeb3React } from '../../hooks' import { useEffect } from 'react' import useGasPrice from 'hooks/useGasPrice' +import { switchNewList } from 'state/lists/actions' // import { afterWrite } from '@popperjs/core' @@ -564,6 +565,9 @@ export function useCrossChain() { chain: GetCurrentChain(currentChainName) }) ) + dispatch( + switchNewList({newCurrency:GetCurrentChain(currentChainName)?.symbol ?? 'ETH', chainNumber: (!chainId) ? 1 : chainId}) + ) dispatch(setTransferAmount({ amount: '' })) UpdateOwnTokenBalance().catch(console.error) UpdateFee().catch(console.error) diff --git a/src/state/lists/actions.ts b/src/state/lists/actions.ts index 9114ad540bb..c8edf590f2c 100644 --- a/src/state/lists/actions.ts +++ b/src/state/lists/actions.ts @@ -1,6 +1,6 @@ import { ActionCreatorWithPayload, createAction } from '@reduxjs/toolkit' import { TokenList, Version } from '@uniswap/token-lists' - +type ChainType = {newCurrency: string, chainNumber: number} export const fetchTokenList: Readonly<{ pending: ActionCreatorWithPayload<{ url: string; requestId: string }> fulfilled: ActionCreatorWithPayload<{ url: string; tokenList: TokenList; requestId: string }> @@ -16,3 +16,4 @@ export const addList = createAction('lists/addList') export const removeList = createAction('lists/removeList') export const selectList = createAction('lists/selectList') export const rejectVersionUpdate = createAction('lists/rejectVersionUpdate') +export const switchNewList = createAction('lists/switchNewList') diff --git a/src/state/lists/reducer.ts b/src/state/lists/reducer.ts index 2d8b1b98135..35ad028b5fa 100644 --- a/src/state/lists/reducer.ts +++ b/src/state/lists/reducer.ts @@ -1,39 +1,35 @@ import { createReducer } from '@reduxjs/toolkit' import { getVersionUpgrade, VersionUpgrade } from '@uniswap/token-lists' import { TokenList } from '@uniswap/token-lists/dist/types' -import { DEFAULT_LIST_OF_LISTS, DEFAULT_TOKEN_LIST_URL, getListTokensByChain } from '../../constants/lists' +import { getListTokensByChain, MAIN_CURRENCY, CHAIN_ID } from '../../constants/lists' import { updateVersion } from '../global/actions' -import { acceptListUpdate, addList, fetchTokenList, removeList, selectList } from './actions' - +import { acceptListUpdate, addList, fetchTokenList, removeList, selectList, switchNewList } from './actions' +const { DEFAULT_TOKEN_LIST_URL, DEFAULT_LIST_OF_LISTS } = getListTokensByChain(MAIN_CURRENCY, CHAIN_ID) export interface ListsState { readonly byUrl: { readonly [url: string]: { readonly current: TokenList | null readonly pendingUpdate: TokenList | null readonly loadingRequestId: string | null - readonly error: string | null + readonly error: string | null, + readonly firstCurrency: string | null } } // this contains the default list of lists from the last time the updateVersion was called, i.e. the app was reloaded readonly lastInitializedDefaultListOfLists?: string[] readonly selectedListUrl: string | undefined + readonly mainCurrency: string } -const ls = localStorage.getItem('redux_localstorage_simple_crosschain') -let nameCurrentMainCurrency = 'ETH' -if(ls) { - nameCurrentMainCurrency = JSON.parse(ls).currentChain.symbol - getListTokensByChain(nameCurrentMainCurrency) -} - -type ListState = ListsState['byUrl'][string] +type ListState = ListsState['byUrl'][string] const NEW_LIST_STATE: ListState = { error: null, current: null, loadingRequestId: null, - pendingUpdate: null + pendingUpdate: null, + firstCurrency: null } type Mutable = { -readonly [P in keyof T]: T[P] extends ReadonlyArray ? U[] : T[P] } @@ -46,7 +42,8 @@ const initialState: ListsState = { return memo }, {}) }, - selectedListUrl: DEFAULT_TOKEN_LIST_URL + selectedListUrl: DEFAULT_TOKEN_LIST_URL, + mainCurrency: MAIN_CURRENCY } export default createReducer(initialState, builder => @@ -57,7 +54,8 @@ export default createReducer(initialState, builder => pendingUpdate: null, ...state.byUrl[url], loadingRequestId: requestId, - error: null + error: null, + firstCurrency: null } }) .addCase(fetchTokenList.fulfilled, (state, { payload: { requestId, tokenList, url } }) => { @@ -74,7 +72,8 @@ export default createReducer(initialState, builder => loadingRequestId: null, error: null, current: current, - pendingUpdate: tokenList + pendingUpdate: tokenList, + firstCurrency: MAIN_CURRENCY } } } else { @@ -83,7 +82,8 @@ export default createReducer(initialState, builder => loadingRequestId: null, error: null, current: tokenList, - pendingUpdate: null + pendingUpdate: null, + firstCurrency: MAIN_CURRENCY } } }) @@ -98,7 +98,8 @@ export default createReducer(initialState, builder => loadingRequestId: null, error: errorMessage, current: null, - pendingUpdate: null + pendingUpdate: null, + firstCurrency: null } }) .addCase(selectList, (state, { payload: url }) => { @@ -131,19 +132,40 @@ export default createReducer(initialState, builder => current: state.byUrl[url].pendingUpdate } }) + .addCase(switchNewList, (state, { payload: {newCurrency, chainNumber} }) => { + if (MAIN_CURRENCY !== newCurrency) { + const newList = getListTokensByChain(newCurrency, chainNumber) + //if(state.lastInitializedDefaultListOfLists) { + const keys = Object.keys(state.byUrl) + keys.map( url => { + delete state.byUrl[url] + }) + + // } + + state.lastInitializedDefaultListOfLists = newList.DEFAULT_LIST_OF_LISTS + state.mainCurrency = newList.MAIN_CURRENCY + newList.DEFAULT_LIST_OF_LISTS.forEach(listUrl => { + state.byUrl[listUrl] = NEW_LIST_STATE + }) + } + } + + ) .addCase(updateVersion, state => { // state loaded from localStorage, but new lists have never been initialized + const newList = getListTokensByChain(MAIN_CURRENCY, CHAIN_ID) if (!state.lastInitializedDefaultListOfLists) { state.byUrl = initialState.byUrl - state.selectedListUrl = DEFAULT_TOKEN_LIST_URL + state.selectedListUrl = newList.DEFAULT_TOKEN_LIST_URL } else if (state.lastInitializedDefaultListOfLists) { const lastInitializedSet = state.lastInitializedDefaultListOfLists.reduce>( (s, l) => s.add(l), new Set() ) - const newListOfListsSet = DEFAULT_LIST_OF_LISTS.reduce>((s, l) => s.add(l), new Set()) + const newListOfListsSet = newList.DEFAULT_LIST_OF_LISTS.reduce>((s, l) => s.add(l), new Set()) - DEFAULT_LIST_OF_LISTS.forEach(listUrl => { + newList.DEFAULT_LIST_OF_LISTS.forEach(listUrl => { if (!lastInitializedSet.has(listUrl)) { state.byUrl[listUrl] = NEW_LIST_STATE } @@ -156,12 +178,13 @@ export default createReducer(initialState, builder => }) } - state.lastInitializedDefaultListOfLists = DEFAULT_LIST_OF_LISTS + state.lastInitializedDefaultListOfLists = newList.DEFAULT_LIST_OF_LISTS + state.mainCurrency = newList.MAIN_CURRENCY if (!state.selectedListUrl) { - state.selectedListUrl = DEFAULT_TOKEN_LIST_URL - if (!state.byUrl[DEFAULT_TOKEN_LIST_URL]) { - state.byUrl[DEFAULT_TOKEN_LIST_URL] = NEW_LIST_STATE + state.selectedListUrl = newList.DEFAULT_TOKEN_LIST_URL + if (!state.byUrl[newList.DEFAULT_TOKEN_LIST_URL]) { + state.byUrl[newList.DEFAULT_TOKEN_LIST_URL] = NEW_LIST_STATE } } }) diff --git a/src/state/lists/updater.ts b/src/state/lists/updater.ts index 6a70a5d2484..5354be409bb 100644 --- a/src/state/lists/updater.ts +++ b/src/state/lists/updater.ts @@ -29,7 +29,7 @@ export default function Updater(): null { }, [fetchList, isWindowVisible, lists]) // fetch all lists every 10 minutes, but only after we initialize library - useInterval(fetchAllListsCallback, library ? 10 * 60 * 10 : null) + useInterval(fetchAllListsCallback, library ? 1000 * 60 * 10 : null) // whenever a list is not loaded and not loading, try again to load it useEffect(() => { diff --git a/src/state/swap/hooks.ts b/src/state/swap/hooks.ts index 93eb89b5202..92c6f5b6dce 100644 --- a/src/state/swap/hooks.ts +++ b/src/state/swap/hooks.ts @@ -19,6 +19,7 @@ import useParsedQueryString from '../../hooks/useParsedQueryString' import useToggledVersion from '../../hooks/useToggledVersion' import { useUserSlippageTolerance } from '../user/hooks' import { useV1Trade } from '../../data/V1' + export function useSwapState(): AppState['swap'] { return useSelector(state => state.swap) @@ -55,8 +56,9 @@ export function useSwapActionHandlers(): { }, [dispatch] ) - + const onSwitchTokens = useCallback(() => { + dispatch(switchCurrencies()) }, [dispatch]) From 46fb051d452d8270f7318d0b12d7a61b2be9006a Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Fri, 2 Apr 2021 15:33:28 +0300 Subject: [PATCH 5/6] add pangolin exchange list --- src/components/SearchModal/CurrencySearch.tsx | 58 +++++++++---------- src/components/SearchModal/ListSelect.tsx | 2 +- src/constants/lists.ts | 1 - src/state/crosschain/hooks.ts | 2 +- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/components/SearchModal/CurrencySearch.tsx b/src/components/SearchModal/CurrencySearch.tsx index fd803a9b756..028a815d907 100644 --- a/src/components/SearchModal/CurrencySearch.tsx +++ b/src/components/SearchModal/CurrencySearch.tsx @@ -64,13 +64,13 @@ export function CurrencySearch({ // ChainId.RINKEBY BUSD const availableTokensArray = isCrossChain ? availableTokens - .filter(a => a.name !== 'BUSD') - .map((x: any) => { - return new Token(x.chainId, x.address, x.decimals, x.symbol, x.name) - }) - : availableTokens.map((x: any) => { + .filter(a => a.name !== 'BUSD') + .map((x: any) => { return new Token(x.chainId, x.address, x.decimals, x.symbol, x.name) }) + : availableTokens.map((x: any) => { + return new Token(x.chainId, x.address, x.decimals, x.symbol, x.name) + }) const defaultTokenList = DEFAULT_TOKEN_LIST.filter((x: any) => x.chainId === chainId).map((x: any) => { return new Token(x.chainId, x.address, x.decimals, x.symbol, x.name) @@ -154,33 +154,29 @@ export function CurrencySearch({ }, [filteredSortedTokens, handleCurrencySelect, searchQuery] ) - + let selectedListInfo = useSelectedListInfo() - if(selectedListInfo === undefined ) { - selectedListInfo = {} as { current: TokenList | null; pending: TokenList | null; loading: boolean; } - } - let newList = filteredSortedTokens; - if(selectedListInfo ) { - selectedListInfo?.current?.tokens?.map(token => { - const index = filteredSortedTokens.findIndex(function(tk, index) { - if(tk.address == token.address && chainId === token.chainId) { - return true; - } else { - return false; - } - - - }); - if(index === -1) { - const newToken = new Token( token.chainId, token.address, token.decimals, token.symbol, token.name ) - filteredSortedTokens.push(newToken) - } - - - }) - filteredSortedTokens = filteredSortedTokens.filter(token => token.chainId !== chainId) - - } + const newSelectedList = useSelectedListInfo() + //let totalList = useRef(() => { + + if (selectedListInfo === undefined) { + selectedListInfo = {} as { current: TokenList | null; pending: TokenList | null; loading: boolean; } + } + let newList: Token[] = [] + + let tokenMergeLength = 0 + if (newSelectedList && newSelectedList.current && newSelectedList.current.tokens && filteredSortedTokens) { + tokenMergeLength = newSelectedList.current.tokens.length + filteredSortedTokens.length + } + if (selectedListInfo.current?.tokens?.length !== tokenMergeLength) { + const arrSortedTokens: Token[] = [] + selectedListInfo?.current?.tokens?.map(token => { + arrSortedTokens.push(new Token(token.chainId, token.address, token.decimals, token.symbol, token.name)) + + }) + newList = arrSortedTokens.concat(filteredSortedTokens) + filteredSortedTokens = newList + } return ( diff --git a/src/components/SearchModal/ListSelect.tsx b/src/components/SearchModal/ListSelect.tsx index b2f30a0b55d..3da901f3b14 100644 --- a/src/components/SearchModal/ListSelect.tsx +++ b/src/components/SearchModal/ListSelect.tsx @@ -10,7 +10,7 @@ import { useOnClickOutside } from '../../hooks/useOnClickOutside' import useToggle from '../../hooks/useToggle' import { AppDispatch, AppState } from '../../state' -import { acceptListUpdate, removeList, selectList} from '../../state/lists/actions' +import { acceptListUpdate, removeList, selectList } from '../../state/lists/actions' import { useSelectedListUrl } from '../../state/lists/hooks' import { CloseIcon, ExternalLink, LinkStyledButton, TYPE } from '../../theme' import listVersionLabel from '../../utils/listVersionLabel' diff --git a/src/constants/lists.ts b/src/constants/lists.ts index 65f37070bf9..a92e4cc7abc 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -9,7 +9,6 @@ if(ls) { export const DEFAULT_ACTIVE_LIST_URLS: string[] = [] export function getListTokensByChain(currency: string, chainId: number) { -console.log("🚀 ~ file: lists.ts ~ line 11 ~ getListTokensByChain ~ chainId", chainId) CHAIN_ID = chainId const DEFAULT_LIST_OF_LISTS: string[] = listTokensFomChains[`${currency}List`] MAIN_CURRENCY = currency diff --git a/src/state/crosschain/hooks.ts b/src/state/crosschain/hooks.ts index 292906f15aa..eb55756d1a6 100644 --- a/src/state/crosschain/hooks.ts +++ b/src/state/crosschain/hooks.ts @@ -566,7 +566,7 @@ export function useCrossChain() { }) ) dispatch( - switchNewList({newCurrency:GetCurrentChain(currentChainName)?.symbol ?? 'ETH', chainNumber: (!chainId) ? 1 : chainId}) + switchNewList({ newCurrency: GetCurrentChain(currentChainName)?.symbol ?? 'ETH', chainNumber: (!chainId) ? 1 : chainId }) ) dispatch(setTransferAmount({ amount: '' })) UpdateOwnTokenBalance().catch(console.error) From c59690348e55ed5c6fb76c0c81d4c4d67703af7e Mon Sep 17 00:00:00 2001 From: mrbot22 Date: Fri, 2 Apr 2021 18:33:31 +0300 Subject: [PATCH 6/6] changed avax token links --- src/constants/lists.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/constants/lists.ts b/src/constants/lists.ts index a92e4cc7abc..294b82350cb 100644 --- a/src/constants/lists.ts +++ b/src/constants/lists.ts @@ -36,10 +36,10 @@ const GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json' // const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json' // from https://pangolin.exchange/ exchanges -const AVAX_DEFI = 'https://raw.githubusercontent.com/pangolindex/tokenlists/main/defi.tokenlist.json' -const AVAX_TOP_15 = 'https://raw.githubusercontent.com/pangolindex/tokenlists/main/top15.tokenlist.json' -const AVAX_ETH = 'https://raw.githubusercontent.com/pangolindex/tokenlists/main/aeb.tokenlist.json' -const AVAX_STABLECOINS = 'https://raw.githubusercontent.com/pangolindex/tokenlists/main/stablecoin.tokenlist.json' +const AVAX_DEFI = 'https://raw.githubusercontent.com/zeroexchange/app/master/tokens-of-exchanges/avalanche/defi.tokenlist.json' +const AVAX_TOP_15 = 'https://raw.githubusercontent.com/zeroexchange/app/master/tokens-of-exchanges/avalanche/top15.tokenlist.json' +const AVAX_ETH = 'https://raw.githubusercontent.com/zeroexchange/app/master/tokens-of-exchanges/avalanche/aeb.tokenlist.json' +const AVAX_STABLECOINS = 'https://raw.githubusercontent.com/zeroexchange/app/master/tokens-of-exchanges/avalanche/stablecoin.tokenlist.json' // used to mark unsupported tokens, these are hosted lists of unsupported tokens