Skip to content

Commit

Permalink
fix: display Uniswap token list in UI (#2821)
Browse files Browse the repository at this point in the history
* fix: display Uniswap token list in UI

* chore: remove default-token-list build dependency

* fix: use ENS name for Uniswap token list

* fix: change Uniswap token list url
  • Loading branch information
bkrochta authored Dec 14, 2021
1 parent e2baa05 commit 37e0857
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@types/wcag-contrast": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"@uniswap/default-token-list": "^2.1.0",
"@uniswap/governance": "^1.0.2",
"@uniswap/liquidity-staker": "^1.0.2",
"@uniswap/merkle-distributor": "1.0.1",
Expand Down
4 changes: 3 additions & 1 deletion src/constants/lists.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const UNI_LIST = 'https://tokens.uniswap.org'
const AAVE_LIST = 'tokenlist.aave.eth'
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json'
const CMC_ALL_LIST = 'https://api.coinmarketcap.com/data-api/v3/uniswap/all.json'
Expand All @@ -16,6 +17,7 @@ export const UNSUPPORTED_LIST_URLS: string[] = [BA_LIST]
// this is the default list of lists that are exposed to users
// lower index == higher priority for token import
const DEFAULT_LIST_OF_LISTS_TO_DISPLAY: string[] = [
UNI_LIST,
COMPOUND_LIST,
AAVE_LIST,
CMC_ALL_LIST,
Expand All @@ -35,4 +37,4 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
]

// default lists to be 'active' aka searched across
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [GEMINI_LIST]
export const DEFAULT_ACTIVE_LIST_URLS: string[] = [UNI_LIST, GEMINI_LIST]
5 changes: 1 addition & 4 deletions src/state/lists/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DEFAULT_TOKEN_LIST from '@uniswap/default-token-list'
import { TokenList } from '@uniswap/token-lists'
import { useMemo } from 'react'
import { useAppSelector } from 'state/hooks'
Expand Down Expand Up @@ -42,8 +41,6 @@ function listToTokenMap(list: TokenList): TokenAddressMap {
return map
}

const TRANSFORMED_DEFAULT_TOKEN_LIST = listToTokenMap(DEFAULT_TOKEN_LIST)

export function useAllLists(): AppState['lists']['byUrl'] {
return useAppSelector((state) => state.lists.byUrl)
}
Expand Down Expand Up @@ -116,7 +113,7 @@ export function useInactiveListUrls(): string[] {
export function useCombinedActiveList(): TokenAddressMap {
const activeListUrls = useActiveListUrls()
const activeTokens = useCombinedTokenMapFromUrls(activeListUrls)
return useMemo(() => combineMaps(activeTokens, TRANSFORMED_DEFAULT_TOKEN_LIST), [activeTokens])
return activeTokens
}

// list of tokens not supported on interface for various reasons, used to show warnings and prevent swaps and adds
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4542,11 +4542,6 @@
"@typescript-eslint/types" "4.30.0"
eslint-visitor-keys "^2.0.0"

"@uniswap/default-token-list@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-2.1.0.tgz#06dc33fbdb3bc4c507d4e9ac8b8b62ef5b252c8d"
integrity sha512-Cd2CrtZ+rNk55txvO76EEZRWOyojX+YyY0xxVjiMN00Y9nKDCftYoUNvwy9d+VuTySYjyCAVUef4PdcongZAPg==

"@uniswap/governance@^1.0.2":
version "1.0.2"
resolved "https://registry.npmjs.org/@uniswap/governance/-/governance-1.0.2.tgz"
Expand Down

0 comments on commit 37e0857

Please sign in to comment.