@onekeyfe/hd-core 1.0.34-alpha.0 → 1.0.34-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/api/BaseMethod.d.ts +1 -1
  2. package/dist/api/BaseMethod.d.ts.map +1 -1
  3. package/dist/api/GetPassphraseState.d.ts +1 -1
  4. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  5. package/dist/api/allnetwork/AllNetworkGetAddress.d.ts +3 -1
  6. package/dist/api/allnetwork/AllNetworkGetAddress.d.ts.map +1 -1
  7. package/dist/api/device/DeviceUnlock.d.ts +7 -0
  8. package/dist/api/device/DeviceUnlock.d.ts.map +1 -0
  9. package/dist/api/index.d.ts +1 -0
  10. package/dist/api/index.d.ts.map +1 -1
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/data-manager/DataManager.d.ts.map +1 -1
  13. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  14. package/dist/device/Device.d.ts +9 -3
  15. package/dist/device/Device.d.ts.map +1 -1
  16. package/dist/device/DeviceCommands.d.ts +7 -5
  17. package/dist/device/DeviceCommands.d.ts.map +1 -1
  18. package/dist/events/device.d.ts +3 -0
  19. package/dist/events/device.d.ts.map +1 -1
  20. package/dist/events/ui-request.d.ts +3 -2
  21. package/dist/events/ui-request.d.ts.map +1 -1
  22. package/dist/events/ui-response.d.ts +1 -0
  23. package/dist/events/ui-response.d.ts.map +1 -1
  24. package/dist/index.d.ts +27 -12
  25. package/dist/index.js +322 -170
  26. package/dist/inject.d.ts.map +1 -1
  27. package/dist/types/api/deviceUnlock.d.ts +4 -0
  28. package/dist/types/api/deviceUnlock.d.ts.map +1 -0
  29. package/dist/types/api/index.d.ts +2 -0
  30. package/dist/types/api/index.d.ts.map +1 -1
  31. package/dist/types/settings.d.ts +1 -1
  32. package/dist/types/settings.d.ts.map +1 -1
  33. package/dist/utils/deviceFeaturesUtils.d.ts +16 -2
  34. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  35. package/dist/utils/logger.d.ts +0 -2
  36. package/dist/utils/logger.d.ts.map +1 -1
  37. package/dist/utils/patch.d.ts +1 -1
  38. package/dist/utils/patch.d.ts.map +1 -1
  39. package/package.json +4 -4
  40. package/src/api/BaseMethod.ts +3 -2
  41. package/src/api/CheckAllFirmwareRelease.ts +1 -1
  42. package/src/api/CheckBLEFirmwareRelease.ts +3 -3
  43. package/src/api/CheckBootloaderRelease.ts +1 -1
  44. package/src/api/CheckBridgeRelease.ts +1 -1
  45. package/src/api/CheckFirmwareRelease.ts +3 -3
  46. package/src/api/CipherKeyValue.ts +1 -1
  47. package/src/api/FirmwareUpdate.ts +1 -1
  48. package/src/api/FirmwareUpdateV2.ts +1 -1
  49. package/src/api/FirmwareUpdateV3.ts +1 -1
  50. package/src/api/GetFeatures.ts +3 -3
  51. package/src/api/GetOnekeyFeatures.ts +3 -3
  52. package/src/api/GetPassphraseState.ts +20 -4
  53. package/src/api/alephium/AlephiumGetAddress.ts +1 -1
  54. package/src/api/alephium/AlephiumSignMessage.ts +1 -1
  55. package/src/api/alephium/AlephiumSignTransaction.ts +1 -1
  56. package/src/api/algo/AlgoGetAddress.ts +1 -1
  57. package/src/api/algo/AlgoSignTransaction.ts +1 -1
  58. package/src/api/allnetwork/AllNetworkGetAddress.ts +19 -21
  59. package/src/api/aptos/AptosGetAddress.ts +1 -1
  60. package/src/api/aptos/AptosGetPublicKey.ts +1 -1
  61. package/src/api/aptos/AptosSignMessage.ts +1 -1
  62. package/src/api/aptos/AptosSignTransaction.ts +1 -1
  63. package/src/api/benfen/BenfenGetAddress.ts +1 -1
  64. package/src/api/benfen/BenfenGetPublicKey.ts +1 -1
  65. package/src/api/benfen/BenfenSignMessage.ts +1 -1
  66. package/src/api/benfen/BenfenSignTransaction.ts +1 -1
  67. package/src/api/btc/BTCGetAddress.ts +1 -1
  68. package/src/api/btc/BTCGetPublicKey.ts +1 -1
  69. package/src/api/btc/BTCSignMessage.ts +1 -1
  70. package/src/api/btc/BTCSignPsbt.ts +1 -1
  71. package/src/api/btc/BTCSignTransaction.ts +1 -1
  72. package/src/api/btc/BTCVerifyMessage.ts +1 -1
  73. package/src/api/cardano/CardanoGetAddress.ts +1 -1
  74. package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
  75. package/src/api/cardano/CardanoSignMessage.ts +1 -1
  76. package/src/api/cardano/CardanoSignTransaction.ts +1 -1
  77. package/src/api/conflux/ConfluxGetAddress.ts +1 -1
  78. package/src/api/conflux/ConfluxSignMessage.ts +1 -1
  79. package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -1
  80. package/src/api/conflux/ConfluxSignTransaction.ts +1 -1
  81. package/src/api/cosmos/CosmosGetAddress.ts +1 -1
  82. package/src/api/cosmos/CosmosGetPublicKey.ts +1 -1
  83. package/src/api/cosmos/CosmosSignTransaction.ts +1 -1
  84. package/src/api/device/DeviceUnlock.ts +26 -0
  85. package/src/api/device/DeviceUpdateBootloader.ts +1 -1
  86. package/src/api/dynex/DnxGetAddress.ts +1 -1
  87. package/src/api/dynex/DnxSignTransaction.ts +1 -1
  88. package/src/api/evm/EVMGetAddress.ts +1 -1
  89. package/src/api/evm/EVMGetPublicKey.ts +1 -1
  90. package/src/api/evm/EVMSignMessage.ts +1 -1
  91. package/src/api/evm/EVMSignMessageEIP712.ts +1 -1
  92. package/src/api/evm/EVMSignTransaction.ts +1 -1
  93. package/src/api/evm/EVMSignTypedData.ts +1 -1
  94. package/src/api/evm/EVMVerifyMessage.ts +1 -1
  95. package/src/api/filecoin/FilecoinGetAddress.ts +1 -1
  96. package/src/api/filecoin/FilecoinSignTransaction.ts +1 -1
  97. package/src/api/index.ts +1 -0
  98. package/src/api/kaspa/KaspaGetAddress.ts +1 -1
  99. package/src/api/kaspa/KaspaSignTransaction.ts +1 -1
  100. package/src/api/lightning/LnurlAuth.ts +1 -1
  101. package/src/api/near/NearGetAddress.ts +1 -1
  102. package/src/api/near/NearSignTransaction.ts +1 -1
  103. package/src/api/nem/NEMGetAddress.ts +1 -1
  104. package/src/api/nem/NEMSignTransaction.ts +1 -1
  105. package/src/api/neo/NeoGetAddress.ts +1 -1
  106. package/src/api/neo/NeoSignTransaction.ts +1 -1
  107. package/src/api/nervos/NervosGetAddress.ts +1 -1
  108. package/src/api/nervos/NervosSignTransaction.ts +1 -1
  109. package/src/api/nexa/NexaGetAddress.ts +1 -1
  110. package/src/api/nostr/NostrDecryptMessage.ts +1 -1
  111. package/src/api/nostr/NostrEncryptMessage.ts +1 -1
  112. package/src/api/nostr/NostrGetPublicKey.ts +1 -1
  113. package/src/api/nostr/NostrSignEvent.ts +1 -1
  114. package/src/api/nostr/NostrSignSchnorr.ts +1 -1
  115. package/src/api/polkadot/PolkadotGetAddress.ts +1 -1
  116. package/src/api/polkadot/PolkadotSignTransaction.ts +1 -1
  117. package/src/api/scdo/ScdoGetAddress.ts +1 -1
  118. package/src/api/scdo/ScdoSignMessage.ts +1 -1
  119. package/src/api/scdo/ScdoSignTransaction.ts +1 -1
  120. package/src/api/solana/SolGetAddress.ts +1 -1
  121. package/src/api/solana/SolSignMessage.ts +1 -1
  122. package/src/api/solana/SolSignOffchainMessage.ts +1 -1
  123. package/src/api/solana/SolSignTransaction.ts +1 -1
  124. package/src/api/starcoin/StarcoinGetAddress.ts +1 -1
  125. package/src/api/starcoin/StarcoinGetPublicKey.ts +1 -1
  126. package/src/api/starcoin/StarcoinSignMessage.ts +1 -1
  127. package/src/api/starcoin/StarcoinSignTransaction.ts +1 -1
  128. package/src/api/starcoin/StarcoinVerifyMessage.ts +1 -1
  129. package/src/api/stellar/StellarGetAddress.ts +1 -1
  130. package/src/api/stellar/StellarSignTransaction.ts +1 -1
  131. package/src/api/sui/SuiGetAddress.ts +1 -1
  132. package/src/api/sui/SuiGetPublicKey.ts +1 -1
  133. package/src/api/sui/SuiSignMessage.ts +1 -1
  134. package/src/api/sui/SuiSignTransaction.ts +1 -1
  135. package/src/api/test/TestInitializeDeviceDuration.ts +3 -3
  136. package/src/api/ton/TonGetAddress.ts +1 -1
  137. package/src/api/ton/TonSignMessage.ts +1 -1
  138. package/src/api/ton/TonSignProof.ts +1 -1
  139. package/src/api/tron/TronGetAddress.ts +1 -1
  140. package/src/api/tron/TronSignMessage.ts +1 -1
  141. package/src/api/tron/TronSignTransaction.ts +1 -1
  142. package/src/api/xrp/XrpGetAddress.ts +1 -1
  143. package/src/api/xrp/XrpSignTransaction.ts +1 -1
  144. package/src/core/index.ts +13 -8
  145. package/src/data/messages/messages.json +57 -2
  146. package/src/data-manager/DataManager.ts +1 -1
  147. package/src/data-manager/TransportManager.ts +0 -3
  148. package/src/device/Device.ts +77 -9
  149. package/src/device/DeviceCommands.ts +15 -4
  150. package/src/events/device.ts +4 -0
  151. package/src/events/ui-request.ts +3 -2
  152. package/src/events/ui-response.ts +1 -0
  153. package/src/inject.ts +2 -0
  154. package/src/types/api/deviceUnlock.ts +4 -0
  155. package/src/types/api/index.ts +2 -0
  156. package/src/types/settings.ts +1 -9
  157. package/src/utils/deviceFeaturesUtils.ts +71 -7
  158. package/src/utils/logger.ts +0 -2
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ const createCoreApi = (call) => ({
73
73
  getPassphraseState: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getPassphraseState' })),
74
74
  deviceCancel: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceCancel' })),
75
75
  deviceLock: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceLock' })),
76
+ deviceUnlock: (connectId, params) => call(Object.assign(Object.assign({}, params), { useEmptyPassphrase: true, connectId, method: 'deviceUnlock' })),
76
77
  getNextU2FCounter: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getNextU2FCounter' })),
77
78
  setU2FCounter: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'setU2FCounter' })),
