From 93d8f2340fd29bf2229e3538976b792dfd6d98c8 Mon Sep 17 00:00:00 2001 From: gregs Date: Tue, 17 Oct 2023 15:12:35 -0300 Subject: [PATCH] scam dapp connection warning (#1051) --- src/core/resources/metadata/dapp.ts | 3 + src/design-system/styles/core.css.ts | 2 +- src/design-system/styles/designTokens.ts | 2 + src/design-system/symbols/generated/index.ts | 54 +++++++ .../useApproveAppRequestValidations.ts | 9 +- .../pages/messages/BottomActions/index.tsx | 28 +++- .../popup/pages/messages/DappScanStatus.tsx | 73 ++++++++++ .../RequestAccountsActions.tsx | 45 +++--- .../RequestAccounts/RequestAccountsInfo.tsx | 53 ++++--- .../pages/messages/RequestAccounts/index.tsx | 4 +- .../SendTransactionActions.tsx | 56 ++++---- .../SendTransaction/SendTransactionsInfo.tsx | 133 +++++++++--------- .../pages/messages/SendTransaction/index.tsx | 1 + .../SignMessage/SignMessageActions.tsx | 55 +++++--- .../messages/SignMessage/SignMessageInfo.tsx | 122 ++++++++-------- .../pages/messages/SignMessage/index.tsx | 1 + static/json/languages/en_US.json | 11 +- 17 files changed, 432 insertions(+), 220 deletions(-) create mode 100644 src/entries/popup/pages/messages/DappScanStatus.tsx diff --git a/src/core/resources/metadata/dapp.ts b/src/core/resources/metadata/dapp.ts index cbb9b00da7..f41a1ee1dd 100644 --- a/src/core/resources/metadata/dapp.ts +++ b/src/core/resources/metadata/dapp.ts @@ -1,6 +1,7 @@ import { useQuery } from '@tanstack/react-query'; import { metadataClient } from '~/core/graphql'; +import { DAppStatus } from '~/core/graphql/__generated__/metadata'; import { QueryFunctionArgs, createQueryKey, @@ -23,6 +24,7 @@ export interface DappMetadata { appShortName: string; appLogo?: string; timestamp?: number; + status?: DAppStatus; } // /////////////////////////////////////////////// @@ -76,6 +78,7 @@ async function fetchDappMetadata({ appName, appShortName, appLogo: response?.dApp?.iconURL, + status: response.dApp?.status, }; return dappMetadata; } diff --git a/src/design-system/styles/core.css.ts b/src/design-system/styles/core.css.ts index 2eb81febe2..5ba780adfa 100644 --- a/src/design-system/styles/core.css.ts +++ b/src/design-system/styles/core.css.ts @@ -368,7 +368,7 @@ const boxBaseProperties = defineProperties({ bottom: positionSpace, cursor: cursorOpts, display: ['none', 'flex', 'block', 'inline'], - flexDirection: ['row', 'column'], + flexDirection: ['row', 'column', 'column-reverse'], flexWrap: ['wrap'], flexBasis: ['0'], flexGrow: ['0', '1'], diff --git a/src/design-system/styles/designTokens.ts b/src/design-system/styles/designTokens.ts index 3203b14e98..d2d23a3f91 100644 --- a/src/design-system/styles/designTokens.ts +++ b/src/design-system/styles/designTokens.ts @@ -1003,6 +1003,8 @@ export const symbolNames = selectSymbolNames( 'creditcard.fill', 'building.columns', 'paintbrush.pointed.fill', + 'exclamationmark.octagon.fill', + 'network.badge.shield.half.filled', 'safari.fill', ); export type SymbolName = (typeof symbolNames)[number]; diff --git a/src/design-system/symbols/generated/index.ts b/src/design-system/symbols/generated/index.ts index 98e9238ec1..e513f262e2 100644 --- a/src/design-system/symbols/generated/index.ts +++ b/src/design-system/symbols/generated/index.ts @@ -3914,6 +3914,60 @@ export default { viewBox: { width: 33.43158688453961, height: 31.049885444208982 }, }, }, + 'exclamationmark.octagon.fill': { + regular: { + name: 'exclamationmark.octagon.fill', + path: 'M9.8937 27.0426H18.1937C19.9337 27.0426 20.7537 26.4826 21.6537 25.5126L26.9637 19.6626C27.8537 18.6726 28.0937 18.0026 28.0937 16.6526V10.4026C28.0937 9.0326 27.8537 8.3826 26.9637 7.3926L21.6537 1.5426C20.7537 0.5726 19.9337 0.0026 18.1937 0.0026H9.8937C8.1637 0.0026 7.3237 0.5726 6.4437 1.5426L1.1337 7.3926C0.2337 8.3826 0.0037 9.0326 0.0037 10.4026V16.6526C0.0037 18.0026 0.2337 18.6726 1.1337 19.6626L6.4437 25.5126C7.3237 26.4826 8.1637 27.0426 9.8937 27.0426ZM14.0537 16.0626C13.3437 16.0626 12.9437 15.6726 12.9337 14.9426L12.7537 7.4926C12.7437 6.7626 13.2737 6.2526 14.0437 6.2526C14.7937 6.2526 15.3537 6.7826 15.3437 7.5026L15.1437 14.9426C15.1337 15.6826 14.7337 16.0626 14.0537 16.0626ZM14.0537 20.6426C13.2337 20.6426 12.5237 19.9926 12.5237 19.1826C12.5237 18.3726 13.2237 17.7026 14.0537 17.7026C14.8937 17.7026 15.5837 18.3626 15.5837 19.1826C15.5837 20.0026 14.8737 20.6426 14.0537 20.6426Z', + viewBox: { width: 28.095703125, height: 27.04296875 }, + }, + medium: { + name: 'exclamationmark.octagon.fill', + path: 'M10.1137 27.4913H18.4837C20.2437 27.4913 21.2037 26.9013 22.1437 25.8513L27.4137 19.9913C28.3737 18.9313 28.6137 18.2413 28.6137 16.8013V10.6913C28.6137 9.2513 28.3237 8.5813 27.3537 7.5013L22.1437 1.6313C21.2237 0.5913 20.2437 0.0013 18.4837 0.0013H10.1137C8.3537 0.0013 7.4137 0.5913 6.4637 1.6313L1.1937 7.5013C0.2437 8.5613 0.0037 9.2513 0.0037 10.6913V16.8013C0.0037 18.2413 0.2437 18.9313 1.1937 19.9913L6.4637 25.8513C7.4137 26.9013 8.3537 27.4913 10.1137 27.4913ZM14.3137 16.1013C13.5237 16.1013 13.0537 15.6513 13.0437 14.8513L12.8337 7.9613C12.8137 7.1213 13.4237 6.5313 14.3037 6.5313C15.1737 6.5313 15.8037 7.1413 15.7737 7.9713L15.5737 14.8513C15.5437 15.6713 15.0937 16.1013 14.3137 16.1013ZM14.3137 20.8113C13.3937 20.8113 12.6437 20.1513 12.6437 19.2513C12.6437 18.3613 13.3937 17.6913 14.3137 17.6913C15.2437 17.6913 15.9837 18.3613 15.9837 19.2513C15.9837 20.1613 15.2337 20.8113 14.3137 20.8113Z', + viewBox: { width: 28.615234375, height: 27.494140625 }, + }, + semibold: { + name: 'exclamationmark.octagon.fill', + path: 'M10.2937 27.8627H18.7137C20.5037 27.8627 21.5437 27.2527 22.5337 26.1527L27.7637 20.2627C28.7537 19.1527 29.0137 18.4327 29.0137 16.9227V10.9327C29.0137 9.4327 28.6837 8.7727 27.6737 7.6027L22.5337 1.7227C21.5637 0.6127 20.5037 0.0027 18.7137 0.0027H10.2937C8.5037 0.0027 7.4637 0.6327 6.4837 1.7227L1.2337 7.6027C0.2437 8.7227 0.0037 9.4327 0.0037 10.9327V16.9227C0.0037 18.4327 0.2437 19.1527 1.2337 20.2627L6.4837 26.1527C7.4637 27.2527 8.5037 27.8627 10.2937 27.8627ZM14.5237 16.1627C13.6437 16.1627 13.1537 15.6827 13.1137 14.7927L12.9037 8.3227C12.8637 7.4127 13.5337 6.7627 14.5037 6.7627C15.4637 6.7627 16.1437 7.4227 16.1037 8.3427L15.9037 14.7927C15.8637 15.6827 15.3637 16.1627 14.5237 16.1627ZM14.5237 20.9727C13.5337 20.9727 12.7237 20.2927 12.7237 19.3327C12.7237 18.3727 13.5237 17.6927 14.5237 17.6927C15.5137 17.6927 16.2937 18.3727 16.2937 19.3327C16.2937 20.3027 15.5037 20.9727 14.5237 20.9727Z', + viewBox: { width: 29.01171875, height: 27.86328125 }, + }, + bold: { + name: 'exclamationmark.octagon.fill', + path: 'M10.5237 28.3252H19.0037C20.8337 28.3252 22.0137 27.6852 23.0337 26.5052L28.2437 20.6052C29.2737 19.4252 29.5337 18.6752 29.5337 17.0852V11.2352C29.5337 9.6552 29.1437 9.0052 28.0837 7.7252L23.0337 1.8152C22.0237 0.6252 20.8337 -0.0048 19.0037 -0.0048H10.5237C8.6937 -0.0048 7.5337 0.6552 6.5037 1.8152L1.3037 7.7252C0.2637 8.9152 0.0037 9.6552 0.0037 11.2352V17.0852C0.0037 18.6752 0.2637 19.4252 1.3037 20.6052L6.5037 26.5052C7.5337 27.6852 8.6937 28.3252 10.5237 28.3252ZM14.7837 16.2152C13.8237 16.2152 13.2637 15.6852 13.2037 14.7152L12.9837 8.8052C12.9437 7.7652 13.6737 7.0652 14.7637 7.0652C15.8637 7.0652 16.5937 7.7752 16.5537 8.8052L16.3237 14.6952C16.2837 15.6852 15.7237 16.2152 14.7837 16.2152ZM14.7837 21.1552C13.7037 21.1552 12.8537 20.4652 12.8537 19.4152C12.8537 18.3852 13.6837 17.6952 14.7837 17.6952C15.8737 17.6952 16.7037 18.3852 16.7037 19.4152C16.7037 20.4652 15.8737 21.1552 14.7837 21.1552Z', + viewBox: { width: 29.53125, height: 28.328125 }, + }, + heavy: { + name: 'exclamationmark.octagon.fill', + path: 'M10.8537 29.007H19.4437C21.3137 29.007 22.6637 28.317 23.7637 27.057L28.9137 21.097C30.0237 19.827 30.2937 19.017 30.2937 17.327V11.687C30.2937 9.997 29.8437 9.337 28.6737 7.917L23.7637 1.967C22.7137 0.667 21.3137 -0.003 19.4437 -0.003H10.8537C8.9837 -0.003 7.6337 0.697 6.5337 1.967L1.3837 7.917C0.2737 9.187 0.0037 9.997 0.0037 11.687V17.327C0.0037 19.017 0.2737 19.827 1.3837 21.097L6.5337 27.057C7.6337 28.317 8.9837 29.007 10.8537 29.007ZM15.1737 16.287C14.0637 16.287 13.4237 15.677 13.3537 14.587L13.1237 9.487C13.0537 8.297 13.8937 7.507 15.1437 7.507C16.4237 7.507 17.2537 8.297 17.2037 9.487L16.9537 14.577C16.8837 15.697 16.2537 16.287 15.1737 16.287ZM15.1737 21.427C13.9437 21.427 13.0137 20.717 13.0137 19.537C13.0137 18.387 13.9437 17.677 15.1737 17.677C16.4037 17.677 17.3037 18.407 17.3037 19.537C17.3037 20.717 16.3937 21.427 15.1737 21.427Z', + viewBox: { width: 30.296875, height: 29.01171875 }, + }, + }, + 'network.badge.shield.half.filled': { + regular: { + name: 'network.badge.shield.half.filled', + path: 'M13.9427 27.8864C15.5727 27.8864 17.2027 27.5764 18.7327 27.0164C18.9327 26.9464 19.1227 26.8664 19.3027 26.7864C18.8627 26.3364 18.4327 25.7764 18.1427 25.2264C17.9827 25.3064 17.8127 25.3564 17.6327 25.4164C16.9127 24.3064 16.3127 23.1564 15.8227 21.9964C16.2127 21.6164 16.4427 21.0664 16.4427 20.4664C16.4427 19.3964 15.6727 18.5264 14.6427 18.3764C14.3027 16.8464 14.1227 15.2964 14.1227 13.7664C14.5427 13.7964 14.9727 13.8064 15.3927 13.8064C15.8827 13.8064 16.3627 13.7764 16.8427 13.7364C17.2127 14.0864 17.7227 14.2864 18.2627 14.2864C19.0727 14.2864 19.7727 13.8364 20.1227 13.1564C22.0527 12.6164 23.8827 11.7464 25.5227 10.5864C25.6227 10.8864 25.6927 11.1864 25.7627 11.4864C26.4127 11.4964 26.9927 11.6464 27.7227 11.9264C26.7427 5.2364 20.8627 -0.0036 13.9327 -0.0036C6.3027 -0.0036 0.0027 6.3164 0.0027 13.9464C0.0027 21.5564 6.3127 27.8864 13.9427 27.8864ZM15.6727 1.9864C13.8627 5.0164 12.7927 8.3964 12.5227 11.9064C11.7027 11.7764 10.9127 11.5664 10.1127 11.3064C10.0727 10.7764 9.8327 10.2964 9.4727 9.9564C10.6827 6.9064 12.5927 4.1464 15.0927 1.9164C15.2827 1.9264 15.4727 1.9564 15.6727 1.9864ZM3.8327 7.3864C5.7827 4.4064 9.0127 2.2964 12.7127 1.9164C10.6327 4.0864 9.0127 6.6164 7.9327 9.3664C7.5427 9.3664 7.1227 9.5064 6.7827 9.7364C5.7127 9.0764 4.7127 8.2864 3.8327 7.3864ZM16.5027 7.5464C16.5127 8.5964 16.6227 9.6364 16.8327 10.6464C16.4227 11.0164 16.1627 11.5364 16.1427 12.1264C15.9027 12.1364 15.6427 12.1564 15.3927 12.1564C14.9827 12.1564 14.5727 12.1364 14.1827 12.1164C14.4127 8.7664 15.4227 5.5464 17.1427 2.7364C16.6927 4.2764 16.4727 5.8964 16.5027 7.5464ZM18.1527 7.5364C18.1327 5.9564 18.3627 4.4064 18.8127 2.9164C21.5027 4.1164 23.6927 6.2864 24.9227 8.9564C23.4927 10.0364 21.9027 10.8564 20.2027 11.4064C19.9027 10.6664 19.2227 10.1464 18.4027 10.0864C18.2527 9.2564 18.1727 8.3964 18.1527 7.5364ZM1.8627 13.9464C1.8627 12.1564 2.2527 10.4564 2.9627 8.9164C3.8727 9.7664 4.8427 10.5164 5.8827 11.1464C5.8627 11.2564 5.8527 11.3764 5.8527 11.4964C5.8527 12.2264 6.2227 12.8664 6.7827 13.2664C6.4927 14.6864 6.3427 16.1464 6.3427 17.6364C4.7627 16.8864 3.2627 15.9164 1.8827 14.7564C1.8627 14.4764 1.8627 14.2164 1.8627 13.9464ZM12.4727 13.6564C12.4727 15.3964 12.6627 17.1164 13.0327 18.7764C12.7727 18.9764 12.5527 19.2264 12.4027 19.5264C10.9127 19.2864 9.4327 18.9064 8.0027 18.3564C7.9427 16.7464 8.0827 15.1464 8.3927 13.6064C8.8727 13.5064 9.3127 13.2464 9.6227 12.8764C10.5427 13.1964 11.5027 13.4264 12.4727 13.5764C12.4727 13.6564 12.4727 13.6564 12.4727 13.6564ZM18.6527 22.0964C18.6527 24.9264 20.3127 25.9664 24.3627 28.3464C24.8127 28.6064 25.3727 28.5464 25.7327 28.3464C29.7727 25.9664 31.4327 24.9264 31.4327 22.0964V16.7464C31.4327 15.8964 31.1127 15.3264 30.2427 14.9564C29.3527 14.5864 26.6227 13.6564 25.8927 13.3864C25.3427 13.1564 24.8027 13.1664 24.3227 13.3264C23.4627 13.6264 20.7427 14.5864 19.8527 14.9564C18.9727 15.3264 18.6527 15.8964 18.6527 16.7464ZM20.6627 21.8364V17.3864C20.6627 16.9764 20.7827 16.7764 21.1927 16.6264C22.1627 16.2664 23.6127 15.7264 24.5727 15.3764C24.7427 15.3164 24.8827 15.2864 25.0427 15.2864V26.2664C24.9127 26.2664 24.7727 26.2264 24.6327 26.1564C21.5027 24.2664 20.6627 23.8064 20.6627 21.8364ZM2.3127 17.1864C3.5927 18.1064 4.9627 18.8664 6.3827 19.4964C6.4527 20.9564 6.6727 22.4064 7.0427 23.8264C4.7827 22.2264 3.0727 19.8964 2.3127 17.1864ZM13.9427 26.0264C12.2527 26.0264 10.6327 25.6764 9.1727 25.0164C8.5827 23.4464 8.2327 21.8164 8.0827 20.1564C9.4627 20.6264 10.8727 20.9764 12.3027 21.1864C12.5927 21.9964 13.3527 22.5864 14.2727 22.6164C14.7427 23.7364 15.3127 24.8164 15.9527 25.8564C15.3027 25.9764 14.6427 26.0264 13.9427 26.0264Z', + viewBox: { width: 31.431640625, height: 28.516712341690944 }, + }, + medium: { + name: 'network.badge.shield.half.filled', + path: 'M14.1227 28.2441C15.7227 28.2441 17.3127 27.9541 18.8127 27.4141C19.0027 27.3541 19.1927 27.2841 19.3727 27.1941C18.7727 26.6041 18.3227 25.9241 18.0427 25.2341C17.8927 25.1741 17.7627 24.9541 17.6227 24.6741C17.0727 23.7741 16.5927 22.8341 16.2027 21.8741C16.5027 21.5041 16.6927 21.0141 16.6927 20.4941C16.6927 19.4841 16.0127 18.6241 15.0627 18.3741C14.7427 16.9141 14.5627 15.4341 14.5327 13.9841C14.8727 14.0141 15.2127 14.0141 15.5627 14.0141C16.0627 14.0141 16.5727 13.9841 17.0627 13.9441C17.4427 14.2841 17.9527 14.5041 18.5127 14.5041C19.3427 14.5041 20.0827 14.0141 20.4427 13.3141C22.2727 12.7841 24.0227 11.9541 25.5927 10.8441C25.6727 11.1141 25.7427 11.4041 25.8127 11.6741C26.5127 11.6941 27.1427 11.8241 28.0927 12.1641C27.1227 5.3341 21.1827 0.0041 14.1127 0.0041C6.3727 0.0041 0.0027 6.3941 0.0027 14.1241C0.0027 21.8641 6.3827 28.2441 14.1227 28.2441ZM15.7227 2.3141C14.0227 5.2541 13.0027 8.5341 12.7427 11.9241C11.9727 11.7841 11.2227 11.5941 10.4827 11.3441C10.4327 10.8241 10.1827 10.3641 9.8327 10.0041C11.0027 7.0841 12.8427 4.4141 15.2327 2.2441C15.3927 2.2741 15.5627 2.2841 15.7227 2.3141ZM4.2527 7.4641C6.1227 4.7041 9.1227 2.7641 12.5527 2.2941C10.6227 4.3741 9.1227 6.7641 8.0927 9.3641C7.7127 9.3941 7.3427 9.5141 7.0427 9.7241C6.0327 9.0741 5.1027 8.3241 4.2527 7.4641ZM18.4727 7.5641C18.4527 6.1141 18.6527 4.6741 19.0427 3.2941C21.6027 4.4541 23.6627 6.5041 24.8927 9.0241C23.5427 10.0441 22.0427 10.8441 20.4527 11.3641C20.1227 10.7141 19.4827 10.2541 18.7327 10.1841C18.5627 9.3241 18.4827 8.4541 18.4727 7.5641ZM16.6227 7.5641C16.6227 8.6641 16.7527 9.7441 16.9627 10.8141C16.6227 11.1541 16.3927 11.6241 16.3527 12.1441C16.0927 12.1541 15.8327 12.1541 15.5627 12.1541C15.2327 12.1641 14.9127 12.1541 14.5927 12.1441C14.8027 9.1741 15.6227 6.3441 17.0127 3.7841C16.7327 5.0141 16.6127 6.2741 16.6227 7.5641ZM2.1827 14.1241C2.1827 12.3641 2.5827 10.6741 3.2827 9.1741C4.1327 9.9641 5.0427 10.6741 6.0127 11.2941C6.0027 11.3841 6.0027 11.4941 6.0027 11.6041C6.0027 12.3441 6.3527 13.0041 6.9227 13.4141C6.6627 14.7541 6.5127 16.1141 6.4927 17.5141C4.9727 16.7641 3.5427 15.8141 2.2027 14.6841C2.1827 14.5041 2.1827 14.3141 2.1827 14.1241ZM8.3527 18.3241C8.3127 16.7841 8.4327 15.2741 8.7227 13.8041C9.1827 13.7141 9.5927 13.4641 9.9127 13.1141C10.8127 13.4141 11.7327 13.6441 12.6727 13.7941C12.6827 15.4541 12.8527 17.1041 13.1927 18.7141C12.9327 18.9041 12.7127 19.1441 12.5527 19.4241C11.1327 19.2041 9.7227 18.8441 8.3527 18.3241ZM18.8127 22.4341C18.8127 25.2641 20.4827 26.3741 24.6127 28.6941C25.0427 28.9541 25.5927 28.9041 25.9627 28.6941C30.0927 26.3641 31.7627 25.2641 31.7627 22.4341V17.1041C31.7627 16.1441 31.4327 15.5741 30.4927 15.1641C29.6527 14.8241 26.9427 13.9141 26.2627 13.6541C25.6227 13.4141 24.9927 13.4141 24.4227 13.6041C23.6227 13.8941 20.9327 14.8241 20.0927 15.1641C19.1527 15.5741 18.8127 16.1441 18.8127 17.1041ZM20.9027 22.1741V17.6741C20.9027 17.2841 21.0127 17.0941 21.4127 16.9541C22.3827 16.5841 23.8827 16.0241 24.7427 15.7241C24.9627 15.6441 25.1127 15.6141 25.2927 15.6141V26.5341C25.1527 26.5341 25.0327 26.5141 24.8927 26.4241C21.8027 24.5641 20.9027 24.0941 20.9027 22.1741ZM2.6527 17.3941C3.8827 18.2541 5.1927 18.9941 6.5527 19.5741C6.6127 21.0141 6.8327 22.4241 7.2027 23.8141C5.0427 22.2541 3.4027 20.0041 2.6527 17.3941ZM14.1227 26.0541C12.5227 26.0541 10.9927 25.7341 9.5927 25.1441C9.0127 23.5941 8.6227 21.9841 8.4627 20.3341C9.7627 20.7641 11.0927 21.0841 12.4327 21.2841C12.7327 22.0841 13.4827 22.6541 14.3727 22.6941C14.8227 23.8341 15.3527 24.8941 15.9527 25.9041C15.3827 26.0041 14.7427 26.0541 14.1227 26.0541Z', + viewBox: { width: 31.759765625, height: 28.872181091690944 }, + }, + semibold: { + name: 'network.badge.shield.half.filled', + path: 'M14.2627 28.5209C15.8427 28.5209 17.4027 28.2509 18.8827 27.7309C19.0627 27.6709 19.2327 27.6009 19.4327 27.5109C18.7027 26.8109 18.2427 26.0409 17.9827 25.2409C17.8427 25.0709 17.7327 24.6409 17.6127 24.1309C17.1827 23.3509 16.8027 22.5709 16.4927 21.7809C16.7327 21.4209 16.8727 20.9909 16.8727 20.5109C16.8727 19.5409 16.2527 18.7009 15.3927 18.3909C15.0627 16.9709 14.8927 15.5409 14.8627 14.1609C15.1327 14.1609 15.4127 14.1809 15.6927 14.1809C16.2127 14.1809 16.7227 14.1509 17.2427 14.1109C17.6227 14.4509 18.1427 14.6609 18.7027 14.6609C19.5627 14.6609 20.3127 14.1609 20.6827 13.4409C22.4527 12.9109 24.1127 12.1009 25.6327 11.0309C25.7127 11.2909 25.7827 11.5709 25.8527 11.8409C26.5927 11.8309 27.2527 11.9509 28.3727 12.3409C27.4227 5.4109 21.4127 0.0009 14.2427 0.0009C6.4227 0.0009 0.0027 6.4509 0.0027 14.2609C0.0027 22.0809 6.4427 28.5209 14.2627 28.5209ZM15.7627 2.5609C14.1327 5.4309 13.1627 8.6309 12.9027 11.9309C12.1827 11.8009 11.4527 11.6209 10.7627 11.3909C10.6927 10.8709 10.4627 10.4009 10.1027 10.0609C11.2527 7.2009 13.0327 4.6309 15.3227 2.5009C15.4727 2.5109 15.6227 2.5309 15.7627 2.5609ZM4.5827 7.5309C6.3827 4.9509 9.2027 3.1009 12.4327 2.6009C10.6227 4.5909 9.2127 6.8909 8.2327 9.3809C7.8627 9.4109 7.5227 9.5309 7.2327 9.7109C6.2727 9.0909 5.3827 8.3509 4.5827 7.5309ZM18.7127 7.5709C18.7027 6.2209 18.8827 4.8809 19.2327 3.5809C21.6727 4.7209 23.6527 6.6709 24.8727 9.0909C23.5727 10.0609 22.1527 10.8309 20.6127 11.3509C20.2927 10.7609 19.6827 10.3409 18.9927 10.2509C18.8127 9.3809 18.7327 8.4809 18.7127 7.5709ZM16.7027 7.5909C16.7227 8.7209 16.8427 9.8409 17.0727 10.9409C16.7727 11.2609 16.5727 11.6909 16.5127 12.1409C16.2427 12.1509 15.9727 12.1709 15.6927 12.1709C15.4227 12.1709 15.1627 12.1709 14.9027 12.1509C15.1027 9.4909 15.7927 6.9209 16.9527 4.5709C16.7927 5.5509 16.7027 6.5609 16.7027 7.5909ZM2.4327 14.2609C2.4327 12.5209 2.8327 10.8509 3.5227 9.3609C4.3227 10.1309 5.1927 10.8009 6.1227 11.4009C6.1127 11.5009 6.1127 11.5909 6.1127 11.6909C6.1127 12.4409 6.4627 13.1009 7.0127 13.5309C6.7627 14.7909 6.6427 16.0909 6.6127 17.4009C5.1427 16.6709 3.7427 15.7509 2.4427 14.6409C2.4427 14.5209 2.4327 14.4009 2.4327 14.2609ZM8.6227 18.2809C8.5827 16.8209 8.7127 15.3809 8.9727 13.9709C9.4227 13.8609 9.8327 13.6309 10.1327 13.3009C11.0227 13.5909 11.9227 13.8109 12.8427 13.9409C12.8527 15.5309 13.0127 17.1209 13.3027 18.6709C13.0527 18.8509 12.8427 19.0909 12.6727 19.3609C11.2927 19.1409 9.9427 18.7709 8.6227 18.2809ZM18.9327 22.7109C18.9327 25.5209 20.5927 26.6709 24.8027 28.9709C25.2427 29.2209 25.7727 29.1909 26.1527 28.9709C30.3427 26.6609 32.0027 25.5209 32.0027 22.7109V17.3609C32.0027 16.3409 31.6627 15.7509 30.6627 15.3309C29.8827 15.0009 27.1927 14.1109 26.5327 13.8609C25.8427 13.6209 25.1327 13.6209 24.5027 13.8209C23.7527 14.0809 21.0727 15.0009 20.2727 15.3309C19.2727 15.7509 18.9327 16.3409 18.9327 17.3609ZM21.0927 22.4309V17.9009C21.0927 17.5109 21.2027 17.3409 21.5727 17.2009C22.5427 16.8309 24.0927 16.2509 24.8827 15.9809C25.1327 15.9009 25.2927 15.8709 25.4727 15.8709V26.7609C25.3427 26.7609 25.2427 26.7309 25.1027 26.6609C22.0227 24.8009 21.0927 24.3209 21.0927 22.4309ZM2.9127 17.5509C4.1027 18.3709 5.3627 19.0709 6.6727 19.6609C6.7527 21.0509 6.9727 22.4309 7.3327 23.8009C5.2327 22.2709 3.6627 20.0809 2.9127 17.5509ZM14.2627 26.0709C12.7327 26.0709 11.2627 25.7809 9.9127 25.2409C9.3227 23.7109 8.9327 22.0909 8.7527 20.4709C9.9827 20.8609 11.2527 21.1809 12.5227 21.3709C12.8427 22.1509 13.5727 22.6909 14.4527 22.7609C14.8727 23.9009 15.3827 24.9609 15.9527 25.9509C15.4527 26.0309 14.8227 26.0709 14.2627 26.0709Z', + viewBox: { width: 32.005859375, height: 29.145170064112204 }, + }, + bold: { + name: 'network.badge.shield.half.filled', + path: 'M14.4327 28.8886C15.9927 28.8886 17.5227 28.6186 18.9627 28.1386C19.1427 28.0786 19.3027 28.0186 19.5127 27.9286C18.6027 27.0886 18.1127 26.1986 17.8827 25.2486C17.7627 24.9486 17.6827 24.2286 17.5927 23.3886C17.3127 22.8186 17.0627 22.2286 16.8327 21.6586C17.0127 21.3186 17.1127 20.9286 17.1127 20.5186C17.1127 19.6186 16.5927 18.8286 15.8327 18.4386C15.5027 17.0586 15.3227 15.6986 15.2827 14.3786C15.4727 14.3786 15.6727 14.3786 15.8627 14.3786C16.3927 14.3786 16.9427 14.3586 17.4627 14.3186C17.8727 14.6586 18.3927 14.8586 18.9627 14.8586C19.8527 14.8586 20.6327 14.3586 21.0027 13.5986C22.6727 13.0886 24.2527 12.3086 25.7027 11.2886C25.7727 11.5386 25.8427 11.7886 25.8927 12.0286C26.7027 12.0186 27.4027 12.1286 28.7427 12.5886C27.8127 5.5086 21.7127 -0.0014 14.4227 -0.0014C6.5127 -0.0014 0.0027 6.5186 0.0027 14.4386C0.0027 22.3686 6.5127 28.8886 14.4327 28.8886ZM15.8327 2.8686C14.3027 5.6786 13.3727 8.7486 13.1227 11.9386C12.4427 11.8086 11.7727 11.6486 11.1127 11.4386C11.0427 10.9286 10.8127 10.4686 10.4727 10.1186C11.5827 7.3786 13.2727 4.8986 15.4627 2.8286C15.5827 2.8486 15.7127 2.8586 15.8327 2.8686ZM5.0027 7.6286C6.7227 5.2686 9.2927 3.5586 12.2627 2.9986C10.6227 4.8986 9.3127 7.0686 8.3927 9.3786C8.0627 9.4186 7.7627 9.5286 7.4927 9.6786C6.5927 9.0886 5.7727 8.4086 5.0027 7.6286ZM19.0427 7.5986C19.0327 6.3686 19.1827 5.1586 19.4827 3.9686C21.7627 5.0686 23.6527 6.9086 24.8327 9.1786C23.6127 10.0886 22.2727 10.8186 20.8527 11.3186C20.4927 10.8186 19.9627 10.4486 19.3227 10.3486C19.1427 9.4486 19.0427 8.5286 19.0427 7.5986ZM16.8327 7.5986C16.8427 8.7886 16.9827 9.9786 17.2227 11.1186C16.9827 11.3986 16.8027 11.7586 16.7327 12.1586C16.4327 12.1686 16.1427 12.1686 15.8627 12.1786C15.6827 12.1786 15.5027 12.1686 15.3227 12.1686C15.5027 9.8686 16.0527 7.6586 16.9427 5.5786C16.8727 6.2486 16.8327 6.9186 16.8327 7.5986ZM2.7727 14.4386C2.7727 12.7286 3.1627 11.0886 3.8427 9.6086C4.5927 10.3386 5.4027 10.9786 6.2627 11.5386C6.2627 11.6186 6.2527 11.6986 6.2527 11.7986C6.2527 12.5486 6.6027 13.2386 7.1527 13.6886C6.9327 14.8586 6.8127 16.0486 6.7827 17.2686C5.3627 16.5386 4.0227 15.6586 2.7727 14.5986C2.7727 14.5486 2.7727 14.4886 2.7727 14.4386ZM8.9827 18.2386C8.9527 16.8586 9.0627 15.5086 9.2927 14.1786C9.7327 14.0686 10.1127 13.8386 10.4327 13.5386C11.2827 13.8086 12.1727 14.0186 13.0527 14.1686C13.0827 15.6386 13.2227 17.1486 13.4627 18.6086C13.2227 18.7686 13.0027 19.0086 12.8427 19.2486C11.5227 19.0486 10.2427 18.6986 8.9827 18.2386ZM19.1027 23.0686C19.1027 25.8486 20.7527 27.0886 25.0427 29.3386C25.4827 29.5686 26.0027 29.5486 26.3827 29.3386C30.6627 27.0586 32.3327 25.8486 32.3327 23.0686V17.7186C32.3327 16.5986 31.9927 15.9986 30.9127 15.5286C30.1827 15.2286 27.5127 14.3586 26.9027 14.1386C26.1227 13.8786 25.3327 13.8586 24.6127 14.1086C23.9227 14.3386 21.2627 15.2286 20.5227 15.5286C19.4527 15.9786 19.1027 16.5986 19.1027 17.7186ZM21.3527 22.7786V18.1986C21.3527 17.8186 21.4527 17.6486 21.7827 17.5186C22.7627 17.1586 24.3727 16.5586 25.0627 16.3286C25.3427 16.2386 25.5227 16.1986 25.7127 16.1986V27.0286C25.6027 27.0286 25.5027 26.9986 25.3727 26.9386C22.3127 25.0986 21.3527 24.6186 21.3527 22.7786ZM3.2627 17.7586C4.4027 18.5286 5.5927 19.1986 6.8227 19.7386C6.9227 21.1086 7.1527 22.4486 7.4927 23.7886C5.5127 22.2986 3.9927 20.1786 3.2627 17.7586ZM14.4327 26.0986C13.0027 26.0986 11.6227 25.8386 10.3327 25.3486C9.7527 23.8286 9.3427 22.2586 9.1327 20.6286C10.2827 20.9986 11.4727 21.2886 12.6627 21.4686C12.9927 22.2186 13.7027 22.7686 14.5427 22.8486C14.9427 23.9986 15.4227 25.0486 15.9527 25.9886C15.5327 26.0686 14.9327 26.0986 14.4327 26.0986Z', + viewBox: { width: 32.333984375, height: 29.504066155727926 }, + }, + heavy: { + name: 'network.badge.shield.half.filled', + path: 'M14.6927 29.4084C16.2327 29.4084 17.6927 29.1584 19.0827 28.7284C19.2527 28.6684 19.3827 28.6284 19.6027 28.5284C18.4727 27.4784 17.9527 26.4184 17.7427 25.2684C17.6527 24.7584 17.6127 23.6284 17.5727 22.3084C17.4727 22.0484 17.3627 21.7784 17.2627 21.5084C17.3927 21.2184 17.4627 20.8884 17.4627 20.5484C17.4627 19.7284 17.0627 19.0084 16.4327 18.5684C16.1427 17.2284 15.9727 15.9184 15.9127 14.6884C15.9727 14.6984 16.0327 14.6984 16.1027 14.6984C16.6627 14.6984 17.2427 14.6584 17.7827 14.5984C18.2127 14.9584 18.7427 15.1784 19.3327 15.1784C20.2727 15.1784 21.0827 14.6284 21.4627 13.8184C22.9927 13.3184 24.4627 12.6084 25.8027 11.6884C25.8627 11.8984 25.9227 12.0984 25.9727 12.3184C26.8627 12.2884 27.6327 12.3884 29.2727 12.9484C28.3727 5.6584 22.1627 -0.0016 14.6927 -0.0016C6.6027 -0.0016 0.0027 6.6284 0.0027 14.7084C0.0027 22.7884 6.6127 29.4084 14.6927 29.4084ZM15.9127 3.3484C14.5227 6.0184 13.6727 8.9384 13.4427 11.9484C12.8227 11.8384 12.2327 11.6884 11.6527 11.5084C11.5527 11.0084 11.3227 10.5584 10.9927 10.1984C12.0427 7.6284 13.6327 5.2884 15.6727 3.3184C15.7527 3.3184 15.8327 3.3384 15.9127 3.3484ZM5.6327 7.7784C7.2027 5.7284 9.4427 4.2084 12.0327 3.5784C10.6127 5.3484 9.4627 7.3184 8.6227 9.3884C8.3527 9.4484 8.0927 9.5284 7.8627 9.6684C7.0727 9.1184 6.3127 8.4784 5.6327 7.7784ZM19.5227 7.6284C19.5127 6.5884 19.6227 5.5484 19.8527 4.5284C21.9127 5.5784 23.6427 7.2484 24.7827 9.2984C23.6627 10.1484 22.4327 10.7984 21.1527 11.2784C20.8127 10.8784 20.3427 10.5984 19.8127 10.4884C19.6227 9.5584 19.5227 8.5984 19.5227 7.6284ZM17.0127 7.6284C17.0227 8.9184 17.1627 10.1584 17.4427 11.3784C17.2627 11.6084 17.1427 11.8684 17.0627 12.1584C16.7527 12.1784 16.4227 12.1784 16.1027 12.1784C16.0527 12.1784 15.9927 12.1784 15.9427 12.1784C16.0827 10.4084 16.4327 8.6684 17.0227 7.0184C17.0227 7.2184 17.0127 7.4284 17.0127 7.6284ZM6.4627 11.9584C6.4627 12.7284 6.8127 13.4284 7.3427 13.8884C7.1527 14.9384 7.0427 15.9984 7.0027 17.0584C5.6827 16.3784 4.4327 15.5284 3.2627 14.5284C3.2827 12.9184 3.6527 11.3884 4.2927 9.9984C4.9627 10.6384 5.7027 11.2284 6.4827 11.7484C6.4627 11.8084 6.4627 11.8784 6.4627 11.9584ZM9.5027 18.1384C9.4727 16.8984 9.5727 15.6684 9.7727 14.4684C10.1827 14.3584 10.5427 14.1484 10.8427 13.8784C11.6727 14.1384 12.5127 14.3384 13.3727 14.4784C13.4127 15.8084 13.5227 17.1684 13.7127 18.5084C13.4627 18.6784 13.2527 18.8784 13.0727 19.1084C11.8527 18.9084 10.6627 18.5984 9.5027 18.1684ZM19.3427 23.5684C19.3427 26.3484 20.9827 27.6884 25.4127 29.8684C25.8427 30.0884 26.3427 30.0784 26.7327 29.8684C31.1427 27.6284 32.8127 26.3484 32.8127 23.5684V18.2284C32.8127 16.9684 32.4527 16.3384 31.2827 15.8484C30.6227 15.5584 27.9827 14.7084 27.4427 14.5284C26.5527 14.2584 25.6027 14.2284 24.7627 14.5184C24.1727 14.7084 21.5427 15.5584 20.8727 15.8484C19.7027 16.3284 19.3427 16.9684 19.3427 18.2284ZM21.7127 23.2784V18.6084C21.7127 18.2684 21.8027 18.0984 22.0927 17.9884C23.0827 17.6184 24.7827 16.9984 25.3227 16.8284C25.6627 16.7384 25.8627 16.6784 26.0727 16.6784V27.4384C25.9727 27.4384 25.8627 27.4084 25.7727 27.3584C22.7327 25.5384 21.7127 25.0584 21.7127 23.2784ZM3.7727 18.0584C4.8227 18.7584 5.9327 19.3684 7.0727 19.8784C7.1827 21.1884 7.3927 22.4784 7.7427 23.7484C5.8827 22.3284 4.4727 20.3284 3.7727 18.0584ZM14.6927 26.1384C13.3827 26.1384 12.1227 25.9184 10.9627 25.5084C10.3527 24.0184 9.9227 22.4784 9.6927 20.8784C10.7327 21.2084 11.7827 21.4484 12.8427 21.6184C13.1927 22.3384 13.8727 22.8484 14.6927 22.9684C15.0527 24.1184 15.4727 25.1684 15.9527 26.0684C15.6727 26.1084 15.0927 26.1384 14.6927 26.1384Z', + viewBox: { width: 32.8125, height: 30.03202374678414 }, + }, + }, 'safari.fill': { regular: { name: 'safari.fill', diff --git a/src/entries/popup/hooks/approveAppRequest/useApproveAppRequestValidations.ts b/src/entries/popup/hooks/approveAppRequest/useApproveAppRequestValidations.ts index de84a1b143..343b2fd7ee 100644 --- a/src/entries/popup/hooks/approveAppRequest/useApproveAppRequestValidations.ts +++ b/src/entries/popup/hooks/approveAppRequest/useApproveAppRequestValidations.ts @@ -1,5 +1,6 @@ import { useMemo } from 'react'; +import { DAppStatus } from '~/core/graphql/__generated__/metadata'; import { i18n } from '~/core/languages'; import { useConnectedToHardhatStore } from '~/core/state/currentSettings/connectedToHardhat'; import { ChainId } from '~/core/types/chains'; @@ -13,9 +14,11 @@ import { useNativeAsset } from '../useNativeAsset'; export const useApproveAppRequestValidations = ({ chainId, selectedGas, + dappStatus, }: { chainId: ChainId; selectedGas?: GasFeeParams | GasFeeLegacyParams; + dappStatus?: DAppStatus; }) => { const { connectedToHardhat } = useConnectedToHardhatStore(); const chainIdToUse = connectedToHardhat ? ChainId.mainnet : chainId; @@ -30,12 +33,16 @@ export const useApproveAppRequestValidations = ({ }, [nativeAsset?.balance?.amount, selectedGas?.gasFee?.amount]); const buttonLabel = useMemo(() => { + if (dappStatus === DAppStatus.Scam) + return i18n.t('approve_request.send_transaction_anyway'); + if (!enoughNativeAssetForGas) return i18n.t('approve_request.insufficient_native_asset_for_gas', { symbol: getChain({ chainId: chainIdToUse }).nativeCurrency.name, }); + return i18n.t('approve_request.send_transaction'); - }, [chainIdToUse, enoughNativeAssetForGas]); + }, [chainIdToUse, enoughNativeAssetForGas, dappStatus]); return { enoughNativeAssetForGas: diff --git a/src/entries/popup/pages/messages/BottomActions/index.tsx b/src/entries/popup/pages/messages/BottomActions/index.tsx index ed95f4cf57..76fb4f7d32 100644 --- a/src/entries/popup/pages/messages/BottomActions/index.tsx +++ b/src/entries/popup/pages/messages/BottomActions/index.tsx @@ -3,6 +3,7 @@ import { Address, useBalance } from 'wagmi'; import { analytics } from '~/analytics'; import { event } from '~/analytics/event'; +import { DAppStatus } from '~/core/graphql/__generated__/metadata'; import { i18n } from '~/core/languages'; import { shortcuts } from '~/core/references/shortcuts'; import { useCurrentAddressStore } from '~/core/state'; @@ -344,6 +345,7 @@ export const AcceptRequestButton = ({ label, waitingForDevice, loading = false, + dappStatus, }: { autoFocus?: boolean; disabled?: boolean; @@ -351,21 +353,32 @@ export const AcceptRequestButton = ({ label: string; waitingForDevice?: boolean; loading?: boolean; + dappStatus?: DAppStatus; }) => { + const isScamDapp = dappStatus === DAppStatus.Scam; + const isVerifiedDapp = dappStatus === DAppStatus.Verified; + + const buttonVariant = isScamDapp ? 'transparent' : 'flat'; + const color = isVerifiedDapp ? 'blue' : 'accent'; + return ( @@ -376,11 +389,15 @@ export const RejectRequestButton = ({ autoFocus, onClick, label, + dappStatus, }: { autoFocus?: boolean; onClick: () => void; label: string; + dappStatus?: DAppStatus; }) => { + const isScamDapp = dappStatus === DAppStatus.Scam; + const { trackShortcut } = useKeyboardAnalytics(); useKeyboardShortcut({ handler: (e: KeyboardEvent) => { @@ -395,15 +412,16 @@ export const RejectRequestButton = ({ } }, }); + return (