Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display Uniswap token list in UI #2821

Merged
merged 5 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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://gateway.ipfs.io/ipns/tokens.uniswap.org'
moodysalem marked this conversation as resolved.
Show resolved Hide resolved
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
moodysalem marked this conversation as resolved.
Show resolved Hide resolved
}

// 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 @@ -4554,11 +4554,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