78
79
  allNetworkGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'allNetworkGetAddress' })),
@@ -876,7 +877,6 @@ exports.LoggerNames = void 0;
876
877
  LoggerNames["HdTransportHttp"] = "@onekey/hd-transport-http";
877
878
  LoggerNames["HdTransportLowLevel"] = "@onekey/hd-transport-lowlevel";
878
879
  LoggerNames["HdBleTransport"] = "@onekey/hd-ble-transport";
879
- LoggerNames["HdWebBleTransport"] = "@onekey/hd-web-ble-transport";
880
880
  LoggerNames["Connect"] = "@onekey/connect";
881
881
  LoggerNames["Iframe"] = "IFrame";
882
882
  LoggerNames["SendMessage"] = "[SendMessage]";
@@ -893,7 +893,6 @@ const LoggerMap = {
893
893
  [exports.LoggerNames.HdBleSdk]: initLog(exports.LoggerNames.HdBleSdk),
894
894
  [exports.LoggerNames.HdTransportHttp]: initLog(exports.LoggerNames.HdTransportHttp),
895
895
  [exports.LoggerNames.HdBleTransport]: initLog(exports.LoggerNames.HdBleTransport),
896
- [exports.LoggerNames.HdWebBleTransport]: initLog(exports.LoggerNames.HdWebBleTransport),
897
896
  [exports.LoggerNames.HdTransportLowLevel]: initLog(exports.LoggerNames.HdTransportLowLevel),
898
897
  [exports.LoggerNames.Connect]: initLog(exports.LoggerNames.Connect),
899
898
  [exports.LoggerNames.Iframe]: initLog(exports.LoggerNames.Iframe),
@@ -4331,7 +4330,8 @@ var nested$1 = {
4331
4330
  ButtonRequest_Success: 17,
4332
4331
  ButtonRequest_Warning: 18,
4333
4332
  ButtonRequest_PassphraseEntry: 19,
4334
- ButtonRequest_PinEntry: 20
4333
+ ButtonRequest_PinEntry: 20,
4334
+ ButtonRequest_AttachPin: 8000
4335
4335
  }
4336
4336
  }
4337
4337
  }
@@ -4382,6 +4382,10 @@ var nested$1 = {
4382
4382
  options: {
4383
4383
  deprecated: true
4384
4384
  }
4385
+ },
4386
+ exists_attach_pin_user: {
4387
+ type: "bool",
4388
+ id: 8000
4385
4389
  }
4386
4390
  }
4387
4391
  },
@@ -4401,6 +4405,10 @@ var nested$1 = {
4401
4405
  on_device: {
4402
4406
  type: "bool",
4403
4407
  id: 3
4408
+ },
4409
+ on_device_attach_pin: {
4410
+ type: "bool",
4411
+ id: 8000
4404
4412
  }
4405
4413
  }
4406
4414
  },
@@ -7368,6 +7376,10 @@ var nested$1 = {
7368
7376
  derive_cardano: {
7369
7377
  type: "bool",
7370
7378
  id: 3
7379
+ },
7380
+ passphrase_state: {
7381
+ type: "string",
7382
+ id: 8000
7371
7383
  }
7372
7384
  }
7373
7385
  },
@@ -7748,6 +7760,14 @@ var nested$1 = {
7748
7760
  onekey_se04_state: {
7749
7761
  type: "OneKeySEState",
7750
7762
  id: 624
7763
+ },
7764
+ attach_to_pin_user: {
7765
+ type: "bool",
7766
+ id: 625
7767
+ },
7768
+ unlocked_attach_pin: {
7769
+ type: "bool",
7770
+ id: 626
7751
7771
  }
7752
7772
  },
7753
7773
  nested: {
@@ -8870,6 +8890,38 @@ var nested$1 = {
8870
8890
  }
8871
8891
  }
8872
8892
  },
