@trezor/connect 9.2.2 → 9.2.3

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 (88) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +1 -1
  3. package/lib/api/blockchainDisconnect.d.ts +1 -0
  4. package/lib/api/blockchainDisconnect.js +3 -4
  5. package/lib/api/blockchainEstimateFee.d.ts +1 -0
  6. package/lib/api/blockchainEstimateFee.js +6 -4
  7. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
  8. package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
  9. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
  10. package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
  11. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
  12. package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
  13. package/lib/api/blockchainGetTransactions.d.ts +1 -0
  14. package/lib/api/blockchainGetTransactions.js +3 -1
  15. package/lib/api/blockchainSetCustomBackend.js +1 -5
  16. package/lib/api/blockchainSubscribe.d.ts +2 -0
  17. package/lib/api/blockchainSubscribe.js +13 -2
  18. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
  19. package/lib/api/blockchainSubscribeFiatRates.js +3 -1
  20. package/lib/api/blockchainUnsubscribe.d.ts +1 -0
  21. package/lib/api/blockchainUnsubscribe.js +5 -2
  22. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
  23. package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
  24. package/lib/api/changeLanguage.d.ts +0 -1
  25. package/lib/api/changeLanguage.js +7 -44
  26. package/lib/api/composeTransaction.d.ts +2 -0
  27. package/lib/api/composeTransaction.js +10 -5
  28. package/lib/api/eos/eosSignTx.d.ts +3 -3
  29. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
  30. package/lib/api/ethereum/ethereumDefinitions.js +1 -0
  31. package/lib/api/getAccountInfo.js +4 -3
  32. package/lib/api/getCoinInfo.d.ts +3 -0
  33. package/lib/api/pushTransaction.d.ts +1 -0
  34. package/lib/api/pushTransaction.js +2 -1
  35. package/lib/api/resetDevice.d.ts +1 -1
  36. package/lib/api/resetDevice.js +2 -2
  37. package/lib/api/signTransaction.d.ts +1 -0
  38. package/lib/api/signTransaction.js +5 -3
  39. package/lib/backend/BackendManager.d.ts +6 -4
  40. package/lib/backend/BackendManager.js +36 -28
  41. package/lib/backend/Blockchain.d.ts +15 -4
  42. package/lib/backend/Blockchain.js +27 -17
  43. package/lib/backend/BlockchainLink.d.ts +3 -3
  44. package/lib/backend/BlockchainLink.js +3 -3
  45. package/lib/core/AbstractMethod.js +1 -0
  46. package/lib/core/index.js +6 -6
  47. package/lib/data/DataManager.d.ts +22 -0
  48. package/lib/data/DataManager.js +7 -3
  49. package/lib/data/coinInfo.d.ts +14 -0
  50. package/lib/data/config.d.ts +22 -0
  51. package/lib/data/config.js +5 -1
  52. package/lib/data/connectSettings.js +3 -0
  53. package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
  54. package/lib/data/deviceAuthenticityConfig.js +23 -3
  55. package/lib/data/firmwareInfo.js +1 -5
  56. package/lib/data/getLanguage.d.ts +6 -0
  57. package/lib/data/getLanguage.js +10 -0
  58. package/lib/data/models.d.ts +9 -0
  59. package/lib/data/models.js +9 -0
  60. package/lib/data/version.d.ts +1 -1
  61. package/lib/data/version.js +1 -1
  62. package/lib/device/Device.d.ts +12 -1
  63. package/lib/device/Device.js +53 -5
  64. package/lib/device/DeviceCommands.d.ts +1 -1
  65. package/lib/device/DeviceList.js +4 -6
  66. package/lib/events/blockchain.d.ts +3 -0
  67. package/lib/types/api/authenticateDevice.d.ts +9 -0
  68. package/lib/types/api/bitcoin/index.d.ts +1 -0
  69. package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
  70. package/lib/types/api/blockchainSubscribe.d.ts +1 -0
  71. package/lib/types/api/composeTransaction.d.ts +2 -0
  72. package/lib/types/api/getAccountInfo.d.ts +1 -0
  73. package/lib/types/api/getCoinInfo.d.ts +4 -2
  74. package/lib/types/api/nemGetAddress.d.ts +11 -4
  75. package/lib/types/api/nemGetAddress.js +9 -0
  76. package/lib/types/api/pushTransaction.d.ts +1 -0
  77. package/lib/types/api/pushTransaction.js +1 -0
  78. package/lib/types/api/resetDevice.d.ts +1 -15
  79. package/lib/types/api/resetDevice.js +0 -9
  80. package/lib/types/api/setBusy.d.ts +2 -2
  81. package/lib/types/coinInfo.d.ts +15 -7
  82. package/lib/types/coinInfo.js +8 -6
  83. package/lib/types/firmware.d.ts +5 -15
  84. package/lib/types/params.d.ts +1 -0
  85. package/lib/types/params.js +1 -2
  86. package/lib/types/settings.d.ts +1 -0
  87. package/lib/utils/assetUtils.js +18 -8
  88. package/package.json +9 -9
