@onekeyfe/hd-core 1.0.33-alpha.5 → 1.0.33-alpha.8

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 (131) 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/allnetwork/AllNetworkGetAddress.d.ts +3 -1
  4. package/dist/api/allnetwork/AllNetworkGetAddress.d.ts.map +1 -1
  5. package/dist/core/index.d.ts.map +1 -1
  6. package/dist/device/Device.d.ts +6 -2
  7. package/dist/device/Device.d.ts.map +1 -1
  8. package/dist/device/DeviceCommands.d.ts +7 -5
  9. package/dist/device/DeviceCommands.d.ts.map +1 -1
  10. package/dist/events/device.d.ts +3 -0
  11. package/dist/events/device.d.ts.map +1 -1
  12. package/dist/events/ui-request.d.ts +3 -2
  13. package/dist/events/ui-request.d.ts.map +1 -1
  14. package/dist/events/ui-response.d.ts +1 -0
  15. package/dist/events/ui-response.d.ts.map +1 -1
  16. package/dist/index.d.ts +18 -8
  17. package/dist/index.js +344 -304
  18. package/dist/utils/deviceFeaturesUtils.d.ts +2 -1
  19. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  20. package/dist/utils/patch.d.ts +1 -1
  21. package/package.json +4 -4
  22. package/src/api/BaseMethod.ts +3 -2
  23. package/src/api/CheckAllFirmwareRelease.ts +1 -1
  24. package/src/api/CheckBLEFirmwareRelease.ts +3 -3
  25. package/src/api/CheckBootloaderRelease.ts +1 -1
  26. package/src/api/CheckBridgeRelease.ts +1 -1
  27. package/src/api/CheckFirmwareRelease.ts +3 -3
  28. package/src/api/CipherKeyValue.ts +1 -1
  29. package/src/api/FirmwareUpdate.ts +1 -1
  30. package/src/api/FirmwareUpdateV2.ts +1 -1
  31. package/src/api/FirmwareUpdateV3.ts +1 -1
  32. package/src/api/GetFeatures.ts +3 -3
  33. package/src/api/GetOnekeyFeatures.ts +3 -3
  34. package/src/api/GetPassphraseState.ts +1 -1
  35. package/src/api/alephium/AlephiumGetAddress.ts +1 -1
  36. package/src/api/alephium/AlephiumSignMessage.ts +1 -1
  37. package/src/api/alephium/AlephiumSignTransaction.ts +1 -1
  38. package/src/api/algo/AlgoGetAddress.ts +1 -1
  39. package/src/api/algo/AlgoSignTransaction.ts +1 -1
  40. package/src/api/allnetwork/AllNetworkGetAddress.ts +19 -21
  41. package/src/api/aptos/AptosGetAddress.ts +1 -1
  42. package/src/api/aptos/AptosGetPublicKey.ts +1 -1
  43. package/src/api/aptos/AptosSignMessage.ts +1 -1
  44. package/src/api/aptos/AptosSignTransaction.ts +1 -1
  45. package/src/api/benfen/BenfenGetAddress.ts +1 -1
  46. package/src/api/benfen/BenfenGetPublicKey.ts +1 -1
  47. package/src/api/benfen/BenfenSignMessage.ts +1 -1
  48. package/src/api/benfen/BenfenSignTransaction.ts +1 -1
  49. package/src/api/btc/BTCGetAddress.ts +1 -1
  50. package/src/api/btc/BTCGetPublicKey.ts +1 -1
  51. package/src/api/btc/BTCSignMessage.ts +1 -1
  52. package/src/api/btc/BTCSignPsbt.ts +1 -1
  53. package/src/api/btc/BTCSignTransaction.ts +1 -1
  54. package/src/api/btc/BTCVerifyMessage.ts +1 -1
  55. package/src/api/cardano/CardanoGetAddress.ts +1 -1
  56. package/src/api/cardano/CardanoGetPublicKey.ts +1 -1
  57. package/src/api/cardano/CardanoSignMessage.ts +1 -1
  58. package/src/api/cardano/CardanoSignTransaction.ts +1 -1
  59. package/src/api/conflux/ConfluxGetAddress.ts +1 -1
  60. package/src/api/conflux/ConfluxSignMessage.ts +1 -1
  61. package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -1
  62. package/src/api/conflux/ConfluxSignTransaction.ts +1 -1
  63. package/src/api/cosmos/CosmosGetAddress.ts +1 -1
  64. package/src/api/cosmos/CosmosGetPublicKey.ts +1 -1
  65. package/src/api/cosmos/CosmosSignTransaction.ts +1 -1
  66. package/src/api/device/DeviceUpdateBootloader.ts +1 -1
  67. package/src/api/dynex/DnxGetAddress.ts +1 -1
  68. package/src/api/dynex/DnxSignTransaction.ts +1 -1
  69. package/src/api/evm/EVMGetAddress.ts +1 -1
  70. package/src/api/evm/EVMGetPublicKey.ts +1 -1
  71. package/src/api/evm/EVMSignMessage.ts +1 -1
  72. package/src/api/evm/EVMSignMessageEIP712.ts +1 -1
  73. package/src/api/evm/EVMSignTransaction.ts +1 -1
  74. package/src/api/evm/EVMSignTypedData.ts +1 -1
  75. package/src/api/evm/EVMVerifyMessage.ts +1 -1
  76. package/src/api/filecoin/FilecoinGetAddress.ts +1 -1
  77. package/src/api/filecoin/FilecoinSignTransaction.ts +1 -1
  78. package/src/api/kaspa/KaspaGetAddress.ts +1 -1
  79. package/src/api/kaspa/KaspaSignTransaction.ts +1 -1
  80. package/src/api/lightning/LnurlAuth.ts +1 -1
  81. package/src/api/near/NearGetAddress.ts +1 -1
  82. package/src/api/near/NearSignTransaction.ts +1 -1
  83. package/src/api/nem/NEMGetAddress.ts +1 -1
  84. package/src/api/nem/NEMSignTransaction.ts +1 -1
  85. package/src/api/neo/NeoGetAddress.ts +1 -1
  86. package/src/api/neo/NeoSignTransaction.ts +1 -1
  87. package/src/api/nervos/NervosGetAddress.ts +1 -1
  88. package/src/api/nervos/NervosSignTransaction.ts +1 -1
  89. package/src/api/nexa/NexaGetAddress.ts +1 -1
  90. package/src/api/nostr/NostrDecryptMessage.ts +1 -1
  91. package/src/api/nostr/NostrEncryptMessage.ts +1 -1
  92. package/src/api/nostr/NostrGetPublicKey.ts +1 -1
  93. package/src/api/nostr/NostrSignEvent.ts +1 -1
  94. package/src/api/nostr/NostrSignSchnorr.ts +1 -1
  95. package/src/api/polkadot/PolkadotGetAddress.ts +1 -1
  96. package/src/api/polkadot/PolkadotSignTransaction.ts +1 -1
  97. package/src/api/scdo/ScdoGetAddress.ts +1 -1
  98. package/src/api/scdo/ScdoSignMessage.ts +1 -1
  99. package/src/api/scdo/ScdoSignTransaction.ts +1 -1
  100. package/src/api/solana/SolGetAddress.ts +1 -1
  101. package/src/api/solana/SolSignMessage.ts +1 -1
  102. package/src/api/solana/SolSignOffchainMessage.ts +1 -1
  103. package/src/api/solana/SolSignTransaction.ts +1 -1
  104. package/src/api/starcoin/StarcoinGetAddress.ts +1 -1
  105. package/src/api/starcoin/StarcoinGetPublicKey.ts +1 -1
  106. package/src/api/starcoin/StarcoinSignMessage.ts +1 -1
  107. package/src/api/starcoin/StarcoinSignTransaction.ts +1 -1
  108. package/src/api/starcoin/StarcoinVerifyMessage.ts +1 -1
  109. package/src/api/stellar/StellarGetAddress.ts +1 -1
  110. package/src/api/stellar/StellarSignTransaction.ts +1 -1
  111. package/src/api/sui/SuiGetAddress.ts +1 -1
  112. package/src/api/sui/SuiGetPublicKey.ts +1 -1
  113. package/src/api/sui/SuiSignMessage.ts +1 -1
  114. package/src/api/sui/SuiSignTransaction.ts +1 -1
  115. package/src/api/test/TestInitializeDeviceDuration.ts +3 -3
  116. package/src/api/ton/TonGetAddress.ts +1 -1
  117. package/src/api/ton/TonSignMessage.ts +1 -1
  118. package/src/api/ton/TonSignProof.ts +1 -1
  119. package/src/api/tron/TronGetAddress.ts +1 -1
  120. package/src/api/tron/TronSignMessage.ts +1 -1
  121. package/src/api/tron/TronSignTransaction.ts +1 -1
  122. package/src/api/xrp/XrpGetAddress.ts +1 -1
  123. package/src/api/xrp/XrpSignTransaction.ts +1 -1
  124. package/src/core/index.ts +11 -7
  125. package/src/data/messages/messages.json +48 -35
  126. package/src/device/Device.ts +24 -10
  127. package/src/device/DeviceCommands.ts +15 -4
  128. package/src/events/device.ts +4 -0
  129. package/src/events/ui-request.ts +3 -2
  130. package/src/events/ui-response.ts +1 -0
  131. package/src/utils/deviceFeaturesUtils.ts +55 -49
package/dist/index.js CHANGED
@@ -1191,6 +1191,118 @@ const getDeviceBoardloaderVersion = (features) => {
1191
1191
  return [0, 0, 0];
1192
1192
  };
