@trezor/connect 9.6.0 → 9.6.1-beta.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 (81) hide show
  1. package/CHANGELOG.md +36 -7
  2. package/README.md +1 -1
  3. package/lib/api/blockchainEstimateFee.js +1 -0
  4. package/lib/api/discoverAccounts.js +10 -2
  5. package/lib/api/ethereum/api/ethereumSignMessage.js +1 -1
  6. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +1 -1
  7. package/lib/api/firmware/getBinary.js +2 -2
  8. package/lib/api/getAccountInfo.d.ts +1 -1
  9. package/lib/api/getCoinInfo.d.ts +3 -3
  10. package/lib/api/getNonce.d.ts +9 -0
  11. package/lib/api/getNonce.js +15 -0
  12. package/lib/api/index.d.ts +1 -0
  13. package/lib/api/index.js +4 -2
  14. package/lib/api/nem/nemSignTx.d.ts +1 -1
  15. package/lib/api/resetDevice.d.ts +2 -3
  16. package/lib/api/resetDevice.js +47 -49
  17. package/lib/api/signMessage.js +1 -1
  18. package/lib/backend/Blockchain.d.ts +1 -0
  19. package/lib/backend/fees/BitcoinFeeLevels.d.ts +0 -1
  20. package/lib/backend/fees/EthereumFeeLevels.d.ts +0 -1
  21. package/lib/backend/fees/EthereumFeeLevels.js +8 -4
  22. package/lib/backend/fees/MiscFeeLevels.d.ts +0 -1
  23. package/lib/constants/errors.d.ts +1 -0
  24. package/lib/constants/errors.js +1 -0
  25. package/lib/core/AbstractMethod.d.ts +2 -2
  26. package/lib/core/AbstractMethod.js +0 -1
  27. package/lib/core/index.js +43 -53
  28. package/lib/core/onCallFirmwareUpdate.js +2 -2
  29. package/lib/data/coinInfo.d.ts +11 -11
  30. package/lib/data/coinInfo.js +1 -1
  31. package/lib/data/connectSettings.js +0 -3
  32. package/lib/data/defaultFeeLevels.d.ts +2 -1
  33. package/lib/data/defaultFeeLevels.js +18 -10
  34. package/lib/data/deviceAuthenticityConfig.js +4 -1
  35. package/lib/data/firmwareInfo.d.ts +1 -0
  36. package/lib/data/firmwareInfo.js +14 -1
  37. package/lib/data/version.d.ts +1 -1
  38. package/lib/data/version.js +1 -1
  39. package/lib/device/Device.d.ts +19 -20
  40. package/lib/device/Device.js +66 -112
  41. package/lib/device/DeviceCurrentSession.d.ts +441 -4027
  42. package/lib/device/DeviceCurrentSession.js +75 -44
  43. package/lib/device/DeviceList.d.ts +3 -8
  44. package/lib/device/DeviceList.js +21 -77
  45. package/lib/device/TransportManager.d.ts +2 -6
  46. package/lib/device/TransportManager.js +11 -7
  47. package/lib/device/checkFirmwareRevision.js +2 -2
  48. package/lib/device/workflow/index.d.ts +2 -0
  49. package/lib/device/workflow/index.js +6 -0
  50. package/lib/device/workflow/validateState.d.ts +3 -0
  51. package/lib/device/workflow/validateState.js +90 -0
  52. package/lib/events/device.d.ts +19 -1
  53. package/lib/events/device.js +2 -0
  54. package/lib/events/index.d.ts +3 -0
  55. package/lib/events/ui-request.d.ts +17 -3
  56. package/lib/events/ui-request.js +2 -0
  57. package/lib/events/ui-response.d.ts +11 -1
  58. package/lib/events/ui-response.js +1 -0
  59. package/lib/factory.js +1 -0
  60. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  61. package/lib/types/api/applySettings.d.ts +1 -0
  62. package/lib/types/api/discoverAccounts.d.ts +17 -4
  63. package/lib/types/api/discoverAccounts.js +2 -0
  64. package/lib/types/api/getNonce.d.ts +4 -0
  65. package/lib/types/api/getNonce.js +3 -0
  66. package/lib/types/api/index.d.ts +2 -0
  67. package/lib/types/coinInfo.d.ts +6 -6
  68. package/lib/types/coinInfo.js +2 -0
  69. package/lib/types/fees.d.ts +1 -1
  70. package/lib/types/fees.js +1 -1
  71. package/lib/types/settings.d.ts +0 -1
  72. package/lib/types/workflow.d.ts +8 -0
  73. package/lib/types/workflow.js +3 -0
  74. package/lib/utils/formatUtils.d.ts +1 -0
  75. package/lib/utils/formatUtils.js +9 -1
  76. package/lib/utils/uiPromiseManager.d.ts +2 -0
  77. package/package.json +16 -16
  78. package/lib/data/downloadReleasesMetadata.d.ts +0 -7
  79. package/lib/data/downloadReleasesMetadata.js +0 -18
  80. package/lib/data/models.d.ts +0 -8
  81. package/lib/data/models.js +0 -49
package/lib/core/index.js CHANGED
@@ -15,6 +15,7 @@ const analyticsInfo_1 = require("../data/analyticsInfo");
15
15
  const connectSettings_1 = require("../data/connectSettings");
16
16
  const DeviceList_1 = require("../device/DeviceList");