@@ -64,6 +64,7 @@ export declare class DataManager {
64
64
  T1B1: string;
65
65
  T2T1: string;
66
66
  T2B1?: undefined;
67
+ T3T1?: undefined;
67
68
  };
68
69
  max: undefined;
69
70
  comment: string[];
@@ -74,6 +75,7 @@ export declare class DataManager {
74
75
  T1B1: string;
75
76
  T2T1: string;
76
77
  T2B1?: undefined;
78
+ T3T1?: undefined;
77
79
  };
78
80
  comment: string[];
79
81
  methods?: undefined;
@@ -85,6 +87,7 @@ export declare class DataManager {
85
87
  T1B1: string;
86
88
  T2T1: string;
87
89
  T2B1?: undefined;
90
+ T3T1?: undefined;
88
91
  };
89
92
  comment: string[];
90
93
  coin?: undefined;
@@ -96,6 +99,7 @@ export declare class DataManager {
96
99
  T1B1: string;
97
100
  T2T1: string;
98
101
  T2B1?: undefined;
102
+ T3T1?: undefined;
99
103
  };
100
104
  comment: string[];
101
105
  coin?: undefined;
@@ -108,6 +112,7 @@ export declare class DataManager {
108
112
  T1B1: string;
109
113
  T2T1: string;
110
114
  T2B1?: undefined;
115
+ T3T1?: undefined;
111
116
  };
112
117
  comment: string[];
113
118
  max?: undefined;
@@ -119,6 +124,7 @@ export declare class DataManager {
119
124
  T1B1: string;
120
125
  T2T1: string;
121
126
  T2B1?: undefined;
127
+ T3T1?: undefined;
122
128
  };
123
129
  coin?: undefined;
124
130
  max?: undefined;
@@ -129,6 +135,7 @@ export declare class DataManager {
129
135
  T1B1: string;
130
136
  T2T1: string;
131
137
  T2B1: string;
138
+ T3T1?: undefined;
132
139
  };
133
140
  comment: string[];
134
141
  coin?: undefined;
@@ -140,6 +147,7 @@ export declare class DataManager {
140
147
  T1B1: string;
141
148
  T2T1: string;
142
149
  T2B1?: undefined;
150
+ T3T1?: undefined;
143
151
  };
144
152
  coin?: undefined;
145
153
  max?: undefined;
@@ -151,6 +159,7 @@ export declare class DataManager {
151
159
  T1B1: string;
152
160
  T2T1: string;
153
161
  T2B1: string;
162
+ T3T1?: undefined;
154
163
  };
155
164
  coin?: undefined;
156
165
  max?: undefined;
@@ -162,11 +171,24 @@ export declare class DataManager {
162
171
  T1B1: string;
163
172
  T2T1: string;
164
173
  T2B1: string;
174
+ T3T1?: undefined;
165
175
  };
166
176
  comment: string[];
167
177
  coin?: undefined;
168
178
  methods?: undefined;
169
179
  max?: undefined;
180
+ } | {
181
+ methods: string[];
182
+ min: {
183
+ T1B1: string;
184
+ T2T1: string;
185
+ T2B1: string;
186
+ T3T1: string;
187
+ };
188
+ coin?: undefined;
189
+ max?: undefined;
190
+ comment?: undefined;
191
+ capabilities?: undefined;
170
192
  })[];
171
193
  };
172
194
  }
@@ -24,9 +24,13 @@ class DataManager {
24
24
  ...this.assets.coins,
25
25
  eth: this.assets.coinsEth,
26
26
  });
