From 766d3b2968432d1c4da674df22fd06c2e868d26e Mon Sep 17 00:00:00 2001 From: vvvvvv1vvvvvv Date: Wed, 16 Oct 2024 22:48:19 +0800 Subject: [PATCH 1/2] feat: add hasInteraction back again --- package.json | 2 +- src/ui/views/Approval/components/Actions/ApproveNFT.tsx | 6 ++++++ .../Approval/components/Actions/ApproveNFTCollection.tsx | 7 ++++++- src/ui/views/Approval/components/Actions/ContractCall.tsx | 7 +++++++ .../views/Approval/components/Actions/CrossSwapToken.tsx | 7 +++++++ src/ui/views/Approval/components/Actions/CrossToken.tsx | 1 + src/ui/views/Approval/components/Actions/MultiSwap.tsx | 6 ++++++ src/ui/views/Approval/components/Actions/Swap.tsx | 7 +++++++ src/ui/views/Approval/components/Actions/SwapLimitPay.tsx | 6 ++++++ src/ui/views/Approval/components/Actions/TokenApprove.tsx | 6 ++++++ src/ui/views/Approval/components/Actions/UnWrapToken.tsx | 7 +++++++ src/ui/views/Approval/components/Actions/WrapToken.tsx | 7 +++++++ .../Actions/components/ViewMorePopup/ContractPopup.tsx | 7 +++++++ .../Actions/components/ViewMorePopup/NFTSpenderPopup.tsx | 7 +++++++ .../Actions/components/ViewMorePopup/SpenderPopup.tsx | 7 +++++++ src/ui/views/Approval/components/CommonAction.tsx | 1 + .../Approval/components/TypedDataActions/BatchPermit2.tsx | 6 ++++++ .../Approval/components/TypedDataActions/ContractCall.tsx | 7 +++++++ .../views/Approval/components/TypedDataActions/Permit.tsx | 6 ++++++ .../Approval/components/TypedDataActions/Permit2.tsx | 6 ++++++ .../components/TypedDataActions/SwapTokenOrder.tsx | 7 +++++++ yarn.lock | 8 ++++---- 22 files changed, 125 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 6c2fce7e5e1..23149df807d 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@rabby-wallet/eth-watch-keyring": "1.0.0", "@rabby-wallet/gnosis-sdk": "1.3.8", "@rabby-wallet/page-provider": "0.4.2", - "@rabby-wallet/rabby-action": "0.1.3", + "@rabby-wallet/rabby-action": "0.1.4", "@rabby-wallet/rabby-api": "0.8.1", "@rabby-wallet/rabby-security-engine": "2.0.7", "@rabby-wallet/rabby-swap": "0.0.40", diff --git a/src/ui/views/Approval/components/Actions/ApproveNFT.tsx b/src/ui/views/Approval/components/Actions/ApproveNFT.tsx index f83aa03cea3..eaec01e2c28 100644 --- a/src/ui/views/Approval/components/Actions/ApproveNFT.tsx +++ b/src/ui/views/Approval/components/Actions/ApproveNFT.tsx @@ -118,6 +118,12 @@ const ApproveNFT = ({ + + {t('page.signTx.interacted')} + + + + { const actionData = data!; - const dispatch = useRabbyDispatch(); const { t } = useTranslation(); const engineResultMap = useMemo(() => { @@ -122,6 +121,12 @@ const ApproveNFTCollection = ({ + + {t('page.signTx.interacted')} + + + + @@ -124,6 +125,12 @@ const ContractCall = ({ + + {t('page.signTx.interacted')} + + + + {isInWhitelist && ( {t('page.signTx.myMark')} diff --git a/src/ui/views/Approval/components/Actions/CrossSwapToken.tsx b/src/ui/views/Approval/components/Actions/CrossSwapToken.tsx index fb20793e954..6b0aa3ddee5 100644 --- a/src/ui/views/Approval/components/Actions/CrossSwapToken.tsx +++ b/src/ui/views/Approval/components/Actions/CrossSwapToken.tsx @@ -247,6 +247,7 @@ const CrossSwapToken = ({ protocol: requireData.protocol, rank: requireData.rank, address: requireData.id, + hasInteraction: requireData.hasInteraction, chain, }} > @@ -266,6 +267,12 @@ const CrossSwapToken = ({ + + {t('page.signTx.interacted')} + + + + {isInWhitelist && ( {t('page.signTx.myMark')} diff --git a/src/ui/views/Approval/components/Actions/CrossToken.tsx b/src/ui/views/Approval/components/Actions/CrossToken.tsx index e830b695380..75ff0a90c24 100644 --- a/src/ui/views/Approval/components/Actions/CrossToken.tsx +++ b/src/ui/views/Approval/components/Actions/CrossToken.tsx @@ -248,6 +248,7 @@ const Swap = ({ protocol: requireData.protocol, rank: requireData.rank, address: requireData.id, + hasInteraction: requireData.hasInteraction, chain, }} > diff --git a/src/ui/views/Approval/components/Actions/MultiSwap.tsx b/src/ui/views/Approval/components/Actions/MultiSwap.tsx index dbc164e1e74..7cb42ceb63d 100644 --- a/src/ui/views/Approval/components/Actions/MultiSwap.tsx +++ b/src/ui/views/Approval/components/Actions/MultiSwap.tsx @@ -192,6 +192,12 @@ const MultiSwap = ({ + + {t('page.signTx.interacted')} + + + + {isInWhitelist && ( diff --git a/src/ui/views/Approval/components/Actions/Swap.tsx b/src/ui/views/Approval/components/Actions/Swap.tsx index d497d627770..b86da15db5b 100644 --- a/src/ui/views/Approval/components/Actions/Swap.tsx +++ b/src/ui/views/Approval/components/Actions/Swap.tsx @@ -307,6 +307,7 @@ const Swap = ({ protocol: requireData.protocol, rank: requireData.rank, address: requireData.id, + hasInteraction: requireData.hasInteraction, chain, }} > @@ -326,6 +327,12 @@ const Swap = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( {t('page.signTx.myMark')} diff --git a/src/ui/views/Approval/components/Actions/SwapLimitPay.tsx b/src/ui/views/Approval/components/Actions/SwapLimitPay.tsx index 96f0929c80b..0472f2d8cab 100644 --- a/src/ui/views/Approval/components/Actions/SwapLimitPay.tsx +++ b/src/ui/views/Approval/components/Actions/SwapLimitPay.tsx @@ -183,6 +183,12 @@ const SwapLimitPay = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( diff --git a/src/ui/views/Approval/components/Actions/TokenApprove.tsx b/src/ui/views/Approval/components/Actions/TokenApprove.tsx index 9e926e531bd..618290617d0 100644 --- a/src/ui/views/Approval/components/Actions/TokenApprove.tsx +++ b/src/ui/views/Approval/components/Actions/TokenApprove.tsx @@ -303,6 +303,12 @@ const TokenApprove = ({ + + {t('page.signTx.hasInteraction')} + + + + @@ -206,6 +207,12 @@ const UnWrapToken = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( {t('page.signTx.myMark')} diff --git a/src/ui/views/Approval/components/Actions/WrapToken.tsx b/src/ui/views/Approval/components/Actions/WrapToken.tsx index ad13cd458af..7ddbdbba8e4 100644 --- a/src/ui/views/Approval/components/Actions/WrapToken.tsx +++ b/src/ui/views/Approval/components/Actions/WrapToken.tsx @@ -187,6 +187,7 @@ const WrapToken = ({ protocol: requireData.protocol, rank: requireData.rank, address: requireData.id, + hasInteraction: requireData.hasInteraction, chain, }} > @@ -206,6 +207,12 @@ const WrapToken = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( diff --git a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/ContractPopup.tsx b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/ContractPopup.tsx index a893ad65372..4456006523b 100644 --- a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/ContractPopup.tsx +++ b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/ContractPopup.tsx @@ -16,6 +16,7 @@ interface ContractData { bornAt: number | null; rank: number | null; title?: string; + hasInteraction: boolean; } export interface Props { @@ -63,6 +64,12 @@ export const ContractPopup: React.FC = ({ data }) => { + + {t('page.signTx.interacted')} + + + + {t('page.signTx.deployTimeTitle')} diff --git a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/NFTSpenderPopup.tsx b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/NFTSpenderPopup.tsx index b559a6749c2..ea644fbf05a 100644 --- a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/NFTSpenderPopup.tsx +++ b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/NFTSpenderPopup.tsx @@ -19,6 +19,7 @@ interface NFTSpenderData { isEOA: boolean; isDanger: boolean | null; isRevoke?: boolean; + hasInteraction: boolean; } export interface Props { @@ -106,6 +107,12 @@ export const NFTSpenderPopup: React.FC = ({ data }) => { : '-'} + + {t('page.signTx.interacted')} + + + + {t('page.signTx.addressNote')} diff --git a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/SpenderPopup.tsx b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/SpenderPopup.tsx index b9a1d35dee6..2cb5fefcbde 100644 --- a/src/ui/views/Approval/components/Actions/components/ViewMorePopup/SpenderPopup.tsx +++ b/src/ui/views/Approval/components/Actions/components/ViewMorePopup/SpenderPopup.tsx @@ -19,6 +19,7 @@ interface SpenderData { isEOA: boolean; isDanger: boolean | null; isRevoke?: boolean; + hasInteraction: boolean; } export interface Props { @@ -106,6 +107,12 @@ export const SpenderPopup: React.FC = ({ data }) => { : '-'} + + {t('page.signTx.interacted')} + + + + {t('page.signTx.addressNote')} diff --git a/src/ui/views/Approval/components/CommonAction.tsx b/src/ui/views/Approval/components/CommonAction.tsx index b92bc5e35b4..5a9d6e13a59 100644 --- a/src/ui/views/Approval/components/CommonAction.tsx +++ b/src/ui/views/Approval/components/CommonAction.tsx @@ -86,6 +86,7 @@ export const CommonAction = ({ protocol: requireData.protocol, rank: requireData.rank, address: requireData.id, + hasInteraction: requireData.hasInteraction, chain, }} > diff --git a/src/ui/views/Approval/components/TypedDataActions/BatchPermit2.tsx b/src/ui/views/Approval/components/TypedDataActions/BatchPermit2.tsx index 6af252238a9..71c3b2f248a 100644 --- a/src/ui/views/Approval/components/TypedDataActions/BatchPermit2.tsx +++ b/src/ui/views/Approval/components/TypedDataActions/BatchPermit2.tsx @@ -156,6 +156,12 @@ const Permit2 = ({ + + {t('page.signTx.hasInteraction')} + + + + @@ -127,6 +128,12 @@ const ContractCall = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( {t('page.signTx.myMark')} diff --git a/src/ui/views/Approval/components/TypedDataActions/Permit.tsx b/src/ui/views/Approval/components/TypedDataActions/Permit.tsx index 7401620538e..33e068cc9d4 100644 --- a/src/ui/views/Approval/components/TypedDataActions/Permit.tsx +++ b/src/ui/views/Approval/components/TypedDataActions/Permit.tsx @@ -131,6 +131,12 @@ const Permit = ({ + + {t('page.signTx.hasInteraction')} + + + + + + {t('page.signTx.hasInteraction')} + + + + @@ -260,6 +261,12 @@ const Permit = ({ + + {t('page.signTx.hasInteraction')} + + + + {isInWhitelist && ( diff --git a/yarn.lock b/yarn.lock index 247ff089208..c1ab189b1b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4710,10 +4710,10 @@ sinon-chrome "^3.0.1" webextension-polyfill "0.7.0" -"@rabby-wallet/rabby-action@0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-action/-/rabby-action-0.1.3.tgz#729f495903afe212612b3e6616ca3684c10698e3" - integrity sha512-Y6S+c300rjdeSJf4+gz+9VVmDh91LWh9hIRTmWFLUEJO7dZakQJNiiGQ31DwiMzwTvHOMY4EL++Hs+IAQmXOyQ== +"@rabby-wallet/rabby-action@0.1.4": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-action/-/rabby-action-0.1.4.tgz#c82e7c8b538b7dfd94506c4f89f78aca7ca880ef" + integrity sha512-6ttnlpGHcO2v/qyYo8epBbSutfS9OZXfXr9mfapuveoBvzqUwvE6ej3bsmdtc+qFhFeH7HeiwASpY6xaTM4E1w== "@rabby-wallet/rabby-api@0.8.1": version "0.8.1" From 62ed7ba140947b22c7d9a878076325aa5ef9b1b4 Mon Sep 17 00:00:00 2001 From: vvvvvv1vvvvvv Date: Thu, 17 Oct 2024 10:58:39 +0800 Subject: [PATCH 2/2] fix: dark mode modal --- src/ui/views/Approval/components/SignTx.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/views/Approval/components/SignTx.tsx b/src/ui/views/Approval/components/SignTx.tsx index 02223a959f4..6c2a4b126e8 100644 --- a/src/ui/views/Approval/components/SignTx.tsx +++ b/src/ui/views/Approval/components/SignTx.tsx @@ -903,6 +903,7 @@ const SignTx = ({ params, origin }: SignTxProps) => { Modal.error({ title: 'Error', content: e.message || JSON.stringify(e), + className: 'modal-support-darkmode', }); } }; @@ -1006,7 +1007,10 @@ const SignTx = ({ params, origin }: SignTxProps) => { } resolveApproval(); } catch (e) { - message.error(e.message); + message.error({ + content: e.message, + className: 'modal-support-darkmode', + }); } } return;