17
17
  const StateStorage_1 = require("../device/StateStorage");
18
+ const workflows = tslib_1.__importStar(require("../device/workflow"));
18
19
  const events_2 = require("../events");
19
20
  const debug_1 = require("../utils/debug");
20
21
  const interactionTimeout_1 = require("../utils/interactionTimeout");
@@ -111,23 +112,6 @@ const initDevice = async (context, methodCallDevice) => {
111
112
  }
112
113
  return device;
113
114
  };
114
- const MAX_PIN_TRIES = 3;
115
- const getInvalidDeviceState = async ({ sendCoreMessage }, device, preauthorized) => {
116
- for (let i = 0; i < MAX_PIN_TRIES - 1; ++i) {
117
- try {
118
- return await device.validateState(preauthorized);
119
- }
120
- catch (error) {
121
- if (error.message.includes('PIN invalid')) {
122
- sendCoreMessage((0, events_2.createUiMessage)(events_2.UI.INVALID_PIN, { device: device.toMessageObject() }));
123
- }
124
- else {
125
- throw error;
126
- }
127
- }
128
- }
129
- return device.validateState(preauthorized);
130
- };
131
115
  const inner = async (context, method, device) => {
132
116
  const { uiPromises, sendCoreMessage } = context;
133
117
  const trustedHost = DataManager_1.DataManager.getSettings('trustedHost');
@@ -215,40 +199,12 @@ const inner = async (context, method, device) => {
215
199
  }
216
200
  }
217
201
  }
218
- const isDeviceUnlocked = device.features.unlocked;
219
- if (method.useDeviceState) {
220
- try {
221
- let invalidDeviceState = await getInvalidDeviceState(context, device, method.preauthorized);
222
- if (isUsingPopup) {
223
- while (invalidDeviceState) {
224
- const uiPromise = uiPromises.create(events_2.UI.INVALID_PASSPHRASE_ACTION, device);
225
- sendCoreMessage((0, events_2.createUiMessage)(events_2.UI.INVALID_PASSPHRASE, {
226
- device: device.toMessageObject(),
227
- }));
228
- const uiResp = await uiPromise.promise;
229
- if (uiResp.payload) {
230
- device.setState({ sessionId: undefined });
231
- await device.initialize(method.useCardanoDerivation);
232
- invalidDeviceState = await getInvalidDeviceState(context, device, method.preauthorized);
233
- }
234
- else {
235
- device.setState({ staticSessionId: invalidDeviceState });
236
- break;
237
- }
238
- }
239
- }
240
- else if (invalidDeviceState) {
241
- throw constants_1.ERRORS.TypedError('Device_InvalidState');
242
- }
243
- }
244
- catch (error) {
245
- device.setState({ sessionId: undefined });
246
- return Promise.reject(error);
247
- }
248
- }
249
- if (!isDeviceUnlocked && device.features.unlocked) {
250
- sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CHANGED, device.toMessageObject()));
251
- }
202
+ const workflowCtx = {
203
+ device,
204
+ method,
205
+ signal: context.signal,
206
+ };
207
+ await workflows.validateState(workflowCtx);
252
208
  if (method.useUi) {
253
209
  await waitForPopup(context);
254
210
  }
@@ -533,6 +489,37 @@ const onDevicePassphraseHandler = (device, context) => async ({ callback }) => {
533
489
  const onEmptyPassphraseHandler = () => ({ callback }) => {
534
490
  callback({ success: true, payload: { value: '' } });
535
491
  };
492
+ const onThpPairingHandler = (device, context) => async ({ callback, payload }) => {
493
+ const { uiPromises, sendCoreMessage } = context;
494
+ await waitForPopup(context);
495
+ const uiPromise = uiPromises.create(events_2.UI.RECEIVE_THP_PAIRING_TAG, device);
496
+ sendCoreMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_THP_PAIRING, {
497
+ device: device.toMessageObject(),
498
+ ...payload,
499
+ }));
500
+ try {
501
+ const uiResp = await uiPromise.promise;
502
+ if (uiResp.payload == null) {
503
+ callback({
504
+ success: false,
505
+ error: new Error(`${events_2.UI.RECEIVE_THP_PAIRING_TAG} missing payload`),
506
+ });
507
+ }
508
+ else {
509
+ callback({ success: true, payload: uiResp.payload });
510
+ }
511
+ }
512
+ catch (error) {
513
+ callback({ success: false, error });
514
+ }
515
+ };
516
+ const onThpCredentialsChangedHandler = (device, context) => (payload) => {
517
+ const { sendCoreMessage } = context;
518
+ sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.THP_CREDENTIALS_CHANGED, {
519
+ device: device.toMessageObject(),
520
+ ...payload,
521
+ }));
522
+ };
536
523
  const registerDeviceEvents = (context, method) => (device) => {
537
524
  device.removeAllListeners();
538
525
  device.on(events_2.DEVICE.BUTTON, onDeviceButtonHandler(device, context, method));
@@ -547,6 +534,8 @@ const registerDeviceEvents = (context, method) => (device) => {
547
534
  device.on(events_2.DEVICE.FIRMWARE_VERSION_CHANGED, payload => {
548
535
  context.sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.FIRMWARE_VERSION_CHANGED, payload));
549
536
  });
