From 329258a2bbcf9617e75ec1bf2e1601fc1eeecd47 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 10 Jan 2022 14:32:35 +0800 Subject: [PATCH 1/5] chore: transaction bar describe --- packages/mask/shared-ui/locales/en-US.json | 1 + .../TransactionDescription.tsx | 34 ++++++++--- .../getRedpacketDescription.tsx | 61 +++++++++++++++++++ .../contractMethodDescription/index.ts | 6 ++ .../SNSAdaptor/WalletStatusDialog/type.ts | 10 +++ 5 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx create mode 100644 packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts create mode 100644 packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/type.ts diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 238a8b5587cc..4ff87f23d3fb 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -358,6 +358,7 @@ "plugin_red_packet_hint": "You can withdraw the remaining balance 24 hours after the Lucky Drop is sent.", "plugin_red_packet_token": "Token", "plugin_red_packet_message_label": "Title", + "plugin_red_packet_create": "Creating Lucky Drop", "plugin_red_packet_create_with_token": "Creating Lucky Drop with {{symbol}}", "plugin_red_packet_history_duration": "Time: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "Total Amount: {{amount}} {{symbol}}", diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx index a1b1dbfb00bd..8325f44c67b3 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx @@ -1,7 +1,10 @@ import type { TransactionReceipt } from 'web3-core' +import { first, last } from 'lodash-unified' import { + ChainId, useNativeTokenDetailed, EthereumRpcType, + useChainId, formatBalance, NativeTokenDetailed, ERC20TokenDetailed, @@ -10,7 +13,7 @@ import { } from '@masknet/web3-shared-evm' import { pow10 } from '@masknet/web3-shared-base' import type Services from '../../../../extension/service' -import { first, last } from 'lodash-unified' +import { getContractMethodDescription } from './contractMethodDescription' function getTokenAmountDescription(amount = '0', tokenDetailed?: FungibleTokenDetailed, negative?: boolean) { const symbol = negative ? '- ' : '' @@ -22,12 +25,14 @@ function getTokenAmountDescription(amount = '0', tokenDetailed?: FungibleTokenDe } function getTransactionDescription( + chainId: ChainId, nativeTokenDetailed?: NativeTokenDetailed | ERC20TokenDetailed, tokenDetailed?: ERC20TokenDetailed, computedPayload?: UnboxPromise> | null, ) { if (!computedPayload) return const type = computedPayload.type + switch (type) { case EthereumRpcType.SEND_ETHER: return `Send token -${getTokenAmountDescription( @@ -73,15 +78,22 @@ function getTransactionDescription( const amountOut = formatBalance(computedPayload.parameters.amountOutMin, tokenDetailed?.decimals, 2) return `Swap ${amountIn} ${nativeTokenDetailed?.symbol} for ${amountOut} ${tokenDetailed?.symbol}` default: - return `${computedPayload.name ?? 'Contract Interaction'} ${ - computedPayload._tx.value - ? getTokenAmountDescription( - computedPayload._tx.value as string | undefined, - nativeTokenDetailed, - true, - ) - : '' - }` + const description = getContractMethodDescription( + { name: computedPayload.name ?? '', chainId, address: computedPayload._tx.to ?? '' }, + computedPayload, + ) + return ( + description ?? + `${computedPayload.name ?? 'Contract Interaction'} ${ + computedPayload._tx.value + ? getTokenAmountDescription( + computedPayload._tx.value as string | undefined, + nativeTokenDetailed, + true, + ) + : '' + }` + ) } case EthereumRpcType.CONTRACT_DEPLOYMENT: return `Contract Deployment ${getTokenAmountDescription( @@ -105,6 +117,7 @@ export interface RecentTransactionDescriptionProps { } export function RecentTransactionDescription(props: RecentTransactionDescriptionProps) { + const chainId = useChainId() const { hash, computedPayload } = props const { loading: getNativeTokenLoading, value: nativeTokenDetailed } = useNativeTokenDetailed() let inputTokenAddress: string | undefined = '' @@ -139,6 +152,7 @@ export function RecentTransactionDescription(props: RecentTransactionDescription return !getNativeTokenLoading && !getERC20TokenLoading && !getInputERC20TokenLoading ? ( {getTransactionDescription( + chainId, inputTokenAddress ? inputTokenDetailed : nativeTokenDetailed, tokenDetailed, computedPayload, diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx new file mode 100644 index 000000000000..4e1f0a21d733 --- /dev/null +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx @@ -0,0 +1,61 @@ +import { + getRedPacketConstants, + isSameAddress, + useERC20TokenDetailed, + formatBalance, + isNativeTokenAddress, + useNativeTokenDetailed, + ERC20TokenDetailed, + NativeTokenDetailed, +} from '@masknet/web3-shared-evm' +import { useI18N } from '../../../../../utils' +import type { ContractMethodInfo, ComputedPayload } from '../type' + +export function getRedpacketDescription( + { name, address, chainId }: ContractMethodInfo, + computedPayload: ComputedPayload, +) { + const { HAPPY_RED_PACKET_ADDRESS_V4 } = getRedPacketConstants(chainId) + + if (!isSameAddress(address, HAPPY_RED_PACKET_ADDRESS_V4)) return false + + switch (name) { + case 'create_red_packet': + return ( + + ) + default: + return false + } +} + +interface CreateRedpacketDescriptionProps { + tokenAddress: string + tokenAmount: string +} + +export function CreateRedpacketDescription(props: CreateRedpacketDescriptionProps) { + const { tokenAddress, tokenAmount } = props + + let token: ERC20TokenDetailed | NativeTokenDetailed | undefined + const { t } = useI18N() + const { value: nativeToken } = useNativeTokenDetailed() + + const { value: tokenDetailed } = useERC20TokenDetailed(tokenAddress) + token = isNativeTokenAddress(tokenAddress) ? nativeToken : tokenDetailed + + return ( + + {token && tokenAddress + ? t('plugin_red_packet_create_with_token', { + symbol: `${formatBalance(tokenAmount, token.decimals)} ${ + isNativeTokenAddress(tokenAddress) ? token.symbol : nativeToken?.decimals + }`, + }) + : t('plugin_red_packet_create')} + + ) +} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts new file mode 100644 index 000000000000..a5807953eb38 --- /dev/null +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts @@ -0,0 +1,6 @@ +import { getRedpacketDescription } from './getRedpacketDescription' +import type { ContractMethodInfo, ComputedPayload } from '../type' + +export function getContractMethodDescription(contractMethodInfo: ContractMethodInfo, computedPayload: ComputedPayload) { + return getRedpacketDescription(contractMethodInfo, computedPayload) +} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/type.ts b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/type.ts new file mode 100644 index 000000000000..f476681a539c --- /dev/null +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/type.ts @@ -0,0 +1,10 @@ +import type { ChainId } from '@masknet/web3-shared-evm' +import type Services from '../../../../extension/service' + +export interface ContractMethodInfo { + name: string + address: string + chainId: ChainId +} + +export type ComputedPayload = UnboxPromise> From a93a743f9fc022a5eec80cda863353af34ff30a0 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 10 Jan 2022 16:02:44 +0800 Subject: [PATCH 2/5] chore: ito fill pool --- packages/mask/shared-ui/locales/en-US.json | 1 + .../getITO_Description.tsx | 43 +++++++++++++++++++ .../getRedpacketDescription.tsx | 8 ++-- .../contractMethodDescription/index.ts | 6 ++- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getITO_Description.tsx diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 4ff87f23d3fb..5d0d536f8838 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -536,6 +536,7 @@ "plugin_ito_region_ban": "This Pool is banned by its creator at your region", "plugin_ito_next": "Next", "plugin_ito_back": "Back", + "plugin_ito_transaction_dialog_summary_with_no_token": "Create an ITO.", "plugin_ito_transaction_dialog_summary": "Create an ITO with {{amount}} {{symbol}}.", "plugin_ito_swap": "Swap", "plugin_ito_send_tip": "You can find your ITOs in the Past tab.", diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getITO_Description.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getITO_Description.tsx new file mode 100644 index 000000000000..e0c98a3d90b3 --- /dev/null +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getITO_Description.tsx @@ -0,0 +1,43 @@ +import { getITOConstants, isSameAddress, useERC20TokenDetailed, formatBalance } from '@masknet/web3-shared-evm' +import { useI18N } from '../../../../../utils' +import type { ContractMethodInfo, ComputedPayload } from '../type' + +export function getITO_Description({ name, address, chainId }: ContractMethodInfo, computedPayload: ComputedPayload) { + const { ITO2_CONTRACT_ADDRESS } = getITOConstants(chainId) + if (!isSameAddress(address, ITO2_CONTRACT_ADDRESS)) return undefined + + switch (name) { + case 'fill_pool': + return ( + + ) + default: + return undefined + } +} + +interface FillPoolDescriptionProps { + tokenAddress: string + tokenAmount: string +} + +function FillPoolDescription(props: FillPoolDescriptionProps) { + const { tokenAddress, tokenAmount } = props + + const { value: token } = useERC20TokenDetailed(tokenAddress) + const { t } = useI18N() + + return ( + + {token && tokenAddress + ? t('plugin_ito_transaction_dialog_summary', { + amount: formatBalance(tokenAmount, token.decimals), + symbol: token.symbol, + }) + : t('plugin_ito_transaction_dialog_summary_with_no_token')} + + ) +} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx index 4e1f0a21d733..0fe7694e289c 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx @@ -17,7 +17,7 @@ export function getRedpacketDescription( ) { const { HAPPY_RED_PACKET_ADDRESS_V4 } = getRedPacketConstants(chainId) - if (!isSameAddress(address, HAPPY_RED_PACKET_ADDRESS_V4)) return false + if (!isSameAddress(address, HAPPY_RED_PACKET_ADDRESS_V4)) return undefined switch (name) { case 'create_red_packet': @@ -28,7 +28,7 @@ export function getRedpacketDescription( /> ) default: - return false + return undefined } } @@ -51,9 +51,7 @@ export function CreateRedpacketDescription(props: CreateRedpacketDescriptionProp {token && tokenAddress ? t('plugin_red_packet_create_with_token', { - symbol: `${formatBalance(tokenAmount, token.decimals)} ${ - isNativeTokenAddress(tokenAddress) ? token.symbol : nativeToken?.decimals - }`, + symbol: `${formatBalance(tokenAmount, token.decimals)} ${token.symbol}`, }) : t('plugin_red_packet_create')} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts index a5807953eb38..3c7c38f8e432 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts @@ -1,6 +1,10 @@ import { getRedpacketDescription } from './getRedpacketDescription' +import { getITO_Description } from './getITO_Description' import type { ContractMethodInfo, ComputedPayload } from '../type' export function getContractMethodDescription(contractMethodInfo: ContractMethodInfo, computedPayload: ComputedPayload) { - return getRedpacketDescription(contractMethodInfo, computedPayload) + return ( + getRedpacketDescription(contractMethodInfo, computedPayload) ?? + getITO_Description(contractMethodInfo, computedPayload) + ) } From 329f9790e52e172bd68146188e94d1d73bea64d9 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 10 Jan 2022 16:09:11 +0800 Subject: [PATCH 3/5] fix: type --- .../WalletStatusDialog/TransactionDescription.tsx | 1 - .../contractMethodDescription/getRedpacketDescription.tsx | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx index 8325f44c67b3..605a8b0f8608 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/TransactionDescription.tsx @@ -32,7 +32,6 @@ function getTransactionDescription( ) { if (!computedPayload) return const type = computedPayload.type - switch (type) { case EthereumRpcType.SEND_ETHER: return `Send token -${getTokenAmountDescription( diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx index 0fe7694e289c..af7aa7aa80fd 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx @@ -5,8 +5,6 @@ import { formatBalance, isNativeTokenAddress, useNativeTokenDetailed, - ERC20TokenDetailed, - NativeTokenDetailed, } from '@masknet/web3-shared-evm' import { useI18N } from '../../../../../utils' import type { ContractMethodInfo, ComputedPayload } from '../type' @@ -39,13 +37,11 @@ interface CreateRedpacketDescriptionProps { export function CreateRedpacketDescription(props: CreateRedpacketDescriptionProps) { const { tokenAddress, tokenAmount } = props - - let token: ERC20TokenDetailed | NativeTokenDetailed | undefined const { t } = useI18N() - const { value: nativeToken } = useNativeTokenDetailed() + const { value: nativeToken } = useNativeTokenDetailed() const { value: tokenDetailed } = useERC20TokenDetailed(tokenAddress) - token = isNativeTokenAddress(tokenAddress) ? nativeToken : tokenDetailed + const token = isNativeTokenAddress(tokenAddress) ? nativeToken : tokenDetailed return ( From 08f0397cf2ed18c623dd66c4120f24061a3d0556 Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Mon, 10 Jan 2022 18:30:11 +0800 Subject: [PATCH 4/5] chore: nft lucky drop create --- packages/mask/shared-ui/locales/en-US.json | 5 +++-- .../getNFTRedpacketDescription.tsx | 19 +++++++++++++++++++ .../contractMethodDescription/index.ts | 4 +++- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getNFTRedpacketDescription.tsx diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 5d0d536f8838..5fa727ebefeb 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -358,14 +358,15 @@ "plugin_red_packet_hint": "You can withdraw the remaining balance 24 hours after the Lucky Drop is sent.", "plugin_red_packet_token": "Token", "plugin_red_packet_message_label": "Title", - "plugin_red_packet_create": "Creating Lucky Drop", - "plugin_red_packet_create_with_token": "Creating Lucky Drop with {{symbol}}", + "plugin_red_packet_create": "Create a Lucky Drop", + "plugin_red_packet_create_with_token": "Create a Lucky Drop with {{symbol}}", "plugin_red_packet_history_duration": "Time: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "Total Amount: {{amount}} {{symbol}}", "plugin_red_packet_history_total_claimed_amount": "Total: {{claimedAmount}}/{{amount}} {{symbol}}", "plugin_red_packet_history_claimed": "Claimed: {{claimedShares}}/{{shares}} Share", "plugin_red_packet_history_split_mode": "Split Mode: {{mode}}", "plugin_red_packet_history_send": "Send", + "plugin_nft_red_packet_create": "Create an NFT Lucky Drop", "plugin_red_packet_nft_account_name": "Wallet account", "plugin_red_packet_nft_attached_message": "Attached Message", "plugin_red_packet_nft_total_amount": "Total Amount", diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getNFTRedpacketDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getNFTRedpacketDescription.tsx new file mode 100644 index 000000000000..efb6071bb0ff --- /dev/null +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getNFTRedpacketDescription.tsx @@ -0,0 +1,19 @@ +import { getNftRedPacketConstants, isSameAddress } from '@masknet/web3-shared-evm' +import { i18n } from '../../../../../../shared-ui/locales_legacy' +import type { ContractMethodInfo, ComputedPayload } from '../type' + +export function getNFTRedpacketDescription( + { name, address, chainId }: ContractMethodInfo, + computedPayload: ComputedPayload, +) { + const { RED_PACKET_NFT_ADDRESS } = getNftRedPacketConstants(chainId) + + if (!isSameAddress(address, RED_PACKET_NFT_ADDRESS)) return undefined + + switch (name) { + case 'create_red_packet': + return i18n.t('plugin_nft_red_packet_create') + default: + return undefined + } +} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts index 3c7c38f8e432..0406de6a2bb3 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/index.ts @@ -1,10 +1,12 @@ import { getRedpacketDescription } from './getRedpacketDescription' import { getITO_Description } from './getITO_Description' +import { getNFTRedpacketDescription } from './getNFTRedpacketDescription' import type { ContractMethodInfo, ComputedPayload } from '../type' export function getContractMethodDescription(contractMethodInfo: ContractMethodInfo, computedPayload: ComputedPayload) { return ( getRedpacketDescription(contractMethodInfo, computedPayload) ?? - getITO_Description(contractMethodInfo, computedPayload) + getITO_Description(contractMethodInfo, computedPayload) ?? + getNFTRedpacketDescription(contractMethodInfo, computedPayload) ) } From f4cb83007f821e284e1796e5b937bb9df3e3d50a Mon Sep 17 00:00:00 2001 From: zhouhanseng Date: Thu, 13 Jan 2022 18:49:09 +0800 Subject: [PATCH 5/5] chore: reply code review --- packages/mask/shared-ui/locales/en-US.json | 2 +- packages/mask/shared-ui/locales/ja-JP.json | 2 +- packages/mask/shared-ui/locales/ko-KR.json | 2 +- packages/mask/shared-ui/locales/qya-AA.json | 2 +- packages/mask/shared-ui/locales/zh-CN.json | 2 +- packages/mask/shared-ui/locales/zh-TW.json | 2 +- .../src/plugins/RedPacket/SNSAdaptor/RedPacketDialog.tsx | 5 ++--- .../contractMethodDescription/getRedpacketDescription.tsx | 3 ++- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 5fa727ebefeb..c97cf8862f06 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -359,7 +359,7 @@ "plugin_red_packet_token": "Token", "plugin_red_packet_message_label": "Title", "plugin_red_packet_create": "Create a Lucky Drop", - "plugin_red_packet_create_with_token": "Create a Lucky Drop with {{symbol}}", + "plugin_red_packet_create_with_token": "Create a Lucky Drop with {{amount}} {{symbol}}", "plugin_red_packet_history_duration": "Time: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "Total Amount: {{amount}} {{symbol}}", "plugin_red_packet_history_total_claimed_amount": "Total: {{claimedAmount}}/{{amount}} {{symbol}}", diff --git a/packages/mask/shared-ui/locales/ja-JP.json b/packages/mask/shared-ui/locales/ja-JP.json index 87488e9583c5..6278ba3a1e6f 100644 --- a/packages/mask/shared-ui/locales/ja-JP.json +++ b/packages/mask/shared-ui/locales/ja-JP.json @@ -163,7 +163,7 @@ "plugin_red_packet_refunding_for": "{{balance}} {{symbol}} の投げ銭を払い戻し中", "plugin_red_packet_amount_per_share": "1株当たりの金額", "plugin_red_packet_send_symbol": "{{symbol}} を送る", - "plugin_red_packet_create_with_token": "{{symbol}} で投げ銭を作成する", + "plugin_red_packet_create_with_token": "{{amount}} {{symbol}} で投げ銭を作成する", "plugin_gitcoin_readme": "このサービスを利用するにあたり、寄付金額の 5% が Gitcoin grants development fund に寄付されます", "plugin_gitcoin_select_a_token": "トークンを選択する", "plugin_gitcoin_enter_an_amount": "量を決める", diff --git a/packages/mask/shared-ui/locales/ko-KR.json b/packages/mask/shared-ui/locales/ko-KR.json index 605c497aa87e..ee5612e3883d 100644 --- a/packages/mask/shared-ui/locales/ko-KR.json +++ b/packages/mask/shared-ui/locales/ko-KR.json @@ -314,7 +314,7 @@ "plugin_red_packet_hint": "레드 패킷이 공유된 후 24시간 후에 나머지 잔액을 인출할 수 있습니다.", "plugin_red_packet_token": "토큰", "plugin_red_packet_message_label": "제목", - "plugin_red_packet_create_with_token": "{{symbol}} 으로 빨간 백 만드는 중", + "plugin_red_packet_create_with_token": "{{amount}} {{symbol}} 으로 빨간 백 만드는 중", "plugin_red_packet_history_duration": "시간: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "총액: {{amount}} {{symbol}}", "plugin_red_packet_history_total_claimed_amount": "전체: {{claimedAmount}}/{{amount}} {{symbol}}", diff --git a/packages/mask/shared-ui/locales/qya-AA.json b/packages/mask/shared-ui/locales/qya-AA.json index 138f4b8e176c..f85d7436e727 100644 --- a/packages/mask/shared-ui/locales/qya-AA.json +++ b/packages/mask/shared-ui/locales/qya-AA.json @@ -358,7 +358,7 @@ "plugin_red_packet_hint": "crwdns4771:0crwdne4771:0", "plugin_red_packet_token": "crwdns4773:0crwdne4773:0", "plugin_red_packet_message_label": "crwdns8157:0crwdne8157:0", - "plugin_red_packet_create_with_token": "crwdns4775:0{{symbol}}crwdne4775:0", + "plugin_red_packet_create_with_token": "crwdns4775:0{{amount}} {{symbol}}crwdne4775:0", "plugin_red_packet_history_duration": "crwdns4777:0{{startTime}}crwdnd4777:0{{endTime}}crwdne4777:0", "plugin_red_packet_history_total_amount": "crwdns4779:0{{amount}}crwdnd4779:0{{symbol}}crwdne4779:0", "plugin_red_packet_history_total_claimed_amount": "crwdns4781:0{{claimedAmount}}crwdnd4781:0{{amount}}crwdnd4781:0{{symbol}}crwdne4781:0", diff --git a/packages/mask/shared-ui/locales/zh-CN.json b/packages/mask/shared-ui/locales/zh-CN.json index cdacba72d114..9721aa728801 100644 --- a/packages/mask/shared-ui/locales/zh-CN.json +++ b/packages/mask/shared-ui/locales/zh-CN.json @@ -353,7 +353,7 @@ "plugin_red_packet_hint": "你可以在红包发送的24小时后提取红包余额。", "plugin_red_packet_token": "代币", "plugin_red_packet_message_label": "标题", - "plugin_red_packet_create_with_token": "使用 {{symbol}} 创建红包", + "plugin_red_packet_create_with_token": "使用 {{amount}} {{symbol}} 创建红包", "plugin_red_packet_history_duration": "时间: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "总额: {{amount}} {{symbol}}", "plugin_red_packet_history_total_claimed_amount": "总额: {{claimedAmount}}/{{amount}} {{symbol}}", diff --git a/packages/mask/shared-ui/locales/zh-TW.json b/packages/mask/shared-ui/locales/zh-TW.json index 7a5c2512295a..fea4dc44b50b 100644 --- a/packages/mask/shared-ui/locales/zh-TW.json +++ b/packages/mask/shared-ui/locales/zh-TW.json @@ -282,7 +282,7 @@ "plugin_red_packet_back": "返回", "plugin_red_packet_token": "代幣", "plugin_red_packet_message_label": "標題", - "plugin_red_packet_create_with_token": "使用 {{symbol}} 建立紅包", + "plugin_red_packet_create_with_token": "使用 {{amount}} {{symbol}} 建立紅包", "plugin_red_packet_history_duration": "時間: {{startTime}} ~ {{endTime}} (UTC+8)", "plugin_red_packet_history_total_amount": "總額: {{amount}} {{symbol}}", "plugin_red_packet_history_total_claimed_amount": "總共: {{claimedAmount}}/{{amount}} {{symbol}}", diff --git a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketDialog.tsx b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketDialog.tsx index 22d4a72d4b76..acfbd73ea910 100644 --- a/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketDialog.tsx +++ b/packages/mask/src/plugins/RedPacket/SNSAdaptor/RedPacketDialog.tsx @@ -209,9 +209,8 @@ export default function RedPacketDialog(props: RedPacketDialogProps) { open: true, state: createState, summary: t('plugin_red_packet_create_with_token', { - symbol: `${formatBalance(createSettings?.total, createSettings?.token?.decimals)} ${ - createSettings?.token.symbol - }`, + amount: formatBalance(createSettings?.total, createSettings?.token?.decimals), + symbol: createSettings?.token.symbol, }), }) }, [createState /* update tx dialog only if state changed */]) diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx index af7aa7aa80fd..205141462a99 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/WalletStatusDialog/contractMethodDescription/getRedpacketDescription.tsx @@ -47,7 +47,8 @@ export function CreateRedpacketDescription(props: CreateRedpacketDescriptionProp {token && tokenAddress ? t('plugin_red_packet_create_with_token', { - symbol: `${formatBalance(tokenAmount, token.decimals)} ${token.symbol}`, + amount: formatBalance(tokenAmount, token.decimals), + symbol: token.symbol, }) : t('plugin_red_packet_create')}