5
5
import React , { memo , useMemo } from 'react' ;
6
6
7
7
import { TokenStandard } from '../../../../../../shared/constants/transaction' ;
8
- import { parseTypedDataMessage } from '../../../../../../shared/modules/transaction.utils' ;
9
8
import GeneralAlert from '../../../../../components/app/alert-system/general-alert/general-alert' ;
10
9
import { Box , Text } from '../../../../../components/component-library' ;
11
10
import {
@@ -22,8 +21,8 @@ import { Confirmation, SignatureRequestType } from '../../../types/confirm';
22
21
import { isSIWESignatureRequest } from '../../../utils' ;
23
22
import { useIsNFT } from '../info/approve/hooks/use-is-nft' ;
24
23
import { useTokenTransactionData } from '../info/hooks/useTokenTransactionData' ;
25
- import { DAI_CONTRACT_ADDRESS } from '../info/typed-sign/typed-sign-v4-simulation/value-display/value-display' ;
26
24
import { getIsRevokeSetApprovalForAll } from '../info/utils' ;
25
+ import { getIsRevokeDAIPermit } from '../utils' ;
27
26
import { useCurrentSpendingCap } from './hooks/useCurrentSpendingCap' ;
28
27
29
28
function ConfirmBannerAlert ( { ownerId } : { ownerId : string } ) {
@@ -87,16 +86,10 @@ const getTitle = (
87
86
return t ( 'setApprovalForAllRedesignedTitle' ) ;
88
87
}
89
88
90
- const msgData = ( confirmation as SignatureRequestType ) ?. msgParams ?. data ;
91
- const {
92
- message,
93
- domain : { verifyingContract } ,
94
- } = parseTypedDataMessage ( msgData as string ) ;
95
- const revokeDAIPermit =
96
- message . allowed === false &&
97
- verifyingContract === DAI_CONTRACT_ADDRESS ;
98
-
99
- if ( revokeDAIPermit ) {
89
+ const isRevokeDAIPermit = getIsRevokeDAIPermit (
90
+ confirmation as SignatureRequestType ,
91
+ ) ;
92
+ if ( isRevokeDAIPermit ) {
100
93
return t ( 'confirmTitleRevokeApproveTransaction' ) ;
101
94
}
102
95
@@ -153,16 +146,10 @@ const getDescription = (
153
146
return t ( 'confirmTitleDescApproveTransaction' ) ;
154
147
}
155
148
156
- const msgData = ( confirmation as SignatureRequestType ) ?. msgParams ?. data ;
157
- const {
158
- message,
159
- domain : { verifyingContract } ,
160
- } = parseTypedDataMessage ( msgData as string ) ;
161
- const revokeDAIPermit =
162
- message . allowed === false &&
163
- verifyingContract === DAI_CONTRACT_ADDRESS ;
164
-
165
- if ( revokeDAIPermit ) {
149
+ const isRevokeDAIPermit = getIsRevokeDAIPermit (
150
+ confirmation as SignatureRequestType ,
151
+ ) ;
152
+ if ( isRevokeDAIPermit ) {
166
153
return '' ;
167
154
}
168
155
0 commit comments