Skip to content

Commit

Permalink
[Release] Hotfix 2.26.0 => 2.26.1 (patch) (#11653)
Browse files Browse the repository at this point in the history
* chore: bump version to 2.26.1

* fix: try to fix runtime bug

* Revert "fix: try to fix runtime bug"

This reverts commit 0c727f3.

* chore: clean ci cache

* feat: mf-6113 add sei chain (#11505)

* feat: mf-6113 add sei chain

* fixup! feat: mf-6113 add sei chain

* fix: token balance in token picker

* fix: redpacket chain list

* fix: mf-6288 approve token

* fix: specific network

---------

Co-authored-by: Jack Works <[email protected]>
Co-authored-by: Wukong Sun <[email protected]>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent b4cd833 commit 380e2ce
Show file tree
Hide file tree
Showing 26 changed files with 126 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
uses: actions/cache@v4
with:
path: packages/mask/node_modules/.cache/
key: extension-${{ hashFiles('pnpm-lock.yaml') }}-${{ steps.get-date.outputs.date }}
key: extension-v2-${{ hashFiles('pnpm-lock.yaml') }}-${{ steps.get-date.outputs.date }}
restore-keys: |
extension-${{ hashFiles('pnpm-lock.yaml') }}
extension-
extension-v2-${{ hashFiles('pnpm-lock.yaml') }}
extension-v2-
- run: git config --global url."https://github.com/".insteadOf [email protected]
- run: pnpm install
- run: npx gulp build-ci
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.26.0",
"version": "2.26.1",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
16 changes: 9 additions & 7 deletions packages/mask/popups/components/TokenPicker/TokenItem.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { Icons } from '@masknet/icons'
import { NetworkIcon, ProgressiveText, TokenIcon } from '@masknet/shared'
import { NetworkPluginID } from '@masknet/shared-base'
import { useEverSeen } from '@masknet/shared-base-ui'
import { makeStyles } from '@masknet/theme'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useFungibleTokenBalance, useWeb3Utils } from '@masknet/web3-hooks-base'
import { isZero, type ReasonableNetwork } from '@masknet/web3-shared-base'
import { CHAIN_ID_TO_DEBANK_CHAIN_MAP } from '@masknet/web3-providers'
import { type ReasonableNetwork } from '@masknet/web3-shared-base'
import type { ChainId } from '@masknet/web3-shared-evm'
import {
Box,
Link,
ListItem,
ListItemIcon,
ListItemText,
Typography,
type ListItemProps,
useForkRef,
type ListItemProps,
} from '@mui/material'
import { memo, useEffect, useMemo, useRef } from 'react'
import { formatTokenBalance } from '../../../shared/index.js'
import { useMaskSharedTrans } from '../../../shared-ui/index.js'
import { NetworkPluginID } from '@masknet/shared-base'
import { useEverSeen } from '@masknet/shared-base-ui'
import type { ChainId } from '@masknet/web3-shared-evm'
import { formatTokenBalance } from '../../../shared/index.js'

const useStyles = makeStyles()((theme) => {
return {
Expand Down Expand Up @@ -108,7 +109,8 @@ export const TokenItem = memo(function TokenItem({
const providerURL = network?.isCustomized ? network.rpcUrl : undefined
const [seen, ref] = useEverSeen<HTMLLIElement>()
// Debank might not provide asset from current custom network
const tryRpc = (!asset.balance || isZero(asset.balance)) && network?.isCustomized && seen
const supportedByDebank = CHAIN_ID_TO_DEBANK_CHAIN_MAP[asset.chainId]
const tryRpc = !supportedByDebank && seen
const { data: rpcBalance, isPending } = useFungibleTokenBalance(
NetworkPluginID.PLUGIN_EVM,
asset.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NetworkPluginID, PopupRoutes } from '@masknet/shared-base'
import { useEverSeen } from '@masknet/shared-base-ui'
import { TextOverflowTooltip, makeStyles } from '@masknet/theme'
import { useFungibleTokenBalance, useNetworks, useWallet } from '@masknet/web3-hooks-base'
import { formatCurrency, isGte, isLessThan, isZero, type FungibleAsset } from '@masknet/web3-shared-base'
import { formatCurrency, isGte, isLessThan, type FungibleAsset } from '@masknet/web3-shared-base'
import { isNativeTokenAddress, ChainId, type SchemaType } from '@masknet/web3-shared-evm'
import { Box, List, ListItem, ListItemText, Skeleton, Typography, type ListItemProps } from '@mui/material'
import { range } from 'lodash-es'
Expand All @@ -14,6 +14,7 @@ import { formatTokenBalance } from '../../../../../shared/index.js'
import { useMaskSharedTrans } from '../../../../../shared-ui/index.js'
import { useAssetExpand, useWalletAssets } from '../../hooks/index.js'
import { MoreBar } from './MoreBar.js'
import { CHAIN_ID_TO_DEBANK_CHAIN_MAP } from '@masknet/web3-providers'

const useStyles = makeStyles<{ hasNav?: boolean }>()((theme, { hasNav }) => ({
container: {
Expand Down Expand Up @@ -99,11 +100,7 @@ const AssetItem = memo(function AssetItem({ asset, onItemClick, ...rest }: Asset
const providerURL = network?.isCustomized ? network.rpcUrl : undefined
const [seen, ref] = useEverSeen<HTMLLIElement>()
// Debank might not provide asset from current custom network
// TODO Temporarily get XLayer balance via rpc
const tryRpc =
(!asset.balance || isZero(asset.balance)) &&
(network?.isCustomized || network?.chainId === ChainId.XLayer) &&
seen
const tryRpc = !CHAIN_ID_TO_DEBANK_CHAIN_MAP[network?.chainId!] && seen
const { data: rpcBalance, isPending } = useFungibleTokenBalance(
NetworkPluginID.PLUGIN_EVM,
asset.address,
Expand Down
19 changes: 10 additions & 9 deletions packages/plugins/RedPacket/src/SiteAdaptor/RedPacketDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useContext, useMemo, useState, Suspense } from 'react'
import * as web3_utils from /* webpackDefer: true */ 'web3-utils'
import { DialogContent, Tab, useTheme } from '@mui/material'
import { TabContext, TabPanel } from '@mui/lab'
import { CrossIsolationMessages, EMPTY_LIST, NetworkPluginID, PluginID } from '@masknet/shared-base'
import { CrossIsolationMessages, NetworkPluginID, PluginID } from '@masknet/shared-base'
import { useChainContext, useGasPrice } from '@masknet/web3-hooks-base'
import {
ApplicationBoardModal,
Expand All @@ -15,7 +15,6 @@ import { ChainId, type GasConfig, GasEditor } from '@masknet/web3-shared-evm'
import { type FireflyRedPacketAPI, type RedPacketJSONPayload } from '@masknet/web3-providers/types'
import { makeStyles, MaskTabList, useTabs } from '@masknet/theme'
import {
useActivatedPluginSiteAdaptor,
useCurrentVisitingIdentity,
useLastRecognizedIdentity,
useSiteThemeMode,
Expand All @@ -40,6 +39,7 @@ import type { FireflyContext, FireflyRedpacketSettings } from '../types.js'
import { FireflyRedpacketConfirmDialog } from './FireflyRedpacketConfirmDialog.js'
import { RedPacketPast } from './RedPacketPast.js'
import { CompositionTypeContext } from './RedPacketInjection.js'
import { base } from '../base.js'

const useStyles = makeStyles<{ scrollY: boolean; isDim: boolean }>()((theme, { isDim, scrollY }) => {
// it's hard to set dynamic color, since the background color of the button is blended transparent
Expand Down Expand Up @@ -100,20 +100,21 @@ export default function RedPacketDialog(props: RedPacketDialogProps) {

const [isNFTRedPacketLoaded, setIsNFTRedPacketLoaded] = useState(false)
const { account, chainId: contextChainId, setChainId } = useChainContext<NetworkPluginID.PLUGIN_EVM>()
const definition = useActivatedPluginSiteAdaptor.visibility.useAnyMode(PluginID.RedPacket)
const [currentTab, onChange, tabs] = useTabs('tokens', 'collectibles')
const [currentHistoryTab, onChangeHistoryTab, historyTabs] = useTabs('claimed', 'sent')
const theme = useTheme()
const mode = useSiteThemeMode(theme)

const { classes } = useStyles({ isDim: mode === 'dim', scrollY: !showHistory && currentTab === 'tokens' })

const chainIdList: ChainId[] = useMemo(() => {
if (currentTab === tabs.tokens)
return definition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? EMPTY_LIST
const chainIds: ChainId[] = useMemo(() => {
if (currentTab === tabs.tokens) return base.enableRequirement.web3[NetworkPluginID.PLUGIN_EVM].supportedChainIds
return [ChainId.Mainnet, ChainId.BSC, ChainId.Matic]
}, [currentTab === tabs.tokens, definition?.enableRequirement.web3])
const chainId = chainIdList.includes(contextChainId) ? contextChainId : ChainId.Mainnet
}, [currentTab === tabs.tokens])
const chainId = chainIds.includes(contextChainId) ? contextChainId : ChainId.Mainnet
if (process.env.NODE_ENV === 'development' && !chainIds.includes(contextChainId)) {
console.error(`${contextChainId} is not in supportedChainIds list, will fallback to mainnet`)
}

// #region token lucky drop
const [settings, setSettings] = useState<RedPacketSettings>()
Expand Down Expand Up @@ -326,7 +327,7 @@ export default function RedPacketDialog(props: RedPacketDialogProps) {
) ?
<div className={classes.abstractTabWrapper}>
<NetworkTab
chains={chainIdList}
chains={chainIds}
hideArrowButton={currentTab === tabs.collectibles}
pluginID={NetworkPluginID.PLUGIN_EVM}
classes={{ arrowButton: classes.arrowButton }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const RedPacketHistoryList = memo(function RedPacketHistoryList({

if (isLoading) return <LoadingStatus className={classes.placeholder} iconSize={30} />

if (!histories?.length) return <EmptyStatus className={classes.placeholder}>{t.search_no_result()}</EmptyStatus>
if (!histories.length) return <EmptyStatus className={classes.placeholder}>{t.search_no_result()}</EmptyStatus>

return (
<div {...rest} className={cx(classes.root, rest.className)}>
Expand Down
5 changes: 3 additions & 2 deletions packages/plugins/RedPacket/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChainId } from '@masknet/web3-shared-evm'
import { RedPacketMetaKey, RedPacketNftMetaKey, RedPacketPluginID } from './constants.js'
import { languages } from './locales/languages.js'

export const base: Plugin.Shared.Definition = {
export const base = {
ID: RedPacketPluginID,
name: { fallback: 'Lucky Drop' },
description: {
Expand Down Expand Up @@ -39,6 +39,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Scroll,
ChainId.Metis,
ChainId.XLayer,
ChainId.Sei,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand All @@ -49,4 +50,4 @@ export const base: Plugin.Shared.Definition = {
metadataKeys: new Set([RedPacketMetaKey, RedPacketNftMetaKey]),
},
i18n: languages,
}
} satisfies Plugin.Shared.Definition
1 change: 1 addition & 0 deletions packages/plugins/Tips/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Optimism,
ChainId.Metis,
ChainId.XLayer,
ChainId.Sei,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"Astar": "0xf5056B96ab242C566002852d0b98ce0BcDf1af51",
"Scroll": "0xbC7d98985966f56A66B0cB5F23d865676dc2ac84",
"Metis": "0xC119574D5Fb333F5AC018658D4d8b5035E16bf39",
"Sei": "0xd81c16d71432d7dF04575fFE9fEd76F837FEa0CC",
"XLayer": "0x87EDa3a18e8C005e120B235AC52F3305186d5d25",
"XLayer_Testnet": "0x8A42F70047a99298822dD1dbA34b454fc49913F2"
},
Expand Down Expand Up @@ -50,6 +51,7 @@
"Astar": "0x1410304B91a280ad083196B0B50e9d8df749d860",
"Scroll": "0x20Ee232E34B87061fE3ba0DB738A3531A3e915BF",
"Metis": "0x6cc1b1058F9153358278C35E0b2D382f1585854B",
"Sei": "0x0Cc83D728CB8dDC5e0C9Aeec375cF08a68Ef9bDF",
"XLayer": "0x8A42F70047a99298822dD1dbA34b454fc49913F2",
"XLayer_Testnet": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/nft-red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"Astar": "0xc3e62b2CC70439C32a381Bfc056aCEd1d7162cef",
"Scroll": "0x727F8030964CCEC6B0E344399c8d8E2B4C837351",
"Metis": "0x812463356F58fc8194645A1838ee6C52D8ca2D26",
"Sei": "0x8A42F70047a99298822dD1dbA34b454fc49913F2",
"XLayer": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81",
"XLayer_Testnet": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc"
},
Expand Down Expand Up @@ -46,6 +47,7 @@
"Astar": 0,
"Scroll": 96705,
"Metis": 1702933,
"Sei": 81152001,
"XLayer": 0,
"XLayer_Testnet": 7319723
}
Expand Down
2 changes: 2 additions & 0 deletions packages/web3-constants/evm/red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"Astar": "0x2cF46Db820e279c5fBF778367D49d9C931D54524",
"Scroll": "0x16f61cb37169523635B6761f3C946892fb3c18fB",
"Metis": "0x2cf91AD8C175305EBe6970Bd8f81231585EFbd77",
"Sei": "0xB349AC5E5C037C2ecb2AE9fCDc8F122b5f384620",
"XLayer": "0xDb847f1D8099C5b15519ECfd0b0C981d719bccE6",
"XLayer_Testnet": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81"
},
Expand Down Expand Up @@ -69,6 +70,7 @@
"Astar": 910985,
"Scroll": 96705,
"Metis": 1702860,
"Sei": 81152032,
"XLayer": 0,
"XLayer_Testnet": 7320220
}
Expand Down
3 changes: 3 additions & 0 deletions packages/web3-constants/evm/rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"Astar": ["https://astar.api.onfinality.io/public"],
"Scroll": ["https://rpc.scroll.io"],
"Metis": ["https://andromeda.metis.io/?owner=1088"],
"Sei": ["https://evm-rpc.sei-apis.com"],
"XLayer": ["https://rpc.xlayer.tech"],
"XLayer_Testnet": ["https://testrpc.xlayer.tech"]
},
Expand Down Expand Up @@ -103,6 +104,7 @@
"Astar": ["https://rpc.astar.network:8545"],
"Scroll": ["https://rpc.scroll.io"],
"Metis": ["https://andromeda.metis.io/?owner=1088"],
"Sei": ["https://evm-rpc.sei-apis.com"],
"XLayer": ["https://rpc.xlayer.tech"],
"XLayer_Testnet": ["https://testrpc.xlayer.tech"]
},
Expand Down Expand Up @@ -134,6 +136,7 @@
"Astar": [0, 0, 0, 0, 0],
"Scroll": [0, 0, 0, 0, 0],
"Metis": [0, 0, 0, 0, 0],
"Sei": [0, 0, 0, 0, 0],
"XLayer": [0, 0, 0, 0, 0],
"XLayer_Testnet": [0, 0, 0, 0, 0]
}
Expand Down
6 changes: 4 additions & 2 deletions packages/web3-constants/evm/token-asset-base-url.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"Conflux": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/conflux"],
"Astar": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/astar"],
"Scroll": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/scroll"],
"Metis": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/metis"]
"Metis": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/metis"],
"Sei": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/sei"]
},
"ERC20_TOKEN_ASSET_BASE_URI": {
"Mainnet": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/ethereum/assets"],
Expand Down Expand Up @@ -55,6 +56,7 @@
"Conflux": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/conflux/assets"],
"Astar": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/astar/assets"],
"Scroll": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/scroll/assets"],
"Metis": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/metis/assets"]
"Metis": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/metis/assets"],
"Sei": ["https://imagedelivery.net/PCnTHRkdRhGodr0AWBAvMA/Assets/blockchains/sei/assets"]
}
}
1 change: 1 addition & 0 deletions packages/web3-constants/evm/token-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"Astar": ["https://tokens.r2d2.to/latest/592/tokens.json"],
"Scroll": ["https://tokens.r2d2.to/latest/534352/tokens.json"],
"Metis": ["https://tokens.r2d2.to/latest/1088/tokens.json"],
"Sei": ["https://tokens.r2d2.to/latest/1329/tokens.json"],
"XLayer": ["https://tokens.r2d2.to/latest/196/tokens.json"],
"XLayer_Testnet": ["https://tokens.r2d2.to/latest/195/tokens.json"]
}
Expand Down
4 changes: 4 additions & 0 deletions packages/web3-constants/evm/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Astar": "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720",
"Scroll": "0x5300000000000000000000000000000000000004",
"Metis": "0x420000000000000000000000000000000000000A",
"Sei": "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",
"XLayer": "0x5a77f1443d16ee5761d310e38b62f77f726bc71c",
"XLayer_Testnet": "0x049a970485cf54904a6da1e1cea2ac18c9b8fb9f"
},
Expand Down Expand Up @@ -57,6 +58,7 @@
"Aurora": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802",
"Astar": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98",
"Scroll": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
"Sei": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1",
"XLayer": "0x74b7f16337b8972027f6196a17a631ac6de26d22",
"XLayer_Testnet": "0x2e1cba4a9f6e69d27e65046fc93b873b05f79a39"
},
Expand All @@ -74,6 +76,7 @@
"Aurora": "0x4988a896b1227218e4a686fde5eabdcabd91571f",
"Astar": "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283",
"Scroll": "0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df",
"Sei": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1",
"XLayer": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"XLayer_Testnet": "0xb81fe42de28e7452088b77f3eb9685487734e088"
},
Expand Down Expand Up @@ -318,6 +321,7 @@
"Astar": "0x0000000000000000000000000000000000000000",
"Scroll": "0x0000000000000000000000000000000000000000",
"Metis": "0x0000000000000000000000000000000000000000",
"Sei": "0x0000000000000000000000000000000000000000",
"XLayer": "0x0000000000000000000000000000000000000000",
"XLayer_Testnet": "0x0000000000000000000000000000000000000000"
},
Expand Down
11 changes: 6 additions & 5 deletions packages/web3-hooks/base/src/useNetworkDescriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { NetworkPluginID } from '@masknet/shared-base'
import { getRegisteredWeb3Networks } from '@masknet/web3-providers'
import type { Web3Helper } from '@masknet/web3-helpers'
import { useChainContext, useNetworkContext } from './useContext.js'
import { useMemo } from 'react'

/**
* Get built in declared network descriptor
Expand All @@ -14,9 +15,9 @@ export function useNetworkDescriptor<S extends 'all' | void = void, T extends Ne
expectedChainIdOrNetworkTypeOrID?: string | number,
): Web3Helper.NetworkDescriptorScope<S, T> | undefined {
const { pluginID } = useNetworkContext(expectedPluginID)
const { networkType } = useChainContext()

return getRegisteredWeb3Networks(pluginID).find((x) =>
[x.chainId, x.type, x.ID].includes(expectedChainIdOrNetworkTypeOrID ?? networkType ?? ''),
)
const { networkType, chainId } = useChainContext()
const identity = expectedChainIdOrNetworkTypeOrID || networkType || chainId || ''
return useMemo(() => {
return getRegisteredWeb3Networks(pluginID).find((x) => [x.chainId, x.type, x.ID].includes(identity))
}, [pluginID, identity])
}
4 changes: 2 additions & 2 deletions packages/web3-providers/src/DeBank/apis/HistoryAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type Transaction } from '@masknet/web3-shared-base'
import { ChainId, getDeBankConstants, type SchemaType } from '@masknet/web3-shared-evm'
import { formatTransactions, resolveDeBankAssetIdReversed } from '../helpers.js'
import type { HistoryRecord } from '../types.js'
import { CHIAN_ID_TO_DEBANK_CHAIN_MAP, DEBANK_OPEN_API } from '../constants.js'
import { CHAIN_ID_TO_DEBANK_CHAIN_MAP, DEBANK_OPEN_API } from '../constants.js'
import { fetchSquashedJSON } from '../../helpers/fetchJSON.js'
import type { HistoryAPI, BaseHubOptions } from '../../entry-types.js'
import { evm } from '../../Manager/registry.js'
Expand All @@ -17,7 +17,7 @@ class DeBankHistoryAPI implements HistoryAPI.Provider<ChainId, SchemaType> {
const networks = evm.state?.Network?.networks?.getCurrentValue()
// Fallback to commonly used chains
if (!networks) return PRESET_CHAIN_IDS
const RUNTIME_CHAIN_IDS = networks.map((x) => CHIAN_ID_TO_DEBANK_CHAIN_MAP[x.chainId])
const RUNTIME_CHAIN_IDS = networks.map((x) => CHAIN_ID_TO_DEBANK_CHAIN_MAP[x.chainId])
return compact(uniq([...RUNTIME_CHAIN_IDS, PRESET_CHAIN_IDS])).join(',')
}
async getTransactions(
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-providers/src/DeBank/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const DEBANK_CHAIN_TO_CHAIN_ID_MAP: Record<DebankChains, ChainId | number
*
* Rabby use this map as well.
*/
export const CHIAN_ID_TO_DEBANK_CHAIN_MAP: Record<number, DebankChains> = {
export const CHAIN_ID_TO_DEBANK_CHAIN_MAP: Record<number, DebankChains> = {
1: 'eth',
10: 'op',
19: 'sgb',
Expand Down
1 change: 1 addition & 0 deletions packages/web3-providers/src/DeBank/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './apis/FungibleTokenAPI.js'
export * from './apis/GasOptionAPI.js'
export * from './apis/HistoryAPI.js'
export * from './constants.js'
Loading

0 comments on commit 380e2ce

Please sign in to comment.