27
- (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t1b1'], types_1.DeviceModelInternal.T1B1);
28
- (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2t1'], types_1.DeviceModelInternal.T2T1);
29
- (0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2b1'], types_1.DeviceModelInternal.T2B1);
27
+ for (const model in types_1.DeviceModelInternal) {
28
+ const firmwareKey = `firmware-${model.toLowerCase()}`;
29
+ const modelType = types_1.DeviceModelInternal[model];
30
+ if (this.assets[firmwareKey]) {
31
+ (0, firmwareInfo_1.parseFirmware)(this.assets[firmwareKey], modelType);
32
+ }
33
+ }
30
34
  }
31
35
  static getProtobufMessages() {
32
36
  return this.messages;
@@ -15,6 +15,7 @@ export declare const getBitcoinNetwork: (pathOrName: DerivationPath) => ({
15
15
  T1B1: string | false;
16
16
  T2T1: string | false;
17
17
  T2B1: string | false;
18
+ T3T1: string | false;
18
19
  connect: boolean;
19
20
  };
20
21
  decimals: number;
@@ -71,6 +72,7 @@ export declare const getEthereumNetwork: (pathOrName: DerivationPath) => ({
71
72
  T1B1: string | false;
72
73
  T2T1: string | false;
73
74
  T2B1: string | false;
75
+ T3T1: string | false;
74
76
  connect: boolean;
75
77
  };
76
78
  decimals: number;
@@ -102,6 +104,7 @@ export declare const getMiscNetwork: (pathOrName: DerivationPath) => ({
102
104
  T1B1: string | false;
103
105
  T2T1: string | false;
104
106
  T2B1: string | false;
107
+ T3T1: string | false;
105
108
  connect: boolean;
106
109
  };
107
110
  decimals: number;
@@ -157,6 +160,7 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
157
160
  T1B1: string | false;
158
161
  T2T1: string | false;
159
162
  T2B1: string | false;
163
+ T3T1: string | false;
160
164
  connect: boolean;
161
165
  };
162
166
  decimals: number;
@@ -213,6 +217,7 @@ export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
213
217
  T1B1: string | false;
214
218
  T2T1: string | false;
215
219
  T2B1: string | false;
220
+ T3T1: string | false;
216
221
  connect: boolean;
217
222
  };
218
223
  decimals: number;
@@ -269,6 +274,7 @@ export declare const getCoinInfo: (currency: string) => ({
269
274
  T1B1: string | false;
270
275
  T2T1: string | false;
271
276
  T2B1: string | false;
277
+ T3T1: string | false;
272
278
  connect: boolean;
273
279
  };
274
280
  decimals: number;
@@ -324,6 +330,7 @@ export declare const getCoinInfo: (currency: string) => ({
324
330
  T1B1: string | false;
325
331
  T2T1: string | false;
326
332
  T2B1: string | false;
333
+ T3T1: string | false;
327
334
  connect: boolean;
328
335
  };
329
336
  decimals: number;
@@ -354,6 +361,7 @@ export declare const getCoinInfo: (currency: string) => ({
354
361
  T1B1: string | false;
355
362
  T2T1: string | false;
356
363
  T2B1: string | false;
364
+ T3T1: string | false;
357
365
  connect: boolean;
358
366
  };
359
367
  decimals: number;
@@ -402,6 +410,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
402
410
  T1B1: string | false;
403
411
  T2T1: string | false;
404
412
  T2B1: string | false;
413
+ T3T1: string | false;
405
414
  connect: boolean;
406
415
  };
407
416
  decimals: number;
@@ -457,6 +466,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
457
466
  T1B1: string | false;
458
467
  T2T1: string | false;
459
468
  T2B1: string | false;
469
+ T3T1: string | false;
460
470
  connect: boolean;
461
471
  };
462
472
  decimals: number;
@@ -487,6 +497,7 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
487
497
  T1B1: string | false;
488
498
  T2T1: string | false;
489
499
  T2B1: string | false;
500
+ T3T1: string | false;
490
501
  connect: boolean;
491
502
  };
492
503
  decimals: number;
@@ -518,6 +529,7 @@ export declare const getAllNetworks: () => (({
518
529
  T1B1: string | false;
519
530
  T2T1: string | false;
520
531
  T2B1: string | false;
532
+ T3T1: string | false;
521
533
  connect: boolean;
522
534
  };
523
535
  decimals: number;
@@ -573,6 +585,7 @@ export declare const getAllNetworks: () => (({
573
585
  T1B1: string | false;
574
586
  T2T1: string | false;
575
587
  T2B1: string | false;
588
+ T3T1: string | false;
576
589
  connect: boolean;
577
590
  };
578
591
  decimals: number;
@@ -603,6 +616,7 @@ export declare const getAllNetworks: () => (({
603
616
  T1B1: string | false;
604
617
  T2T1: string | false;
605
618
  T2B1: string | false;
619
+ T3T1: string | false;
606
620
  connect: boolean;
607
621
  };
608
622
  decimals: number;
@@ -52,6 +52,7 @@ export declare const config: {
52
52
  T1B1: string;
53
53
  T2T1: string;
54
54
  T2B1?: undefined;
55
+ T3T1?: undefined;
55
56
  };
56
57
  max: undefined;
57
58
  comment: string[];
@@ -62,6 +63,7 @@ export declare const config: {
62
63
  T1B1: string;
63
64
  T2T1: string;
64
65
  T2B1?: undefined;
66
+ T3T1?: undefined;
65
67
  };
66
68
  comment: string[];
67
69
  methods?: undefined;
@@ -73,6 +75,7 @@ export declare const config: {
73
75
  T1B1: string;
74
76
  T2T1: string;
75
77
  T2B1?: undefined;
78
+ T3T1?: undefined;
76
79
  };
77
80
  comment: string[];
78
81
  coin?: undefined;
@@ -84,6 +87,7 @@ export declare const config: {
84
87
  T1B1: string;
85
88
  T2T1: string;
86
89
  T2B1?: undefined;
90
+ T3T1?: undefined;
87
91
  };
88
92
  comment: string[];
89
93
  coin?: undefined;
@@ -96,6 +100,7 @@ export declare const config: {
96
100
  T1B1: string;
97
101
  T2T1: string;
98
102
  T2B1?: undefined;
103
+ T3T1?: undefined;
99
104
  };
100
105
  comment: string[];
101
106
  max?: undefined;
@@ -107,6 +112,7 @@ export declare const config: {
107
112
  T1B1: string;
108
113
  T2T1: string;
109
114
  T2B1?: undefined;
115
+ T3T1?: undefined;
110
116
  };
111
117
  coin?: undefined;
112
118
  max?: undefined;
@@ -117,6 +123,7 @@ export declare const config: {
117
123
  T1B1: string;
118
124
  T2T1: string;
119
125
  T2B1: string;
126
+ T3T1?: undefined;
120
127
  };
121
128
  comment: string[];
122
129
  coin?: undefined;
@@ -128,6 +135,7 @@ export declare const config: {
128
135
  T1B1: string;
129
136
  T2T1: string;
130
137
  T2B1?: undefined;
138
+ T3T1?: undefined;
131
139
  };
132
140
  coin?: undefined;
133
141
  max?: undefined;
@@ -139,6 +147,7 @@ export declare const config: {
139
147
  T1B1: string;
140
148
  T2T1: string;
141
149
  T2B1: string;
150
+ T3T1?: undefined;
142
151
  };
143
152
  coin?: undefined;
144
153
  max?: undefined;
@@ -150,11 +159,24 @@ export declare const config: {
150
159
  T1B1: string;
151
160
  T2T1: string;
152
161
  T2B1: string;
162
+ T3T1?: undefined;
153
163
  };
154
164
  comment: string[];
155
165
  coin?: undefined;
156
166
  methods?: undefined;
157
167
  max?: undefined;
168
+ } | {
169
+ methods: string[];
170
+ min: {
171
+ T1B1: string;
172
+ T2T1: string;
173
+ T2B1: string;
174
+ T3T1: string;
175
+ };
176
+ coin?: undefined;
177
+ max?: undefined;
178
+ comment?: undefined;
179
+ capabilities?: undefined;
158
180
  })[];
159
181
  };
160
182
  //# sourceMappingURL=config.d.ts.map
@@ -76,6 +76,10 @@ exports.config = {
76
76
  name: 'firmware-t2b1',
77
77
  url: './data/firmware/t2b1/releases.json',
78
78
  },
79
+ {
80
+ name: 'firmware-t3t1',
81
+ url: './data/firmware/t3t1/releases.json',
82
+ },
79
83
  ],
80
84
  messages: './data/messages/messages.json',
81
85
  supportedBrowsers: {
@@ -240,7 +244,7 @@ exports.config = {
240
244
  },
241
245
  {
242
246
  methods: ['changeLanguage'],
243
- min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0' },
247
+ min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0', T3T1: '2.7.1' },
244
248
  },
245
249
  ],
246
250
  };
@@ -110,6 +110,9 @@ const parseConnectSettings = (input = {}) => {
110
110
  if (typeof input.useCoreInPopup === 'boolean') {
111
111
  settings.useCoreInPopup = input.useCoreInPopup;
112
112
  }
113
+ if (typeof input._extendWebextensionLifetime === 'boolean') {
114
+ settings._extendWebextensionLifetime = input._extendWebextensionLifetime;
115
+ }
113
116
  return settings;
114
117
  };
115
118
  exports.parseConnectSettings = parseConnectSettings;
@@ -10,6 +10,15 @@ export declare const DeviceAuthenticityConfig: import("@sinclair/typebox").TInte
10
10
  caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
11
11
  }>>;
12
12
  }>]>;
13
+ T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
14
+ rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
15
+ caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
16
+ }>, import("@sinclair/typebox").TObject<{
17
+ debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
18
+ rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
19
+ caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
20
+ }>>;
21
+ }>]>;
13
22
  }>, import("@sinclair/typebox").TObject<{
14
23
  T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
15
24
  T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
@@ -8,13 +8,13 @@ const CertPubKeys = schema_utils_1.Type.Object({
8
8
  caPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
9
9
  });
10
10
  const ModelPubKeys = schema_utils_1.Type.Intersect([
11
- schema_utils_1.Type.Record(schema_utils_1.Type.Literal(constants_1.PROTO.DeviceModelInternal.T2B1), schema_utils_1.Type.Intersect([
11
+ schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T1B1'), schema_utils_1.Type.Literal('T2T1')])), schema_utils_1.Type.Intersect([
12
12
  CertPubKeys,
13
13
  schema_utils_1.Type.Object({
14
14
  debug: schema_utils_1.Type.Optional(CertPubKeys),
15
15
  }),
16
16
  ])),
17
- schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Literal('T2B1')), schema_utils_1.Type.Undefined())),
17
+ schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T2B1'), schema_utils_1.Type.Literal('T3T1')])), schema_utils_1.Type.Undefined())),
18
18
  ]);