8893
+ GetPassphraseState: {
8894
+ fields: {
8895
+ passphrase_state: {
8896
+ type: "string",
8897
+ id: 1
8898
+ },
8899
+ _only_main_pin: {
8900
+ type: "bool",
8901
+ id: 2
8902
+ },
8903
+ allow_create_attach_pin: {
8904
+ type: "bool",
8905
+ id: 3
8906
+ }
8907
+ }
8908
+ },
8909
+ PassphraseState: {
8910
+ fields: {
8911
+ passphrase_state: {
8912
+ type: "string",
8913
+ id: 1
8914
+ },
8915
+ session_id: {
8916
+ type: "bytes",
8917
+ id: 2
8918
+ },
8919
+ unlocked_attach_pin: {
8920
+ type: "bool",
8921
+ id: 3
8922
+ }
8923
+ }
8924
+ },
8873
8925
  MoneroTransactionSourceEntry: {
8874
8926
  fields: {
8875
8927
  outputs: {
@@ -13494,7 +13546,9 @@ var nested$1 = {
13494
13546
  MessageType_ListResDir: 10023,
13495
13547
  MessageType_FileInfoList: 10024,
13496
13548
  MessageType_OnekeyGetFeatures: 10025,
13497
- MessageType_OnekeyFeatures: 10026
13549
+ MessageType_OnekeyFeatures: 10026,
13550
+ MessageType_GetPassphraseState: 10028,
13551
+ MessageType_PassphraseState: 10029
13498
13552
  }
13499
13553
  },
13500
13554
  google: {
@@ -24895,7 +24949,7 @@ DataManager.getTransportStatus = (localVersion) => {
24895
24949
  return isLatest ? 'valid' : 'outdated';
24896
24950
  };
24897
24951
  DataManager.getBridgeChangelog = () => { var _b; return (_b = _a$1.assets) === null || _b === void 0 ? void 0 : _b.bridge.changelog; };
24898
- DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel' || env === 'desktop-web-ble';
24952
+ DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
24899
24953
  DataManager.isWebUsbConnect = (env) => env === 'webusb';
24900
24954
 
24901
24955
  const PROTOBUF_MESSAGE_CONFIG = {
@@ -24957,21 +25011,42 @@ const supportNewPassphrase = (features) => {
24957
25011
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
24958
25012
  return { support: semver__default["default"].gte(currentVersion, '2.4.0'), require: '2.4.0' };
24959
25013
  };
24960
- const getPassphraseStateWithRefreshDeviceInfo = (device) => __awaiter(void 0, void 0, void 0, function* () {
25014
+ const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
24961
25015
  const { features, commands } = device;
24962
25016
  const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
24963
- const passphraseState = yield getPassphraseState(features, commands);
25017
+ const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
25018
+ if (newSession && passphraseState && (features === null || features === void 0 ? void 0 : features.device_id)) {
25019
+ console.log('=====>>>>>> run updateInternalState newSession:', newSession);
25020
+ device.updateInternalState(passphraseState, features.device_id, newSession);
25021
+ }
24964
25022
  const isModeT = getDeviceType(features) === hdShared.EDeviceType.Touch || getDeviceType(features) === hdShared.EDeviceType.Pro;
24965
25023
  const needRefreshWithPassphrase = passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
24966
25024
  const needRefreshWithLocked = isModeT && locked;
24967
25025
  if (needRefreshWithLocked || needRefreshWithPassphrase) {
24968
25026
  yield device.getFeatures();
24969
25027
  }
24970
- return passphraseState;
25028
+ return { passphraseState, newSession, unlockedAttachPin };
24971
25029
  });
24972
- const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, void 0, function* () {
25030
+ const getPassphraseState = (features, commands, options) => __awaiter(void 0, void 0, void 0, function* () {
24973
25031
  if (!features)
24974
- return false;
25032
+ return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
25033
+ const firmwareVersion = getDeviceFirmwareVersion(features);
25034
+ const deviceType = getDeviceType(features);
25035
+ if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.14.0')) {
25036
+ console.log('=====>>>>>> getPassphraseState begin: ', options === null || options === void 0 ? void 0 : options.onlyMainPin, options === null || options === void 0 ? void 0 : options.expectPassphraseState);
25037
+ const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
25038
+ passphrase_state: (options === null || options === void 0 ? void 0 : options.onlyMainPin) ? undefined : options === null || options === void 0 ? void 0 : options.expectPassphraseState,
25039
+ });
25040
+ console.log('=====>>>>>> getPassphraseState end: result ', message);
25041
+ if (type === 'CallMethodError') {
25042
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
25043
+ }
25044
+ return {
25045
+ passphraseState: message.passphrase_state,
25046
+ newSession: message.session_id,
25047
+ unlockedAttachPin: message.unlocked_attach_pin,
25048
+ };
25049
+ }
24975
25050
  const { message, type } = yield commands.typedCall('GetAddress', 'Address', {
24976
25051
  address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
24977
25052
  coin_name: 'Testnet',
@@ -24981,7 +25056,11 @@ const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, voi
24981
25056
  if (type === 'CallMethodError') {
24982
25057
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
24983
25058
  }
24984
- return message.address;
25059
+ return {
25060
+ passphraseState: message.address,
25061
+ newSession: undefined,
25062
+ unlockedAttachPin: undefined,
25063
+ };
24985
25064
  });
24986
25065
  const supportBatchPublicKey = (features, options) => {
24987
25066
  if (!features)
@@ -25626,7 +25705,7 @@ const UI_REQUEST = {
25626
25705
  BOOTLOADER: 'ui-device_bootloader_mode',
25627
25706
  NOT_IN_BOOTLOADER: 'ui-device_not_in_bootloader_mode',
25628
25707
  REQUIRE_MODE: 'ui-device_require_mode',
25629
- INITIALIZE: 'ui-device_not_initialized',
25708
+ NOT_INITIALIZE: 'ui-device_not_initialized',
25630
25709
  SEEDLESS: 'ui-device_seedless',
25631
25710
  FIRMWARE_OLD: 'ui-device_firmware_old',
25632
25711
  FIRMWARE_NOT_SUPPORTED: 'ui-device_firmware_unsupported',
@@ -25955,7 +26034,6 @@ const Log$c = getLogger(exports.LoggerNames.Transport);
25955
26034
  const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
25956
26035
  const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
25957
26036
  const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
25958
- const WebBleLogger = getLogger(exports.LoggerNames.HdWebBleTransport);
25959
26037
  class TransportManager {
25960
26038
  static load() {
25961
26039
  Log$c.debug('transport manager load');
@@ -25983,9 +26061,6 @@ class TransportManager {
25983
26061
  }
25984
26062
  yield this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
25985
26063
  }
25986
- else if (env === 'desktop-web-ble') {
25987
- yield this.transport.init(WebBleLogger);
25988
- }
25989
26064
  else {
25990
26065
  yield this.transport.init(HttpLogger);
25991
26066
  }
@@ -26361,8 +26436,14 @@ class DeviceCommands {
26361
26436
  }, error => Promise.reject(error));
26362
26437
  }
26363
26438
  if (res.type === 'PassphraseRequest') {
26364
- return this._promptPassphrase().then(response => {
26365
- const { passphrase, passphraseOnDevice } = response;
26439
+ const existsAttachPinUser = res.message.exists_attach_pin_user;
26440
+ return this._promptPassphrase({
26441
+ existsAttachPinUser,
26442
+ }).then(response => {
26443
+ const { passphrase, passphraseOnDevice, attachPinOnDevice } = response;
26444
+ if (attachPinOnDevice && existsAttachPinUser) {
26445
+ return this._commonCall('PassphraseAck', { on_device_attach_pin: true });
26446
+ }
26366
26447
  return !passphraseOnDevice
26367
26448
  ? this._commonCall('PassphraseAck', { passphrase })
26368
26449
  : this._commonCall('PassphraseAck', { on_device: true });
@@ -26406,7 +26487,7 @@ class DeviceCommands {
26406
26487
  }
26407
26488
  });
26408
26489
  }
26409
- _promptPassphrase() {
26490
+ _promptPassphrase(options) {
26410
26491
  return new Promise((resolve, reject) => {
26411
26492
  const cancelAndReject = (_error) => cancelDeviceInPrompt(this.device, false)
26412
26493
  .then(onCancel => {
@@ -26424,7 +26505,7 @@ class DeviceCommands {
26424
26505
  });
26425
26506
  if (this.device.listenerCount(DEVICE.PASSPHRASE) > 0) {
26426
26507
  this.device.setCancelableAction(cancelAndReject);
26427
- this.device.emit(DEVICE.PASSPHRASE, this.device, (response, error) => {
26508
+ this.device.emit(DEVICE.PASSPHRASE, this.device, options, (response, error) => {
26428
26509
  this.device.clearCancelableAction();
26429
26510
  if (error) {
26430
26511
  cancelAndReject();
@@ -26620,6 +26701,17 @@ class Device extends events.exports {
26620
26701
  }
26621
26702
  Log$a.debug('tryFixInternalState session cache: ', deviceSessionCache);
26622
26703
  }
26704
+ updateInternalState(state, deviceId, sessionId = null) {
26705
+ Log$a.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `passphraseState: ${state}`, `sessionId: ${sessionId}`);
26706
+ if (sessionId) {
26707
+ deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
26708
+ const oldKey = `${deviceId}`;
26709
+ if (deviceSessionCache[oldKey]) {
26710
+ delete deviceSessionCache[oldKey];
26711
+ }
26712
+ }
26713
+ Log$a.debug('updateInternalState session cache: ', deviceSessionCache);
26714
+ }
26623
26715
  setInternalState(state, initSession) {
26624
26716
  var _a, _b;
26625
26717
  Log$a.debug('setInternalState session param: ', `state: ${state}`, `initSession: ${initSession}`, `device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
@@ -26651,7 +26743,6 @@ class Device extends events.exports {
26651
26743
  }
26652
26744
  initialize(options) {
26653
26745
  return __awaiter(this, void 0, void 0, function* () {
26654
- Log$a.debug('initialize param:', options);
26655
26746
  this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
26656
26747
  if (options === null || options === void 0 ? void 0 : options.initSession) {
26657
26748
  this.clearInternalState(options === null || options === void 0 ? void 0 : options.deviceId);
@@ -26664,7 +26755,12 @@ class Device extends events.exports {
26664
26755
  if (options === null || options === void 0 ? void 0 : options.deriveCardano) {
26665
26756
  payload.derive_cardano = true;
26666
26757
  }
26667
- Log$a.debug('initialize payload:', payload);
26758
+ payload.passphrase_state = options === null || options === void 0 ? void 0 : options.passphraseState;
26759
+ console.log('=====>>>>>> initialize device begin: ', payload, {
26760
+ deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
26761
+ passphraseState: options === null || options === void 0 ? void 0 : options.passphraseState,
26762
+ initSession: options === null || options === void 0 ? void 0 : options.initSession,
26763
+ });
26668
26764
  try {
26669
26765
  const { message } = yield Promise.race([
26670
26766
  this.commands.typedCall('Initialize', 'Features', payload),
@@ -26674,6 +26770,7 @@ class Device extends events.exports {
26674
26770
  }, 25 * 1000);
26675
26771
  }),
26676
26772
  ]);
26773
+ console.log('=====>>>>>> initialize device end: ', message);
26677
26774
  this._updateFeatures(message, options === null || options === void 0 ? void 0 : options.initSession);
26678
26775
  yield TransportManager.reconfigure(this.features);
26679
26776
  }
@@ -26900,8 +26997,8 @@ class Device extends events.exports {
26900
26997
  if (this.isBootloader() && !allow.includes(UI_REQUEST.BOOTLOADER)) {
26901
26998
  return UI_REQUEST.BOOTLOADER;
26902
26999
  }
26903
- if (!this.isInitialized() && !allow.includes(UI_REQUEST.INITIALIZE)) {
26904
- return UI_REQUEST.INITIALIZE;
27000
+ if (!this.isInitialized() && !allow.includes(UI_REQUEST.NOT_INITIALIZE)) {
27001
+ return UI_REQUEST.NOT_INITIALIZE;
26905
27002
  }
26906
27003
  if (this.isSeedless() && !allow.includes(UI_REQUEST.SEEDLESS)) {
26907
27004
  return UI_REQUEST.SEEDLESS;
@@ -26925,12 +27022,38 @@ class Device extends events.exports {
26925
27022
  }
26926
27023
  return false;
26927
27024
  }
26928
- checkPassphraseStateSafety(passphraseState) {
27025
+ lockDevice() {
27026
+ return __awaiter(this, void 0, void 0, function* () {
27027
+ const res = yield this.commands.typedCall('LockDevice', 'Success', {});
27028
+ return res.message;
27029
+ });
27030
+ }
27031
+ checkPassphraseStateSafety(passphraseState, useEmptyPassphraseState) {
26929
27032
  return __awaiter(this, void 0, void 0, function* () {
26930
27033
  if (!this.features)
26931
27034
  return false;
26932
- const newState = yield getPassphraseStateWithRefreshDeviceInfo(this);
26933
- if (passphraseState && passphraseState !== newState) {
27035
+ const { passphraseState: newPassphraseState, unlockedAttachPin } = yield getPassphraseStateWithRefreshDeviceInfo(this, {
27036
+ expectPassphraseState: passphraseState,
27037
+ onlyMainPin: useEmptyPassphraseState,
27038
+ });
27039
+ const mainWalletUseAttachPin = unlockedAttachPin && useEmptyPassphraseState;
27040
+ const useErrorAttachPin = unlockedAttachPin && passphraseState && passphraseState !== newPassphraseState;
27041
+ console.log('=====>>>>>> checkPassphraseStateSafety passphraseState: ', {
27042
+ passphraseState,
27043
+ newPassphraseState,
27044
+ unlockedAttachPin,
27045
+ useEmptyPassphraseState,
27046
+ });
27047
+ if (mainWalletUseAttachPin || useErrorAttachPin) {
27048
+ try {
27049
+ yield this.lockDevice();
27050
+ }
27051
+ catch (error) {
27052
+ }
27053
+ this.clearInternalState();
27054
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError));
27055
+ }
27056
+ if (passphraseState && passphraseState !== newPassphraseState) {
26934
27057
  this.clearInternalState();
26935
27058
  return false;
26936
27059
  }
@@ -27032,7 +27155,7 @@ class BaseMethod {
27032
27155
  this.connectId = payload.connectId || '';
27033
27156
  this.deviceId = payload.deviceId || '';
27034
27157
  this.useDevice = true;
27035
- this.notAllowDeviceMode = [UI_REQUEST.INITIALIZE];
27158
+ this.allowDeviceMode = [UI_REQUEST.NOT_INITIALIZE];
27036
27159
  this.requireDeviceMode = [];
27037
27160
  }
27038
27161
  getVersionRange() {
@@ -27098,9 +27221,9 @@ class BaseMethod {
27098
27221
 
27099
27222
  class TestInitializeDeviceDuration extends BaseMethod {
27100
27223
  init() {
27101
- this.notAllowDeviceMode = [
27102
- ...this.notAllowDeviceMode,
27103
- UI_REQUEST.INITIALIZE,
27224
+ this.allowDeviceMode = [
27225
+ ...this.allowDeviceMode,
27226
+ UI_REQUEST.NOT_INITIALIZE,
27104
27227
  UI_REQUEST.BOOTLOADER,
27105
27228
  ];
27106
27229
  this.useDevicePassphraseState = false;
@@ -27150,9 +27273,9 @@ class SearchDevices extends BaseMethod {
27150
27273
 
27151
27274
  class GetFeatures extends BaseMethod {
27152
27275
  init() {
27153
- this.notAllowDeviceMode = [
27154
- ...this.notAllowDeviceMode,
27155
- UI_REQUEST.INITIALIZE,
27276
+ this.allowDeviceMode = [
27277
+ ...this.allowDeviceMode,
27278
+ UI_REQUEST.NOT_INITIALIZE,
27156
27279
  UI_REQUEST.BOOTLOADER,
27157
27280
  ];
27158
27281
  this.useDevicePassphraseState = false;
@@ -27169,9 +27292,9 @@ class GetFeatures extends BaseMethod {
27169
27292
 
27170
27293
  class GetOnekeyFeatures extends BaseMethod {
27171
27294
  init() {
27172
- this.notAllowDeviceMode = [
27173
- ...this.notAllowDeviceMode,
27174
- UI_REQUEST.INITIALIZE,
27295
+ this.allowDeviceMode = [
27296
+ ...this.allowDeviceMode,
27297
+ UI_REQUEST.NOT_INITIALIZE,
27175
27298
  UI_REQUEST.BOOTLOADER,
27176
27299
  ];
27177
27300
  this.useDevicePassphraseState = false;
@@ -27190,18 +27313,24 @@ class GetOnekeyFeatures extends BaseMethod {
27190
27313
 
27191
27314
  class GetPassphraseState extends BaseMethod {
27192
27315
  init() {
27193
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
27316
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
27194
27317
  this.useDevicePassphraseState = false;
27195
27318
  }
27196
27319
  run() {
27197
27320
  return __awaiter(this, void 0, void 0, function* () {
27198
27321
  if (!this.device.features)
27199
27322
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
27200
- const passphraseState = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
27323
+ const { passphraseState, newSession } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
27324
+ console.log('=====>>>>>> GetPassphraseState run passphraseState: ', passphraseState);
27325
+ console.log('=====>>>>>> GetPassphraseState run newSession: ', newSession);
27326
+ console.log('=====>>>>>> GetPassphraseState run features: ', this.device.features.passphrase_protection);
27201
27327
  const { features } = this.device;
27202
27328
  if (features && features.passphrase_protection === true) {
27203
- if (passphraseState && features.device_id) {
27204
- this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
27329
+ if (!newSession) {
27330
+ console.log('=====>>>>>> GetPassphraseState run tryFixInternalState', newSession);
27331
+ if (passphraseState && features.device_id) {
27332
+ this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
27333
+ }
27205
27334
  }
27206
27335
  return Promise.resolve(passphraseState);
27207
27336
  }
@@ -27238,9 +27367,9 @@ class GetLogs extends BaseMethod {
27238
27367
 
27239
27368
  class CheckFirmwareRelease extends BaseMethod {
27240
27369
  init() {
27241
- this.notAllowDeviceMode = [
27242
- ...this.notAllowDeviceMode,
27243
- UI_REQUEST.INITIALIZE,
27370
+ this.allowDeviceMode = [
27371
+ ...this.allowDeviceMode,
27372
+ UI_REQUEST.NOT_INITIALIZE,
27244
27373
  UI_REQUEST.BOOTLOADER,
27245
27374
  ];
27246
27375
  this.useDevicePassphraseState = false;
@@ -27257,9 +27386,9 @@ class CheckFirmwareRelease extends BaseMethod {
27257
27386
 
27258
27387
  class CheckBLEFirmwareRelease extends BaseMethod {
27259
27388
  init() {
27260
- this.notAllowDeviceMode = [
27261
- ...this.notAllowDeviceMode,
27262
- UI_REQUEST.INITIALIZE,
27389
+ this.allowDeviceMode = [
27390
+ ...this.allowDeviceMode,
27391
+ UI_REQUEST.NOT_INITIALIZE,
27263
27392
  UI_REQUEST.BOOTLOADER,
27264
27393
  ];
27265
27394
  this.useDevicePassphraseState = false;
@@ -27360,7 +27489,7 @@ function getBridgeReleaseInfo({ deviceType, currentFirmwareVersion, willUpdateFi
27360
27489
 
27361
27490
  class CheckBridgeRelease extends BaseMethod {
27362
27491
  init() {
27363
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27492
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27364
27493
  this.useDevicePassphraseState = false;
27365
27494
  this.skipForceUpdateCheck = true;
27366
27495
  }
@@ -27384,7 +27513,7 @@ class CheckBridgeRelease extends BaseMethod {
27384
27513
 
27385
27514
  class CheckBootloaderRelease extends BaseMethod {
27386
27515
  init() {
27387
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27516
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27388
27517
  this.useDevicePassphraseState = false;
27389
27518
  this.skipForceUpdateCheck = true;
27390
27519
  }
@@ -27402,7 +27531,7 @@ class CheckBootloaderRelease extends BaseMethod {
27402
27531
 
27403
27532
  class CheckAllFirmwareRelease extends BaseMethod {
27404
27533
  init() {
27405
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27534
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27406
27535
  this.useDevicePassphraseState = false;
27407
27536
  this.skipForceUpdateCheck = true;
27408
27537
  }
@@ -28397,7 +28526,7 @@ class DeviceUpdateBootloader extends BaseMethod {
28397
28526
  };
28398
28527
  }
28399
28528
  init() {
28400
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28529
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28401
28530
  this.requireDeviceMode = [];
28402
28531
  this.useDevicePassphraseState = false;
28403
28532
  this.skipForceUpdateCheck = true;
@@ -28452,6 +28581,27 @@ class DeviceLock extends BaseMethod {
28452
28581
  }
28453
28582
  }
28454
28583
 
28584
+ class DeviceUnlock extends BaseMethod {
28585
+ init() {
28586
+ this.useDevicePassphraseState = false;
28587
+ }
28588
+ run() {
28589
+ return __awaiter(this, void 0, void 0, function* () {
28590
+ const { type } = yield this.device.commands.typedCall('GetAddress', 'Address', {
28591
+ address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
28592
+ coin_name: 'Testnet',
28593
+ script_type: 'SPENDADDRESS',
28594
+ show_display: false,
28595
+ });
28596
+ if (type === 'CallMethodError') {
28597
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
28598
+ }
28599
+ const res = yield this.device.commands.typedCall('GetFeatures', 'Features');
28600
+ return Promise.resolve(res.message);
28601
+ });
28602
+ }
28603
+ }
28604
+
28455
28605
  class DeviceCancel extends BaseMethod {
28456
28606
  init() {
28457
28607
  this.useDevicePassphraseState = false;
@@ -28506,7 +28656,7 @@ class FirmwareUpdate extends BaseMethod {
28506
28656
  };
28507
28657
  }
28508
28658
  init() {
28509
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28659
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28510
28660
  this.requireDeviceMode = [];
28511
28661
  this.useDevicePassphraseState = false;
28512
28662
  this.skipForceUpdateCheck = true;
@@ -28647,7 +28797,7 @@ class FirmwareUpdateV2 extends BaseMethod {
28647
28797
  };
28648
28798
  }
28649
28799
  init() {
28650
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28800
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28651
28801
  this.requireDeviceMode = [];
28652
28802
  this.useDevicePassphraseState = false;
28653
28803
  this.skipForceUpdateCheck = true;
@@ -29184,7 +29334,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29184
29334
  this.checkPromise = null;
29185
29335
  }
29186
29336
  init() {
29187
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
29337
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
29188
29338
  this.requireDeviceMode = [];
29189
29339
  this.useDevicePassphraseState = false;
29190
29340
  this.skipForceUpdateCheck = true;
@@ -29581,7 +29731,7 @@ class CipherKeyValue extends BaseMethod {
29581
29731
  init() {
29582
29732
  var _a;
29583
29733
  this.checkDeviceId = true;
29584
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
29734
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
29585
29735
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
29586
29736
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
29587
29737
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -29811,7 +29961,7 @@ const networkConfigMap = {
29811
29961
  class AllNetworkGetAddress extends BaseMethod {
29812
29962
  init() {
29813
29963
  this.checkDeviceId = true;
29814
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
29964
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
29815
29965
  validateParams(this.payload, [{ name: 'bundle', type: 'array' }]);
29816
29966
  this.payload.bundle.forEach((batch) => {
29817
29967
  validateParams(batch, [
@@ -29822,7 +29972,7 @@ class AllNetworkGetAddress extends BaseMethod {
29822
29972
  ]);
29823
29973
  });
29824
29974
  }
29825
- generateMethodName({ network, payload, }) {
29975
+ generateMethodName({ network, payload, originalIndex, }) {
29826
29976
  var _a, _b;
29827
29977
  const { name: networkName, coin } = networkAliases[network] || {
29828
29978
  name: network,
@@ -29836,6 +29986,7 @@ class AllNetworkGetAddress extends BaseMethod {
29836
29986
  methodName: config.methodName,
29837
29987
  params: Object.assign(Object.assign({}, ((_b = (_a = config === null || config === void 0 ? void 0 : config.getParams) === null || _a === void 0 ? void 0 : _a.call(config, payload, coin, config.methodName)) !== null && _b !== void 0 ? _b : payload)), { originPayload: payload }),
29838
29988
  _originRequestParams: payload,
29989
+ _originalIndex: originalIndex,
29839
29990
  };
29840
29991
  }
29841
29992
  callMethod(methodName, params) {
@@ -29883,10 +30034,11 @@ class AllNetworkGetAddress extends BaseMethod {
29883
30034
  const responses = [];
29884
30035
  const resultMap = {};
29885
30036
  const { bundle } = this.payload;
29886
- const methodReduceParams = bundle
29887
- .map(param => this.generateMethodName({
30037
+ const methodGroups = bundle
30038
+ .map((param, index) => this.generateMethodName({
29888
30039
  network: param.network,
29889
30040
  payload: param,
30041
+ originalIndex: index,
29890
30042
  }))
29891
30043
  .reduce((acc, cur) => {
29892
30044
  if (!acc[cur.methodName]) {
@@ -29895,28 +30047,25 @@ class AllNetworkGetAddress extends BaseMethod {
29895
30047
  acc[cur.methodName].push(cur);
29896
30048
  return acc;
29897
30049
  }, {});
29898
- const methodParamsArray = Object.values(methodReduceParams);
29899
- const generateResponseKey = (payload) => `${payload.path}-${payload.network}-${payload.chainName}-${payload.prefix}`;
29900
- for (let i = 0; i < methodParamsArray.length; i++) {
29901
- const methodParams = methodParamsArray[i];
29902
- const { methodName } = methodParams[0];
29903
- const params = {
29904
- bundle: methodParams.map(param => (Object.assign({}, param.params))),
30050
+ let i = 0;
30051
+ for (const [methodName, params] of Object.entries(methodGroups)) {
30052
+ const methodParams = {
30053
+ bundle: params.map(param => (Object.assign({}, param.params))),
29905
30054
  };
29906
- const response = yield this.callMethod(methodName, params);
29907
- for (let i = 0; i < methodParams.length; i++) {
29908
- const { _originRequestParams } = methodParams[i];
29909
- const responseKey = generateResponseKey(_originRequestParams);
30055
+ const response = yield this.callMethod(methodName, methodParams);
30056
+ for (let i = 0; i < params.length; i++) {
30057
+ const { _originRequestParams, _originalIndex } = params[i];
30058
+ const responseKey = `${_originalIndex}`;
29910
30059
  resultMap[responseKey] = Object.assign(Object.assign({}, _originRequestParams), response[i]);
29911
30060
  }
29912
30061
  if (((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle) === null || _b === void 0 ? void 0 : _b.length) > 1) {
29913
30062
  const progress = Math.round(((i + 1) / this.payload.bundle.length) * 100);
29914
30063
  this.postMessage(createUiMessage(UI_REQUEST.DEVICE_PROGRESS, { progress }));
29915
30064
  }
30065
+ i++;
29916
30066
  }
29917
- for (const param of bundle) {
29918
- const responseKey = generateResponseKey(param);
29919
- responses.push(resultMap[responseKey]);
30067
+ for (let i = 0; i < bundle.length; i++) {
30068
+ responses.push(resultMap[i]);
29920
30069
  }
29921
30070
  return Promise.resolve(responses);
29922
30071
  });
@@ -30250,7 +30399,7 @@ class BTCGetAddress extends BaseMethod {
30250
30399
  }
30251
30400
  init() {
30252
30401
  this.checkDeviceId = true;
30253
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30402
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30254
30403
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
30255
30404
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
30256
30405
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -30449,7 +30598,7 @@ class BTCGetPublicKey extends BaseMethod {
30449
30598
  }
30450
30599
  init() {
30451
30600
  this.checkDeviceId = true;
30452
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30601
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30453
30602
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
30454
30603
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
30455
30604
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -30552,7 +30701,7 @@ class BTCGetPublicKey extends BaseMethod {
30552
30701
  class BTCSignMessage extends BaseMethod {
30553
30702
  init() {
30554
30703
  this.checkDeviceId = true;
30555
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30704
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30556
30705
  validateParams(this.payload, [
30557
30706
  { name: 'path', required: true },
30558
30707
  { name: 'messageHex', type: 'hexString', required: true },
@@ -30608,7 +30757,7 @@ class BTCSignMessage extends BaseMethod {
30608
30757
  class BTCSignPsbt extends BaseMethod {
30609
30758
  init() {
30610
30759
  this.checkDeviceId = true;
30611
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30760
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30612
30761
  validateParams(this.payload, [
30613
30762
  { name: 'psbt', type: 'hexString', required: true },
30614
30763
  { name: 'coin', type: 'string' },
@@ -30926,7 +31075,7 @@ var signtxLegacy = (typedCall, inputs, outputs, refTxsArray, options, coinName)
30926
31075
  class BTCSignTransaction extends BaseMethod {
30927
31076
  init() {
30928
31077
  this.checkDeviceId = true;
30929
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31078
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30930
31079
  validateParams(this.payload, [
30931
31080
  { name: 'coin', type: 'string', required: true },
30932
31081
  { name: 'inputs', type: 'array', required: true },
@@ -31020,7 +31169,7 @@ class BTCSignTransaction extends BaseMethod {
31020
31169
  class BTCVerifyMessage extends BaseMethod {
31021
31170
  init() {
31022
31171
  this.checkDeviceId = true;
31023
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31172
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31024
31173
  validateParams(this.payload, [
31025
31174
  { name: 'address', type: 'string', required: true },
31026
31175
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31055,7 +31204,7 @@ class ConfluxGetAddress extends BaseMethod {
31055
31204
  }
31056
31205
  init() {
31057
31206
  var _a;
31058
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31207
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31059
31208
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31060
31209
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
31061
31210
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -31106,7 +31255,7 @@ class ConfluxGetAddress extends BaseMethod {
31106
31255
 
31107
31256
  class ConfluxSignMessage extends BaseMethod {
31108
31257
  init() {
31109
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31258
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31110
31259
  validateParams(this.payload, [
31111
31260
  { name: 'path', required: true },
31112
31261
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31135,7 +31284,7 @@ class ConfluxSignMessage extends BaseMethod {
31135
31284
 
31136
31285
  class ConfluxSignMessageCIP23 extends BaseMethod {
31137
31286
  init() {
31138
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31287
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31139
31288
  validateParams(this.payload, [
31140
31289
  { name: 'path', required: true },
31141
31290
  { name: 'domainHash', type: 'hexString', required: true },
@@ -31220,7 +31369,7 @@ class ConfluxSignTransaction extends BaseMethod {
31220
31369
  });
31221
31370
  }
31222
31371
  init() {
31223
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31372
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31224
31373
  validateParams(this.payload, [
31225
31374
  { name: 'path', required: true },
31226
31375
  { name: 'transaction', type: 'object', required: true },
@@ -31285,7 +31434,7 @@ class EvmGetAddress extends BaseMethod {
31285
31434
  init() {
31286
31435
  var _a;
31287
31436
  this.checkDeviceId = true;
31288
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31437
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31289
31438
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31290
31439
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
31291
31440
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -31370,7 +31519,7 @@ class EVMGetPublicKey extends BaseMethod {
31370
31519
  init() {
31371
31520
  var _a, _b, _c;
31372
31521
  this.checkDeviceId = true;
31373
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31522
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31374
31523
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31375
31524
  this.useBatch = (_c = (_b = this.payload) === null || _b === void 0 ? void 0 : _b.bundle) === null || _c === void 0 ? void 0 : _c.every((item) => item.showOnOneKey !== true);
31376
31525
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -31461,7 +31610,7 @@ function signMessageLegacyV1 ({ typedCall, params, }) {
31461
31610
  class EVMSignMessage$2 extends BaseMethod {
31462
31611
  init() {
31463
31612
  this.checkDeviceId = true;
31464
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31613
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31465
31614
  validateParams(this.payload, [
31466
31615
  { name: 'path', required: true },
31467
31616
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31494,7 +31643,7 @@ class EVMSignMessage$2 extends BaseMethod {
31494
31643
  class EVMSignMessageEIP712 extends BaseMethod {
31495
31644
  init() {
31496
31645
  this.checkDeviceId = true;
31497
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31646
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31498
31647
  validateParams(this.payload, [
31499
31648
  { name: 'path', required: true },
31500
31649
  { name: 'domainHash', type: 'hexString', required: true },
@@ -31648,7 +31797,7 @@ class EVMSignTransaction extends BaseMethod {
31648
31797
  }
31649
31798
  init() {
31650
31799
  this.checkDeviceId = true;
31651
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31800
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31652
31801
  validateParams(this.payload, [
31653
31802
  { name: 'path', required: true },
31654
31803
  { name: 'transaction', type: 'object', required: true },
@@ -31892,7 +32041,7 @@ const getFieldType = (typeName, types) => {
31892
32041
  class EVMSignTypedData extends BaseMethod {
31893
32042
  init() {
31894
32043
  this.checkDeviceId = true;
31895
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32044
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31896
32045
  validateParams(this.payload, [
31897
32046
  { name: 'path', required: true },
31898
32047
  { name: 'metamaskV4Compat', type: 'boolean' },
@@ -32220,7 +32369,7 @@ function verifyMessage ({ typedCall, params, }) {
32220
32369
  class EVMSignMessage$1 extends BaseMethod {
32221
32370
  init() {
32222
32371
  this.checkDeviceId = true;
32223
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32372
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32224
32373
  validateParams(this.payload, [
32225
32374
  { name: 'address', type: 'string', required: true },
32226
32375
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32259,7 +32408,7 @@ class StarcoinGetAddress extends BaseMethod {
32259
32408
  init() {
32260
32409
  var _a;
32261
32410
  this.checkDeviceId = true;
32262
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32411
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32263
32412
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32264
32413
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32265
32414
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32307,7 +32456,7 @@ class StarcoinGetPublicKey extends BaseMethod {
32307
32456
  init() {
32308
32457
  var _a;
32309
32458
  this.checkDeviceId = true;
32310
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32459
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32311
32460
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32312
32461
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32313
32462
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32345,7 +32494,7 @@ class StarcoinGetPublicKey extends BaseMethod {
32345
32494
  class StarcoinSignMessage extends BaseMethod {
32346
32495
  init() {
32347
32496
  this.checkDeviceId = true;
32348
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32497
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32349
32498
  validateParams(this.payload, [
32350
32499
  { name: 'path', required: true },
32351
32500
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32368,7 +32517,7 @@ class StarcoinSignMessage extends BaseMethod {
32368
32517
  class StarcoinSignTransaction extends BaseMethod {
32369
32518
  init() {
32370
32519
  this.checkDeviceId = true;
32371
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32520
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32372
32521
  validateParams(this.payload, [
32373
32522
  { name: 'path', required: true },
32374
32523
  { name: 'rawTx', type: 'hexString', required: true },
@@ -32391,7 +32540,7 @@ class StarcoinSignTransaction extends BaseMethod {
32391
32540
  class EVMSignMessage extends BaseMethod {
32392
32541
  init() {
32393
32542
  this.checkDeviceId = true;
32394
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32543
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32395
32544
  validateParams(this.payload, [
32396
32545
  { name: 'publicKey', type: 'string', required: true },
32397
32546
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32421,7 +32570,7 @@ class NEMGetAddress extends BaseMethod {
32421
32570
  init() {
32422
32571
  var _a;
32423
32572
  this.checkDeviceId = true;
32424
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32573
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32425
32574
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32426
32575
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32427
32576
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32636,7 +32785,7 @@ class NEMSignTransaction extends BaseMethod {
32636
32785
  }
32637
32786
  init() {
32638
32787
  this.checkDeviceId = true;
32639
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32788
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32640
32789
  validateParams(this.payload, [
32641
32790
  { name: 'path', required: true },
32642
32791
  { name: 'transaction', type: 'object', required: true },
@@ -32661,7 +32810,7 @@ class SolGetAddress extends BaseMethod {
32661
32810
  init() {
32662
32811
  var _a;
32663
32812
  this.checkDeviceId = true;
32664
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32813
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32665
32814
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32666
32815
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32667
32816
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32710,7 +32859,7 @@ class SolSignTransaction extends BaseMethod {
32710
32859
  init() {
32711
32860
  var _a;
32712
32861
  this.checkDeviceId = true;
32713
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32862
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32714
32863
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32715
32864
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32716
32865
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32789,7 +32938,7 @@ class SolSignTransaction extends BaseMethod {
32789
32938
  class SolSignOffchainMessage extends BaseMethod {
32790
32939
  init() {
32791
32940
  this.checkDeviceId = true;
32792
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32941
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32793
32942
  validateParams(this.payload, [
32794
32943
  { name: 'path', required: true },
32795
32944
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32831,7 +32980,7 @@ class SolSignOffchainMessage extends BaseMethod {
32831
32980
  class SolSignMessage extends BaseMethod {
32832
32981
  init() {
32833
32982
  this.checkDeviceId = true;
32834
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32983
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32835
32984
  validateParams(this.payload, [
32836
32985
  { name: 'path', required: true },
32837
32986
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32878,7 +33027,7 @@ class StellarGetAddress extends BaseMethod {
32878
33027
  init() {
32879
33028
  var _a;
32880
33029
  this.checkDeviceId = true;
32881
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33030
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32882
33031
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32883
33032
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32884
33033
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33047,7 +33196,7 @@ class StellarSignTransaction extends BaseMethod {
33047
33196
  }
33048
33197
  init() {
33049
33198
  this.checkDeviceId = true;
33050
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33199
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33051
33200
  validateParams(this.payload, [
33052
33201
  { name: 'path', required: true },
33053
33202
  { name: 'networkPassphrase', type: 'string', required: true },
@@ -33100,7 +33249,7 @@ class TronGetAddress extends BaseMethod {
33100
33249
  init() {
33101
33250
  var _a;
33102
33251
  this.checkDeviceId = true;
33103
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33252
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33104
33253
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33105
33254
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33106
33255
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33151,7 +33300,7 @@ class TronGetAddress extends BaseMethod {
33151
33300
  class TronSignMessage extends BaseMethod {
33152
33301
  init() {
33153
33302
  this.checkDeviceId = true;
33154
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33303
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33155
33304
  validateParams(this.payload, [
33156
33305
  { name: 'path', required: true },
33157
33306
  { name: 'messageHex', type: 'hexString', required: true },
@@ -33279,7 +33428,7 @@ class TronSignTransaction extends BaseMethod {
33279
33428
  }
33280
33429
  init() {
33281
33430
  this.checkDeviceId = true;
33282
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33431
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33283
33432
  validateParams(this.payload, [
33284
33433
  { name: 'path', required: true },
33285
33434
  { name: 'transaction', type: 'object', required: true },
@@ -33334,7 +33483,7 @@ class NearGetAddress extends BaseMethod {
33334
33483
  init() {
33335
33484
  var _a;
33336
33485
  this.checkDeviceId = true;
33337
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33486
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33338
33487
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33339
33488
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33340
33489
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33385,7 +33534,7 @@ class NearGetAddress extends BaseMethod {
33385
33534
  class NearSignTransaction extends BaseMethod {
33386
33535
  init() {
33387
33536
  this.checkDeviceId = true;
33388
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33537
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33389
33538
  validateParams(this.payload, [
33390
33539
  { name: 'path', required: true },
33391
33540
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33421,7 +33570,7 @@ class AptosGetAddress extends BaseMethod {
33421
33570
  init() {
33422
33571
  var _a, _b;
33423
33572
  this.checkDeviceId = true;
33424
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33573
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33425
33574
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33426
33575
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33427
33576
  this.shouldConfirm =
@@ -33516,7 +33665,7 @@ class AptosGetPublicKey extends BaseMethod {
33516
33665
  init() {
33517
33666
  var _a;
33518
33667
  this.checkDeviceId = true;
33519
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33668
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33520
33669
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33521
33670
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33522
33671
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33561,7 +33710,7 @@ class AptosGetPublicKey extends BaseMethod {
33561
33710
  class AptosSignTransaction extends BaseMethod {
33562
33711
  init() {
33563
33712
  this.checkDeviceId = true;
33564
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33713
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33565
33714
  validateParams(this.payload, [
33566
33715
  { name: 'path', required: true },
33567
33716
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33611,7 +33760,7 @@ class AptosSignTransaction extends BaseMethod {
33611
33760
  class AptosSignMessage extends BaseMethod {
33612
33761
  init() {
33613
33762
  this.checkDeviceId = true;
33614
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33763
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33615
33764
  validateParams(this.payload, [
33616
33765
  { name: 'path', required: true },
33617
33766
  { name: 'payload', type: 'object', required: true },
@@ -33677,7 +33826,7 @@ class AlgoGetAddress extends BaseMethod {
33677
33826
  init() {
33678
33827
  var _a;
33679
33828
  this.checkDeviceId = true;
33680
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33829
+ this.allowDeviceMode = [...this.allowDeviceMode];
33681
33830
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33682
33831
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33683
33832
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33732,7 +33881,7 @@ class AlgoSignTransaction extends BaseMethod {
33732
33881
  }
33733
33882
  init() {
33734
33883
  this.checkDeviceId = true;
33735
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33884
+ this.allowDeviceMode = [...this.allowDeviceMode];
33736
33885
  validateParams(this.payload, [
33737
33886
  { name: 'path', required: true },
33738
33887
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33771,7 +33920,7 @@ class CosmosGetAddress extends BaseMethod {
33771
33920
  init() {
33772
33921
  var _a;
33773
33922
  this.checkDeviceId = true;
33774
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33923
+ this.allowDeviceMode = [...this.allowDeviceMode];
33775
33924
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33776
33925
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33777
33926
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33833,7 +33982,7 @@ class CosmosGetPublicKey extends BaseMethod {
33833
33982
  init() {
33834
33983
  var _a;
33835
33984
  this.checkDeviceId = true;
33836
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33985
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33837
33986
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33838
33987
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33839
33988
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33894,7 +34043,7 @@ class CosmosSignTransaction extends BaseMethod {
33894
34043
  }
33895
34044
  init() {
33896
34045
  this.checkDeviceId = true;
33897
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
34046
+ this.allowDeviceMode = [...this.allowDeviceMode];
33898
34047
  validateParams(this.payload, [
33899
34048
  { name: 'path', required: true },
33900
34049
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33937,7 +34086,7 @@ class XrpGetAddress$1 extends BaseMethod {
33937
34086
  init() {
33938
34087
  var _a;
33939
34088
  this.checkDeviceId = true;
33940
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34089
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33941
34090
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33942
34091
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33943
34092
  this.shouldConfirm = this.hasBundle
@@ -34018,7 +34167,7 @@ class XrpGetAddress extends BaseMethod {
34018
34167
  }
34019
34168
  init() {
34020
34169
  this.checkDeviceId = true;
34021
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34170
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34022
34171
  const { payload } = this;
34023
34172
  validateParams(payload, [
34024
34173
  { name: 'path', required: true },
@@ -34098,7 +34247,7 @@ class SuiGetAddress extends BaseMethod {
34098
34247
  init() {
34099
34248
  var _a, _b;
34100
34249
  this.checkDeviceId = true;
34101
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34250
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34102
34251
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34103
34252
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34104
34253
  this.shouldConfirm =
@@ -34190,7 +34339,7 @@ class SuiGetPublicKey extends BaseMethod {
34190
34339
  init() {
34191
34340
  var _a;
34192
34341
  this.checkDeviceId = true;
34193
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34342
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34194
34343
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34195
34344
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34196
34345
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -34238,7 +34387,7 @@ class SuiGetPublicKey extends BaseMethod {
34238
34387
  class SuiSignMessage extends BaseMethod {
34239
34388
  init() {
34240
34389
  this.checkDeviceId = true;
34241
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34390
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34242
34391
  validateParams(this.payload, [
34243
34392
  { name: 'path', required: true },
34244
34393
  { name: 'messageHex', type: 'hexString', required: true },
@@ -34291,7 +34440,7 @@ class SuiSignTransaction extends BaseMethod {
34291
34440
  }
34292
34441
  init() {
34293
34442
  this.checkDeviceId = true;
34294
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34443
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34295
34444
  validateParams(this.payload, [
34296
34445
  { name: 'path', required: true },
34297
34446
  { name: 'rawTx', type: 'hexString', required: true },
@@ -34434,7 +34583,7 @@ class CardanoGetAddress extends BaseMethod {
34434
34583
  init() {
34435
34584
  var _a, _b, _c;
34436
34585
  this.checkDeviceId = true;
34437
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34586
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34438
34587
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34439
34588
  this.isCheck = this.hasBundle
34440
34589
  ? !!((_b = this.payload) === null || _b === void 0 ? void 0 : _b.bundle.every((i) => !!i.isCheck))
@@ -34534,7 +34683,7 @@ class CardanoGetPublicKey extends BaseMethod {
34534
34683
  init() {
34535
34684
  var _a;
34536
34685
  this.checkDeviceId = true;
34537
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34686
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34538
34687
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34539
34688
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34540
34689
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35089,7 +35238,7 @@ class CardanoSignTransaction extends BaseMethod {
35089
35238
  init() {
35090
35239
  var _a;
35091
35240
  this.checkDeviceId = true;
35092
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35241
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35093
35242
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35094
35243
  const { payload } = this;
35095
35244
  if (payload.auxiliaryData && payload.auxiliaryData.governanceRegistrationParameters) {
@@ -35324,7 +35473,7 @@ class CardanoSignTransaction extends BaseMethod {
35324
35473
  class CardanoSignMessage extends BaseMethod {
35325
35474
  init() {
35326
35475
  this.checkDeviceId = true;
35327
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35476
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35328
35477
  const { payload } = this;
35329
35478
  validateParams(payload, [
35330
35479
  { name: 'path', type: 'string', required: true },
@@ -35365,7 +35514,7 @@ class FilecoinGetAddress extends BaseMethod {
35365
35514
  init() {
35366
35515
  var _a;
35367
35516
  this.checkDeviceId = true;
35368
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35517
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35369
35518
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35370
35519
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35371
35520
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35425,7 +35574,7 @@ class FilecoinSignTransaction extends BaseMethod {
35425
35574
  }
35426
35575
  init() {
35427
35576
  this.checkDeviceId = true;
35428
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35577
+ this.allowDeviceMode = [...this.allowDeviceMode];
35429
35578
  validateParams(this.payload, [
35430
35579
  { name: 'path', required: true },
35431
35580
  { name: 'rawTx', type: 'hexString', required: true },
@@ -35518,7 +35667,7 @@ class PolkadotGetAddress extends BaseMethod {
35518
35667
  init() {
35519
35668
  var _a;
35520
35669
  this.checkDeviceId = true;
35521
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35670
+ this.allowDeviceMode = [...this.allowDeviceMode];
35522
35671
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35523
35672
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35524
35673
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35580,7 +35729,7 @@ class PolkadotSignTransaction extends BaseMethod {
35580
35729
  }
35581
35730
  init() {
35582
35731
  this.checkDeviceId = true;
35583
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35732
+ this.allowDeviceMode = [...this.allowDeviceMode];
35584
35733
  validateParams(this.payload, [
35585
35734
  { name: 'path', required: true },
35586
35735
  { name: 'network', required: true },
@@ -35617,7 +35766,7 @@ class KaspaGetAddress extends BaseMethod {
35617
35766
  init() {
35618
35767
  var _a;
35619
35768
  this.checkDeviceId = true;
35620
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35769
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35621
35770
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35622
35771
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35623
35772
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36000,7 +36149,7 @@ class KaspaSignTransaction extends BaseMethod {
36000
36149
  init() {
36001
36150
  var _a, _b, _c, _d, _e;
36002
36151
  this.checkDeviceId = true;
36003
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36152
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36004
36153
  const payload = this.payload;
36005
36154
  validateParams(payload, [
36006
36155
  { name: 'version', type: 'number' },
@@ -36111,7 +36260,7 @@ class NexaGetAddress extends BaseMethod {
36111
36260
  init() {
36112
36261
  var _a;
36113
36262
  this.checkDeviceId = true;
36114
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36263
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36115
36264
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36116
36265
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36117
36266
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36245,7 +36394,7 @@ class NostrGetPublicKey extends BaseMethod {
36245
36394
  }
36246
36395
  init() {
36247
36396
  this.checkDeviceId = true;
36248
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36397
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36249
36398
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
36250
36399
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36251
36400
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36323,7 +36472,7 @@ class NostrSignEvent extends BaseMethod {
36323
36472
  }
36324
36473
  init() {
36325
36474
  this.checkDeviceId = true;
36326
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36475
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36327
36476
  const { payload } = this;
36328
36477
  if (!validateEvent(payload.event)) {
36329
36478
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Can't serialize event with wrong or missing properties`);
@@ -36372,7 +36521,7 @@ class NostrEncryptMessage extends BaseMethod {
36372
36521
  init() {
36373
36522
  var _a;
36374
36523
  this.checkDeviceId = true;
36375
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36524
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36376
36525
  const { payload } = this;
36377
36526
  validateParams(payload, [
36378
36527
  { name: 'path', required: true },
@@ -36419,7 +36568,7 @@ class NostrDecryptMessage extends BaseMethod {
36419
36568
  init() {
36420
36569
  var _a;
36421
36570
  this.checkDeviceId = true;
36422
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36571
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36423
36572
  const { payload } = this;
36424
36573
  validateParams(payload, [
36425
36574
  { name: 'path', required: true },
@@ -36465,7 +36614,7 @@ class NostrSignSchnorr extends BaseMethod {
36465
36614
  }
36466
36615
  init() {
36467
36616
  this.checkDeviceId = true;
36468
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36617
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36469
36618
  const { payload } = this;
36470
36619
  validateParams(payload, [
36471
36620
  { name: 'path', required: true },
@@ -36506,7 +36655,7 @@ class LnurlAuth1 extends BaseMethod {
36506
36655
  }
36507
36656
  init() {
36508
36657
  this.checkDeviceId = true;
36509
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36658
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36510
36659
  const { payload } = this;
36511
36660
  validateParams(payload, [
36512
36661
  { name: 'domain', type: 'string', required: true },
@@ -36544,7 +36693,7 @@ class NervosGetAddress extends BaseMethod {
36544
36693
  init() {
36545
36694
  var _a;
36546
36695
  this.checkDeviceId = true;
36547
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36696
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36548
36697
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36549
36698
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36550
36699
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36628,7 +36777,7 @@ class NervosSignTransaction extends BaseMethod {
36628
36777
  }
36629
36778
  init() {
36630
36779
  this.checkDeviceId = true;
36631
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
36780
+ this.allowDeviceMode = [...this.allowDeviceMode];
36632
36781
  validateParams(this.payload, [
36633
36782
  { name: 'path', required: true },
36634
36783
  { name: 'rawTx', type: 'hexString', required: true },
@@ -36680,7 +36829,7 @@ class DnxGetAddress extends BaseMethod {
36680
36829
  init() {
36681
36830
  var _a;
36682
36831
  this.checkDeviceId = true;
36683
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36832
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36684
36833
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36685
36834
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36686
36835
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36735,7 +36884,7 @@ class DnxSignTransaction extends BaseMethod {
36735
36884
  }
36736
36885
  init() {
36737
36886
  this.checkDeviceId = true;
36738
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36887
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36739
36888
  const { payload } = this;
36740
36889
  const addressN = validatePath(payload.path, 3);
36741
36890
  validateParams(payload, [
@@ -36829,7 +36978,7 @@ class TonGetAddress extends BaseMethod {
36829
36978
  var _a;
36830
36979
  this.strictCheckDeviceSupport = true;
36831
36980
  this.checkDeviceId = true;
36832
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36981
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36833
36982
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36834
36983
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36835
36984
  this.shouldConfirm = this.hasBundle
@@ -36916,7 +37065,7 @@ class TonSignMessage extends BaseMethod {
36916
37065
  init() {
36917
37066
  this.strictCheckDeviceSupport = true;
36918
37067
  this.checkDeviceId = true;
36919
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37068
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36920
37069
  validateParams(this.payload, [
36921
37070
  { name: 'path', required: true },
36922
37071
  { name: 'destination', type: 'string' },
@@ -37060,7 +37209,7 @@ class TonSignProof extends BaseMethod {
37060
37209
  init() {
37061
37210
  this.strictCheckDeviceSupport = true;
37062
37211
  this.checkDeviceId = true;
37063
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37212
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37064
37213
  validateParams(this.payload, [
37065
37214
  { name: 'path', required: true },
37066
37215
  { name: 'appdomain', type: 'string' },
@@ -37112,7 +37261,7 @@ class ScdoGetAddress extends BaseMethod {
37112
37261
  init() {
37113
37262
  var _a;
37114
37263
  this.checkDeviceId = true;
37115
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37264
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37116
37265
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37117
37266
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37118
37267
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37180,7 +37329,7 @@ class ScdoSignTransaction extends BaseMethod {
37180
37329
  }
37181
37330
  init() {
37182
37331
  this.checkDeviceId = true;
37183
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37332
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37184
37333
  validateParams(this.payload, [
37185
37334
  { name: 'path', required: true },
37186
37335
  { name: 'nonce', required: true },
@@ -37233,7 +37382,7 @@ class ScdoSignTransaction extends BaseMethod {
37233
37382
  class ScdoSignMessage extends BaseMethod {
37234
37383
  init() {
37235
37384
  this.checkDeviceId = true;
37236
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37385
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37237
37386
  validateParams(this.payload, [
37238
37387
  { name: 'path', required: true },
37239
37388
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37268,7 +37417,7 @@ class AlephiumGetAddress extends BaseMethod {
37268
37417
  init() {
37269
37418
  var _a;
37270
37419
  this.checkDeviceId = true;
37271
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37420
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37272
37421
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37273
37422
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37274
37423
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37355,7 +37504,7 @@ class AlephiumSignTransaction extends BaseMethod {
37355
37504
  }
37356
37505
  init() {
37357
37506
  this.checkDeviceId = true;
37358
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37507
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37359
37508
  validateParams(this.payload, [
37360
37509
  { name: 'path', required: true },
37361
37510
  { name: 'rawTx', required: true, type: 'hexString' },
@@ -37396,7 +37545,7 @@ class AlephiumSignTransaction extends BaseMethod {
37396
37545
  class AlephiumSignMessage extends BaseMethod {
37397
37546
  init() {
37398
37547
  this.checkDeviceId = true;
37399
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37548
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37400
37549
  validateParams(this.payload, [
37401
37550
  { name: 'path', required: true },
37402
37551
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37463,7 +37612,7 @@ class BenfenGetAddress extends BaseMethod {
37463
37612
  init() {
37464
37613
  var _a, _b;
37465
37614
  this.checkDeviceId = true;
37466
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37615
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37467
37616
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37468
37617
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37469
37618
  this.shouldConfirm =
@@ -37554,7 +37703,7 @@ class BenfenGetPublicKey extends BaseMethod {
37554
37703
  init() {
37555
37704
  var _a;
37556
37705
  this.checkDeviceId = true;
37557
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37706
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37558
37707
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37559
37708
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37560
37709
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37601,7 +37750,7 @@ class BenfenGetPublicKey extends BaseMethod {
37601
37750
  class BenfenSignMessage extends BaseMethod {
37602
37751
  init() {
37603
37752
  this.checkDeviceId = true;
37604
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37753
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37605
37754
  validateParams(this.payload, [
37606
37755
  { name: 'path', required: true },
37607
37756
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37654,7 +37803,7 @@ class BenfenSignTransaction extends BaseMethod {
37654
37803
  }
37655
37804
  init() {
37656
37805
  this.checkDeviceId = true;
37657
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37806
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37658
37807
  validateParams(this.payload, [
37659
37808
  { name: 'path', required: true },
37660
37809
  { name: 'rawTx', type: 'hexString', required: true },
@@ -37702,7 +37851,7 @@ class NeoGetAddress extends BaseMethod {
37702
37851
  init() {
37703
37852
  var _a;
37704
37853
  this.checkDeviceId = true;
37705
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37854
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37706
37855
  this.strictCheckDeviceSupport = true;
37707
37856
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37708
37857
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -37761,7 +37910,7 @@ class NeoGetAddress extends BaseMethod {
37761
37910
  class NeoSignTransaction extends BaseMethod {
37762
37911
  init() {
37763
37912
  this.checkDeviceId = true;
37764
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37913
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37765
37914
  this.strictCheckDeviceSupport = true;
37766
37915
  validateParams(this.payload, [
37767
37916
  { name: 'path', required: true },
@@ -37833,6 +37982,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
37833
37982
  deviceFullyUploadResource: DeviceFullyUploadResource,
37834
37983
  deviceUpdateBootloader: DeviceUpdateBootloader,
37835
37984
  deviceLock: DeviceLock,
37985
+ deviceUnlock: DeviceUnlock,
37836
37986
  deviceCancel: DeviceCancel,
37837
37987
  setU2FCounter: SetU2FCounter,
37838
37988
  getNextU2FCounter: GetNextU2FCounter,
@@ -38284,7 +38434,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38284
38434
  try {
38285
38435
  yield waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
38286
38436
  const inner = () => __awaiter(void 0, void 0, void 0, function* () {
38287
- var _c, _d, _e;
38437
+ var _c, _d, _e, _f;
38288
38438
  const versionRange = getMethodVersionRange(device.features, type => method.getVersionRange()[type]);
38289
38439
  if (device.features) {
38290
38440
  yield DataManager.checkAndReloadData();
@@ -38312,7 +38462,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38312
38462
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportMethod);
38313
38463
  }
38314
38464
  }
38315
- const unexpectedMode = device.hasUnexpectedMode(method.notAllowDeviceMode, method.requireDeviceMode);
38465
+ const unexpectedMode = device.hasUnexpectedMode(method.allowDeviceMode, method.requireDeviceMode);
38316
38466
  if (unexpectedMode) {
38317
38467
  if (unexpectedMode === UI_REQUEST.NOT_IN_BOOTLOADER) {
38318
38468
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RequiredButInBootloaderMode));
@@ -38341,7 +38491,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38341
38491
  require: support.require,
38342
38492
  }));
38343
38493
  }
38344
- const passphraseStateSafety = yield device.checkPassphraseStateSafety((_c = method.payload) === null || _c === void 0 ? void 0 : _c.passphraseState);
38494
+ const passphraseStateSafety = yield device.checkPassphraseStateSafety((_c = method.payload) === null || _c === void 0 ? void 0 : _c.passphraseState, (_d = method.payload) === null || _d === void 0 ? void 0 : _d.useEmptyPassphrase);
38345
38495
  checkPassphraseEnableState(method, device.features);
38346
38496
  if (!passphraseStateSafety) {
38347
38497
  DevicePool.clearDeviceCache(method.payload.connectId);
@@ -38357,7 +38507,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38357
38507
  : hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'open safety check failed.');
38358
38508
  throw error;
38359
38509
  }
38360
- (_e = (_d = method.device) === null || _d === void 0 ? void 0 : _d.commands) === null || _e === void 0 ? void 0 : _e.checkDisposed();
38510
+ (_f = (_e = method.device) === null || _e === void 0 ? void 0 : _e.commands) === null || _f === void 0 ? void 0 : _f.checkDisposed();
38361
38511
  try {
38362
38512
  const response = yield method.run();
38363
38513
  Log.debug('Call API - Inner Method Run: ');
@@ -38717,11 +38867,11 @@ const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, vo
38717
38867
  });
38718
38868
  const onDeviceButtonHandler = (...[device, request]) => {
38719
38869
  postMessage(createDeviceMessage(DEVICE.BUTTON, Object.assign(Object.assign({}, request), { device: device.toMessageObject() })));
38720
- if (request.code === 'ButtonRequest_PinEntry') {
38721
- Log.log('request Confirm Input PIN');
38870
+ if (request.code === 'ButtonRequest_PinEntry' || request.code === 'ButtonRequest_AttachPin') {
38871
+ Log.log('request Confirm Input PIN or Attach PIN');
38722
38872
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PIN, {
38723
38873
  device: device.toMessageObject(),
38724
- type: 'ButtonRequest_PinEntry',
38874
+ type: request.code,
38725
38875
  }));
38726
38876
  }
38727
38877
  else {
@@ -38732,22 +38882,24 @@ const onDeviceButtonHandler = (...[device, request]) => {
38732
38882
  const onDeviceFeaturesHandler = (...[_, features]) => {
38733
38883
  postMessage(createDeviceMessage(DEVICE.FEATURES, Object.assign({}, features)));
38734
38884
  };
38735
- const onDevicePassphraseHandler = (...[device, callback]) => __awaiter(void 0, void 0, void 0, function* () {
38885
+ const onDevicePassphraseHandler = (...[device, requestPayload, callback]) => __awaiter(void 0, void 0, void 0, function* () {
38736
38886
  Log.debug('onDevicePassphraseHandler');
38737
38887
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PASSPHRASE, device);
38738
38888
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PASSPHRASE, {
38739
38889
  device: device.toMessageObject(),
38740
38890
  passphraseState: device.passphraseState,
38891
+ existsAttachPinUser: requestPayload.existsAttachPinUser,
38741
38892
  }));
38742
38893
  const uiResp = yield uiPromise.promise;
38743
- const { value, passphraseOnDevice, save } = uiResp.payload;
38894
+ const { value, passphraseOnDevice, save, attachPinOnDevice } = uiResp.payload;
38744
38895
  callback({
38745
38896
  passphrase: value.normalize('NFKD'),
38746
38897
  passphraseOnDevice,
38898
+ attachPinOnDevice,
38747
38899
  cache: save,
38748
38900
  });
38749
38901
  });
38750
- const onEmptyPassphraseHandler = (...[_, callback]) => {
38902
+ const onEmptyPassphraseHandler = (...[_, , callback]) => {
38751
38903
  Log.debug('onEmptyPassphraseHandler');
38752
38904
  callback({ passphrase: '' });
38753
38905
  };
@@ -38856,7 +39008,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
38856
39008
  yield DataManager.load(settings);
38857
39009
  initTransport(Transport, plugin);
38858
39010
  }
38859
- catch (_f) {
39011
+ catch (_g) {
38860
39012
  Log.error('DataManager.load error');
38861
39013
  }
38862
39014
  enableLog(DataManager.getSettings('debug'));