Skip to content

Commit

Permalink
[Release] New release 2.31.0 (minor) (#12074)
Browse files Browse the repository at this point in the history
* chore: bump version to 2.31.0

* refactor: rename ERC20RedPacket to TokenRedPacket (#12075)

* fix: connect/change wallet label (#12076)

* fix: get redpacket state without parse api (#12077)

* fix: token badge icon (#12078)

* fix: token badge icon

* fix: solana redpacket expired

* fix: adjust layout in token approval (#12079)

* fix: hard code fix for virtual on base (#12080)

---------

Co-authored-by: Wukong Sun <[email protected]>
  • Loading branch information
guanbinrui and swkatmask authored Jan 26, 2025
1 parent c5e03df commit db78e1d
Show file tree
Hide file tree
Showing 55 changed files with 484 additions and 371 deletions.
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.30.0",
"version": "2.31.0",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const WatchTokenRequest = memo<InteractionItemProps>((props) => {
address={address}
name={symbol}
size={60}
disableBadge
/>
{isTrustedName ?
asset?.name
Expand Down
1 change: 1 addition & 0 deletions packages/mask/popups/pages/Wallet/TokenDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export const TokenDetailUI = memo(function TokenDetailUI(props: TokenDetailUIPro
chainId={asset.chainId}
logoURL={asset.logoURL}
size={16}
disableBadge
/>
<FormattedBalance
value={balance}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Icons } from '@masknet/icons'
import { NetworkIcon, ProgressiveText, TokenIcon, useAvailableBalance } from '@masknet/shared'
import { ProgressiveText, TokenIcon, useAvailableBalance } from '@masknet/shared'
import { NetworkPluginID } from '@masknet/shared-base'
import { ActionButton, MaskColors, makeStyles, usePopupCustomSnackbar } from '@masknet/theme'
import type { Web3Helper } from '@masknet/web3-helpers'
Expand All @@ -13,13 +13,7 @@ import {
} from '@masknet/web3-hooks-base'
import { useGasLimit } from '@masknet/web3-hooks-evm'
import { isLessThan, isLte, isZero, leftShift, minus, rightShift } from '@masknet/web3-shared-base'
import {
SchemaType,
isNativeTokenAddress,
type ChainId,
type GasConfig,
getNativeTokenAddress,
} from '@masknet/web3-shared-evm'
import { SchemaType, isNativeTokenAddress, type GasConfig, getNativeTokenAddress } from '@masknet/web3-shared-evm'
import { Box, Input, Typography } from '@mui/material'
import { BigNumber } from 'bignumber.js'
import { memo, useCallback, useMemo, useState } from 'react'
Expand Down Expand Up @@ -47,17 +41,6 @@ const useStyles = makeStyles()((theme) => ({
tokenPicker: {
margin: theme.spacing(0, 2),
},
tokenIcon: {
width: 36,
height: 36,
},
badgeIcon: {
position: 'absolute',
right: -6,
bottom: -4,
border: `1px solid ${theme.palette.common.white}`,
borderRadius: '50%',
},
maxButton: {
cursor: 'pointer',
},
Expand Down Expand Up @@ -248,21 +231,7 @@ export const FungibleTokenSection = memo(function FungibleTokenSection() {
})
if (picked) handleSelectAsset(picked as Web3Helper.FungibleAssetAll)
}}>
<Box position="relative" height={36} width={36}>
<TokenIcon
className={classes.tokenIcon}
chainId={chainId}
address={address}
logoURL={selectedAsset?.logoURL}
/>
<NetworkIcon
pluginID={NetworkPluginID.PLUGIN_EVM}
chainId={network?.chainId as ChainId}
className={classes.badgeIcon}
size={16}
network={network}
/>
</Box>
<TokenIcon size={36} chainId={chainId} address={address} logoURL={selectedAsset?.logoURL} />
<Box mr="auto" ml={2}>
<ProgressiveText loading={isPending} skeletonWidth={36}>
{token?.symbol}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const AssetItem = memo(function AssetItem({ asset, onItemClick, ...rest }: Asset
name={asset.name}
logoURL={asset.logoURL}
size={36}
disableBadge
/>
<NetworkIcon
pluginID={NetworkPluginID.PLUGIN_EVM}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const useStyles = makeStyles<{ listItemBackground?: string; listItemBackgroundIc
spenderLogoIcon: {
width: 16,
height: 16,
marginRight: 4,
},
link: {
width: 16,
Expand All @@ -95,7 +94,6 @@ const useStyles = makeStyles<{ listItemBackground?: string; listItemBackgroundIc
},
spenderMaskLogoIcon: {
display: 'inline-block',
marginRight: 4,
width: 16,
height: 16,
'& > svg': {
Expand Down Expand Up @@ -249,11 +247,15 @@ function ApprovalTokenItem(props: ApprovalTokenItemProps) {
</div>
<div>
<Typography className={classes.secondaryText}>
<Trans>Approved Amount</Trans>
<Trans>
Approved Amount{' '}
{amount ?
<Typography component="span" className={classes.primaryText}>
{formatSpendingCap(amount)}
</Typography>
: null}
</Trans>
</Typography>
{amount ?
<Typography className={classes.primaryText}>{formatSpendingCap(amount)}</Typography>
: null}
</div>
</div>
<ChainBoundary
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Approval/src/locale/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion packages/plugins/Approval/src/locale/en-US.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/plugins/Approval/src/locale/ja-JP.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions packages/plugins/Approval/src/locale/ja-JP.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/plugins/Approval/src/locale/ko-KR.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions packages/plugins/Approval/src/locale/ko-KR.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/plugins/Approval/src/locale/zh-CN.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions packages/plugins/Approval/src/locale/zh-CN.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/plugins/Approval/src/locale/zh-TW.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion packages/plugins/Approval/src/locale/zh-TW.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const OfferCard = memo(function OfferCard({ offer, ...rest }: OfferCardPr
style={{
fontSize: 14,
}}
disableBadge
/>
: <Typography className={classes.fallbackSymbol}>
{offer.priceInToken?.token.symbol || offer.priceInToken?.token.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ const useStyles = makeStyles()((theme) => ({
display: 'none',
},
},
icon: {
width: '48px',
height: '48px',
},
tokenName: {
fontSize: '18px',
fontWeight: 700,
Expand Down Expand Up @@ -94,11 +90,12 @@ export const SecurityPanel = memo<TokenCardProps>(({ tokenSecurity, tokenInfo, t
<Stack direction="row" spacing={0.8}>
{tokenSecurity?.token_name ?
<TokenIcon
className={classes.icon}
size={48}
address={tokenSecurity.contract ?? ''}
name={tokenSecurity.token_name}
logoURL={tokenInfo?.logoURL}
chainId={tokenSecurity.chainId}
disableBadge
/>
: <Icons.DefaultToken size={48} />}
<Stack>
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/RedPacket/src/SiteAdaptor/MainDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useStyles = makeStyles()((theme) => ({
},
}))

const initialEntries = [RoutePaths.Exit, RoutePaths.CreateErc20RedPacket]
const initialEntries = [RoutePaths.Exit, RoutePaths.CreateTokenRedPacket]

export function RedPacketMainDialog({ onClose }: RedPacketDialogProps) {
const { classes } = useStyles()
Expand All @@ -52,7 +52,7 @@ export function RedPacketMainDialog({ onClose }: RedPacketDialogProps) {
<RedPacketProvider>
<RouterDialog
pageMap={{
[RedPacketTabs.tokens]: RoutePaths.CreateErc20RedPacket,
[RedPacketTabs.tokens]: RoutePaths.CreateTokenRedPacket,
[RedPacketTabs.collectibles]: RoutePaths.CreateNftRedPacket,
}}
open
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export function OperationFooter({
disabled={isLoading}
onClick={onClick}>
{unsatisfied ?
<Trans>Conditions not met</Trans>
<>
<Trans>Who can claim</Trans>
<Icons.Questions size={18} />
</>
: canClaim ?
isClaiming ?
<Trans>Claiming...</Trans>
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/RedPacket/src/SiteAdaptor/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Navigate, Route, Routes } from 'react-router-dom'
import { RoutePaths } from '../constants.js'
import { CreateERC20RedPacket } from './views/CreateERC20RedPacket.js'
import { CreateTokenRedPacket } from './views/CreateTokenRedPacket.js'
import { CreateNftRedPacket } from './views/CreateNftRedPacket.js'
import { CustomCover } from './views/CustomCover.js'
import { Erc20RedPacketConfirm } from './views/Erc20RedPacketConfirm.js'
import { TokenRedPacketConfirm } from './views/TokenRedPacketConfirm.js'
import { History } from './views/History.js'
import { HistoryDetail } from './views/HistoryDetail.js'
import { NftHistory } from './views/NftHistory.js'
Expand All @@ -14,7 +14,7 @@ export function RedPacketRoutes() {
return (
<Routes>
<Route path={RoutePaths.Create}>
<Route index path={RoutePaths.CreateErc20RedPacket} element={<CreateERC20RedPacket />} />
<Route index path={RoutePaths.CreateTokenRedPacket} element={<CreateTokenRedPacket />} />
<Route path={RoutePaths.CreateNftRedPacket} element={<CreateNftRedPacket />} />
</Route>
<Route path={RoutePaths.CustomCover} element={<CustomCover />} />
Expand All @@ -25,13 +25,13 @@ export function RedPacketRoutes() {
</Route>
<Route path={RoutePaths.NftHistory} element={<NftHistory />} />
<Route path={RoutePaths.Confirm}>
<Route index path={RoutePaths.ConfirmErc20RedPacket} element={<Erc20RedPacketConfirm />} />
<Route index path={RoutePaths.ConfirmTokenRedPacket} element={<TokenRedPacketConfirm />} />
<Route path={RoutePaths.ConfirmNftRedPacket} element={<NftRedPacketConfirm />} />
</Route>
{/* If router is embedded inside a dialog, */}
{/* which should know it's time to close itself once we enter Exit */}
<Route path={RoutePaths.Exit} element={null} />
<Route path="*" element={<Navigate replace to={RoutePaths.CreateErc20RedPacket} />} />
<Route path="*" element={<Navigate replace to={RoutePaths.CreateTokenRedPacket} />} />
</Routes>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ interface OperationFooterProps extends BoxProps {
canRefund: boolean
/** Is claiming or checking claim status */
isClaiming: boolean
isExpired: boolean
onClaimOrRefund: () => void | Promise<void>
}
export function OperationFooter({
chainId,
canClaim,
canRefund,
isClaiming,
isExpired,
onClaimOrRefund,
...rest
}: OperationFooterProps) {
Expand All @@ -50,6 +52,7 @@ export function OperationFooter({

const { value: nativeTokenBalance } = useNativeTokenBalance()

if (isExpired) return null
if (!canClaim && !canRefund && account) return null

function getObtainButton(onClick: MouseEventHandler<HTMLButtonElement>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
canClaim={canClaim}
canRefund={canRefund}
isClaiming={isClaiming || isClaimingAndChecking}
isExpired={availability.expired}
onClaimOrRefund={onClaimOrRefund}
/>
</NetworkContextProvider>
Expand Down
Loading

0 comments on commit db78e1d

Please sign in to comment.