19
19
  exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
20
20
  ModelPubKeys,
@@ -25,7 +25,7 @@ exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
25
25
  ]);
26
26
  exports.deviceAuthenticityConfig = {
27
27
  version: 1,
28
- timestamp: '2023-03-18T12:00:00+00:00',
28
+ timestamp: '2023-04-17T12:00:00+00:00',
29
29
  T2B1: {
30
30
  rootPubKeys: [
31
31
  '04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
@@ -56,5 +56,25 @@ exports.deviceAuthenticityConfig = {
56
56
  ],
57
57
  },
58
58
  },
59
+ T3T1: {
60
+ rootPubKeys: [
61
+ '041854b27fb1d9f65abb66828e78c9dc0ca301e66081ab0c6a4d104f9df1cd0ad5a7c75f77a8c092f55cf825d2abaf734f934c9394d5e75f75a5a06a5ee9be93ae',
62
+ ],
63
+ caPubKeys: [
64
+ '045b785b703810363deeadc0faa5a7388d8385f5e4f9170a3c27d3d2506bf9090d5b09044fbad6b906446d8cdb754b65869e8992b26a344e01ecff75844fe5a3d6',
65
+ '046442ece98b1cd13389b6eda3235e2848becc655db564897b2dc0862580f69b29be59dc30f92820f41a7a493b90623e66e1ee8529dbfd60d50aed97b46c4b8f64',
66
+ '0416960078e1d2b44df717ff5445ec76f4247333375982c5ae59b3bc223371f3cf81e7c182fd1ca36c95977070e2ff46f998bff3f00ab0de266edfdd430aea56b8',
67
+ ],
68
+ debug: {
69
+ rootPubKeys: [
70
+ '047f77368dea2d4d61e989f474a56723c3212dacf8a808d8795595ef38441427c4389bc454f02089d7f08b873005e4c28d432468997871c0bf286fd3861e21e96a',
71
+ ],
72
+ caPubKeys: [
73
+ '04829e8965018feb542e9236c9b2ce08f864a55ed9183d0259564f0e05345b04676a0bef36c59d21d3c24868b5601f0b1193a6bfcf6d814e1cfb79c2256a05e953',
74
+ '046f64eff0dfa3ceeae9708a3881fc09a3dae62198559d022d120e96edc168f3991a9e9b016635a0d43997ee55d8c2b37d969e8abc84e75c791ec911108b52f3c7',
75
+ '041260c3c1fd4ddfc97ba19732d5dcbe6efab61d58af83281b95d6cdb30606bf08f0b817eb6db2825b5ce32d0cc2c275b7eadcedaa1805f00b3f5a11668b6c5cb5',
76
+ ],
77
+ },
78
+ },
59
79
  };
