Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add different copy for tooltip when a snap is requesting a signature #27492

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/_locales/en/messages.json

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 @@ -19,6 +19,7 @@ import { selectUseTransactionSimulations } from '../../../../selectors/preferenc
import { isSIWESignatureRequest } from '../../../../utils';
import { ConfirmInfoAlertRow } from '../../../../../../components/app/confirm/info/row/alert-row/alert-row';
import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { isSnapId } from '../../../../../../helpers/utils/snaps';
import { SIWESignInfo } from './siwe-sign';

const PersonalSignInfo: React.FC = () => {
Expand All @@ -35,6 +36,15 @@ const PersonalSignInfo: React.FC = () => {
const { from } = currentConfirmation.msgParams;
const isSIWE = isSIWESignatureRequest(currentConfirmation);

let toolTipMessage;
if (!isSIWE) {
if (isSnapId(currentConfirmation.msgParams.origin)) {
toolTipMessage = t('requestfromInfoSnap');
} else {
toolTipMessage = t('requestFromInfo');
}
}

return (
<>
{isSIWE && useTransactionSimulations && (
Expand All @@ -52,7 +62,7 @@ const PersonalSignInfo: React.FC = () => {
alertKey={RowAlertKey.RequestFrom}
ownerId={currentConfirmation.id}
label={t('requestFrom')}
tooltip={isSIWE ? undefined : t('requestFromInfo')}
tooltip={toolTipMessage}
>
<ConfirmInfoRowUrl url={currentConfirmation.msgParams.origin} />
</ConfirmInfoAlertRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { useConfirmContext } from '../../../../context/confirm';
import { ConfirmInfoRowTypedSignDataV1 } from '../../row/typed-sign-data-v1/typedSignDataV1';
import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { isSnapId } from '../../../../../../helpers/utils/snaps';

const TypedSignV1Info: React.FC = () => {
const t = useI18nContext();
Expand All @@ -23,14 +24,18 @@ const TypedSignV1Info: React.FC = () => {
return null;
}

const toolTipMessage = isSnapId(currentConfirmation.msgParams.origin)
? t('requestfromInfoSnap')
: t('requestFromInfo');

return (
<>
<ConfirmInfoSection>
<ConfirmInfoAlertRow
alertKey={RowAlertKey.RequestFrom}
ownerId={currentConfirmation.id}
label={t('requestFrom')}
tooltip={t('requestFromInfo')}
tooltip={toolTipMessage}
>
<ConfirmInfoRowUrl
url={currentConfirmation.msgParams?.origin ?? ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useConfirmContext } from '../../../../context/confirm';
import { selectUseTransactionSimulations } from '../../../../selectors/preferences';
import { ConfirmInfoRowTypedSignData } from '../../row/typed-sign-data/typedSignData';
import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { isSnapId } from '../../../../../../helpers/utils/snaps';
import { PermitSimulation } from './permit-simulation';

const TypedSignInfo: React.FC = () => {
Expand Down Expand Up @@ -54,6 +55,10 @@ const TypedSignInfo: React.FC = () => {
})();
}, [verifyingContract]);

const toolTipMessage = isSnapId(currentConfirmation.msgParams.origin)
? t('requestfromInfoSnap')
: t('requestFromInfo');

return (
<>
{isPermit && useTransactionSimulations && <PermitSimulation />}
Expand All @@ -70,7 +75,7 @@ const TypedSignInfo: React.FC = () => {
alertKey={RowAlertKey.RequestFrom}
ownerId={currentConfirmation.id}
label={t('requestFrom')}
tooltip={t('requestFromInfo')}
tooltip={toolTipMessage}
>
<ConfirmInfoRowUrl url={currentConfirmation.msgParams.origin} />
</ConfirmInfoAlertRow>
Expand Down