diff --git a/src/constant/index.ts b/src/constant/index.ts index 02e36f36288..7d28f0d72a9 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -1057,3 +1057,5 @@ export const SIGN_PERMISSION_OPTIONS = [ value: SIGN_PERMISSION_TYPES.TESTNET, }, ]; + +export const REJECT_SIGN_TEXT_KEYRINGS = [KEYRING_TYPE.CoboArgusKeyring]; diff --git a/src/ui/views/Approval/components/SignText.tsx b/src/ui/views/Approval/components/SignText.tsx index 5ca670964f8..866c9c28c03 100644 --- a/src/ui/views/Approval/components/SignText.tsx +++ b/src/ui/views/Approval/components/SignText.tsx @@ -11,6 +11,7 @@ import { KEYRING_CLASS, KEYRING_TYPE, CHAINS, + REJECT_SIGN_TEXT_KEYRINGS, } from 'consts'; import { hex2Text, useApproval, useCommonPopupView, useWallet } from 'ui/utils'; import { getKRCategoryByType } from '@/utils/transaction'; @@ -286,6 +287,13 @@ const SignText = ({ params }: { params: SignTextProps }) => { signText: string, sender: string ) => { + const currentAccount = await wallet.getCurrentAccount(); + if ( + currentAccount?.type && + REJECT_SIGN_TEXT_KEYRINGS.includes(currentAccount.type) + ) { + rejectApproval('This address can not sign text message', false, true); + } const parsed = parseAction(textActionData, signText, sender); setParsedActionData(parsed); const ctx = formatSecurityEngineCtx({ diff --git a/src/ui/views/Approval/components/SignTypedData.tsx b/src/ui/views/Approval/components/SignTypedData.tsx index 7f0afe3604f..6d3f7812f8b 100644 --- a/src/ui/views/Approval/components/SignTypedData.tsx +++ b/src/ui/views/Approval/components/SignTypedData.tsx @@ -16,6 +16,7 @@ import { KEYRING_CLASS, KEYRING_TYPE, CHAINS, + REJECT_SIGN_TEXT_KEYRINGS, } from 'consts'; import IconGnosis from 'ui/assets/walletlogo/safe.svg'; import { useApproval, useCommonPopupView, useWallet } from 'ui/utils'; @@ -387,6 +388,12 @@ const SignTypedData = ({ params }: { params: SignTypedDataProps }) => { const currentAccount = isGnosis ? account : await wallet.getCurrentAccount(); + if ( + currentAccount?.type && + REJECT_SIGN_TEXT_KEYRINGS.includes(currentAccount.type) + ) { + rejectApproval('This address can not sign text message', false, true); + } setIsLedger(currentAccount?.type === KEYRING_CLASS.HARDWARE.LEDGER); setUseLedgerLive(await wallet.isUseLedgerLive()); };