60
80
  //# sourceMappingURL=deviceAuthenticityConfig.js.map
@@ -4,11 +4,7 @@ exports.getReleases = exports.getRelease = exports.getFirmwareStatus = exports.g
4
4
  const utils_1 = require("@trezor/utils");
5
5
  const firmwareUtils_1 = require("../utils/firmwareUtils");
6
6
  const types_1 = require("../types");
7
- const releases = {
8
- [types_1.DeviceModelInternal.T1B1]: [],
9
- [types_1.DeviceModelInternal.T2T1]: [],
10
- [types_1.DeviceModelInternal.T2B1]: [],
11
- };
7
+ const releases = Object.values(types_1.DeviceModelInternal).reduce((acc, key) => ({ ...acc, [key]: [] }), {});
12
8
  const parseFirmware = (json, deviceModel) => {
13
9
  Object.keys(json).forEach(key => {
14
10
  const release = json[key];
@@ -0,0 +1,6 @@
1
+ export declare const getLanguage: ({ language, version, internal_model, }: {
2
+ language: string;
3
+ version: number[];
4
+ internal_model: string;
5
+ }) => Promise<ArrayBuffer>;
6
+ //# sourceMappingURL=getLanguage.d.ts.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLanguage = void 0;
4
+ const assets_1 = require("../utils/assets");
5
+ const getLanguage = ({ language, version, internal_model, }) => {
6
+ const url = `https://data.trezor.io/firmware/translations/${internal_model.toLowerCase()}/translation-${internal_model.toUpperCase()}-${language}-${version.join('.')}.bin`;
7
+ return (0, assets_1.httpRequest)(url, 'binary');
8
+ };
9
+ exports.getLanguage = getLanguage;
10
+ //# sourceMappingURL=getLanguage.js.map
@@ -17,5 +17,14 @@ export declare const models: {
17
17
  '5': string;
18
18
  };
19
19
  };
20
+ T3T1: {
21
+ name: string;
22
+ colors: {
23
+ '1': string;
24
+ '2': string;
25
+ '3': string;
26
+ '4': string;
27
+ };
28
+ };
20
29
  };
21
30
  //# sourceMappingURL=models.d.ts.map
@@ -20,5 +20,14 @@ exports.models = {
20
20
  '5': 'Bitcoin Orange',
21
21
  },
22
22
  },
