diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketInHistoryList.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketInHistoryList.tsx index 240af1c71cd5..f4eba6ac0884 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketInHistoryList.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketInHistoryList.tsx @@ -8,7 +8,7 @@ import { type RedPacketJSONPayloadFromChain, } from '@masknet/web3-providers/types' import { formatBalance, minus, type FungibleToken } from '@masknet/web3-shared-base' -import { type ChainId, type SchemaType } from '@masknet/web3-shared-evm' +import { ChainId, type SchemaType, NETWORK_DESCRIPTORS } from '@masknet/web3-shared-evm' import { Box, ListItem, Typography, useMediaQuery, type Theme } from '@mui/material' import { intervalToDuration, nextDay } from 'date-fns' import { memo, useCallback, useMemo } from 'react' @@ -19,6 +19,7 @@ import { useCreateRedPacketReceipt } from './hooks/useCreateRedPacketReceipt.js' import { useRefundCallback } from './hooks/useRefundCallback.js' import { dateTimeFormat } from './utils/formatDate.js' +const DEFAULT_BACKGROUND = NETWORK_DESCRIPTORS.find((x) => x.chainId === ChainId.Mainnet)!.backgroundGradient! const useStyles = makeStyles<{ listItemBackground?: string; listItemBackgroundIcon?: string }>()(( theme, { listItemBackground, listItemBackgroundIcon }, @@ -49,7 +50,7 @@ const useStyles = makeStyles<{ listItemBackground?: string; listItemBackgroundIc position: 'static !important' as any, height: 'auto !important', padding: theme.spacing(1.5), - background: listItemBackground ?? theme.palette.background.default, + background: listItemBackground || DEFAULT_BACKGROUND, [smallQuery]: { padding: theme.spacing(2, 1.5), }, @@ -179,6 +180,7 @@ interface RedPacketInHistoryListProps { history: RedPacketJSONPayload | RedPacketJSONPayloadFromChain onSelect: (payload: RedPacketJSONPayload) => void } + export const RedPacketInHistoryList = memo(function RedPacketInHistoryList(props: RedPacketInHistoryListProps) { const { history, onSelect } = props const t = useRedPacketTrans() diff --git a/packages/web3-constants/evm/ethereum.json b/packages/web3-constants/evm/ethereum.json index 439aaaf4a549..c42b1ecc21e3 100644 --- a/packages/web3-constants/evm/ethereum.json +++ b/packages/web3-constants/evm/ethereum.json @@ -18,6 +18,7 @@ "Celo": "0x8e28F1d64ceD52b9A09aB1AA3071Aa3c05802d1F", "Fantom": "0xc119574d5fb333f5ac018658d4d8b5035e16bf39", "Aurora": "0xC119574D5Fb333F5AC018658D4d8b5035E16bf39", + "Conflux": "0x93e0b87a0ad0c991dc1b5176ddcd850c9a78aabb", "Astar": "0xf5056B96ab242C566002852d0b98ce0BcDf1af51", "Scroll": "0xbC7d98985966f56A66B0cB5F23d865676dc2ac84", "Metis": "0xC119574D5Fb333F5AC018658D4d8b5035E16bf39", diff --git a/packages/web3-providers/src/DeBank/types.ts b/packages/web3-providers/src/DeBank/types.ts index 76a3e1be01ee..c3dcd93bf991 100644 --- a/packages/web3-providers/src/DeBank/types.ts +++ b/packages/web3-providers/src/DeBank/types.ts @@ -7,12 +7,11 @@ export enum DebankTransactionDirection { * Collect from https://docs.cloud.debank.com/en/readme/api-pro-reference/chain#returns-1 */ export type DebankChains = - | 'base' - | 'eth' | 'arb' | 'astar' | 'aurora' | 'avax' + | 'base' | 'boba' | 'brise' | 'bsc' @@ -23,6 +22,7 @@ export type DebankChains = | 'cro' | 'dfk' | 'doge' + | 'eth' | 'evmos' | 'ftm' | 'fuse' @@ -44,6 +44,7 @@ export type DebankChains = | 'pls' | 'rsk' | 'sbch' + | 'scrl' | 'sdn' | 'sgb' | 'step' @@ -51,7 +52,6 @@ export type DebankChains = | 'tlos' | 'wan' | 'xdai' - | 'scrl' export interface DictItem { name: string diff --git a/packages/web3-providers/src/Web3/EVM/apis/ConnectionReadonlyAPI.ts b/packages/web3-providers/src/Web3/EVM/apis/ConnectionReadonlyAPI.ts index 16ef375f507d..f9ca2eb52da0 100644 --- a/packages/web3-providers/src/Web3/EVM/apis/ConnectionReadonlyAPI.ts +++ b/packages/web3-providers/src/Web3/EVM/apis/ConnectionReadonlyAPI.ts @@ -531,17 +531,26 @@ export class EVMConnectionReadonlyAPI const options = this.ConnectionOptions.fill(initial) const NATIVE_TOKEN_ADDRESS = getTokenConstant(options.chainId, 'NATIVE_TOKEN_ADDRESS') - const BALANCE_CHECKER_ADDRESS = getEthereumConstant(options.chainId, 'BALANCE_CHECKER_ADDRESS') const entities: Array<[string, string]> = [] if (listOfAddress.some(isNativeTokenAddress)) { entities.push([NATIVE_TOKEN_ADDRESS ?? '', await this.getBalance(options.account, options)]) } + const BALANCE_CHECKER_ADDRESS = getEthereumConstant(options.chainId, 'BALANCE_CHECKER_ADDRESS') + if (!BALANCE_CHECKER_ADDRESS) { + if (process.env.NODE_ENV === 'development') { + console.error( + `BALANCE_CHECKER_ADDRESS for chain ${options.chainId} is not provided, do you forget to update packages/web3-constants/evm/ethereum.json ?`, + BALANCE_CHECKER_ADDRESS, + ) + } + return Object.fromEntries(entities) + } const listOfNonNativeAddress = listOfAddress.filter((x) => !isNativeTokenAddress(x)) if (listOfNonNativeAddress.length) { - const contract = this.Contract.getBalanceCheckerContract(BALANCE_CHECKER_ADDRESS ?? '', options) + const contract = this.Contract.getBalanceCheckerContract(BALANCE_CHECKER_ADDRESS, options) const balances = await contract?.methods.balances([options.account], listOfNonNativeAddress).call({ // cannot check the sender's balance in the same contract from: undefined, @@ -563,7 +572,16 @@ export class EVMConnectionReadonlyAPI const options = this.ConnectionOptions.fill(initial) const BALANCE_CHECKER_ADDRESS = getEthereumConstant(options.chainId, 'BALANCE_CHECKER_ADDRESS') - const contract = this.Contract.getBalanceCheckerContract(BALANCE_CHECKER_ADDRESS ?? '', options) + if (!BALANCE_CHECKER_ADDRESS) { + if (process.env.NODE_ENV === 'development') { + console.error( + `BALANCE_CHECKER_ADDRESS for chain ${options.chainId} is not provided, do you forget to update packages/web3-constants/evm/ethereum.json ?`, + BALANCE_CHECKER_ADDRESS, + ) + } + return {} + } + const contract = this.Contract.getBalanceCheckerContract(BALANCE_CHECKER_ADDRESS, options) const result = await contract?.methods.balances([options.account], listOfAddress).call({ // cannot check the sender's balance in the same contract from: undefined, diff --git a/packages/web3-shared/evm/src/constants/descriptors.ts b/packages/web3-shared/evm/src/constants/descriptors.ts index d94e5928f5f3..eca9a6a807d1 100644 --- a/packages/web3-shared/evm/src/constants/descriptors.ts +++ b/packages/web3-shared/evm/src/constants/descriptors.ts @@ -244,6 +244,7 @@ export const NETWORK_DESCRIPTORS: ReadonlyArray