1193
1193
 
1194
+ const HD_HARDENED = 0x80000000;
1195
+ const toHardened = (n) => (n | HD_HARDENED) >>> 0;
1196
+ const fromHardened = (n) => (n & ~HD_HARDENED) >>> 0;
1197
+ const PATH_NOT_VALID = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Not a valid path');
1198
+ const PATH_NEGATIVE_VALUES = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Path cannot contain negative values');
1199
+ const getHDPath = (path) => {
1200
+ const parts = path.toLowerCase().split('/');
1201
+ if (parts[0] !== 'm')
1202
+ throw PATH_NOT_VALID;
1203
+ return parts
1204
+ .filter((p) => p !== 'm' && p !== '')
1205
+ .map((p) => {
1206
+ let hardened = false;
1207
+ if (p.substr(p.length - 1) === "'") {
1208
+ hardened = true;
1209
+ p = p.substr(0, p.length - 1);
1210
+ }
1211
+ let n = parseInt(p);
1212
+ if (Number.isNaN(n)) {
1213
+ throw PATH_NOT_VALID;
1214
+ }
1215
+ else if (n < 0) {
1216
+ throw PATH_NEGATIVE_VALUES;
1217
+ }
1218
+ if (hardened) {
1219
+ n = toHardened(n);
1220
+ }
1221
+ return n;
1222
+ });
1223
+ };
1224
+ const isEqualBip44CoinType = (path, coinType) => isBip44Path(path) && path[1] === toHardened(coinType);
1225
+ const isBip44Path = (path) => Array.isArray(path) && path[0] === toHardened(44);
1226
+ const isMultisigPath = (path) => Array.isArray(path) && path[0] === toHardened(48);
1227
+ const isSegwitPath = (path) => Array.isArray(path) && path[0] === toHardened(49);
1228
+ const isTaprootPath = (path) => Array.isArray(path) && (path[0] === toHardened(86) || path[0] === toHardened(10025));
1229
+ const getScriptType = (path) => {
1230
+ if (!Array.isArray(path) || path.length < 1)
1231
+ return 'SPENDADDRESS';
1232
+ const p1 = fromHardened(path[0]);
1233
+ switch (p1) {
1234
+ case 48:
1235
+ return 'SPENDMULTISIG';
1236
+ case 49:
1237
+ return 'SPENDP2SHWITNESS';
1238
+ case 84:
1239
+ return 'SPENDWITNESS';
1240
+ case 86:
1241
+ case 10025:
1242
+ return 'SPENDTAPROOT';
1243
+ default:
1244
+ return 'SPENDADDRESS';
1245
+ }
1246
+ };
1247
+ const getOutputScriptType = (path) => {
1248
+ if (!Array.isArray(path) || path.length < 1)
1249
+ return 'PAYTOADDRESS';
1250
+ if (path[0] === 49) {
1251
+ return 'PAYTOP2SHWITNESS';
1252
+ }
1253
+ const p = fromHardened(path[0]);
1254
+ switch (p) {
1255
+ case 48:
1256
+ return 'PAYTOMULTISIG';
1257
+ case 49:
1258
+ return 'PAYTOP2SHWITNESS';
1259
+ case 84:
1260
+ return 'PAYTOWITNESS';
1261
+ case 86:
1262
+ case 10025:
1263
+ return 'PAYTOTAPROOT';
1264
+ default:
1265
+ return 'PAYTOADDRESS';
1266
+ }
1267
+ };
1268
+ const serializedPath = (path) => {
1269
+ const pathStr = path
1270
+ .map((p) => {
1271
+ if (p & HD_HARDENED) {
1272
+ return `${p & ~HD_HARDENED}'`;
1273
+ }
1274
+ return p;
1275
+ })
1276
+ .join('/');
1277
+ return `m/${pathStr}`;
1278
+ };
1279
+ const validatePath = (path, length = 0, base = false) => {
1280
+ let valid;
1281
+ if (typeof path === 'string') {
1282
+ valid = getHDPath(path);
1283
+ }
1284
+ else if (Array.isArray(path)) {
1285
+ valid = path.map((p) => {
1286
+ const n = parseInt(p);
1287
+ if (Number.isNaN(n)) {
1288
+ throw PATH_NOT_VALID;
1289
+ }
1290
+ else if (n < 0) {
1291
+ throw PATH_NEGATIVE_VALUES;
1292
+ }
1293
+ return n;
1294
+ });
1295
+ }
1296
+ else {
1297
+ valid = undefined;
1298
+ }
1299
+ if (!valid)
1300
+ throw PATH_NOT_VALID;
1301
+ if (length > 0 && valid.length < length)
1302
+ throw PATH_NOT_VALID;
1303
+ return base ? valid.splice(0, 3) : valid;
1304
+ };
1305
+
1194
1306
  var nested$1 = {
1195
1307
  AlephiumGetAddress: {
1196
1308
  fields: {
@@ -4217,7 +4329,8 @@ var nested$1 = {
4217
4329
  ButtonRequest_Success: 17,
4218
4330
  ButtonRequest_Warning: 18,
4219
4331
  ButtonRequest_PassphraseEntry: 19,
4220
- ButtonRequest_PinEntry: 20
4332
+ ButtonRequest_PinEntry: 20,
4333
+ ButtonRequest_AttachPin: 8000
4221
4334
  }
4222
4335
  }
4223
4336
  }
@@ -4268,6 +4381,10 @@ var nested$1 = {
4268
4381
  options: {
4269
4382
  deprecated: true
4270
4383
  }
4384
+ },
4385
+ exists_attach_pin_user: {
4386
+ type: "bool",
4387
+ id: 8000
4271
4388
  }
4272
4389
  }
4273
4390
  },
@@ -4287,6 +4404,10 @@ var nested$1 = {
4287
4404
  on_device: {
4288
4405
  type: "bool",
4289
4406
  id: 3
4407
+ },
4408
+ on_device_attach_pin: {
4409
+ type: "bool",
4410
+ id: 8000
4290
4411
  }
4291
4412
  }
4292
4413
  },
@@ -4345,38 +4466,6 @@ var nested$1 = {
4345
4466
  fields: {
4346
4467
  }
4347
4468
  },