23
+ T3T1: {
24
+ name: 'Trezor Safe 5',
25
+ colors: {
26
+ '1': 'Fantastic Ethereum',
27
+ '2': 'Lunatic Dogecoin',
28
+ '3': 'Galactic Litecoin',
29
+ '4': 'Majestic Bitcoin',
30
+ },
31
+ },
23
32
  };
24
33
  //# sourceMappingURL=models.js.map
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "9.2.2";
1
+ export declare const VERSION = "9.2.3";
2
2
  export declare const DEFAULT_DOMAIN: string;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
4
- exports.VERSION = '9.2.2';
4
+ exports.VERSION = '9.2.3';
5
5
  const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
6
6
  exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
7
7
  //# sourceMappingURL=version.js.map
@@ -4,7 +4,7 @@ import { TransportProtocol } from '@trezor/protocol';
4
4
  import { DeviceCommands, PassphrasePromptResponse } from './DeviceCommands';
5
5
  import { PROTO, NETWORK } from '../constants';
6
6
  import { DEVICE, DeviceButtonRequestPayload } from '../events';
7
- import type { Transport, Descriptor } from '@trezor/transport';
7
+ import { type Transport, type Descriptor } from '@trezor/transport';
8
8
  import { Device as DeviceTyped, DeviceFirmwareStatus, Features, ReleaseInfo, UnavailableCapabilities, FirmwareType } from '../types';