537
+ device.on(events_2.DEVICE.THP_PAIRING, onThpPairingHandler(device, context));
538
+ device.on(events_2.DEVICE.THP_CREDENTIALS_CHANGED, onThpCredentialsChangedHandler(device, context));
550
539
  };
551
540
  const onPopupClosed = (context, customErrorMessage) => {
552
541
  const { uiPromises, popupPromise, deviceList, callMethods, resetWaitForFirstMethod, sendCoreMessage, } = context;
@@ -656,6 +645,7 @@ class Core extends events_1.default {
656
645
  }
657
646
  getCoreContext() {
658
647
  return {
648
+ signal: this.abortController.signal,
659
649
  uiPromises: this.uiPromises,
660
650
  popupPromise: this.popupPromise,
661
651
  interactionTimeout: this.interactionTimeout,
@@ -709,6 +699,7 @@ class Core extends events_1.default {
709
699
  case events_2.UI.RECEIVE_PIN:
710
700
  case events_2.UI.RECEIVE_PASSPHRASE:
711
701
  case events_2.UI.INVALID_PASSPHRASE_ACTION:
702
+ case events_2.UI.RECEIVE_THP_PAIRING_TAG:
712
703
  case events_2.UI.RECEIVE_ACCOUNT:
713
704
  case events_2.UI.RECEIVE_FEE:
714
705
  case events_2.UI.RECEIVE_WORD:
@@ -785,7 +776,7 @@ class Core extends events_1.default {
785
776
  if (localFirmwares) {
786
777
  DataManager_1.DataManager.setLocalFirmwares(localFirmwares);
787
778
  }
788
- const { debug, priority, _sessionsBackgroundUrl, manifest } = DataManager_1.DataManager.getSettings();
779
+ const { debug, priority, manifest } = DataManager_1.DataManager.getSettings();
789
780
  const messages = DataManager_1.DataManager.getProtobufMessages();
790
781
  (0, debug_1.enableLog)(debug);
791
782
  this._interactionTimeout = new interactionTimeout_1.InteractionTimeout(settings.popup ? settings.interactionTimeout : 0);
@@ -793,7 +784,6 @@ class Core extends events_1.default {
793
784
  debug,
794
785
  messages,
795
786
  priority,
796
- _sessionsBackgroundUrl,
797
787
  manifest,
798
788
  });
799
789
  initDeviceList(this.getCoreContext());
@@ -211,13 +211,13 @@ const onCallFirmwareUpdate = async ({ params, context, }) => {
211
211
  await device.getCommands().typedCall('RebootToBootloader', 'Success', rebootParams);
212
212
  }
213
213
  else {
214
- let rebootResponse = await device.getCommands().typedCall('RebootToBootloader', ['TranslationDataRequest', 'Success'], { ...rebootParams, language_data_length: languageBlob?.byteLength });
214
+ let rebootResponse = await device.getCommands().typedCall('RebootToBootloader', ['DataChunkRequest', 'Success'], { ...rebootParams, language_data_length: languageBlob?.byteLength });
215
215
  log.debug('onCallFirmwareUpdate', 'RebootToBootloader response', rebootResponse.message);
216
216
  while (languageBlob && rebootResponse.type !== 'Success') {
217
217
  const start = rebootResponse.message.data_offset;
218
218
  const end = rebootResponse.message.data_offset + rebootResponse.message.data_length;
219
219
  const chunk = languageBlob.slice(start, end);
220
- rebootResponse = await device.getCommands().typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], { data_chunk: Buffer.from(chunk).toString('hex') });
220
+ rebootResponse = await device.getCommands().typedCall('DataChunkAck', ['DataChunkRequest', 'Success'], { data_chunk: Buffer.from(chunk).toString('hex') });
221
221
  }
222
222
  }
223
223
  log.info('onCallFirmwareUpdate', 'waiting for disconnected event after rebootToBootloader...');
@@ -8,6 +8,7 @@ export declare const getBitcoinNetwork: (pathOrName: DerivationPath) => ({
8
8
  blockTime: number;
9
9
  minFee: number;
10
10
  maxFee: number;
11
+ minPriorityFee: number;
11
12
  name: string;
12
13
  shortcut: string;
13
14
  slip44: number;
@@ -28,7 +29,6 @@ export declare const getBitcoinNetwork: (pathOrName: DerivationPath) => ({
28
29
  baseFeePerGas?: string | undefined;
29
30
  maxFeePerGas?: string | undefined;
30
31
  maxPriorityFeePerGas?: string | undefined;
31
- maxWaitTimeEstimate?: number | undefined;
32
32
  label: "normal" | "custom" | "high" | "economy" | "low";
33
33
  blocks: number;
34
34
  feePerUnit: string;
@@ -72,6 +72,7 @@ export declare const getEthereumNetwork: (pathOrNetworkSymbol: DerivationPath) =
72
72
  blockTime: number;
73
73
  minFee: number;
74
74
  maxFee: number;
75
+ minPriorityFee: number;
75
76
  name: string;
76
77
  shortcut: string;
77
78
  slip44: number;
@@ -92,7 +93,6 @@ export declare const getEthereumNetwork: (pathOrNetworkSymbol: DerivationPath) =
92
93
  baseFeePerGas?: string | undefined;
93
94
  maxFeePerGas?: string | undefined;
94
95
  maxPriorityFeePerGas?: string | undefined;
95
- maxWaitTimeEstimate?: number | undefined;
96
96
  label: "normal" | "custom" | "high" | "economy" | "low";
97
97
  blocks: number;
98
98
  feePerUnit: string;
@@ -111,6 +111,7 @@ export declare const getMiscNetwork: (pathOrName: DerivationPath) => ({
111
111
  blockTime: number;
112
112
  minFee: number;
113
113
  maxFee: number;
114
+ minPriorityFee: number;
114
115
  name: string;
115
116
  shortcut: string;
116
117
  slip44: number;
@@ -131,7 +132,6 @@ export declare const getMiscNetwork: (pathOrName: DerivationPath) => ({
131
132
  baseFeePerGas?: string | undefined;
132
133
  maxFeePerGas?: string | undefined;
133
134
  maxPriorityFeePerGas?: string | undefined;
134
- maxWaitTimeEstimate?: number | undefined;
135
135
  label: "normal" | "custom" | "high" | "economy" | "low";
136
136
  blocks: number;
137
137
  feePerUnit: string;
@@ -174,6 +174,7 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
174
174
  blockTime: number;
175
175
  minFee: number;
176
176
  maxFee: number;
177
+ minPriorityFee: number;
177
178
  name: string;
178
179
  shortcut: string;
179
180
  slip44: number;
@@ -194,7 +195,6 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
194
195
  baseFeePerGas?: string | undefined;
195
196
  maxFeePerGas?: string | undefined;
196
197
  maxPriorityFeePerGas?: string | undefined;
197
- maxWaitTimeEstimate?: number | undefined;
198
198
  label: "normal" | "custom" | "high" | "economy" | "low";
199
199
  blocks: number;
200
200
  feePerUnit: string;
@@ -238,6 +238,7 @@ export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
238
238
  blockTime: number;
239
239
  minFee: number;
240
240
  maxFee: number;
241
+ minPriorityFee: number;
241
242
  name: string;
242
243
  shortcut: string;
243
244
  slip44: number;
@@ -258,7 +259,6 @@ export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
258
259
  baseFeePerGas?: string | undefined;
259
260
  maxFeePerGas?: string | undefined;
260
261
  maxPriorityFeePerGas?: string | undefined;
261
- maxWaitTimeEstimate?: number | undefined;
262
262
  label: "normal" | "custom" | "high" | "economy" | "low";
263
263
  blocks: number;
264
264
  feePerUnit: string;
@@ -302,6 +302,7 @@ export declare const getCoinInfo: (currency: string) => ({
302
302
  blockTime: number;
303
303
  minFee: number;
304
304
  maxFee: number;
305
+ minPriorityFee: number;
305
306
  name: string;
306
307
  shortcut: string;
307
308
  slip44: number;
@@ -322,7 +323,6 @@ export declare const getCoinInfo: (currency: string) => ({
322
323
  baseFeePerGas?: string | undefined;
323
324
  maxFeePerGas?: string | undefined;
324
325
  maxPriorityFeePerGas?: string | undefined;
325
- maxWaitTimeEstimate?: number | undefined;
326
326
  label: "normal" | "custom" | "high" | "economy" | "low";
327
327
  blocks: number;
328
328
  feePerUnit: string;
@@ -365,6 +365,7 @@ export declare const getCoinInfo: (currency: string) => ({
365
365
  blockTime: number;
366
366
  minFee: number;
367
367
  maxFee: number;
368
+ minPriorityFee: number;
368
369
  name: string;
369
370
  shortcut: string;
370
371
  slip44: number;
@@ -385,7 +386,6 @@ export declare const getCoinInfo: (currency: string) => ({
385
386
  baseFeePerGas?: string | undefined;
386
387
  maxFeePerGas?: string | undefined;
387
388
  maxPriorityFeePerGas?: string | undefined;
388
- maxWaitTimeEstimate?: number | undefined;
389
389
  label: "normal" | "custom" | "high" | "economy" | "low";
390
390
  blocks: number;
391
391
  feePerUnit: string;
@@ -403,6 +403,7 @@ export declare const getCoinInfo: (currency: string) => ({
403
403
  blockTime: number;
404
404
  minFee: number;
405
405
  maxFee: number;
406
+ minPriorityFee: number;
406
407
  name: string;
407
408
  shortcut: string;
408
409
  slip44: number;
@@ -423,7 +424,6 @@ export declare const getCoinInfo: (currency: string) => ({
423
424
  baseFeePerGas?: string | undefined;
424
425
  maxFeePerGas?: string | undefined;
425
426
  maxPriorityFeePerGas?: string | undefined;
426
- maxWaitTimeEstimate?: number | undefined;
427
427
  label: "normal" | "custom" | "high" | "economy" | "low";
428
428
  blocks: number;
429
429
  feePerUnit: string;
@@ -451,6 +451,7 @@ export declare const getAllNetworks: () => (({
451
451
  blockTime: number;
452
452
  minFee: number;
453
453
  maxFee: number;
454
+ minPriorityFee: number;
454
455
  name: string;
455
456
  shortcut: string;
456
457
  slip44: number;
@@ -471,7 +472,6 @@ export declare const getAllNetworks: () => (({
471
472
  baseFeePerGas?: string | undefined;
472
473
  maxFeePerGas?: string | undefined;
473
474
  maxPriorityFeePerGas?: string | undefined;
474
- maxWaitTimeEstimate?: number | undefined;
475
475
  label: "normal" | "custom" | "high" | "economy" | "low";
476
476
  blocks: number;
477
477
  feePerUnit: string;
@@ -514,6 +514,7 @@ export declare const getAllNetworks: () => (({
514
514
  blockTime: number;
515
515
  minFee: number;
516
516
  maxFee: number;
517
+ minPriorityFee: number;
517
518
  name: string;
518
519
  shortcut: string;
519
520
  slip44: number;
@@ -534,7 +535,6 @@ export declare const getAllNetworks: () => (({
534
535
  baseFeePerGas?: string | undefined;
535
536
  maxFeePerGas?: string | undefined;
536
537
  maxPriorityFeePerGas?: string | undefined;
537
- maxWaitTimeEstimate?: number | undefined;
538
538
  label: "normal" | "custom" | "high" | "economy" | "low";
539
539
  blocks: number;
540
540
  feePerUnit: string;
@@ -552,6 +552,7 @@ export declare const getAllNetworks: () => (({
552
552
  blockTime: number;
553
553
  minFee: number;
554
554
  maxFee: number;
555
+ minPriorityFee: number;
555
556
  name: string;
556
557
  shortcut: string;
557
558
  slip44: number;
@@ -572,7 +573,6 @@ export declare const getAllNetworks: () => (({
572
573
  baseFeePerGas?: string | undefined;
573
574
  maxFeePerGas?: string | undefined;
574
575
  maxPriorityFeePerGas?: string | undefined;
575
- maxWaitTimeEstimate?: number | undefined;
576
576
  label: "normal" | "custom" | "high" | "economy" | "low";
577
577
  blocks: number;
578
578
  feePerUnit: string;
@@ -187,7 +187,7 @@ const parseEthereumNetworksJson = (json) => {
187
187
  const network = json[key];
188
188
  ethereumNetworks.push({
189
189
  ...exports.ethereumNetworkInfoBase,
190
- ...(0, defaultFeeLevels_1.getEthereumFeeLevels)(network.chain),
190
+ ...(0, defaultFeeLevels_1.getEthereumFeeLevels)(network),
191
191
  blockchainLink: network.blockchain_link,
192
192
  chainId: network.chain_id,
193
193
  label: network.label,
@@ -137,9 +137,6 @@ const parseConnectSettings = (input = {}) => {
137
137
  if (typeof input._extendWebextensionLifetime === 'boolean') {
138
138
  settings._extendWebextensionLifetime = input._extendWebextensionLifetime;
139
139
  }
140
- if (typeof input._sessionsBackgroundUrl === 'string' || input._sessionsBackgroundUrl === null) {
141
- settings._sessionsBackgroundUrl = input._sessionsBackgroundUrl;
142
- }
143
140
  if (typeof input.binFilesBaseUrl === 'string') {
144
141
  settings.binFilesBaseUrl = input.binFilesBaseUrl;
145
142
  }
@@ -6,12 +6,13 @@ interface CoinsJsonData {
6
6
  maxfee_kb: number;
7
7
  minfee_kb: number;
8
8
  dust_limit: number;
9
+ chain: string;
9
10
  }
10
11
  export type FeeInfoWithLevels = FeeInfo & {
11
12
  defaultFees: FeeLevel[];
12
13
  };
13
14
  export declare const getBitcoinFeeLevels: (coin: CoinsJsonData) => FeeInfoWithLevels;
14
- export declare const getEthereumFeeLevels: (chain: string) => FeeInfoWithLevels;
15
+ export declare const getEthereumFeeLevels: (network: CoinsJsonData) => FeeInfoWithLevels;
15
16
  export declare const getMiscFeeLevels: (data: CoinsJsonData) => FeeInfoWithLevels;
16
17
  export {};
17
18
  //# sourceMappingURL=defaultFeeLevels.d.ts.map
@@ -14,17 +14,18 @@ const getDefaultBlocksForFeeLevel = (shortcut, label) => BLOCKS_FOR_FEE_LEVEL[sh
14
14
  ? BLOCKS_FOR_FEE_LEVEL[shortcut][label]
15
15
  : -1;
16
16
  const EVM_GAS_PRICE_PER_CHAIN_IN_GWEI = {
17
- eth: { min: 1, max: 10000, defaultGas: 15 },
18
- pol: { min: 1, max: 10000000, defaultGas: 200 },
19
- bsc: { min: 1, max: 100000, defaultGas: 3 },
20
- base: { min: 0.0000001, max: 1000, defaultGas: 0.01 },
21
- arb: { min: 0.001, max: 1000, defaultGas: 0.01 },
22
- op: { min: 0.000000001, max: 1000, defaultGas: 0.01 },
17
+ eth: { min: 0.1, max: 10000, defaultGas: 10, minPriorityFee: 0 },
18
+ pol: { min: 0.1, max: 10000000, defaultGas: 200, minPriorityFee: 30 },
19
+ bsc: { min: 0.1, max: 100000, defaultGas: 1, minPriorityFee: 0 },
20
+ base: { min: 0.0000001, max: 1000, defaultGas: 0.01, minPriorityFee: 0 },
21
+ arb: { min: 0.001, max: 1000, defaultGas: 0.01, minPriorityFee: 0 },
22
+ op: { min: 0.000000001, max: 1000, defaultGas: 0.01, minPriorityFee: 0 },
23
23
  };
24
24
  const getEvmChainGweiGasPrice = (chain) => EVM_GAS_PRICE_PER_CHAIN_IN_GWEI[chain] ?? {
25
25
  min: 0.000000001,
26
26
  max: 10000,
27
- defaultGas: 5,
27
+ defaultGas: 1,
28
+ minPriorityFee: 0,
28
29
  };
29
30
  const getBitcoinFeeLevels = (coin) => {
30
31
  const defaultFees = coin.default_fee_b;
@@ -45,14 +46,15 @@ const getBitcoinFeeLevels = (coin) => {
45
46
  dustLimit: coin.dust_limit,
46
47
  maxFee: Math.round(coin.maxfee_kb / 1000),
47
48
  minFee: Math.round(coin.minfee_kb / 1000),
49
+ minPriorityFee: -1,
48
50
  defaultFees: levels,
49
51
  };
50
52
  };
51
53
  exports.getBitcoinFeeLevels = getBitcoinFeeLevels;
52
- const getEthereumFeeLevels = (chain) => {
53
- const { min, max, defaultGas } = getEvmChainGweiGasPrice(chain);
54
+ const getEthereumFeeLevels = (network) => {
55
+ const { min, max, defaultGas, minPriorityFee } = getEvmChainGweiGasPrice(network.chain);
54
56
  return {
55
- blockTime: -1,
57
+ blockTime: Math.max(0.1, Math.round(network.blocktime_seconds)),
56
58
  defaultFees: [
57
59
  {
58
60
  label: 'normal',
@@ -63,6 +65,7 @@ const getEthereumFeeLevels = (chain) => {
63
65
  ],
64
66
  minFee: min,
65
67
  maxFee: max,
68
+ minPriorityFee,
66
69
  dustLimit: -1,
67
70
  };
68
71
  };
@@ -72,6 +75,7 @@ const RIPPLE_FEE_INFO = {
72
75
  defaultFees: [{ label: 'normal', feePerUnit: '12', blocks: -1 }],
73
76
  minFee: 10,
74
77
  maxFee: 10000,
78
+ minPriorityFee: -1,
75
79
  dustLimit: -1,
76
80
  };
77
81
  const CARDANO_FEE_INFO = {
@@ -79,6 +83,7 @@ const CARDANO_FEE_INFO = {
79
83
  defaultFees: [{ label: 'normal', feePerUnit: '44', blocks: -1 }],
80
84
  minFee: 44,
81
85
  maxFee: 16384 * 44 + 155381,
86
+ minPriorityFee: -1,
82
87
  dustLimit: -1,
83
88
  };
84
89
  const SOLANA_FEE_INFO = {
@@ -94,6 +99,7 @@ const SOLANA_FEE_INFO = {
94
99
  ],
95
100
  minFee: 5000,
96
101
  maxFee: 1000000000,
102
+ minPriorityFee: -1,
97
103
  dustLimit: -1,
98
104
  };
99
105
  const STELLAR_FEE_INFO = {
@@ -101,6 +107,7 @@ const STELLAR_FEE_INFO = {
101
107
  defaultFees: [{ label: 'normal', feePerUnit: '100', blocks: -1 }],
102
108
  minFee: 100,
103
109
  maxFee: 10000000,
110
+ minPriorityFee: -1,
104
111
  dustLimit: -1,
105
112
  };
106
113
  const MISC_FEE_LEVELS = {
@@ -120,6 +127,7 @@ const getMiscFeeLevels = (data) => {
120
127
  minFee: -1,
121
128
  maxFee: -1,
122
129
  defaultFees: [{ label: 'normal', feePerUnit: '-1', blocks: -1 }],
130
+ minPriorityFee: -1,
123
131
  dustLimit: -1,
124
132
  });
125
133
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deviceAuthenticityConfig = void 0;
4
4
  exports.deviceAuthenticityConfig = {
5
5
  version: 1,
6
- timestamp: '2025-04-23T12:00:00.000Z',
6
+ timestamp: '2025-05-25T12:00:00.000Z',
7
7
  T2B1: {
8
8
  rootPubKeys: [
9
9
  '04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
@@ -143,6 +143,9 @@ exports.deviceAuthenticityConfig = {
143
143
  '045f5f8c0f6665149630f001871e0f5baec0633d3452da2f6c0b5a6585429525e47704eb79b2dfb8a628e429016a8f426ead61e8623be69d242553c4d67725c4f0',
144
144
  '0459a992145ffbe5f18123380427208dc940fc946648530e516328e3b511a1fc8e920287e51aa1bbae5d015587164acabe52b04d4d48cab2d8b0415b651ffb372f',
145
145
  '040925ae014e1fc43bdaadb1a2596f69bb5ea6bb42e8c295600940607788b2673d89eba89a0a3a2c8e46a66356f45e462f5bd84fc0254dae37c2543a837701587e',
146
+ '040bdbc1617f8949463c2c113df382303ade8d4e55cdff60cd424ce19e983772a7dc606c42e99f2d1dfc8fbc93e1bddb3aa112761380e12161846c25d2a0a069a9',
147
+ '044540af92c1a645fb36f360f6a2a685e979480fd2afe70f465199c64020779dd5c8ab2129dbca29ea893dc6b2b0af732ad09bb61d881f43bbcf4b91e91b90a592',
148
+ '04f7dea866ad77fe63b6c2114e7f9efdac21501de1a9fc43ee6574397353d950cb3f7cd77e19a2bf13adc6ee39ee758720b66f3802053281dedba07735bf56b7a0',
146
149
  ],
147
150
  debug: {
148
151
  rootPubKeys: [
@@ -2,6 +2,7 @@ import { DeviceModelInternal, FirmwareRelease, VersionArray } from '@trezor/devi
2
2
  import type { Features, ReleaseInfo } from '../types';
3
3
  export declare const parseFirmwareReleases: (json: any, deviceModel: DeviceModelInternal) => void;
4
4
  export declare const getReleases: (deviceModel: DeviceModelInternal) => FirmwareRelease[];
5
+ export declare const getOnlineReleases: (internalModel: DeviceModelInternal) => Promise<FirmwareRelease[]>;
5
6
  export interface GetInfoProps {
6
7
  features: Features;
7
8
  releases: FirmwareRelease[];
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRelease = exports.getReleaseInfo = exports.getFirmwareStatus = exports.getInfo = exports.getReleases = exports.parseFirmwareReleases = void 0;
3
+ exports.getRelease = exports.getReleaseInfo = exports.getFirmwareStatus = exports.getInfo = exports.getOnlineReleases = exports.getReleases = exports.parseFirmwareReleases = void 0;
4
4
  const device_utils_1 = require("@trezor/device-utils");
5
5
  const utils_1 = require("@trezor/utils");
6
+ const assets_1 = require("../utils/assets");
6
7
  const firmwareUtils_1 = require("../utils/firmwareUtils");
7
8
  const releases = Object.values(device_utils_1.DeviceModelInternal).reduce((acc, key) => ({ ...acc, [key]: [] }), {});
8
9
  const parseFirmwareReleases = (json, deviceModel) => {
@@ -16,6 +17,18 @@ const parseFirmwareReleases = (json, deviceModel) => {
16
17
  exports.parseFirmwareReleases = parseFirmwareReleases;
17
18
  const getReleases = (deviceModel) => releases[deviceModel] || [];
18
19
  exports.getReleases = getReleases;
20
+ const getOnlineReleases = async (internalModel) => {
21
+ const url = `https://data.trezor.io/firmware/${internalModel.toLowerCase()}/releases.json`;
22
+ const response = await (0, assets_1.httpRequest)(url, 'json', {
23
+ signal: AbortSignal.timeout(10000),
24
+ skipLocalForceDownload: true,
25
+ });
26
+ if ((0, firmwareUtils_1.isValidReleases)(response)) {
27
+ return response;
28
+ }
29
+ return [];
30
+ };
31
+ exports.getOnlineReleases = getOnlineReleases;
19
32
  const getChangelog = (releases2, features) => {
20
33
  if (features.bootloader_mode) {
21
34
  if (features.firmware_present && features.major_version === 1) {
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "9.6.0";
1
+ export declare const VERSION = "9.6.1-beta.1";
2
2
  export declare const DEFAULT_DOMAIN: string;
3
3
  export declare const CONTENT_SCRIPT_VERSION = 1;
4
4
  export declare const DEEPLINK_VERSION = 1;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEEPLINK_VERSION = exports.CONTENT_SCRIPT_VERSION = exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
4
- exports.VERSION = '9.6.0';
4
+ exports.VERSION = '9.6.1-beta.1';
5
5
  const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
6
6
  const isBeta = exports.VERSION.includes('beta');
7
7
  exports.DEFAULT_DOMAIN = isBeta
@@ -1,11 +1,11 @@
1
- import { TransportProtocol } from '@trezor/protocol';
1
+ import { TransportProtocol, thp as protocolThp } from '@trezor/protocol';
2
2
  import { Session } from '@trezor/transport';
3
3
  import { type Descriptor, type Transport } from '@trezor/transport';
4
4
  import { TypedEmitter } from '@trezor/utils';
5
5
  import { PROTO } from '../constants';
6
6
  import { TypedCallProvider } from './DeviceCurrentSession';
7
7
  import { IStateStorage } from './StateStorage';
8
- import { DEVICE, DeviceButtonRequestPayload, DeviceVersionChanged, UiResponsePassphrase, UiResponsePin, UiResponseWord } from '../events';
8
+ import { DEVICE, DeviceButtonRequestPayload, DeviceThpCredentialsChangedPayload, DeviceThpPairingPayload, DeviceVersionChanged, UiResponsePassphrase, UiResponsePin, UiResponseThpPairingTag, UiResponseWord } from '../events';
9
9
  import { DeviceFirmwareStatus, DeviceState, Device as DeviceTyped, DeviceUniquePath, FirmwareType, ReleaseInfo, UnavailableCapabilities, VersionArray } from '../types';
10
10
  type RunOptions = {
11
11
  skipFinalReload?: boolean;
@@ -42,6 +42,11 @@ export interface DeviceEvents {
42
42
  payload: DeviceButtonRequestPayload;
43
43
  };
44
44
  [DEVICE.FIRMWARE_VERSION_CHANGED]: DeviceVersionChanged['payload'];
45
+ [DEVICE.THP_PAIRING]: {
46
+ payload: DeviceThpPairingPayload;
47
+ callback: (response: Result<UiResponseThpPairingTag['payload']>) => void;
48
+ };
49
+ [DEVICE.THP_CREDENTIALS_CHANGED]: DeviceThpCredentialsChangedPayload;
45
50
  }
46
51
  type DeviceLifecycle = typeof DEVICE.CONNECT | typeof DEVICE.CONNECT_UNACQUIRED | typeof DEVICE.DISCONNECT | typeof DEVICE.CHANGED;
47
52
  type DeviceLifecycleListener = (lifecycle: DeviceLifecycle) => void;
@@ -53,16 +58,16 @@ type DeviceParams = {
53
58
  };
54
59
  export declare class Device extends TypedEmitter<DeviceEvents> {
55
60
  readonly transport: Transport;
56
- readonly protocol: TransportProtocol;
57
61
  readonly transportPath: import("@trezor/transport/lib/types").PathPublic;
58
62
  readonly bluetoothProps: {
59
63
  id: string;
60
64
  } | undefined;
61
65
  private thp;
62
66
  private readonly transportDescriptorType;
63
- private session;
64
- private transportSessionOwner;
65
- private lastAcquiredHere;
67
+ private sessionAcquired;
68
+ private _protocol;
69
+ get protocol(): TransportProtocol;
70
+ getThpState(): protocolThp.ThpState | undefined;
66
71
  private unreadableError?;
67
72
  private _firmwareStatus;
68
73
  get firmwareStatus(): DeviceFirmwareStatus;
@@ -123,14 +128,13 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
123
128
  experimental_features: boolean | null;
124
129
  internal_model: PROTO.DeviceModelInternal;
125
130
  };
126
- private _featuresNeedsReload;
131
+ private wasUsedElsewhere;
127
132
  private acquirePromise?;
128
133
  private releasePromise?;
129
134
  private runAbort?;
130
135
  private runPromise?;
131
136
  private keepTransportSession;
132
137
  private currentSession?;
133
- private inconsistent;
134
138
  private instance;
135
139
  private state;
136
140
  private stateStorage?;
@@ -147,20 +151,18 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
147
151
  private sessionDfd?;
148
152
  handshakeFinished: boolean;
149
153
  constructor({ id, transport, descriptor, listener }: DeviceParams);
154
+ private readonly onTransportStopped;
155
+ private readonly onTransportDeviceEvent;
150
156
  private getSessionChangePromise;
151
157
  private waitAndCompareSession;
152
158
  acquire(): import("@trezor/transport/lib/types").AsyncResultWithTypedError<Session, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session" | "LIBUSB_ERROR_ACCESS">;
153
- release(): Promise<import("@trezor/transport/lib/types").Success<null> | {
154
- success: false;
155
- error: "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "session not found" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session";
156
- message?: string;
157
- } | undefined>;
159
+ release(): import("@trezor/transport/lib/types").AsyncResultWithTypedError<null, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "session not found" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session"> | undefined;
158
160
  handshake(delay?: number): Promise<void>;
159
- updateDescriptor(descriptor: Descriptor): Promise<void>;
161
+ private updateDescriptor;
160
162
  run(fn?: () => Promise<void>, options?: RunOptions): Promise<void>;
161
163
  interrupt(reason: Error): Promise<void>;
162
164
  get currentRun(): Promise<void> | undefined;
163
- usedElsewhere(): void;
165
+ private usedElsewhere;
164
166
  private _runInner;
165
167
  getCurrentSession(): TypedCallProvider;
166
168
  getCommands(): {
@@ -228,7 +230,6 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
228
230
  getInstance(): number;
229
231
  getState(): DeviceState | undefined;
230
232
  setState(state?: Partial<DeviceState>): void;
231
- validateState(preauthorized?: boolean): Promise<`${string}@${string}:${number}` | undefined>;
232
233
  initialize(useCardanoDerivation: boolean): Promise<void>;
233
234
  initStorage(storage: IStateStorage): void;
234
235
  getFeatures(): Promise<void>;
@@ -247,14 +248,13 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
247
248
  }>;
248
249
  private _uploadTranslationData;
249
250
  private _updateFeatures;
250
- prompt<T extends typeof DEVICE.PIN | typeof DEVICE.PASSPHRASE | typeof DEVICE.WORD>(type: T, args: Omit<DeviceEvents[T], 'callback'>): Promise<Parameters<DeviceEvents[T]["callback"]>[0]>;
251
+ prompt<T extends typeof DEVICE.PIN | typeof DEVICE.PASSPHRASE | typeof DEVICE.WORD | typeof DEVICE.THP_PAIRING>(type: T, args: Omit<DeviceEvents[T], 'callback'>): Promise<Parameters<DeviceEvents[T]["callback"]>[0]>;
251
252
  isUnacquired(): boolean;
252
253
  isUnreadable(): boolean;
253
- disconnect(): Promise<void>;
254
+ private disconnect;
254
255
  isBootloader(): boolean;
255
256
  isInitialized(): boolean;
256
257
  isSeedless(): boolean;
257
- isInconsistent(): boolean;
258
258
  getVersion(): VersionArray | undefined;
259
259
  atLeast(versions: string[] | string): boolean;
260
260
  isUsed(): boolean;
@@ -263,7 +263,6 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
263
263
  getUniquePath(): DeviceUniquePath;
264
264
  isT1(): boolean;
265
265
  hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
266
- dispose(): void;
267
266
  private getMode;
268
267
  toMessageObject(): DeviceTyped;
269
268
  }