4348
- GetPassphraseState: {
4349
- fields: {
4350
- btc_test: {
4351
- type: "string",
4352
- id: 1
4353
- },
4354
- only_main_pin: {
4355
- type: "bool",
4356
- id: 2
4357
- },
4358
- session_id: {
4359
- type: "bytes",
4360
- id: 3
4361
- }
4362
- }
4363
- },
4364
- PassphraseState: {
4365
- fields: {
4366
- btc_test: {
4367
- type: "string",
4368
- id: 1
4369
- },
4370
- session_id: {
4371
- type: "bytes",
4372
- id: 2
4373
- },
4374
- attach_to_pin_user: {
4375
- type: "bool",
4376
- id: 3
4377
- }
4378
- }
4379
- },
4380
4469
  ConfluxGetAddress: {
4381
4470
  fields: {
4382
4471
  address_n: {
@@ -7287,9 +7376,9 @@ var nested$1 = {
7287
7376
  type: "bool",
7288
7377
  id: 3
7289
7378
  },
7290
- btc_test: {
7379
+ passphrase_state: {
7291
7380
  type: "string",
7292
- id: 4
7381
+ id: 8000
7293
7382
  }
7294
7383
  }
7295
7384
  },
@@ -7674,6 +7763,10 @@ var nested$1 = {
7674
7763
  attach_to_pin_user: {
7675
7764
  type: "bool",
7676
7765
  id: 625
7766
+ },
7767
+ unlocked_attach_pin: {
7768
+ type: "bool",
7769
+ id: 626
7677
7770
  }
7678
7771
  },
7679
7772
  nested: {
@@ -8796,6 +8889,38 @@ var nested$1 = {
8796
8889
  }
8797
8890
  }
8798
8891
  },
8892
+ GetPassphraseState: {
8893
+ fields: {
8894
+ passphrase_state: {
8895
+ type: "string",
8896
+ id: 1
8897
+ },
8898
+ _only_main_pin: {
8899
+ type: "bool",
8900
+ id: 2
8901
+ },
8902
+ allow_create_attach_pin: {
8903
+ type: "bool",
8904
+ id: 3
8905
+ }
8906
+ }
8907
+ },
8908
+ PassphraseState: {
8909
+ fields: {
8910
+ passphrase_state: {
8911
+ type: "string",
8912
+ id: 1
8913
+ },
8914
+ session_id: {
8915
+ type: "bytes",
8916
+ id: 2
8917
+ },
8918
+ unlocked_attach_pin: {
8919
+ type: "bool",
8920
+ id: 3
8921
+ }
8922
+ }
8923
+ },
8799
8924
  MoneroTransactionSourceEntry: {
8800
8925
  fields: {
8801
8926
  outputs: {
@@ -24888,8 +25013,7 @@ const supportNewPassphrase = (features) => {
24888
25013
  const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
24889
25014
  const { features, commands } = device;
24890
25015
  const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
24891
- const sessionId = device.getInternalState();
24892
- const { passphraseState, newSession } = yield getPassphraseState(features, commands, Object.assign({ sessionId }, options));
25016
+ const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
24893
25017
  if (newSession && passphraseState && (features === null || features === void 0 ? void 0 : features.device_id)) {
24894
25018
  console.log('=====>>>>>> run updateInternalState newSession:', newSession);
24895
25019
  device.updateInternalState(passphraseState, features.device_id, newSession);
@@ -24900,24 +25024,41 @@ const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(v
24900
25024
  if (needRefreshWithLocked || needRefreshWithPassphrase) {
24901
25025
  yield device.getFeatures();
24902
25026
  }
24903
- return { passphraseState, newSession };
25027
+ return { passphraseState, newSession, unlockedAttachPin };
24904
25028
  });
24905
25029
  const getPassphraseState = (features, commands, options) => __awaiter(void 0, void 0, void 0, function* () {
24906
25030
  if (!features)
24907
- return { passphraseState: undefined, newSession: undefined };
24908
- console.log('=====>>>>>> getPassphraseState begin: ', options === null || options === void 0 ? void 0 : options.onlyMainPin, options === null || options === void 0 ? void 0 : options.expectPassphraseState, options === null || options === void 0 ? void 0 : options.sessionId);
24909
- const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
24910
- session_id: options === null || options === void 0 ? void 0 : options.sessionId,
24911
- btc_test: (options === null || options === void 0 ? void 0 : options.onlyMainPin) ? undefined : options === null || options === void 0 ? void 0 : options.expectPassphraseState,
24912
- onlyMainPin: options === null || options === void 0 ? void 0 : options.onlyMainPin,
25031
+ return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
25032
+ const firmwareVersion = getDeviceFirmwareVersion(features);
25033
+ const deviceType = getDeviceType(features);
25034
+ if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.13.2')) {
25035
+ console.log('=====>>>>>> getPassphraseState begin: ', options === null || options === void 0 ? void 0 : options.onlyMainPin, options === null || options === void 0 ? void 0 : options.expectPassphraseState);
25036
+ const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
25037
+ passphrase_state: (options === null || options === void 0 ? void 0 : options.onlyMainPin) ? undefined : options === null || options === void 0 ? void 0 : options.expectPassphraseState,
25038
+ });
25039
+ console.log('=====>>>>>> getPassphraseState end: result ', message);
25040
+ if (type === 'CallMethodError') {
25041
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
25042
+ }
25043
+ return {
25044
+ passphraseState: message.passphrase_state,
25045
+ newSession: message.session_id,
25046
+ unlockedAttachPin: message.unlocked_attach_pin,
25047
+ };
25048
+ }
25049
+ const { message, type } = yield commands.typedCall('GetAddress', 'Address', {
25050
+ address_n: [toHardened(44), toHardened(1), toHardened(0), 0, 0],
25051
+ coin_name: 'Testnet',
25052
+ script_type: 'SPENDADDRESS',
25053
+ show_display: false,
24913
25054
  });
24914
- console.log('=====>>>>>> getPassphraseState end: result ', message);
24915
25055
  if (type === 'CallMethodError') {
24916
25056
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
24917
25057
  }
24918
25058
  return {
24919
- passphraseState: message.btc_test,
24920
- newSession: message.session_id,
25059
+ passphraseState: message.address,
25060
+ newSession: undefined,
25061
+ unlockedAttachPin: undefined,
24921
25062
  };
24922
25063
  });
24923
25064
  const supportBatchPublicKey = (features, options) => {
@@ -25204,118 +25345,6 @@ function checkBootloaderLength(data) {
25204
25345
  return bootloaderLength === data.byteLength;
25205
25346
  }
25206
25347
 
25207
- const HD_HARDENED = 0x80000000;
25208
- const toHardened = (n) => (n | HD_HARDENED) >>> 0;
25209
- const fromHardened = (n) => (n & ~HD_HARDENED) >>> 0;
25210
- const PATH_NOT_VALID = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Not a valid path');
25211
- const PATH_NEGATIVE_VALUES = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Path cannot contain negative values');
25212
- const getHDPath = (path) => {
25213
- const parts = path.toLowerCase().split('/');
25214
- if (parts[0] !== 'm')
25215
- throw PATH_NOT_VALID;
25216
- return parts
25217
- .filter((p) => p !== 'm' && p !== '')
25218
- .map((p) => {
25219
- let hardened = false;
25220
- if (p.substr(p.length - 1) === "'") {
25221
- hardened = true;
25222
- p = p.substr(0, p.length - 1);
25223
- }
25224
- let n = parseInt(p);
25225
- if (Number.isNaN(n)) {
25226
- throw PATH_NOT_VALID;
25227
- }
25228
- else if (n < 0) {
25229
- throw PATH_NEGATIVE_VALUES;
25230
- }
25231
- if (hardened) {
25232
- n = toHardened(n);
25233
- }
25234
- return n;
25235
- });
25236
- };
25237
- const isEqualBip44CoinType = (path, coinType) => isBip44Path(path) && path[1] === toHardened(coinType);
25238
- const isBip44Path = (path) => Array.isArray(path) && path[0] === toHardened(44);
25239
- const isMultisigPath = (path) => Array.isArray(path) && path[0] === toHardened(48);
25240
- const isSegwitPath = (path) => Array.isArray(path) && path[0] === toHardened(49);
25241
- const isTaprootPath = (path) => Array.isArray(path) && (path[0] === toHardened(86) || path[0] === toHardened(10025));
25242
- const getScriptType = (path) => {
25243
- if (!Array.isArray(path) || path.length < 1)
25244
- return 'SPENDADDRESS';
25245
- const p1 = fromHardened(path[0]);
25246
- switch (p1) {
25247
- case 48:
25248
- return 'SPENDMULTISIG';
25249
- case 49:
25250
- return 'SPENDP2SHWITNESS';
25251
- case 84:
25252
- return 'SPENDWITNESS';
25253
- case 86:
25254
- case 10025:
25255
- return 'SPENDTAPROOT';
25256
- default:
25257
- return 'SPENDADDRESS';
25258
- }
25259
- };
25260
- const getOutputScriptType = (path) => {
25261
- if (!Array.isArray(path) || path.length < 1)
25262
- return 'PAYTOADDRESS';
25263
- if (path[0] === 49) {
25264
- return 'PAYTOP2SHWITNESS';
25265
- }
25266
- const p = fromHardened(path[0]);
25267
- switch (p) {
25268
- case 48:
25269
- return 'PAYTOMULTISIG';
25270
- case 49:
25271
- return 'PAYTOP2SHWITNESS';
25272
- case 84:
25273
- return 'PAYTOWITNESS';
25274
- case 86:
25275
- case 10025:
25276
- return 'PAYTOTAPROOT';
25277
- default:
25278
- return 'PAYTOADDRESS';
25279
- }
25280
- };
25281
- const serializedPath = (path) => {
25282
- const pathStr = path
25283
- .map((p) => {
25284
- if (p & HD_HARDENED) {
25285
- return `${p & ~HD_HARDENED}'`;
25286
- }
25287
- return p;
25288
- })
25289
- .join('/');
25290
- return `m/${pathStr}`;
25291
- };
25292
- const validatePath = (path, length = 0, base = false) => {
25293
- let valid;
25294
- if (typeof path === 'string') {
25295
- valid = getHDPath(path);
25296
- }
25297
- else if (Array.isArray(path)) {
25298
- valid = path.map((p) => {
25299
- const n = parseInt(p);
25300
- if (Number.isNaN(n)) {
25301
- throw PATH_NOT_VALID;
25302
- }
25303
- else if (n < 0) {
25304
- throw PATH_NEGATIVE_VALUES;
25305
- }
25306
- return n;
25307
- });
25308
- }
25309
- else {
25310
- valid = undefined;
25311
- }
25312
- if (!valid)
25313
- throw PATH_NOT_VALID;
25314
- if (length > 0 && valid.length < length)
25315
- throw PATH_NOT_VALID;
25316
- return base ? valid.splice(0, 3) : valid;
25317
- };
25318
-
25319
25348
  const getT1Data = () => ({
25320
25349
  default: {
25321
25350
  name: 'default',
@@ -25675,7 +25704,7 @@ const UI_REQUEST = {
25675
25704
  BOOTLOADER: 'ui-device_bootloader_mode',
25676
25705
  NOT_IN_BOOTLOADER: 'ui-device_not_in_bootloader_mode',
25677
25706
  REQUIRE_MODE: 'ui-device_require_mode',
25678
- INITIALIZE: 'ui-device_not_initialized',
25707
+ NOT_INITIALIZE: 'ui-device_not_initialized',
25679
25708
  SEEDLESS: 'ui-device_seedless',
25680
25709
  FIRMWARE_OLD: 'ui-device_firmware_old',
25681
25710
  FIRMWARE_NOT_SUPPORTED: 'ui-device_firmware_unsupported',
@@ -26406,8 +26435,14 @@ class DeviceCommands {
26406
26435
  }, error => Promise.reject(error));
26407
26436
  }
26408
26437
  if (res.type === 'PassphraseRequest') {
26409
- return this._promptPassphrase().then(response => {
26410
- const { passphrase, passphraseOnDevice } = response;
26438
+ const existsAttachPinUser = res.message.exists_attach_pin_user;
26439
+ return this._promptPassphrase({
26440
+ existsAttachPinUser,
26441
+ }).then(response => {
26442
+ const { passphrase, passphraseOnDevice, attachPinOnDevice } = response;
26443
+ if (attachPinOnDevice && existsAttachPinUser) {
26444
+ return this._commonCall('PassphraseAck', { on_device_attach_pin: true });
26445
+ }
26411
26446
  return !passphraseOnDevice
26412
26447
  ? this._commonCall('PassphraseAck', { passphrase })
26413
26448
  : this._commonCall('PassphraseAck', { on_device: true });
@@ -26451,7 +26486,7 @@ class DeviceCommands {
26451
26486
  }
26452
26487
  });
26453
26488
  }
26454
- _promptPassphrase() {
26489
+ _promptPassphrase(options) {
26455
26490
  return new Promise((resolve, reject) => {
26456
26491
  const cancelAndReject = (_error) => cancelDeviceInPrompt(this.device, false)
26457
26492
  .then(onCancel => {
@@ -26469,7 +26504,7 @@ class DeviceCommands {
26469
26504
  });
26470
26505
  if (this.device.listenerCount(DEVICE.PASSPHRASE) > 0) {
26471
26506
  this.device.setCancelableAction(cancelAndReject);
26472
- this.device.emit(DEVICE.PASSPHRASE, this.device, (response, error) => {
26507
+ this.device.emit(DEVICE.PASSPHRASE, this.device, options, (response, error) => {
26473
26508
  this.device.clearCancelableAction();
26474
26509
  if (error) {
26475
26510
  cancelAndReject();
@@ -26719,7 +26754,7 @@ class Device extends events.exports {
26719
26754
  if (options === null || options === void 0 ? void 0 : options.deriveCardano) {
26720
26755
  payload.derive_cardano = true;
26721
26756
  }
26722
- payload.btc_test = options === null || options === void 0 ? void 0 : options.passphraseState;
26757
+ payload.passphrase_state = options === null || options === void 0 ? void 0 : options.passphraseState;
26723
26758
  console.log('=====>>>>>> initialize device begin: ', payload, {
26724
26759
  deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
26725
26760
  passphraseState: options === null || options === void 0 ? void 0 : options.passphraseState,
@@ -26961,8 +26996,8 @@ class Device extends events.exports {
26961
26996
  if (this.isBootloader() && !allow.includes(UI_REQUEST.BOOTLOADER)) {
26962
26997
  return UI_REQUEST.BOOTLOADER;
26963
26998
  }
26964
- if (!this.isInitialized() && !allow.includes(UI_REQUEST.INITIALIZE)) {
26965
- return UI_REQUEST.INITIALIZE;
26999
+ if (!this.isInitialized() && !allow.includes(UI_REQUEST.NOT_INITIALIZE)) {
27000
+ return UI_REQUEST.NOT_INITIALIZE;
26966
27001
  }
26967
27002
  if (this.isSeedless() && !allow.includes(UI_REQUEST.SEEDLESS)) {
26968
27003
  return UI_REQUEST.SEEDLESS;
@@ -26990,10 +27025,14 @@ class Device extends events.exports {
26990
27025
  return __awaiter(this, void 0, void 0, function* () {
26991
27026
  if (!this.features)
26992
27027
  return false;
26993
- const { passphraseState: newPassphraseState } = yield getPassphraseStateWithRefreshDeviceInfo(this, {
27028
+ const { passphraseState: newPassphraseState, unlockedAttachPin } = yield getPassphraseStateWithRefreshDeviceInfo(this, {
26994
27029
  expectPassphraseState: passphraseState,
26995
27030
  onlyMainPin: useEmptyPassphraseState,
26996
27031
  });
27032
+ if (unlockedAttachPin && useEmptyPassphraseState) {
27033
+ this.clearInternalState();
27034
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError));
27035
+ }
26997
27036
  if (passphraseState && passphraseState !== newPassphraseState) {
26998
27037
  this.clearInternalState();
26999
27038
  return false;
@@ -27096,7 +27135,7 @@ class BaseMethod {
27096
27135
  this.connectId = payload.connectId || '';
27097
27136
  this.deviceId = payload.deviceId || '';
27098
27137
  this.useDevice = true;
27099
- this.notAllowDeviceMode = [UI_REQUEST.INITIALIZE];
27138
+ this.allowDeviceMode = [UI_REQUEST.NOT_INITIALIZE];
27100
27139
  this.requireDeviceMode = [];
27101
27140
  }
27102
27141
  getVersionRange() {
@@ -27162,9 +27201,9 @@ class BaseMethod {
27162
27201
 
27163
27202
  class TestInitializeDeviceDuration extends BaseMethod {
27164
27203
  init() {
27165
- this.notAllowDeviceMode = [
27166
- ...this.notAllowDeviceMode,
27167
- UI_REQUEST.INITIALIZE,
27204
+ this.allowDeviceMode = [
27205
+ ...this.allowDeviceMode,
27206
+ UI_REQUEST.NOT_INITIALIZE,
27168
27207
  UI_REQUEST.BOOTLOADER,
27169
27208
  ];
27170
27209
  this.useDevicePassphraseState = false;
@@ -27214,9 +27253,9 @@ class SearchDevices extends BaseMethod {
27214
27253
 
27215
27254
  class GetFeatures extends BaseMethod {
27216
27255
  init() {
27217
- this.notAllowDeviceMode = [
27218
- ...this.notAllowDeviceMode,
27219
- UI_REQUEST.INITIALIZE,
27256
+ this.allowDeviceMode = [
27257
+ ...this.allowDeviceMode,
27258
+ UI_REQUEST.NOT_INITIALIZE,
27220
27259
  UI_REQUEST.BOOTLOADER,
27221
27260
  ];
27222
27261
  this.useDevicePassphraseState = false;
@@ -27233,9 +27272,9 @@ class GetFeatures extends BaseMethod {
27233
27272
 
27234
27273
  class GetOnekeyFeatures extends BaseMethod {
27235
27274
  init() {
27236
- this.notAllowDeviceMode = [
27237
- ...this.notAllowDeviceMode,
27238
- UI_REQUEST.INITIALIZE,
27275
+ this.allowDeviceMode = [
27276
+ ...this.allowDeviceMode,
27277
+ UI_REQUEST.NOT_INITIALIZE,
27239
27278
  UI_REQUEST.BOOTLOADER,
27240
27279
  ];
27241
27280
  this.useDevicePassphraseState = false;
@@ -27254,7 +27293,7 @@ class GetOnekeyFeatures extends BaseMethod {
27254
27293
 
27255
27294
  class GetPassphraseState extends BaseMethod {
27256
27295
  init() {
27257
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
27296
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
27258
27297
  this.useDevicePassphraseState = false;
27259
27298
  }
27260
27299
  run() {
@@ -27308,9 +27347,9 @@ class GetLogs extends BaseMethod {
27308
27347
 
27309
27348
  class CheckFirmwareRelease extends BaseMethod {
27310
27349
  init() {
27311
- this.notAllowDeviceMode = [
27312
- ...this.notAllowDeviceMode,
27313
- UI_REQUEST.INITIALIZE,
27350
+ this.allowDeviceMode = [
27351
+ ...this.allowDeviceMode,
27352
+ UI_REQUEST.NOT_INITIALIZE,
27314
27353
  UI_REQUEST.BOOTLOADER,
27315
27354
  ];
27316
27355
  this.useDevicePassphraseState = false;
@@ -27327,9 +27366,9 @@ class CheckFirmwareRelease extends BaseMethod {
27327
27366
 
27328
27367
  class CheckBLEFirmwareRelease extends BaseMethod {
27329
27368
  init() {
27330
- this.notAllowDeviceMode = [
27331
- ...this.notAllowDeviceMode,
27332
- UI_REQUEST.INITIALIZE,
27369
+ this.allowDeviceMode = [
27370
+ ...this.allowDeviceMode,
27371
+ UI_REQUEST.NOT_INITIALIZE,
27333
27372
  UI_REQUEST.BOOTLOADER,
27334
27373
  ];
27335
27374
  this.useDevicePassphraseState = false;
@@ -27430,7 +27469,7 @@ function getBridgeReleaseInfo({ deviceType, currentFirmwareVersion, willUpdateFi
27430
27469
 
27431
27470
  class CheckBridgeRelease extends BaseMethod {
27432
27471
  init() {
27433
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27472
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27434
27473
  this.useDevicePassphraseState = false;
27435
27474
  this.skipForceUpdateCheck = true;
27436
27475
  }
@@ -27454,7 +27493,7 @@ class CheckBridgeRelease extends BaseMethod {
27454
27493
 
27455
27494
  class CheckBootloaderRelease extends BaseMethod {
27456
27495
  init() {
27457
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27496
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27458
27497
  this.useDevicePassphraseState = false;
27459
27498
  this.skipForceUpdateCheck = true;
27460
27499
  }
@@ -27472,7 +27511,7 @@ class CheckBootloaderRelease extends BaseMethod {
27472
27511
 
27473
27512
  class CheckAllFirmwareRelease extends BaseMethod {
27474
27513
  init() {
27475
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.BOOTLOADER];
27514
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
27476
27515
  this.useDevicePassphraseState = false;
27477
27516
  this.skipForceUpdateCheck = true;
27478
27517
  }
@@ -28467,7 +28506,7 @@ class DeviceUpdateBootloader extends BaseMethod {
28467
28506
  };
28468
28507
  }
28469
28508
  init() {
28470
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28509
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28471
28510
  this.requireDeviceMode = [];
28472
28511
  this.useDevicePassphraseState = false;
28473
28512
  this.skipForceUpdateCheck = true;
@@ -28576,7 +28615,7 @@ class FirmwareUpdate extends BaseMethod {
28576
28615
  };
28577
28616
  }
28578
28617
  init() {
28579
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28618
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28580
28619
  this.requireDeviceMode = [];
28581
28620
  this.useDevicePassphraseState = false;
28582
28621
  this.skipForceUpdateCheck = true;
@@ -28717,7 +28756,7 @@ class FirmwareUpdateV2 extends BaseMethod {
28717
28756
  };
28718
28757
  }
28719
28758
  init() {
28720
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
28759
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
28721
28760
  this.requireDeviceMode = [];
28722
28761
  this.useDevicePassphraseState = false;
28723
28762
  this.skipForceUpdateCheck = true;
@@ -29254,7 +29293,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
29254
29293
  this.checkPromise = null;
29255
29294
  }
29256
29295
  init() {
29257
- this.notAllowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.INITIALIZE];
29296
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
29258
29297
  this.requireDeviceMode = [];
29259
29298
  this.useDevicePassphraseState = false;
29260
29299
  this.skipForceUpdateCheck = true;
@@ -29651,7 +29690,7 @@ class CipherKeyValue extends BaseMethod {
29651
29690
  init() {
29652
29691
  var _a;
29653
29692
  this.checkDeviceId = true;
29654
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
29693
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
29655
29694
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
29656
29695
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
29657
29696
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -29881,7 +29920,7 @@ const networkConfigMap = {
29881
29920
  class AllNetworkGetAddress extends BaseMethod {
29882
29921
  init() {
29883
29922
  this.checkDeviceId = true;
29884
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
29923
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
29885
29924
  validateParams(this.payload, [{ name: 'bundle', type: 'array' }]);
29886
29925
  this.payload.bundle.forEach((batch) => {
29887
29926
  validateParams(batch, [
@@ -29892,7 +29931,7 @@ class AllNetworkGetAddress extends BaseMethod {
29892
29931
  ]);
29893
29932
  });
29894
29933
  }
29895
- generateMethodName({ network, payload, }) {
29934
+ generateMethodName({ network, payload, originalIndex, }) {
29896
29935
  var _a, _b;
29897
29936
  const { name: networkName, coin } = networkAliases[network] || {
29898
29937
  name: network,
@@ -29906,6 +29945,7 @@ class AllNetworkGetAddress extends BaseMethod {
29906
29945
  methodName: config.methodName,
29907
29946
  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 }),
29908
29947
  _originRequestParams: payload,
29948
+ _originalIndex: originalIndex,
29909
29949
  };
29910
29950
  }
29911
29951
  callMethod(methodName, params) {
@@ -29953,10 +29993,11 @@ class AllNetworkGetAddress extends BaseMethod {
29953
29993
  const responses = [];
29954
29994
  const resultMap = {};
29955
29995
  const { bundle } = this.payload;
29956
- const methodReduceParams = bundle
29957
- .map(param => this.generateMethodName({
29996
+ const methodGroups = bundle
29997
+ .map((param, index) => this.generateMethodName({
29958
29998
  network: param.network,
29959
29999
  payload: param,
30000
+ originalIndex: index,
29960
30001
  }))
29961
30002
  .reduce((acc, cur) => {
29962
30003
  if (!acc[cur.methodName]) {
@@ -29965,28 +30006,25 @@ class AllNetworkGetAddress extends BaseMethod {
29965
30006
  acc[cur.methodName].push(cur);
29966
30007
  return acc;
29967
30008
  }, {});
29968
- const methodParamsArray = Object.values(methodReduceParams);
29969
- const generateResponseKey = (payload) => `${payload.path}-${payload.network}-${payload.chainName}-${payload.prefix}`;
29970
- for (let i = 0; i < methodParamsArray.length; i++) {
29971
- const methodParams = methodParamsArray[i];
29972
- const { methodName } = methodParams[0];
29973
- const params = {
29974
- bundle: methodParams.map(param => (Object.assign({}, param.params))),
30009
+ let i = 0;
30010
+ for (const [methodName, params] of Object.entries(methodGroups)) {
30011
+ const methodParams = {
30012
+ bundle: params.map(param => (Object.assign({}, param.params))),
29975
30013
  };
29976
- const response = yield this.callMethod(methodName, params);
29977
- for (let i = 0; i < methodParams.length; i++) {
29978
- const { _originRequestParams } = methodParams[i];
29979
- const responseKey = generateResponseKey(_originRequestParams);
30014
+ const response = yield this.callMethod(methodName, methodParams);
30015
+ for (let i = 0; i < params.length; i++) {
30016
+ const { _originRequestParams, _originalIndex } = params[i];
30017
+ const responseKey = `${_originalIndex}`;
29980
30018
  resultMap[responseKey] = Object.assign(Object.assign({}, _originRequestParams), response[i]);
29981
30019
  }
29982
30020
  if (((_b = (_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle) === null || _b === void 0 ? void 0 : _b.length) > 1) {
29983
30021
  const progress = Math.round(((i + 1) / this.payload.bundle.length) * 100);
29984
30022
  this.postMessage(createUiMessage(UI_REQUEST.DEVICE_PROGRESS, { progress }));
29985
30023
  }
30024
+ i++;
29986
30025
  }
29987
- for (const param of bundle) {
29988
- const responseKey = generateResponseKey(param);
29989
- responses.push(resultMap[responseKey]);
30026
+ for (let i = 0; i < bundle.length; i++) {
30027
+ responses.push(resultMap[i]);
29990
30028
  }
29991
30029
  return Promise.resolve(responses);
29992
30030
  });
@@ -30320,7 +30358,7 @@ class BTCGetAddress extends BaseMethod {
30320
30358
  }
30321
30359
  init() {
30322
30360
  this.checkDeviceId = true;
30323
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30361
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30324
30362
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
30325
30363
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
30326
30364
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -30519,7 +30557,7 @@ class BTCGetPublicKey extends BaseMethod {
30519
30557
  }
30520
30558
  init() {
30521
30559
  this.checkDeviceId = true;
30522
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30560
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30523
30561
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
30524
30562
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
30525
30563
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -30622,7 +30660,7 @@ class BTCGetPublicKey extends BaseMethod {
30622
30660
  class BTCSignMessage extends BaseMethod {
30623
30661
  init() {
30624
30662
  this.checkDeviceId = true;
30625
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30663
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30626
30664
  validateParams(this.payload, [
30627
30665
  { name: 'path', required: true },
30628
30666
  { name: 'messageHex', type: 'hexString', required: true },
@@ -30678,7 +30716,7 @@ class BTCSignMessage extends BaseMethod {
30678
30716
  class BTCSignPsbt extends BaseMethod {
30679
30717
  init() {
30680
30718
  this.checkDeviceId = true;
30681
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
30719
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
30682
30720
  validateParams(this.payload, [
30683
30721
  { name: 'psbt', type: 'hexString', required: true },
30684
30722
  { name: 'coin', type: 'string' },
@@ -30996,7 +31034,7 @@ var signtxLegacy = (typedCall, inputs, outputs, refTxsArray, options, coinName)
30996
31034
  class BTCSignTransaction extends BaseMethod {
30997
31035
  init() {
30998
31036
  this.checkDeviceId = true;
30999
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31037
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31000
31038
  validateParams(this.payload, [
31001
31039
  { name: 'coin', type: 'string', required: true },
31002
31040
  { name: 'inputs', type: 'array', required: true },
@@ -31090,7 +31128,7 @@ class BTCSignTransaction extends BaseMethod {
31090
31128
  class BTCVerifyMessage extends BaseMethod {
31091
31129
  init() {
31092
31130
  this.checkDeviceId = true;
31093
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31131
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31094
31132
  validateParams(this.payload, [
31095
31133
  { name: 'address', type: 'string', required: true },
31096
31134
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31125,7 +31163,7 @@ class ConfluxGetAddress extends BaseMethod {
31125
31163
  }
31126
31164
  init() {
31127
31165
  var _a;
31128
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31166
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31129
31167
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31130
31168
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
31131
31169
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -31176,7 +31214,7 @@ class ConfluxGetAddress extends BaseMethod {
31176
31214
 
31177
31215
  class ConfluxSignMessage extends BaseMethod {
31178
31216
  init() {
31179
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31217
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31180
31218
  validateParams(this.payload, [
31181
31219
  { name: 'path', required: true },
31182
31220
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31205,7 +31243,7 @@ class ConfluxSignMessage extends BaseMethod {
31205
31243
 
31206
31244
  class ConfluxSignMessageCIP23 extends BaseMethod {
31207
31245
  init() {
31208
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31246
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31209
31247
  validateParams(this.payload, [
31210
31248
  { name: 'path', required: true },
31211
31249
  { name: 'domainHash', type: 'hexString', required: true },
@@ -31290,7 +31328,7 @@ class ConfluxSignTransaction extends BaseMethod {
31290
31328
  });
31291
31329
  }
31292
31330
  init() {
31293
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31331
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31294
31332
  validateParams(this.payload, [
31295
31333
  { name: 'path', required: true },
31296
31334
  { name: 'transaction', type: 'object', required: true },
@@ -31355,7 +31393,7 @@ class EvmGetAddress extends BaseMethod {
31355
31393
  init() {
31356
31394
  var _a;
31357
31395
  this.checkDeviceId = true;
31358
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31396
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31359
31397
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31360
31398
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
31361
31399
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -31440,7 +31478,7 @@ class EVMGetPublicKey extends BaseMethod {
31440
31478
  init() {
31441
31479
  var _a, _b, _c;
31442
31480
  this.checkDeviceId = true;
31443
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31481
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31444
31482
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
31445
31483
  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);
31446
31484
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -31531,7 +31569,7 @@ function signMessageLegacyV1 ({ typedCall, params, }) {
31531
31569
  class EVMSignMessage$2 extends BaseMethod {
31532
31570
  init() {
31533
31571
  this.checkDeviceId = true;
31534
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31572
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31535
31573
  validateParams(this.payload, [
31536
31574
  { name: 'path', required: true },
31537
31575
  { name: 'messageHex', type: 'hexString', required: true },
@@ -31564,7 +31602,7 @@ class EVMSignMessage$2 extends BaseMethod {
31564
31602
  class EVMSignMessageEIP712 extends BaseMethod {
31565
31603
  init() {
31566
31604
  this.checkDeviceId = true;
31567
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31605
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31568
31606
  validateParams(this.payload, [
31569
31607
  { name: 'path', required: true },
31570
31608
  { name: 'domainHash', type: 'hexString', required: true },
@@ -31718,7 +31756,7 @@ class EVMSignTransaction extends BaseMethod {
31718
31756
  }
31719
31757
  init() {
31720
31758
  this.checkDeviceId = true;
31721
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
31759
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31722
31760
  validateParams(this.payload, [
31723
31761
  { name: 'path', required: true },
31724
31762
  { name: 'transaction', type: 'object', required: true },
@@ -31962,7 +32000,7 @@ const getFieldType = (typeName, types) => {
31962
32000
  class EVMSignTypedData extends BaseMethod {
31963
32001
  init() {
31964
32002
  this.checkDeviceId = true;
31965
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32003
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
31966
32004
  validateParams(this.payload, [
31967
32005
  { name: 'path', required: true },
31968
32006
  { name: 'metamaskV4Compat', type: 'boolean' },
@@ -32290,7 +32328,7 @@ function verifyMessage ({ typedCall, params, }) {
32290
32328
  class EVMSignMessage$1 extends BaseMethod {
32291
32329
  init() {
32292
32330
  this.checkDeviceId = true;
32293
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32331
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32294
32332
  validateParams(this.payload, [
32295
32333
  { name: 'address', type: 'string', required: true },
32296
32334
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32329,7 +32367,7 @@ class StarcoinGetAddress extends BaseMethod {
32329
32367
  init() {
32330
32368
  var _a;
32331
32369
  this.checkDeviceId = true;
32332
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32370
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32333
32371
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32334
32372
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32335
32373
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32377,7 +32415,7 @@ class StarcoinGetPublicKey extends BaseMethod {
32377
32415
  init() {
32378
32416
  var _a;
32379
32417
  this.checkDeviceId = true;
32380
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32418
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32381
32419
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32382
32420
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32383
32421
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32415,7 +32453,7 @@ class StarcoinGetPublicKey extends BaseMethod {
32415
32453
  class StarcoinSignMessage extends BaseMethod {
32416
32454
  init() {
32417
32455
  this.checkDeviceId = true;
32418
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32456
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32419
32457
  validateParams(this.payload, [
32420
32458
  { name: 'path', required: true },
32421
32459
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32438,7 +32476,7 @@ class StarcoinSignMessage extends BaseMethod {
32438
32476
  class StarcoinSignTransaction extends BaseMethod {
32439
32477
  init() {
32440
32478
  this.checkDeviceId = true;
32441
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32479
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32442
32480
  validateParams(this.payload, [
32443
32481
  { name: 'path', required: true },
32444
32482
  { name: 'rawTx', type: 'hexString', required: true },
@@ -32461,7 +32499,7 @@ class StarcoinSignTransaction extends BaseMethod {
32461
32499
  class EVMSignMessage extends BaseMethod {
32462
32500
  init() {
32463
32501
  this.checkDeviceId = true;
32464
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32502
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32465
32503
  validateParams(this.payload, [
32466
32504
  { name: 'publicKey', type: 'string', required: true },
32467
32505
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32491,7 +32529,7 @@ class NEMGetAddress extends BaseMethod {
32491
32529
  init() {
32492
32530
  var _a;
32493
32531
  this.checkDeviceId = true;
32494
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32532
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32495
32533
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32496
32534
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32497
32535
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32706,7 +32744,7 @@ class NEMSignTransaction extends BaseMethod {
32706
32744
  }
32707
32745
  init() {
32708
32746
  this.checkDeviceId = true;
32709
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32747
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32710
32748
  validateParams(this.payload, [
32711
32749
  { name: 'path', required: true },
32712
32750
  { name: 'transaction', type: 'object', required: true },
@@ -32731,7 +32769,7 @@ class SolGetAddress extends BaseMethod {
32731
32769
  init() {
32732
32770
  var _a;
32733
32771
  this.checkDeviceId = true;
32734
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32772
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32735
32773
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32736
32774
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32737
32775
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32780,7 +32818,7 @@ class SolSignTransaction extends BaseMethod {
32780
32818
  init() {
32781
32819
  var _a;
32782
32820
  this.checkDeviceId = true;
32783
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32821
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32784
32822
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32785
32823
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32786
32824
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -32859,7 +32897,7 @@ class SolSignTransaction extends BaseMethod {
32859
32897
  class SolSignOffchainMessage extends BaseMethod {
32860
32898
  init() {
32861
32899
  this.checkDeviceId = true;
32862
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32900
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32863
32901
  validateParams(this.payload, [
32864
32902
  { name: 'path', required: true },
32865
32903
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32901,7 +32939,7 @@ class SolSignOffchainMessage extends BaseMethod {
32901
32939
  class SolSignMessage extends BaseMethod {
32902
32940
  init() {
32903
32941
  this.checkDeviceId = true;
32904
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32942
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32905
32943
  validateParams(this.payload, [
32906
32944
  { name: 'path', required: true },
32907
32945
  { name: 'messageHex', type: 'hexString', required: true },
@@ -32948,7 +32986,7 @@ class StellarGetAddress extends BaseMethod {
32948
32986
  init() {
32949
32987
  var _a;
32950
32988
  this.checkDeviceId = true;
32951
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
32989
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
32952
32990
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
32953
32991
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
32954
32992
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33117,7 +33155,7 @@ class StellarSignTransaction extends BaseMethod {
33117
33155
  }
33118
33156
  init() {
33119
33157
  this.checkDeviceId = true;
33120
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33158
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33121
33159
  validateParams(this.payload, [
33122
33160
  { name: 'path', required: true },
33123
33161
  { name: 'networkPassphrase', type: 'string', required: true },
@@ -33170,7 +33208,7 @@ class TronGetAddress extends BaseMethod {
33170
33208
  init() {
33171
33209
  var _a;
33172
33210
  this.checkDeviceId = true;
33173
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33211
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33174
33212
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33175
33213
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33176
33214
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33221,7 +33259,7 @@ class TronGetAddress extends BaseMethod {
33221
33259
  class TronSignMessage extends BaseMethod {
33222
33260
  init() {
33223
33261
  this.checkDeviceId = true;
33224
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33262
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33225
33263
  validateParams(this.payload, [
33226
33264
  { name: 'path', required: true },
33227
33265
  { name: 'messageHex', type: 'hexString', required: true },
@@ -33349,7 +33387,7 @@ class TronSignTransaction extends BaseMethod {
33349
33387
  }
33350
33388
  init() {
33351
33389
  this.checkDeviceId = true;
33352
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33390
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33353
33391
  validateParams(this.payload, [
33354
33392
  { name: 'path', required: true },
33355
33393
  { name: 'transaction', type: 'object', required: true },
@@ -33404,7 +33442,7 @@ class NearGetAddress extends BaseMethod {
33404
33442
  init() {
33405
33443
  var _a;
33406
33444
  this.checkDeviceId = true;
33407
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33445
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33408
33446
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33409
33447
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33410
33448
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33455,7 +33493,7 @@ class NearGetAddress extends BaseMethod {
33455
33493
  class NearSignTransaction extends BaseMethod {
33456
33494
  init() {
33457
33495
  this.checkDeviceId = true;
33458
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33496
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33459
33497
  validateParams(this.payload, [
33460
33498
  { name: 'path', required: true },
33461
33499
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33491,7 +33529,7 @@ class AptosGetAddress extends BaseMethod {
33491
33529
  init() {
33492
33530
  var _a, _b;
33493
33531
  this.checkDeviceId = true;
33494
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33532
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33495
33533
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33496
33534
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33497
33535
  this.shouldConfirm =
@@ -33586,7 +33624,7 @@ class AptosGetPublicKey extends BaseMethod {
33586
33624
  init() {
33587
33625
  var _a;
33588
33626
  this.checkDeviceId = true;
33589
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33627
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33590
33628
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33591
33629
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33592
33630
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33631,7 +33669,7 @@ class AptosGetPublicKey extends BaseMethod {
33631
33669
  class AptosSignTransaction extends BaseMethod {
33632
33670
  init() {
33633
33671
  this.checkDeviceId = true;
33634
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33672
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33635
33673
  validateParams(this.payload, [
33636
33674
  { name: 'path', required: true },
33637
33675
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33681,7 +33719,7 @@ class AptosSignTransaction extends BaseMethod {
33681
33719
  class AptosSignMessage extends BaseMethod {
33682
33720
  init() {
33683
33721
  this.checkDeviceId = true;
33684
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33722
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33685
33723
  validateParams(this.payload, [
33686
33724
  { name: 'path', required: true },
33687
33725
  { name: 'payload', type: 'object', required: true },
@@ -33747,7 +33785,7 @@ class AlgoGetAddress extends BaseMethod {
33747
33785
  init() {
33748
33786
  var _a;
33749
33787
  this.checkDeviceId = true;
33750
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33788
+ this.allowDeviceMode = [...this.allowDeviceMode];
33751
33789
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33752
33790
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33753
33791
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33802,7 +33840,7 @@ class AlgoSignTransaction extends BaseMethod {
33802
33840
  }
33803
33841
  init() {
33804
33842
  this.checkDeviceId = true;
33805
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33843
+ this.allowDeviceMode = [...this.allowDeviceMode];
33806
33844
  validateParams(this.payload, [
33807
33845
  { name: 'path', required: true },
33808
33846
  { name: 'rawTx', type: 'hexString', required: true },
@@ -33841,7 +33879,7 @@ class CosmosGetAddress extends BaseMethod {
33841
33879
  init() {
33842
33880
  var _a;
33843
33881
  this.checkDeviceId = true;
33844
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
33882
+ this.allowDeviceMode = [...this.allowDeviceMode];
33845
33883
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33846
33884
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33847
33885
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33903,7 +33941,7 @@ class CosmosGetPublicKey extends BaseMethod {
33903
33941
  init() {
33904
33942
  var _a;
33905
33943
  this.checkDeviceId = true;
33906
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
33944
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
33907
33945
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
33908
33946
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
33909
33947
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -33964,7 +34002,7 @@ class CosmosSignTransaction extends BaseMethod {
33964
34002
  }
33965
34003
  init() {
33966
34004
  this.checkDeviceId = true;
33967
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
34005
+ this.allowDeviceMode = [...this.allowDeviceMode];
33968
34006
  validateParams(this.payload, [
33969
34007
  { name: 'path', required: true },
33970
34008
  { name: 'rawTx', type: 'hexString', required: true },
@@ -34007,7 +34045,7 @@ class XrpGetAddress$1 extends BaseMethod {
34007
34045
  init() {
34008
34046
  var _a;
34009
34047
  this.checkDeviceId = true;
34010
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34048
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34011
34049
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34012
34050
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34013
34051
  this.shouldConfirm = this.hasBundle
@@ -34088,7 +34126,7 @@ class XrpGetAddress extends BaseMethod {
34088
34126
  }
34089
34127
  init() {
34090
34128
  this.checkDeviceId = true;
34091
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34129
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34092
34130
  const { payload } = this;
34093
34131
  validateParams(payload, [
34094
34132
  { name: 'path', required: true },
@@ -34168,7 +34206,7 @@ class SuiGetAddress extends BaseMethod {
34168
34206
  init() {
34169
34207
  var _a, _b;
34170
34208
  this.checkDeviceId = true;
34171
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34209
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34172
34210
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34173
34211
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34174
34212
  this.shouldConfirm =
@@ -34260,7 +34298,7 @@ class SuiGetPublicKey extends BaseMethod {
34260
34298
  init() {
34261
34299
  var _a;
34262
34300
  this.checkDeviceId = true;
34263
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34301
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34264
34302
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34265
34303
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34266
34304
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -34308,7 +34346,7 @@ class SuiGetPublicKey extends BaseMethod {
34308
34346
  class SuiSignMessage extends BaseMethod {
34309
34347
  init() {
34310
34348
  this.checkDeviceId = true;
34311
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34349
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34312
34350
  validateParams(this.payload, [
34313
34351
  { name: 'path', required: true },
34314
34352
  { name: 'messageHex', type: 'hexString', required: true },
@@ -34361,7 +34399,7 @@ class SuiSignTransaction extends BaseMethod {
34361
34399
  }
34362
34400
  init() {
34363
34401
  this.checkDeviceId = true;
34364
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34402
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34365
34403
  validateParams(this.payload, [
34366
34404
  { name: 'path', required: true },
34367
34405
  { name: 'rawTx', type: 'hexString', required: true },
@@ -34504,7 +34542,7 @@ class CardanoGetAddress extends BaseMethod {
34504
34542
  init() {
34505
34543
  var _a, _b, _c;
34506
34544
  this.checkDeviceId = true;
34507
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34545
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34508
34546
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34509
34547
  this.isCheck = this.hasBundle
34510
34548
  ? !!((_b = this.payload) === null || _b === void 0 ? void 0 : _b.bundle.every((i) => !!i.isCheck))
@@ -34604,7 +34642,7 @@ class CardanoGetPublicKey extends BaseMethod {
34604
34642
  init() {
34605
34643
  var _a;
34606
34644
  this.checkDeviceId = true;
34607
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
34645
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34608
34646
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
34609
34647
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
34610
34648
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35159,7 +35197,7 @@ class CardanoSignTransaction extends BaseMethod {
35159
35197
  init() {
35160
35198
  var _a;
35161
35199
  this.checkDeviceId = true;
35162
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35200
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35163
35201
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35164
35202
  const { payload } = this;
35165
35203
  if (payload.auxiliaryData && payload.auxiliaryData.governanceRegistrationParameters) {
@@ -35394,7 +35432,7 @@ class CardanoSignTransaction extends BaseMethod {
35394
35432
  class CardanoSignMessage extends BaseMethod {
35395
35433
  init() {
35396
35434
  this.checkDeviceId = true;
35397
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35435
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35398
35436
  const { payload } = this;
35399
35437
  validateParams(payload, [
35400
35438
  { name: 'path', type: 'string', required: true },
@@ -35435,7 +35473,7 @@ class FilecoinGetAddress extends BaseMethod {
35435
35473
  init() {
35436
35474
  var _a;
35437
35475
  this.checkDeviceId = true;
35438
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35476
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35439
35477
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35440
35478
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35441
35479
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35495,7 +35533,7 @@ class FilecoinSignTransaction extends BaseMethod {
35495
35533
  }
35496
35534
  init() {
35497
35535
  this.checkDeviceId = true;
35498
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35536
+ this.allowDeviceMode = [...this.allowDeviceMode];
35499
35537
  validateParams(this.payload, [
35500
35538
  { name: 'path', required: true },
35501
35539
  { name: 'rawTx', type: 'hexString', required: true },
@@ -35588,7 +35626,7 @@ class PolkadotGetAddress extends BaseMethod {
35588
35626
  init() {
35589
35627
  var _a;
35590
35628
  this.checkDeviceId = true;
35591
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35629
+ this.allowDeviceMode = [...this.allowDeviceMode];
35592
35630
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35593
35631
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35594
35632
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -35650,7 +35688,7 @@ class PolkadotSignTransaction extends BaseMethod {
35650
35688
  }
35651
35689
  init() {
35652
35690
  this.checkDeviceId = true;
35653
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
35691
+ this.allowDeviceMode = [...this.allowDeviceMode];
35654
35692
  validateParams(this.payload, [
35655
35693
  { name: 'path', required: true },
35656
35694
  { name: 'network', required: true },
@@ -35687,7 +35725,7 @@ class KaspaGetAddress extends BaseMethod {
35687
35725
  init() {
35688
35726
  var _a;
35689
35727
  this.checkDeviceId = true;
35690
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
35728
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
35691
35729
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
35692
35730
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
35693
35731
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36070,7 +36108,7 @@ class KaspaSignTransaction extends BaseMethod {
36070
36108
  init() {
36071
36109
  var _a, _b, _c, _d, _e;
36072
36110
  this.checkDeviceId = true;
36073
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36111
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36074
36112
  const payload = this.payload;
36075
36113
  validateParams(payload, [
36076
36114
  { name: 'version', type: 'number' },
@@ -36181,7 +36219,7 @@ class NexaGetAddress extends BaseMethod {
36181
36219
  init() {
36182
36220
  var _a;
36183
36221
  this.checkDeviceId = true;
36184
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36222
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36185
36223
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36186
36224
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36187
36225
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36315,7 +36353,7 @@ class NostrGetPublicKey extends BaseMethod {
36315
36353
  }
36316
36354
  init() {
36317
36355
  this.checkDeviceId = true;
36318
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36356
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36319
36357
  this.hasBundle = Object.prototype.hasOwnProperty.call(this.payload, 'bundle');
36320
36358
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36321
36359
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36393,7 +36431,7 @@ class NostrSignEvent extends BaseMethod {
36393
36431
  }
36394
36432
  init() {
36395
36433
  this.checkDeviceId = true;
36396
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36434
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36397
36435
  const { payload } = this;
36398
36436
  if (!validateEvent(payload.event)) {
36399
36437
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Can't serialize event with wrong or missing properties`);
@@ -36442,7 +36480,7 @@ class NostrEncryptMessage extends BaseMethod {
36442
36480
  init() {
36443
36481
  var _a;
36444
36482
  this.checkDeviceId = true;
36445
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36483
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36446
36484
  const { payload } = this;
36447
36485
  validateParams(payload, [
36448
36486
  { name: 'path', required: true },
@@ -36489,7 +36527,7 @@ class NostrDecryptMessage extends BaseMethod {
36489
36527
  init() {
36490
36528
  var _a;
36491
36529
  this.checkDeviceId = true;
36492
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36530
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36493
36531
  const { payload } = this;
36494
36532
  validateParams(payload, [
36495
36533
  { name: 'path', required: true },
@@ -36535,7 +36573,7 @@ class NostrSignSchnorr extends BaseMethod {
36535
36573
  }
36536
36574
  init() {
36537
36575
  this.checkDeviceId = true;
36538
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36576
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36539
36577
  const { payload } = this;
36540
36578
  validateParams(payload, [
36541
36579
  { name: 'path', required: true },
@@ -36576,7 +36614,7 @@ class LnurlAuth1 extends BaseMethod {
36576
36614
  }
36577
36615
  init() {
36578
36616
  this.checkDeviceId = true;
36579
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36617
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36580
36618
  const { payload } = this;
36581
36619
  validateParams(payload, [
36582
36620
  { name: 'domain', type: 'string', required: true },
@@ -36614,7 +36652,7 @@ class NervosGetAddress extends BaseMethod {
36614
36652
  init() {
36615
36653
  var _a;
36616
36654
  this.checkDeviceId = true;
36617
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36655
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36618
36656
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36619
36657
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36620
36658
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36698,7 +36736,7 @@ class NervosSignTransaction extends BaseMethod {
36698
36736
  }
36699
36737
  init() {
36700
36738
  this.checkDeviceId = true;
36701
- this.notAllowDeviceMode = [...this.notAllowDeviceMode];
36739
+ this.allowDeviceMode = [...this.allowDeviceMode];
36702
36740
  validateParams(this.payload, [
36703
36741
  { name: 'path', required: true },
36704
36742
  { name: 'rawTx', type: 'hexString', required: true },
@@ -36750,7 +36788,7 @@ class DnxGetAddress extends BaseMethod {
36750
36788
  init() {
36751
36789
  var _a;
36752
36790
  this.checkDeviceId = true;
36753
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36791
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36754
36792
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36755
36793
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36756
36794
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -36805,7 +36843,7 @@ class DnxSignTransaction extends BaseMethod {
36805
36843
  }
36806
36844
  init() {
36807
36845
  this.checkDeviceId = true;
36808
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36846
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36809
36847
  const { payload } = this;
36810
36848
  const addressN = validatePath(payload.path, 3);
36811
36849
  validateParams(payload, [
@@ -36899,7 +36937,7 @@ class TonGetAddress extends BaseMethod {
36899
36937
  var _a;
36900
36938
  this.strictCheckDeviceSupport = true;
36901
36939
  this.checkDeviceId = true;
36902
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
36940
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36903
36941
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
36904
36942
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
36905
36943
  this.shouldConfirm = this.hasBundle
@@ -36986,7 +37024,7 @@ class TonSignMessage extends BaseMethod {
36986
37024
  init() {
36987
37025
  this.strictCheckDeviceSupport = true;
36988
37026
  this.checkDeviceId = true;
36989
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37027
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
36990
37028
  validateParams(this.payload, [
36991
37029
  { name: 'path', required: true },
36992
37030
  { name: 'destination', type: 'string' },
@@ -37130,7 +37168,7 @@ class TonSignProof extends BaseMethod {
37130
37168
  init() {
37131
37169
  this.strictCheckDeviceSupport = true;
37132
37170
  this.checkDeviceId = true;
37133
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37171
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37134
37172
  validateParams(this.payload, [
37135
37173
  { name: 'path', required: true },
37136
37174
  { name: 'appdomain', type: 'string' },
@@ -37182,7 +37220,7 @@ class ScdoGetAddress extends BaseMethod {
37182
37220
  init() {
37183
37221
  var _a;
37184
37222
  this.checkDeviceId = true;
37185
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37223
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37186
37224
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37187
37225
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37188
37226
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37250,7 +37288,7 @@ class ScdoSignTransaction extends BaseMethod {
37250
37288
  }
37251
37289
  init() {
37252
37290
  this.checkDeviceId = true;
37253
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37291
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37254
37292
  validateParams(this.payload, [
37255
37293
  { name: 'path', required: true },
37256
37294
  { name: 'nonce', required: true },
@@ -37303,7 +37341,7 @@ class ScdoSignTransaction extends BaseMethod {
37303
37341
  class ScdoSignMessage extends BaseMethod {
37304
37342
  init() {
37305
37343
  this.checkDeviceId = true;
37306
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37344
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37307
37345
  validateParams(this.payload, [
37308
37346
  { name: 'path', required: true },
37309
37347
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37338,7 +37376,7 @@ class AlephiumGetAddress extends BaseMethod {
37338
37376
  init() {
37339
37377
  var _a;
37340
37378
  this.checkDeviceId = true;
37341
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37379
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37342
37380
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37343
37381
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37344
37382
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37425,7 +37463,7 @@ class AlephiumSignTransaction extends BaseMethod {
37425
37463
  }
37426
37464
  init() {
37427
37465
  this.checkDeviceId = true;
37428
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37466
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37429
37467
  validateParams(this.payload, [
37430
37468
  { name: 'path', required: true },
37431
37469
  { name: 'rawTx', required: true, type: 'hexString' },
@@ -37466,7 +37504,7 @@ class AlephiumSignTransaction extends BaseMethod {
37466
37504
  class AlephiumSignMessage extends BaseMethod {
37467
37505
  init() {
37468
37506
  this.checkDeviceId = true;
37469
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37507
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37470
37508
  validateParams(this.payload, [
37471
37509
  { name: 'path', required: true },
37472
37510
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37533,7 +37571,7 @@ class BenfenGetAddress extends BaseMethod {
37533
37571
  init() {
37534
37572
  var _a, _b;
37535
37573
  this.checkDeviceId = true;
37536
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37574
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37537
37575
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37538
37576
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37539
37577
  this.shouldConfirm =
@@ -37624,7 +37662,7 @@ class BenfenGetPublicKey extends BaseMethod {
37624
37662
  init() {
37625
37663
  var _a;
37626
37664
  this.checkDeviceId = true;
37627
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37665
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37628
37666
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37629
37667
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
37630
37668
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -37671,7 +37709,7 @@ class BenfenGetPublicKey extends BaseMethod {
37671
37709
  class BenfenSignMessage extends BaseMethod {
37672
37710
  init() {
37673
37711
  this.checkDeviceId = true;
37674
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37712
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37675
37713
  validateParams(this.payload, [
37676
37714
  { name: 'path', required: true },
37677
37715
  { name: 'messageHex', type: 'hexString', required: true },
@@ -37724,7 +37762,7 @@ class BenfenSignTransaction extends BaseMethod {
37724
37762
  }
37725
37763
  init() {
37726
37764
  this.checkDeviceId = true;
37727
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37765
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37728
37766
  validateParams(this.payload, [
37729
37767
  { name: 'path', required: true },
37730
37768
  { name: 'rawTx', type: 'hexString', required: true },
@@ -37772,7 +37810,7 @@ class NeoGetAddress extends BaseMethod {
37772
37810
  init() {
37773
37811
  var _a;
37774
37812
  this.checkDeviceId = true;
37775
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37813
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37776
37814
  this.strictCheckDeviceSupport = true;
37777
37815
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
37778
37816
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -37831,7 +37869,7 @@ class NeoGetAddress extends BaseMethod {
37831
37869
  class NeoSignTransaction extends BaseMethod {
37832
37870
  init() {
37833
37871
  this.checkDeviceId = true;
37834
- this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];
37872
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
37835
37873
  this.strictCheckDeviceSupport = true;
37836
37874
  validateParams(this.payload, [
37837
37875
  { name: 'path', required: true },
@@ -38382,7 +38420,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
38382
38420
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportMethod);
38383
38421
  }
38384
38422
  }
38385
- const unexpectedMode = device.hasUnexpectedMode(method.notAllowDeviceMode, method.requireDeviceMode);
38423
+ const unexpectedMode = device.hasUnexpectedMode(method.allowDeviceMode, method.requireDeviceMode);
38386
38424
  if (unexpectedMode) {
38387
38425
  if (unexpectedMode === UI_REQUEST.NOT_IN_BOOTLOADER) {
38388
38426
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RequiredButInBootloaderMode));
@@ -38787,11 +38825,11 @@ const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, vo
38787
38825
  });
38788
38826
  const onDeviceButtonHandler = (...[device, request]) => {
38789
38827
  postMessage(createDeviceMessage(DEVICE.BUTTON, Object.assign(Object.assign({}, request), { device: device.toMessageObject() })));
38790
- if (request.code === 'ButtonRequest_PinEntry') {
38791
- Log.log('request Confirm Input PIN');
38828
+ if (request.code === 'ButtonRequest_PinEntry' || request.code === 'ButtonRequest_AttachPin') {
38829
+ Log.log('request Confirm Input PIN or Attach PIN');
38792
38830
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PIN, {
38793
38831
  device: device.toMessageObject(),
38794
- type: 'ButtonRequest_PinEntry',
38832
+ type: request.code,
38795
38833
  }));
38796
38834
  }
38797
38835
  else {
@@ -38802,22 +38840,24 @@ const onDeviceButtonHandler = (...[device, request]) => {
38802
38840
  const onDeviceFeaturesHandler = (...[_, features]) => {
38803
38841
  postMessage(createDeviceMessage(DEVICE.FEATURES, Object.assign({}, features)));
38804
38842
  };
38805
- const onDevicePassphraseHandler = (...[device, callback]) => __awaiter(void 0, void 0, void 0, function* () {
38843
+ const onDevicePassphraseHandler = (...[device, requestPayload, callback]) => __awaiter(void 0, void 0, void 0, function* () {
38806
38844
  Log.debug('onDevicePassphraseHandler');
38807
38845
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PASSPHRASE, device);
38808
38846
  postMessage(createUiMessage(UI_REQUEST.REQUEST_PASSPHRASE, {
38809
38847
  device: device.toMessageObject(),
38810
38848
  passphraseState: device.passphraseState,
38849
+ existsAttachPinUser: requestPayload.existsAttachPinUser,
38811
38850
  }));
38812
38851
  const uiResp = yield uiPromise.promise;
38813
- const { value, passphraseOnDevice, save } = uiResp.payload;
38852
+ const { value, passphraseOnDevice, save, attachPinOnDevice } = uiResp.payload;
38814
38853
  callback({
38815
38854
  passphrase: value.normalize('NFKD'),
38816
38855
  passphraseOnDevice,
38856
+ attachPinOnDevice,
38817
38857
  cache: save,
38818
38858
  });
38819
38859
  });
38820
- const onEmptyPassphraseHandler = (...[_, callback]) => {
38860
+ const onEmptyPassphraseHandler = (...[_, , callback]) => {
38821
38861
  Log.debug('onEmptyPassphraseHandler');
38822
38862
  callback({ passphrase: '' });
38823
38863
  };