-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat: Dynamically load tokenlists for Orbit chains #2135
Changes from 3 commits
5bd0e1a
b6911af
04105b9
12b7446
53ce54e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,13 @@ import CoinGeckoLogo from '@/images/lists/coinGecko.svg' | |
import ArbitrumLogo from '@/images/lists/ArbitrumLogo.png' | ||
import { ArbTokenBridge } from '../hooks/arbTokenBridge.types' | ||
import { ChainId } from './networks' | ||
import orbitChainsData from './orbitChainsData.json' | ||
|
||
export const SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID = 0 | ||
export const SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID = | ||
'SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID' | ||
|
||
export interface BridgeTokenList { | ||
id: number | ||
id: string | ||
originChainID: number | ||
url: string | ||
name: string | ||
|
@@ -34,39 +36,39 @@ export const BRIDGE_TOKEN_LISTS: BridgeTokenList[] = [ | |
isArbitrumTokenTokenList: true | ||
}, | ||
{ | ||
id: 1, | ||
id: '1', | ||
originChainID: ChainId.ArbitrumOne, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_arb_whitelist_era.json', | ||
name: 'Arbitrum Whitelist Era', | ||
isDefault: true, | ||
logoURI: ArbitrumLogo | ||
}, | ||
{ | ||
id: 2, | ||
id: '2', | ||
originChainID: ChainId.ArbitrumOne, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs_default.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}, | ||
{ | ||
id: 4, | ||
id: '4', | ||
originChainID: ChainId.ArbitrumOne, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_coingecko.json', | ||
name: 'Arbed CoinGecko List', | ||
isDefault: true, | ||
logoURI: CoinGeckoLogo | ||
}, | ||
{ | ||
id: 5, | ||
id: '5', | ||
originChainID: ChainId.ArbitrumOne, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_coinmarketcap.json', | ||
name: 'Arbed CMC List', | ||
isDefault: false, | ||
logoURI: CMCLogo | ||
}, | ||
{ | ||
id: 6, | ||
id: '6', | ||
originChainID: ChainId.ArbitrumNova, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_uniswap_labs_default.json', | ||
name: 'Arbed Uniswap List', | ||
|
@@ -78,7 +80,7 @@ export const BRIDGE_TOKEN_LISTS: BridgeTokenList[] = [ | |
// TODO: remove list for chain ID 412346 after fix: | ||
// https://github.com/OffchainLabs/arb-token-bridge/issues/564 | ||
{ | ||
id: 9, | ||
id: '9', | ||
// Local node | ||
originChainID: ChainId.ArbitrumLocal, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/421613_arbed_coinmarketcap.json', | ||
|
@@ -87,7 +89,7 @@ export const BRIDGE_TOKEN_LISTS: BridgeTokenList[] = [ | |
logoURI: CMCLogo | ||
}, | ||
{ | ||
id: 10, | ||
id: '10', | ||
originChainID: ChainId.ArbitrumSepolia, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
|
@@ -96,76 +98,57 @@ export const BRIDGE_TOKEN_LISTS: BridgeTokenList[] = [ | |
}, | ||
// CoinGecko | ||
{ | ||
id: 11, | ||
id: '11', | ||
originChainID: ChainId.ArbitrumNova, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_coingecko.json', | ||
name: 'Arbed CoinGecko List', | ||
isDefault: true, | ||
logoURI: CoinGeckoLogo | ||
}, | ||
{ | ||
id: 13, | ||
id: '13', | ||
originChainID: ChainId.ArbitrumSepolia, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_coingecko.json', | ||
name: 'Arbed CoinGecko List', | ||
isDefault: true, | ||
logoURI: CoinGeckoLogo | ||
}, | ||
// Orbit | ||
{ | ||
id: 14, | ||
// Xai | ||
originChainID: 660279, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/660279_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}, | ||
{ | ||
id: 660279, | ||
id: '660279', | ||
// Xai | ||
originChainID: 660279, | ||
url: 'tokenLists/660279_default.json', | ||
name: 'XAI Default List', | ||
isDefault: true, | ||
logoURI: '/images/XaiLogo.svg' | ||
}, | ||
{ | ||
id: 15, | ||
// Rari | ||
originChainID: 1380012617, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/1380012617_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}, | ||
{ | ||
id: 16, | ||
// Muster | ||
originChainID: 4078, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/4078_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}, | ||
{ | ||
id: 17, | ||
// Proof of Play Apex | ||
originChainID: 70700, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/70700_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}, | ||
{ | ||
id: 19, | ||
// SX Network | ||
originChainID: 4162, | ||
url: 'https://tokenlist.arbitrum.io/ArbTokenLists/4162_arbed_uniswap_labs.json', | ||
name: 'Arbed Uniswap List', | ||
isDefault: true, | ||
logoURI: UniswapLogo | ||
} | ||
// For all orbit chains, | ||
...orbitChainsData.mainnet | ||
.concat(orbitChainsData.testnet) | ||
.reduce((acc, chain) => { | ||
// Only include arbified native token list for L3 settling to ArbOne | ||
if (chain.parentChainId === ChainId.ArbitrumOne) { | ||
acc.push({ | ||
id: `${chain.chainId}_native`, | ||
originChainID: chain.chainId, | ||
url: `https://tokenlist.arbitrum.io/ArbTokenLists/${chain.chainId}_arbed_native_list.json`, | ||
name: `${chain.name} Arbed L2 native list`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a note: if the user has some local storage (visited the bridge before), these new lists seem to be off by default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
isDefault: true, | ||
logoURI: ArbitrumLogo | ||
}) | ||
} | ||
|
||
acc.push({ | ||
id: `${chain.chainId}_uniswap`, | ||
originChainID: chain.chainId, | ||
url: `https://tokenlist.arbitrum.io/ArbTokenLists/${chain.chainId}_arbed_uniswap_labs.json`, | ||
name: `${chain.name} Arbed Uniswap List`, | ||
fionnachan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
isDefault: true, | ||
logoURI: UniswapLogo | ||
}) | ||
|
||
return acc | ||
}, [] as BridgeTokenList[]) | ||
] | ||
|
||
export const listIdsToNames: { [key: string]: string } = {} | ||
|
@@ -176,7 +159,7 @@ BRIDGE_TOKEN_LISTS.forEach(bridgeTokenList => { | |
|
||
export interface TokenListWithId extends TokenList { | ||
l2ChainId: string | ||
bridgeTokenListId: number | ||
bridgeTokenListId: string | ||
isValid?: boolean | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should unify the id syntax and use
${chain.chainId}_native
or${chain.chainId}_uniswap
or_cmc
etc, then tighten the type