Skip to content

Commit

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

* chore: change calendar api (#10994)

* chore: change calendar api (#10995)

* chore: change calendar api

* chore: change calendar api

* fix: news list same key (#10996)

* feat: mf-5475 add scroll chain (#10971)

* fix: type error (#10999)

* fixup! feat: mf-5475 add scroll chain (#11001)

* fix: mf-5520 add debank scroll chain name (#11003)

* fix: update scroll icon (#11004)

* fixup! fix: update scroll icon (#11004) (#11006)

* fix: web3 selector (#11007)

* fix: the web3/more injection

* refactor: code style

* fix: mf-5518 add scroll chain name for rabby (#11008)

---------

Co-authored-by: Harlan Sun <33143119+beyond009@users.noreply.github.com>
Co-authored-by: UncleBill <billbill290@gmail.com>
  • Loading branch information
3 people committed Oct 19, 2023
1 parent 87182ed commit 307729c
Show file tree
Hide file tree
Showing 53 changed files with 250 additions and 140 deletions.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
"sbch",
"scamsniffer",
"scenechange",
"scrl",
"scroller",
"secp",
"serializers",
Expand Down
1 change: 0 additions & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default {
'*': 'prettier --write --ignore-unknown',
'packages/**/*.{ts,tsx,js,jsx}': 'eslint --fix',
'packages/web3-constants/**/*': () => 'pnpm --filter ./packages/web3-constants start',
'cspell.json': () => 'gulp reorder-spellcheck',
'packages/**/*.svg': 'npx svgo',
}
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.23.3",
"version": "2.23.4",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const TokenItem = memo(function TokenItem({
<Box position="relative">
<TokenIcon
className={classes.tokenIcon}
pluginID={NetworkPluginID.PLUGIN_EVM}
chainId={asset.chainId}
address={asset.address}
name={asset.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export const UnlockERC20Token = memo<UnlockERC20TokenProps>(function UnlockERC20
const { data: token } = useFungibleToken(
NetworkPluginID.PLUGIN_EVM,
transaction.formattedTransaction?.tokenInAddress,
undefined,
{ chainId },
)

const { data: balance = '0' } = useFungibleTokenBalance(
Expand Down Expand Up @@ -244,7 +246,7 @@ export const UnlockERC20Token = memo<UnlockERC20TokenProps>(function UnlockERC20
) : null}
<Typography className={classes.name}>{t('popups_wallet_unlock_erc20_requested_by')}</Typography>
{transaction.formattedTransaction.popup?.spender ? (
<Typography className={classes.spender}>
<Typography className={classes.spender} component="div">
{t('contract')}:
<Typography className={classes.spenderAddress}>
{transaction.formattedTransaction.popup?.spender}{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const querySelectorAll = <T extends E>(selector: string) => {
// #region "Enhanced Profile"
export const searchProfileTabListLastChildSelector: () => LiveSelector<E, true> = () =>
querySelector<E>(
'[data-testid="primaryColumn"] div + [role="navigation"][aria-label] [data-testid="ScrollSnap-List"] a[href*="/like"]',
'[data-testid="primaryColumn"] div + [role="navigation"][aria-label] [data-testid="ScrollSnap-List"] div[role="presentation"]:last-of-type a[role="tab"]',
).closest(1)
export const nextTabListSelector: () => LiveSelector<E, true> = () =>
querySelector('[data-testid="ScrollSnap-nextButtonWrapper"]')
Expand Down
109 changes: 55 additions & 54 deletions packages/plugins/Approval/src/SiteAdaptor/ApprovalDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,64 @@ import { TabContext } from '@mui/lab'
import { PluginWalletStatusBar, InjectedDialog, NetworkTab } from '@masknet/shared'
import { useChainContext } from '@masknet/web3-hooks-base'
import { type ChainId } from '@masknet/web3-shared-evm'
import { NetworkPluginID, PluginID } from '@masknet/shared-base'
import { EMPTY_LIST, NetworkPluginID, PluginID } from '@masknet/shared-base'
import { useActivatedPlugin } from '@masknet/plugin-infra/dom'
import { useI18N } from '../locales/index.js'
import { ApprovalTokenContent } from './ApprovalTokenContent.js'
import { ApprovalNFTContent } from './ApprovalNFTContent.js'
import { useMemo } from 'react'

const useStyles = makeStyles<{ listItemBackground?: string; listItemBackgroundIcon?: string } | void>()(
(theme, props) => ({
dialogRoot: {
width: 600,
height: 620,
overflowX: 'hidden',
const useStyles = makeStyles()((theme, props) => ({
dialogRoot: {
width: 600,
height: 620,
overflowX: 'hidden',
},
dialogContent: {
width: 600,
background: theme.palette.maskColor.bottom,
padding: 0,
margin: 'auto',
overflowX: 'hidden',
},
contentWrapper: {
width: 602,
padding: 0,
overflowY: 'auto',
overflowX: 'hidden',
height: '100%',
'::-webkit-scrollbar': {
backgroundColor: 'transparent',
width: 18,
},
dialogContent: {
width: 600,
background: theme.palette.maskColor.bottom,
padding: 0,
margin: 'auto',
overflowX: 'hidden',
'::-webkit-scrollbar-thumb': {
borderRadius: '20px',
width: 5,
border: '7px solid rgba(0, 0, 0, 0)',
backgroundColor: theme.palette.maskColor.secondaryLine,
backgroundClip: 'padding-box',
},
contentWrapper: {
width: 602,
padding: 0,
overflowY: 'auto',
overflowX: 'hidden',
height: '100%',
'::-webkit-scrollbar': {
backgroundColor: 'transparent',
width: 18,
},
'::-webkit-scrollbar-thumb': {
borderRadius: '20px',
width: 5,
border: '7px solid rgba(0, 0, 0, 0)',
backgroundColor: theme.palette.maskColor.secondaryLine,
backgroundClip: 'padding-box',
},
},
dialogTitle: {
'& > p': {
overflow: 'visible',
},
dialogTitle: {
'& > p': {
overflow: 'visible',
},
},
abstractTabWrapper: {
width: '100%',
paddingBottom: theme.spacing(2),
},
approvalWrapper: {
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
},
footer: {
position: 'sticky',
bottom: 0,
},
}),
)
},
abstractTabWrapper: {
width: '100%',
paddingBottom: theme.spacing(2),
},
approvalWrapper: {
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
},
footer: {
position: 'sticky',
bottom: 0,
},
}))

export interface ApprovalDialogProps {
open: boolean
Expand Down Expand Up @@ -111,9 +110,11 @@ function ApprovalWrapper(props: ApprovalWrapperProps) {

const { chainId } = useChainContext<NetworkPluginID.PLUGIN_EVM>()
const approvalDefinition = useActivatedPlugin(PluginID.Approval, 'any')
const chainIdList = compact<ChainId>(
approvalDefinition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? [],
)
const chainIdList = useMemo(() => {
return compact<ChainId>(
approvalDefinition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? EMPTY_LIST,
)
}, [approvalDefinition])
const { classes } = useStyles()

return (
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Approval/src/SiteAdaptor/pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const resolveNetworkOnRabby = createLookupTableResolver<NetworkType, stri
[NetworkType.Conflux]: '',
[NetworkType.Astar]: '',
[NetworkType.Moonbeam]: '',
[NetworkType.Scroll]: '',
[NetworkType.CustomNetwork]: '',
},
'eth',
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Approval/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Avalanche,
ChainId.Aurora,
ChainId.Optimism,
ChainId.Scroll,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function NewsList({ list, isLoading, empty, dateString }: NewsListProps)
{list[key].map((v) => (
<div
className={classes.eventCard}
key={v.eventTitle}
key={v.event_url}
onClick={() => {
window.open(v.event_url)
}}>
Expand Down
18 changes: 13 additions & 5 deletions packages/plugins/Collectible/src/SiteAdaptor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { useCallback } from 'react'
import { Trans } from 'react-i18next'
import { Box } from '@mui/material'
import { Icons } from '@masknet/icons'
import { usePluginWrapper, usePostInfoDetails, type Plugin } from '@masknet/plugin-infra/content-script'
import { CollectionList, UserAssetsProvider } from '@masknet/shared'
import { CrossIsolationMessages, NetworkPluginID, PluginID, SocialAddressType, parseURLs } from '@masknet/shared-base'
import { makeStyles } from '@masknet/theme'
import { extractTextFromTypedMessage } from '@masknet/typed-message'
import type { Web3Helper } from '@masknet/web3-helpers'
import { Telemetry } from '@masknet/web3-telemetry'
import { EventID, EventType } from '@masknet/web3-telemetry/types'
import { Web3ContextProvider } from '@masknet/web3-hooks-base'
import { SearchResultType } from '@masknet/web3-shared-base'
import { Telemetry } from '@masknet/web3-telemetry'
import { EventID, EventType } from '@masknet/web3-telemetry/types'
import { Box } from '@mui/material'
import { useCallback } from 'react'
import { Trans } from 'react-i18next'
import { base } from '../base.js'
import { PLUGIN_ID, PLUGIN_NAME } from '../constants.js'
import { getPayloadFromURLs } from '../helpers/index.js'
Expand Down Expand Up @@ -39,6 +40,11 @@ function useInspectCollectible(pluginID?: NetworkPluginID) {
const gridProps = {
columns: 'repeat(auto-fill, minmax(20%, 1fr))',
}
const usePopupCollectionStyles = makeStyles()({
sidebar: {
paddingBottom: 48,
},
})
const TabConfig: Plugin.SiteAdaptor.ProfileTab = {
ID: `${PLUGIN_ID}_nfts`,
label: 'NFTs',
Expand Down Expand Up @@ -101,6 +107,7 @@ const site: Plugin.SiteAdaptor.Definition = {
UI: {
TabContent({ socialAccount }) {
const inspectCollectible = useInspectCollectible(socialAccount?.pluginID)
const { classes } = usePopupCollectionStyles()

if (!socialAccount) return null

Expand All @@ -110,6 +117,7 @@ const site: Plugin.SiteAdaptor.Definition = {
<CollectionList
height={392}
gridProps={gridProps}
classes={{ sidebar: classes.sidebar }}
disableWindowScroll
from="profileCard"
onItemClick={(asset) => inspectCollectible(asset, 'profileCard')}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/MaskBox/src/hooks/useContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ function useContext(initialState?: { boxId: string; hashRoot: string }) {
proofBytes,
openBoxTransactionOverrides,
)
const { value: erc20Allowance, retry: retryAllowance } = useERC20TokenAllowance(
const { data: erc20Allowance, refetch: retryAllowance } = useERC20TokenAllowance(
isNativeToken ? undefined : paymentTokenAddress,
MASK_BOX_CONTRACT_ADDRESS,
)
Expand Down
11 changes: 4 additions & 7 deletions packages/plugins/RedPacket/src/SiteAdaptor/RedPacketDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useCallback, useMemo, useState } from 'react'
import { compact } from 'lodash-es'
import Web3Utils from 'web3-utils'
import { DialogContent, Tab, useTheme } from '@mui/material'
import { TabContext, TabPanel } from '@mui/lab'
Expand Down Expand Up @@ -83,12 +82,10 @@ export default function RedPacketDialog(props: RedPacketDialogProps) {
const theme = useTheme()
const mode = useSiteThemeMode(theme)
const { classes } = useStyles({ currentTab, showHistory, isDim: mode === 'dim' })
const chainIdList = useMemo(() => {
return compact<ChainId>(
currentTab === tabs.tokens
? approvalDefinition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? []
: [ChainId.Mainnet, ChainId.BSC, ChainId.Matic],
)
const chainIdList: ChainId[] = useMemo(() => {
return currentTab === tabs.tokens
? approvalDefinition?.enableRequirement.web3?.[NetworkPluginID.PLUGIN_EVM]?.supportedChainIds ?? []
: [ChainId.Mainnet, ChainId.BSC, ChainId.Matic]
}, [currentTab === tabs.tokens, approvalDefinition?.enableRequirement.web3])
const chainId = chainIdList.includes(_chainId) ? _chainId : ChainId.Mainnet

Expand Down
1 change: 1 addition & 0 deletions packages/plugins/RedPacket/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Aurora,
ChainId.Conflux,
ChainId.Astar,
ChainId.Scroll,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const SmartPayContent = memo(() => {
const { data: maskToken } = useFungibleToken(NetworkPluginID.PLUGIN_EVM, maskAddress, undefined, { chainId })

const { PAYMASTER_MASK_CONTRACT_ADDRESS } = useSmartPayConstants(chainId)
const { value: allowance = '0' } = useERC20TokenAllowance(maskAddress, PAYMASTER_MASK_CONTRACT_ADDRESS, {
const { data: allowance = '0' } = useERC20TokenAllowance(maskAddress, PAYMASTER_MASK_CONTRACT_ADDRESS, {
chainId,
})

Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Tips/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Fantom,
ChainId.Conflux,
ChainId.Astar,
ChainId.Scroll,
ChainId.Optimism,
],
},
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/constants/0x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export const ZRX_BASE_URL: Record<NetworkType, string> = {
[NetworkType.Conflux]: '',
[NetworkType.Astar]: '',
[NetworkType.Moonbeam]: '',
[NetworkType.Scroll]: '',
[NetworkType.CustomNetwork]: '',
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function getEVMAvailableTraderProviders(networkType?: NetworkType) {
return [TradeProvider.DODO, TradeProvider.WANNASWAP, TradeProvider.TRISOLARIS]
case NetworkType.Astar:
return [TradeProvider.ARTHSWAP, TradeProvider.VERSA, TradeProvider.ASTAREXCHANGE, TradeProvider.YUMISWAP]
case NetworkType.Scroll:
case NetworkType.Boba:
case NetworkType.Fuse:
case NetworkType.Metis:
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/providers/ZeroX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Optimism:
case NetworkType.Conflux:
case NetworkType.Astar:
case NetworkType.Scroll:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
return ZRX_NATIVE_TOKEN_ADDRESS
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/trader/0x/useTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Conflux:
case NetworkType.Astar:
case NetworkType.Moonbeam:
case NetworkType.Scroll:
case NetworkType.CustomNetwork:
return NATIVE_TOKEN_ADDRESS
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ChainRuntimeContext = createContext<ChainRuntimeOptions>({
networks: EMPTY_LIST,
})

// https://docs.simplehash.com/reference/chains
const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
[NetworkPluginID.PLUGIN_EVM]: [
ChainId.Mainnet,
Expand All @@ -43,6 +44,7 @@ const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
ChainId.Optimism,
ChainId.Avalanche,
ChainId.xDai,
ChainId.Scroll,
],
[NetworkPluginID.PLUGIN_SOLANA]: [SolanaChainId.Mainnet],
[NetworkPluginID.PLUGIN_FLOW]: [FlowChainId.Mainnet],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ function getTopOffset() {
}
export interface CollectionListProps
extends BoxProps,
Pick<CollectionProps, 'disableAction' | 'onActionClick' | 'onItemClick'> {
Pick<CollectionProps, 'disableAction' | 'onActionClick' | 'onItemClick'>,
withClasses<'sidebar'> {
gridProps?: CollectibleGridProps
disableSidebar?: boolean
disableWindowScroll?: boolean
Expand Down Expand Up @@ -121,7 +122,7 @@ export const CollectionList = memo(function CollectionList({
...rest
}: CollectionListProps) {
const t = useSharedI18N()
const { classes, cx } = useStyles(gridProps)
const { classes, cx } = useStyles(gridProps, { props: rest })

const { pluginID, account, chainId, setChainId, networks } = useChainRuntime()
const { collections, currentCollection, setCurrentCollectionId, loading, error, retry } =
Expand Down

0 comments on commit 307729c

Please sign in to comment.