Skip to content

Commit 800457c

Browse files
authored
fix: hard code fix for virtual on base (#12080)
1 parent 6a5bad3 commit 800457c

File tree

1 file changed

+20
-8
lines changed
  • packages/shared/src/UI/components/FungibleTokenList

1 file changed

+20
-8
lines changed

packages/shared/src/UI/components/FungibleTokenList/index.tsx

+20-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import {
1919
} from '@masknet/web3-hooks-base'
2020
import {
2121
CurrencyType,
22+
TokenType,
2223
ZERO,
2324
currySameAddress,
2425
isSameAddress,
2526
leftShift,
2627
toZero,
2728
type FungibleToken,
2829
} from '@masknet/web3-shared-base'
29-
import { AddressType } from '@masknet/web3-shared-evm'
30+
import { AddressType, ChainId as EvmChainId, SchemaType } from '@masknet/web3-shared-evm'
3031
import { uniqBy } from 'lodash-es'
3132
import { useCallback, useEffect, useMemo, useState, useTransition } from 'react'
3233
import { getFungibleTokenItem } from './FungibleTokenItem.js'
@@ -105,13 +106,24 @@ export function FungibleTokenList<T extends NetworkPluginID>(props: FungibleToke
105106
const nativeToken = useMemo(() => Utils.chainResolver.nativeCurrency(chainId), [chainId])
106107

107108
const filteredFungibleTokens = useMemo(() => {
108-
const allFungibleTokens =
109-
extendTokens ?
110-
uniqBy(
111-
[...(nativeToken ? [nativeToken] : []), ...tokens, ...fungibleTokens, ...trustedFungibleTokens],
112-
(x) => x.address.toLowerCase(),
113-
)
114-
: tokens
109+
const merged = [...(nativeToken ? [nativeToken] : []), ...tokens, ...fungibleTokens, ...trustedFungibleTokens]
110+
if (chainId === EvmChainId.Base) {
111+
if (!merged.some((x) => x.symbol === 'VIRTUAL')) {
112+
merged.push({
113+
id: '0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b',
114+
type: TokenType.Fungible,
115+
schema: SchemaType.ERC20,
116+
chainId: 8453,
117+
address: '0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b',
118+
name: 'Virtual Protocol',
119+
symbol: 'VIRTUAL',
120+
decimals: 18,
121+
logoURL:
122+
'https://www.okx.com/cdn/web3/currency/token/8453-0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b-97.png/type=default_350_0?v=1732307157464',
123+
})
124+
}
125+
}
126+
const allFungibleTokens = extendTokens ? uniqBy(merged, (x) => x.address.toLowerCase()) : tokens
115127

116128
const blockedTokenAddresses = new Map(blockedFungibleTokens.map((x) => [x.address.toLowerCase(), true]))
117129
const includeMap = includeTokens ? new Map(includeTokens.map((x) => [x.toLowerCase(), true])) : null

0 commit comments

Comments
 (0)