@@ -3,6 +3,7 @@ import { useIntl } from 'react-intl';
33import { selectSelectedAccount } from '@suite/account' ;
44import { messages } from '@suite/intl' ;
55import { type MODAL_CONTEXT_DEVICE } from '@suite/modal' ;
6+ import { selectConnectPopupCall } from '@suite-common/connect-popup' ;
67import { selectSelectedDevice } from '@suite-common/device' ;
78import TrezorConnect , { UI_REQUEST } from '@trezor/connect' ;
89
@@ -17,6 +18,8 @@ import { SignMessageModal } from './SignMessageModal';
1718import { ConfirmXpubModal } from '../ConfirmXpubModal' ;
1819import type { ReduxModalProps } from '../ReduxModalProps' ;
1920import { TransactionReviewModal } from '../TransactionReviewModal/TransactionReviewModal' ;
21+ import { ConnectAddressConfirmation } from '../UserContextModal/ConnectAddressConfirmation' ;
22+ import { ConnectSelectAccount } from '../UserContextModal/ConnectSelectAccount/ConnectSelectAccount' ;
2023
2124/** Modals requested by Device from `trezor-connect` */
2225export const DeviceContextModal = ( {
@@ -26,6 +29,7 @@ export const DeviceContextModal = ({
2629 const device = useSelector ( selectSelectedDevice ) ;
2730 const intl = useIntl ( ) ;
2831 const selectedAccount = useSelector ( selectSelectedAccount ) ;
32+ const popupCallState = useSelector ( state => selectConnectPopupCall ( state ) ?. state ) ;
2933
3034 if ( ! device ) return null ;
3135 const abort = ( ) => TrezorConnect . cancel ( { reason : intl . formatMessage ( messages . TR_CANCELLED ) } ) ;
@@ -78,10 +82,20 @@ export const DeviceContextModal = ({
7882 return < ConfirmActionModal device = { device } /> ;
7983 }
8084 }
81- case 'ButtonRequest_Address' :
82- return data ?. type === 'address' ? (
83- < ConfirmActionModal device = { device } title = "TR_COMPARE_ADDRESS_ON_TREZOR" />
84- ) : null ;
85+ case 'ButtonRequest_Address' : {
86+ if ( data ?. type !== 'address' ) {
87+ return null ;
88+ }
89+
90+ if ( popupCallState === 'address-confirmation' ) {
91+ return < ConnectAddressConfirmation /> ;
92+ }
93+ if ( popupCallState === 'select-account' ) {
94+ return < ConnectSelectAccount /> ;
95+ }
96+
97+ return < ConfirmActionModal device = { device } title = "TR_COMPARE_ADDRESS_ON_TREZOR" /> ;
98+ }
8599 case 'ButtonRequest_PublicKey' :
86100 return < ConfirmXpubModal onCancel = { abort } /> ;
87101 default :
0 commit comments