9
9
  export type RunOptions = {
10
10
  skipFinalReload?: boolean;
@@ -15,6 +15,7 @@ export type RunOptions = {
15
15
  useEmptyPassphrase?: boolean;
16
16
  useCardanoDerivation?: boolean;
17
17
  };
18
+ export declare const GET_FEATURES_TIMEOUT = 3000;
18
19
  export interface DeviceEvents {
19
20
  [DEVICE.PIN]: (device: Device, b: PROTO.PinMatrixRequestType | undefined, callback: (err: any, pin: string) => void) => void;
20
21
  [DEVICE.WORD]: (device: Device, b: PROTO.WordRequestType, callback: (err: any, word: string) => void) => void;
@@ -73,6 +74,16 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
73
74
  useLegacyPassphrase(): boolean;
74
75
  initialize(useEmptyPassphrase: boolean, useCardanoDerivation: boolean): Promise<void>;
75
76
  getFeatures(): Promise<void>;
77
+ changeLanguage({ language, binary, }: {
78
+ language?: undefined;
79
+ binary: ArrayBuffer;
80
+ } | {
81
+ language: string;
82
+ binary?: undefined;
83
+ }): Promise<{
84
+ message: string;
85
+ }>;
86
+ private _uploadTranslationData;
76
87
  _updateFeatures(feat: Features): void;
77
88
  isUnacquired(): boolean;
78
89
  disconnect(): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Device = void 0;
3
+ exports.Device = exports.GET_FEATURES_TIMEOUT = void 0;
4
4
  const utils_1 = require("@trezor/utils");
5
5
  const utils_2 = require("@trezor/utils");
6
6
  const utils_3 = require("@trezor/utils");
@@ -12,9 +12,12 @@ const coinInfo_1 = require("../data/coinInfo");
12
12
  const firmwareInfo_1 = require("../data/firmwareInfo");
13
13
  const deviceFeaturesUtils_1 = require("../utils/deviceFeaturesUtils");
14
14
  const debug_1 = require("../utils/debug");
15
+ const transport_1 = require("@trezor/transport");
15
16
  const types_1 = require("../types");
16
17
  const models_1 = require("../data/models");
18
+ const getLanguage_1 = require("../data/getLanguage");
17
19
  const _log = (0, debug_1.initLog)('Device');
20
+ exports.GET_FEATURES_TIMEOUT = 3000;
18
21
  const parseRunOptions = (options) => {
19
22
  if (!options)
20
23
  options = {};
@@ -98,9 +101,6 @@ class Device extends utils_1.TypedEmitter {
98
101
  await this.commands.callPromise.promise;
99
102
  }
100
103
  }
101
- if (this.releasePromise) {
102
- await this.releasePromise;
103
- }
104
104
  this.releasePromise = this.transport.release({
105
105
  session: this.activitySessionID,
106
106
  path: this.originalDescriptor.path,
@@ -177,7 +177,7 @@ class Device extends utils_1.TypedEmitter {
177
177
  else {
178
178
  await Promise.race([
179
179
  this.getFeatures(),
180
- new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')), 3000)),
180
+ new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')), exports.GET_FEATURES_TIMEOUT)),
181
181
  ]);
182
182
  }
183
183
  }
@@ -186,6 +186,9 @@ class Device extends utils_1.TypedEmitter {
186
186
  this.inconsistent = true;
187
187
  return this._runInner(() => Promise.resolve({}), options);
188
188
  }
189
+ if (transport_1.TRANSPORT_ERROR.ABORTED_BY_TIMEOUT === error.message) {
190
+ this.unreadableError = 'Connection timeout';
191
+ }
189
192
  this.inconsistent = true;
190
193
  delete this.runPromise;
191
194
  return Promise.reject(constants_1.ERRORS.TypedError('Device_InitializeFailed', `Initialize failed: ${error.message} ${error.code ? `, code: ${error.code}` : ''}`));
@@ -310,6 +313,51 @@ class Device extends utils_1.TypedEmitter {
310
313
  async getFeatures() {
311
314
  const { message } = await this.getCommands().typedCall('GetFeatures', 'Features', {});
312
315
  this._updateFeatures(message);
316
+ if (!this.features.language_version_matches &&
317
+ this.features.language &&
318
+ this.atLeast('2.7.0')) {
319
+ _log.info('language version mismatch. silently updating...');
320
+ try {
321
+ await this.changeLanguage({ language: this.features.language });
322
+ }
323
+ catch (err) {
324
+ _log.error('change language failed silently', err);
325
+ }
326
+ }
327
+ }
328
+ async changeLanguage({ language, binary, }) {
329
+ if (language === 'en-US') {
330
+ return this._uploadTranslationData(null);
331
+ }
332
+ if (binary) {
333
+ return this._uploadTranslationData(binary);
334
+ }
335
+ const downloadedBinary = await (0, getLanguage_1.getLanguage)({
336
+ language,
337
+ version: this.getVersion(),
338
+ internal_model: this.features.internal_model,
339
+ });
340
+ return this._uploadTranslationData(downloadedBinary);
341
+ }
342
+ async _uploadTranslationData(payload) {
343
+ if (!this.commands) {
344
+ throw constants_1.ERRORS.TypedError('Runtime', 'uploadTranslationData: device.commands is not set');
345
+ }
346
+ if (payload === null) {
347
+ const response = await this.commands.typedCall('ChangeLanguage', ['Success'], { data_length: 0 });
348
+ return response.message;
349
+ }
350
+ const length = payload.byteLength;
351
+ let response = await this.commands.typedCall('ChangeLanguage', ['TranslationDataRequest', 'Success'], { data_length: length });
352
+ while (response.type !== 'Success') {
353
+ const start = response.message.data_offset;
354
+ const end = response.message.data_offset + response.message.data_length;
355
+ const chunk = payload.slice(start, end);
356
+ response = await this.commands.typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], {
357
+ data_chunk: Buffer.from(chunk).toString('hex'),
358
+ });
359
+ }
360
+ return response.message;
313
361
  }
314
362
  _updateFeatures(feat) {
315
363
  var _a, _b, _c, _d;
@@ -1,6 +1,6 @@
1
1
  import { Transport } from '@trezor/transport';
2
2
  import { MessagesSchema as Messages } from '@trezor/protobuf';
3
- import type { Device } from './Device';
3
+ import { Device } from './Device';
4
4
  import type { CoinInfo, BitcoinNetworkInfo } from '../types';
5
5
  import type { HDNodeResponse } from '../types/api/getPublicKey';
6
6
  type MessageType = Messages.MessageType;
@@ -324,22 +324,20 @@ class DeviceList extends utils_1.TypedEmitter {
324
324
  if (error.code === 'Device_NotFound' ||
325
325
  error.message === transport_1.TRANSPORT_ERROR.DEVICE_NOT_FOUND ||
326
326
  error.message === transport_1.TRANSPORT_ERROR.DEVICE_DISCONNECTED_DURING_ACTION ||
327
- error.message === transport_1.TRANSPORT_ERROR.UNEXPECTED_ERROR ||
328
- error.message === transport_1.TRANSPORT_ERROR.INTERFACE_UNABLE_TO_OPEN_DEVICE) {
327
+ error.message === transport_1.TRANSPORT_ERROR.UNEXPECTED_ERROR) {
329
328
  delete this.devices[path];
330
329
  }
331
330
  else if (error.message === transport_1.TRANSPORT_ERROR.SESSION_WRONG_PREVIOUS) {
332
331
  this.enumerate();
333
332
  this._handleUsedElsewhere(descriptor);
334
333
  }
335
- else if (((_a = error.message) === null || _a === void 0 ? void 0 : _a.indexOf(constants_1.ERRORS.LIBUSB_ERROR_MESSAGE)) >= 0) {
334
+ else if (error.message === transport_1.TRANSPORT_ERROR.INTERFACE_UNABLE_TO_OPEN_DEVICE ||
335
+ ((_a = error.message) === null || _a === void 0 ? void 0 : _a.indexOf(constants_1.ERRORS.LIBUSB_ERROR_MESSAGE)) >= 0 ||
336
+ error.code === 'Device_InitializeFailed') {
336
337
  const device = this._createUnreadableDevice(this.creatingDevicesDescriptors[path], error.message);
337
338
  this.devices[path] = device;
338
339
  this.emit(events_1.DEVICE.CONNECT_UNACQUIRED, device.toMessageObject());
339
340
  }
340
- else if (error.code === 'Device_InitializeFailed') {
341
- this._handleUsedElsewhere(descriptor);
342
- }
343
341
  else if (error.code === 'Device_UsedElsewhere') {
344
342
  this._handleUsedElsewhere(descriptor);
345
343
  }