11import semver from 'semver' ;
22import { isNaN } from 'lodash' ;
33import { EDeviceType , ERRORS , HardwareErrorCode } from '@onekeyfe/hd-shared' ;
4+ import { Enum_Capability } from '@onekeyfe/hd-transport' ;
45import { toHardened } from '../api/helpers/pathUtils' ;
56import { DeviceCommands } from '../device/DeviceCommands' ;
67import type { Features , SupportFeatureType } from '../types' ;
@@ -10,6 +11,7 @@ import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
1011import { Device } from '../device/Device' ;
1112import { getDeviceType } from './deviceInfoUtils' ;
1213import { getDeviceFirmwareVersion } from './deviceVersionUtils' ;
14+ import { existCapability } from './capabilitieUtils' ;
1315
1416export const getSupportMessageVersion = (
1517 features : Features | undefined
@@ -138,7 +140,15 @@ export const getPassphraseState = async (
138140 const firmwareVersion = getDeviceFirmwareVersion ( features ) ;
139141 const deviceType = getDeviceType ( features ) ;
140142
141- if ( deviceType === EDeviceType . Pro && semver . gte ( firmwareVersion . join ( '.' ) , '4.15.0' ) ) {
143+ const supportAttachPinCapability = existCapability (
144+ features ,
145+ Enum_Capability . Capability_AttachToPin
146+ ) ;
147+ const supportGetPassphraseState =
148+ supportAttachPinCapability ||
149+ ( deviceType === EDeviceType . Pro && semver . gte ( firmwareVersion . join ( '.' ) , '4.15.0' ) ) ;
150+
151+ if ( supportGetPassphraseState ) {
142152 const { message, type } = await commands . typedCall ( 'GetPassphraseState' , 'PassphraseState' , {
143153 passphrase_state : options ?. onlyMainPin ? undefined : options ?. expectPassphraseState ,
144154 } ) ;
0 commit comments