@trezor/connect 9.4.3 → 9.4.4

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 (55) hide show
  1. package/CHANGELOG.md +35 -4
  2. package/README.md +1 -1
  3. package/lib/api/binance/api/binanceGetAddress.js +1 -0
  4. package/lib/api/binance/api/binanceGetPublicKey.js +1 -0
  5. package/lib/api/bitcoin/signtx.js +1 -0
  6. package/lib/api/bitcoin/signtxLegacy.js +1 -0
  7. package/lib/api/blockchainEstimateFee.js +1 -1
  8. package/lib/api/blockchainEvmRpcCall.js +1 -1
  9. package/lib/api/cardano/api/cardanoGetAddress.js +1 -0
  10. package/lib/api/cardano/api/cardanoGetPublicKey.js +1 -0
  11. package/lib/api/cipherKeyValue.js +1 -0
  12. package/lib/api/eos/api/eosGetPublicKey.js +1 -0
  13. package/lib/api/ethereum/api/ethereumGetAddress.js +1 -0
  14. package/lib/api/ethereum/api/ethereumGetPublicKey.js +1 -0
  15. package/lib/api/getAccountDescriptor.js +1 -0
  16. package/lib/api/getAccountInfo.js +1 -0
  17. package/lib/api/getAddress.js +1 -0
  18. package/lib/api/getOwnershipId.js +1 -0
  19. package/lib/api/getOwnershipProof.js +1 -0
  20. package/lib/api/getPublicKey.js +1 -0
  21. package/lib/api/index.d.ts +0 -1
  22. package/lib/api/index.js +1 -3
  23. package/lib/api/nem/api/nemGetAddress.js +1 -0
  24. package/lib/api/ripple/api/rippleGetAddress.js +1 -0
  25. package/lib/api/solana/api/solanaGetAddress.js +1 -0
  26. package/lib/api/solana/api/solanaGetPublicKey.js +1 -0
  27. package/lib/api/stellar/api/stellarGetAddress.js +1 -0
  28. package/lib/api/tezos/api/tezosGetAddress.js +1 -0
  29. package/lib/api/tezos/api/tezosGetPublicKey.js +1 -0
  30. package/lib/core/AbstractMethod.d.ts +1 -2
  31. package/lib/core/AbstractMethod.js +2 -4
  32. package/lib/core/index.js +36 -35
  33. package/lib/data/coinInfo.js +2 -1
  34. package/lib/data/config.js +0 -4
  35. package/lib/data/deviceAuthenticityConfig.js +3 -0
  36. package/lib/data/firmwareInfo.js +8 -8
  37. package/lib/data/models.d.ts +1 -0
  38. package/lib/data/models.js +1 -0
  39. package/lib/data/transportInfo.js +4 -4
  40. package/lib/data/udevInfo.js +4 -4
  41. package/lib/data/version.d.ts +1 -1
  42. package/lib/data/version.js +1 -1
  43. package/lib/device/Device.js +7 -7
  44. package/lib/device/DeviceList.d.ts +2 -1
  45. package/lib/device/DeviceList.js +4 -0
  46. package/lib/events/ui-request.d.ts +1 -0
  47. package/lib/factory.js +0 -1
  48. package/lib/types/api/index.d.ts +0 -2
  49. package/lib/utils/deviceFeaturesUtils.js +1 -1
  50. package/lib/utils/formatUtils.js +1 -1
  51. package/package.json +14 -12
  52. package/lib/api/rebootToBootloader.d.ts +0 -18
  53. package/lib/api/rebootToBootloader.js +0 -44
  54. package/lib/types/api/rebootToBootloader.d.ts +0 -4
  55. package/lib/types/api/rebootToBootloader.js +0 -3
package/CHANGELOG.md CHANGED
@@ -1,15 +1,46 @@
1
1
  | Package | Stable | Canary |
2
2
  | :------------------------------: | :----: | :----: |
3
- | npm @trezor/connect | 9.4.3 | - |
4
- | npm @trezor/connect-web | 9.4.3 | - |
5
- | npm @trezor/connect-webextension | 9.4.3 | - |
3
+ | npm @trezor/connect | 9.4.4 | - |
4
+ | npm @trezor/connect-web | 9.4.4 | - |
5
+ | npm @trezor/connect-webextension | 9.4.4 | - |
6
6
 
7
7
  | Deployment | Stable | Canary |
8
8
  | :----------------: | :----: | :----: |
9
- | connect.trezor.io/ | 9.4.3 | - |
9
+ | connect.trezor.io/ | 9.4.4 | - |
10
10
 
11
11
  Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
12
12
 
13
+ # 9.4.4
14
+
15
+ This release among other improvements fixes a bug in ethereum serialization of empty strings as hex that was causing issues when signing that was caused by @ethereumjs libs update (2d6465f, d6bc8c5020) in 9.4.3.
16
+
17
+ ## Feature
18
+
19
+ - Show bundleprogress in popup. This is helpful when a 3rd party requests a big bundle of addresses which might take long to process (5cf9963)
20
+
21
+ ## Fixes
22
+
23
+ - preferred device handling based on (passphrase) state instead of path (58b854c)
24
+ - fix "BetaOnly" component that is supposed to hide selected parts of content in beta environments (fdb433a)
25
+ - blockchainEvmRpcCall postMessage instance not propagated correctly (c98a08e)
26
+
27
+ ## Dependencies update
28
+
29
+ - npm-release: @trezor/blockchain-link 2.3.3
30
+ - npm-release: @trezor/blockchain-link-utils 1.2.3
31
+ - npm-release: @trezor/blockchain-link-types 1.2.3
32
+ - npm-release: @trezor/type-utils 1.1.2
33
+ - npm-release: @trezor/connect-analytics 1.2.3
34
+ - npm-release: @trezor/analytics 1.2.3
35
+ - npm-release: @trezor/connect-common 0.2.4
36
+ - npm-release: @trezor/env-utils 1.2.1
37
+ - npm-release: @trezor/transport 1.3.4
38
+ - npm-release: @trezor/protobuf 1.2.4
39
+ - npm-release: @trezor/schema-utils 1.2.3
40
+ - npm-release: @trezor/protocol 1.2.2
41
+ - npm-release: @trezor/utxo-lib 2.2.3
42
+ - npm-release: @trezor/utils 9.2.3
43
+
13
44
  # 9.4.3
14
45
 
15
46
  This release introduces `@trezor/connect-mobile`, which allows mobile apps to integrate with Trezor Suite mobile using deeplinks. This package is still beta and work in progress.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.4.3
3
+ API version 9.4.4
4
4
 
5
5
  [![Build Status](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml/badge.svg)](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
6
6
  [![NPM](https://img.shields.io/npm/v/@trezor/connect.svg)](https://www.npmjs.org/package/@trezor/connect)
@@ -97,6 +97,7 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
97
97
  });
98
98
  if (this.hasBundle) {
99
99
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
100
+ total: this.params.length,
100
101
  progress: i,
101
102
  response,
102
103
  }));
@@ -49,6 +49,7 @@ class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
49
49
  });
50
50
  if (this.hasBundle) {
51
51
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
52
+ total: this.params.length,
52
53
  progress: i,
53
54
  response: message,
54
55
  }));
@@ -142,6 +142,7 @@ const processTxRequest = async (props) => {
142
142
  const signTx = async ({ typedCall, inputs, outputs, paymentRequests, refTxs, options, coinInfo, }) => {
143
143
  const { message } = await typedCall('SignTx', 'TxRequest', {
144
144
  ...options,
145
+ version: options.version === undefined && coinInfo.isBitcoin ? 2 : options.version,
145
146
  inputs_count: inputs.length,
146
147
  outputs_count: outputs.length,
147
148
  coin_name: coinInfo.name,
@@ -114,6 +114,7 @@ const processTxRequest = async (props) => {
114
114
  const signTxLegacy = async ({ typedCall, inputs, outputs, refTxs, options, coinInfo, }) => {
115
115
  const { message } = await typedCall('SignTx', 'TxRequest', {
116
116
  ...options,
117
+ version: options.version === undefined && coinInfo.isBitcoin ? 2 : options.version,
117
118
  inputs_count: inputs.length,
118
119
  outputs_count: outputs.length,
119
120
  coin_name: coinInfo.name,
@@ -56,7 +56,7 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
56
56
  };
57
57
  if (request && request.feeLevels) {
58
58
  const fees = new Fees_1.FeeLevels(coinInfo);
59
- if (request.feeLevels === 'smart' && coinInfo.shortcut !== 'DOGE') {
59
+ if (request.feeLevels === 'smart') {
60
60
  const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
61
61
  await fees.load(backend);
62
62
  }
@@ -36,7 +36,7 @@ class BlockchainEvmRpcCall extends AbstractMethod_1.AbstractMethod {
36
36
  return 'Blockchain Evm Rpc Call';
37
37
  }
38
38
  async run() {
39
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, postMessage, this.params.identity);
39
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
40
40
  const response = await backend.rpcCall(this.params.request);
41
41
  return response;
42
42
  }
@@ -110,6 +110,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
110
110
  });
111
111
  if (this.hasBundle) {
112
112
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
113
+ total: this.params.length,
113
114
  progress: i,
114
115
  response,
115
116
  }));
@@ -59,6 +59,7 @@ class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
59
59
  });
60
60
  if (this.hasBundle) {
61
61
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
62
+ total: this.params.length,
62
63
  progress: i,
63
64
  response: message,
64
65
  }));
@@ -39,6 +39,7 @@ class CipherKeyValue extends AbstractMethod_1.AbstractMethod {
39
39
  responses.push(response.message);
40
40
  if (this.hasBundle) {
41
41
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
42
+ total: this.params.length,
42
43
  progress: i,
43
44
  response,
44
45
  }));
@@ -51,6 +51,7 @@ class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
51
51
  });
52
52
  if (this.hasBundle) {
53
53
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
54
+ total: this.params.length,
54
55
  progress: i,
55
56
  response: message,
56
57
  }));
@@ -121,6 +121,7 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
121
121
  responses.push(response);
122
122
  if (this.hasBundle) {
123
123
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
124
+ total: this.params.length,
124
125
  progress: i,
125
126
  response,
126
127
  }));
@@ -57,6 +57,7 @@ class EthereumGetPublicKey extends AbstractMethod_1.AbstractMethod {
57
57
  responses.push(response);
58
58
  if (this.hasBundle) {
59
59
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
60
+ total: this.params.length,
60
61
  progress: i,
61
62
  response,
62
63
  }));
@@ -100,6 +100,7 @@ class GetAccountDescriptor extends AbstractMethod_1.AbstractMethod {
100
100
  if (!this.hasBundle || this.disposed)
101
101
  return;
102
102
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
103
+ total: this.params.length,
103
104
  progress,
104
105
  response,
105
106
  error,
@@ -149,6 +149,7 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
149
149
  if (!this.hasBundle || (this.device && this.device.getCommands().disposed))
150
150
  return;
151
151
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
152
+ total: this.params.length,
152
153
  progress,
153
154
  response,
154
155
  error,
@@ -127,6 +127,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
127
127
  responses.push(response);
128
128
  if (this.hasBundle) {
129
129
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
130
+ total: this.params.length,
130
131
  progress: i,
131
132
  response,
132
133
  }));
@@ -51,6 +51,7 @@ class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
51
51
  });
52
52
  if (this.hasBundle) {
53
53
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
54
+ total: this.params.length,
54
55
  progress: i,
55
56
  response: message,
56
57
  }));
@@ -60,6 +60,7 @@ class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
60
60
  });
61
61
  if (this.hasBundle) {
62
62
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
63
+ total: this.params.length,
63
64
  progress: i,
64
65
  response: message,
65
66
  }));
@@ -67,6 +67,7 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
67
67
  responses.push(response);
68
68
  if (this.hasBundle) {
69
69
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
70
+ total: this.params.length,
70
71
  progress: i,
71
72
  response,
72
73
  }));
@@ -34,7 +34,6 @@ export { default as getOwnershipProof } from './getOwnershipProof';
34
34
  export { default as getPublicKey } from './getPublicKey';
35
35
  export { default as getSettings } from './getSettings';
36
36
  export { default as pushTransaction } from './pushTransaction';
37
- export { default as rebootToBootloader } from './rebootToBootloader';
38
37
  export { default as recoveryDevice } from './recoveryDevice';
39
38
  export { default as requestLogin } from './requestLogin';
40
39
  export { default as resetDevice } from './resetDevice';
package/lib/api/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.setBrightness = exports.loadDevice = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.changeLanguage = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainEvmRpcCall = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
3
+ exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.setBrightness = exports.loadDevice = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.changeLanguage = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainEvmRpcCall = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var applyFlags_1 = require("./applyFlags");
6
6
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return tslib_1.__importDefault(applyFlags_1).default; } });
@@ -74,8 +74,6 @@ var getSettings_1 = require("./getSettings");
74
74
  Object.defineProperty(exports, "getSettings", { enumerable: true, get: function () { return tslib_1.__importDefault(getSettings_1).default; } });
75
75
  var pushTransaction_1 = require("./pushTransaction");
76
76
  Object.defineProperty(exports, "pushTransaction", { enumerable: true, get: function () { return tslib_1.__importDefault(pushTransaction_1).default; } });
77
- var rebootToBootloader_1 = require("./rebootToBootloader");
78
- Object.defineProperty(exports, "rebootToBootloader", { enumerable: true, get: function () { return tslib_1.__importDefault(rebootToBootloader_1).default; } });
79
77
  var recoveryDevice_1 = require("./recoveryDevice");
80
78
  Object.defineProperty(exports, "recoveryDevice", { enumerable: true, get: function () { return tslib_1.__importDefault(recoveryDevice_1).default; } });
81
79
  var requestLogin_1 = require("./requestLogin");
@@ -112,6 +112,7 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
112
112
  });
113
113
  if (this.hasBundle) {
114
114
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
115
+ total: this.params.length,
115
116
  progress: i,
116
117
  response,
117
118
  }));
@@ -95,6 +95,7 @@ class RippleGetAddress extends AbstractMethod_1.AbstractMethod {
95
95
  });
96
96
  if (this.hasBundle) {
97
97
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
98
+ total: this.params.length,
98
99
  progress: i,
99
100
  response,
100
101
  }));
@@ -97,6 +97,7 @@ class SolanaGetAddress extends AbstractMethod_1.AbstractMethod {
97
97
  });
98
98
  if (this.hasBundle) {
99
99
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
100
+ total: this.params.length,
100
101
  progress: i,
101
102
  response: message,
102
103
  }));
@@ -50,6 +50,7 @@ class SolanaGetPublicKey extends AbstractMethod_1.AbstractMethod {
50
50
  });
51
51
  if (this.hasBundle) {
52
52
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
53
+ total: this.params.length,
53
54
  progress: i,
54
55
  response: message,
55
56
  }));
@@ -95,6 +95,7 @@ class StellarGetAddress extends AbstractMethod_1.AbstractMethod {
95
95
  });
96
96
  if (this.hasBundle) {
97
97
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
98
+ total: this.params.length,
98
99
  progress: i,
99
100
  response,
100
101
  }));
@@ -95,6 +95,7 @@ class TezosGetAddress extends AbstractMethod_1.AbstractMethod {
95
95
  });
96
96
  if (this.hasBundle) {
97
97
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
98
+ total: this.params.length,
98
99
  progress: i,
99
100
  response,
100
101
  }));
@@ -50,6 +50,7 @@ class TezosGetPublicKey extends AbstractMethod_1.AbstractMethod {
50
50
  });
51
51
  if (this.hasBundle) {
52
52
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
53
+ total: this.params.length,
53
54
  progress: i,
54
55
  response: message,
55
56
  }));
@@ -2,7 +2,7 @@ import { Capability } from '@trezor/protobuf/lib/messages';
2
2
  import { NETWORK } from '../constants';
3
3
  import { UI, CallMethodPayload, CallMethodResponse, UiRequestButtonData, UiPromiseCreator, CoreEventMessage, UiRequestConfirmation } from '../events';
4
4
  import type { Device } from '../device/Device';
5
- import type { FirmwareRange, DeviceState, DeviceUniquePath, ConnectSettings } from '../types';
5
+ import type { FirmwareRange, DeviceState, ConnectSettings } from '../types';
6
6
  export type Payload<M> = Extract<CallMethodPayload, {
7
7
  method: M;
8
8
  }> & {
@@ -16,7 +16,6 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
16
16
  responseID: number;
17
17
  device: Device;
18
18
  params: Params;
19
- devicePath?: DeviceUniquePath;
20
19
  deviceState?: DeviceState;
21
20
  hasExpectedDeviceState: boolean;
22
21
  keepSession: boolean;
@@ -55,14 +55,13 @@ class AbstractMethod {
55
55
  return undefined;
56
56
  }
57
57
  constructor(message) {
58
- var _a, _b;
58
+ var _a;
59
59
  this.requiredDeviceCapabilities = [];
60
60
  const { payload } = message;
61
61
  this.name = payload.method;
62
62
  this.payload = payload;
63
63
  this.responseID = message.id || 0;
64
- this.devicePath = (_a = payload.device) === null || _a === void 0 ? void 0 : _a.path;
65
- this.deviceState = validateDeviceState((_b = payload.device) === null || _b === void 0 ? void 0 : _b.state);
64
+ this.deviceState = validateDeviceState((_a = payload.device) === null || _a === void 0 ? void 0 : _a.state);
66
65
  this.hasExpectedDeviceState = payload.device
67
66
  ? Object.prototype.hasOwnProperty.call(payload.device, 'state')
68
67
  : false;
@@ -101,7 +100,6 @@ class AbstractMethod {
101
100
  }
102
101
  setDevice(device) {
103
102
  this.device = device;
104
- this.devicePath = device.getUniquePath();
105
103
  const originalFn = this.createUiPromise;
106
104
  this.createUiPromise = (t, d) => originalFn(t, d || device);
107
105
  }
package/lib/core/index.js CHANGED
@@ -12,7 +12,6 @@ const analyticsInfo_1 = require("../data/analyticsInfo");
12
12
  const constants_1 = require("../constants");
13
13
  const events_2 = require("../events");
14
14
  const method_1 = require("./method");
15
- const promiseUtils_1 = require("../utils/promiseUtils");
16
15
  const uiPromiseManager_1 = require("../utils/uiPromiseManager");
17
16
  const popupPromiseManager_1 = require("../utils/popupPromiseManager");
18
17
  const debug_1 = require("../utils/debug");
@@ -28,7 +27,8 @@ const waitForPopup = ({ popupPromise, sendCoreMessage }) => {
28
27
  const startInteractionTimeout = (context) => context.interactionTimeout.start(() => {
29
28
  onPopupClosed(context, 'Interaction timeout');
30
29
  });
31
- const initDevice = async (context, devicePath) => {
30
+ const initDevice = async (context, methodCallDevice) => {
31
+ var _a;
32
32
  const { uiPromises, deviceList, sendCoreMessage } = context;
33
33
  (0, DeviceList_1.assertDeviceListConnected)(deviceList);
34
34
  const isWebUsb = deviceList.transportType() === 'WebUsbTransport';
@@ -38,17 +38,26 @@ const initDevice = async (context, devicePath) => {
38
38
  const origin = DataManager_1.DataManager.getSettings('origin');
39
39
  const useCoreInPopup = DataManager_1.DataManager.getSettings('useCoreInPopup');
40
40
  const { preferredDevice } = connect_common_1.storage.load().origin[origin] || {};
41
- const preferredDeviceInList = preferredDevice && deviceList.getDeviceByPath(preferredDevice.path);
42
- if (preferredDevice && !preferredDeviceInList) {
43
- connect_common_1.storage.save(store => {
44
- store.origin[origin] = { ...store.origin[origin], preferredDevice: undefined };
45
- return store;
46
- });
41
+ const preferredDeviceInList = (preferredDevice === null || preferredDevice === void 0 ? void 0 : preferredDevice.state) && deviceList.getDeviceByStaticState(preferredDevice.state);
42
+ if ((_a = methodCallDevice === null || methodCallDevice === void 0 ? void 0 : methodCallDevice.state) === null || _a === void 0 ? void 0 : _a.staticSessionId) {
43
+ device = deviceList.getDeviceByStaticState(methodCallDevice.state.staticSessionId);
44
+ }
45
+ else if (methodCallDevice === null || methodCallDevice === void 0 ? void 0 : methodCallDevice.path) {
46
+ device = deviceList.getDeviceByPath(methodCallDevice.path);
47
+ }
48
+ if (preferredDevice && !device) {
49
+ if (preferredDeviceInList) {
50
+ device = preferredDeviceInList;
51
+ }
52
+ else {
53
+ connect_common_1.storage.save(store => {
54
+ store.origin[origin] = { ...store.origin[origin], preferredDevice: undefined };
55
+ return store;
56
+ });
57
+ }
47
58
  }
48
- if (devicePath) {
49
- device = deviceList.getDeviceByPath(devicePath);
50
- showDeviceSelection =
51
- !device || device.isUnreadable() || (device.isUnacquired() && !!isUsingPopup);
59
+ if (device) {
60
+ showDeviceSelection = device.isUnreadable() || (device.isUnacquired() && !!isUsingPopup);
52
61
  }
53
62
  else {
54
63
  const onlyDevice = deviceList.getOnlyDevice();
@@ -262,23 +271,18 @@ const onCall = async (context, message) => {
262
271
  }
263
272
  const { uiPromises, callMethods, methodSynchronize, resolveWaitForFirstMethod, sendCoreMessage, } = context;
264
273
  const responseID = message.id;
265
- const origin = DataManager_1.DataManager.getSettings('origin');
266
- const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
267
- if (preferredDevice && !message.payload.device) {
268
- message.payload.device = preferredDevice;
269
- }
270
274
  let method;
271
275
  try {
272
276
  method = await methodSynchronize(async () => {
273
277
  var _a;
274
278
  _log.debug('loading method...');
275
- const method = await (0, method_1.getMethod)(message);
276
- _log.debug('method selected', method.name);
277
- method.postMessage = sendCoreMessage;
278
- method.createUiPromise = uiPromises.create;
279
- method.init();
280
- await ((_a = method.initAsync) === null || _a === void 0 ? void 0 : _a.call(method));
281
- return method;
279
+ const method2 = await (0, method_1.getMethod)(message);
280
+ _log.debug('method selected', method2.name);
281
+ method2.postMessage = sendCoreMessage;
282
+ method2.createUiPromise = uiPromises.create;
283
+ method2.init();
284
+ await ((_a = method2.initAsync) === null || _a === void 0 ? void 0 : _a.call(method2));
285
+ return method2;
282
286
  });
283
287
  resolveWaitForFirstMethod();
284
288
  callMethods.push(method);
@@ -331,7 +335,7 @@ const onCallDevice = async (context, message, method) => {
331
335
  let tempDevice;
332
336
  while (!tempDevice) {
333
337
  try {
334
- tempDevice = await initDevice(context, method.devicePath);
338
+ tempDevice = await initDevice(context, message.payload.device);
335
339
  }
336
340
  catch (error) {
337
341
  if (error.code === 'Transport_Missing') {
@@ -353,7 +357,12 @@ const onCallDevice = async (context, message, method) => {
353
357
  }
354
358
  const device = tempDevice;
355
359
  method.setDevice(device);
356
- const previousCall = callMethods.filter(call => call && call !== method && call.devicePath === method.devicePath);
360
+ const previousCall = callMethods.filter(call => {
361
+ var _a;
362
+ return call &&
363
+ call !== method &&
364
+ ((_a = call.device) === null || _a === void 0 ? void 0 : _a.getUniquePath()) === method.device.getUniquePath();
365
+ });
357
366
  if (previousCall.length > 0 && method.overridePreviousCall) {
358
367
  previousCall.forEach(call => {
359
368
  call.overridden = true;
@@ -428,14 +437,6 @@ const onCallDevice = async (context, message, method) => {
428
437
  }
429
438
  const response = messageResponse;
430
439
  if (response) {
431
- if (method.name === 'rebootToBootloader' && response.success) {
432
- await (0, promiseUtils_1.resolveAfter)(1000).promise;
433
- try {
434
- await device.run(() => Promise.resolve(), { skipFinalReload: true });
435
- }
436
- catch {
437
- }
438
- }
439
440
  await device.cleanup();
440
441
  if (useCoreInPopup) {
441
442
  sendCoreMessage(response);
@@ -702,7 +703,7 @@ class Core extends events_1.default {
702
703
  context: {
703
704
  deviceList: this.deviceList,
704
705
  postMessage: this.sendCoreMessage.bind(this),
705
- initDevice: path => initDevice(this.getCoreContext(), path),
706
+ initDevice: path => initDevice(this.getCoreContext(), { path }),
706
707
  log: _log,
707
708
  abortSignal: this.abortController.signal,
708
709
  },
@@ -132,11 +132,12 @@ const getCoinName = (path) => {
132
132
  return network ? network.name : 'Unknown coin';
133
133
  };
134
134
  exports.getCoinName = getCoinName;
135
+ const BITCOIN_SHORTCUTS = ['BTC', 'TEST', 'REGTEST'];
135
136
  const parseBitcoinNetworksJson = (json) => {
136
137
  Object.keys(json).forEach(key => {
137
138
  const coin = json[key];
138
139
  const shortcut = coin.coin_shortcut;
139
- const isBitcoin = shortcut === 'BTC' || shortcut === 'TEST';
140
+ const isBitcoin = BITCOIN_SHORTCUTS.includes(shortcut);
140
141
  const network = {
141
142
  messagePrefix: coin.signed_message_header,
142
143
  bech32: coin.bech32_prefix,
@@ -225,10 +225,6 @@ exports.config = {
225
225
  T3T1: '2.8.0',
226
226
  },
227
227
  },
228
- {
229
- methods: ['rebootToBootloader'],
230
- min: { T1B1: '1.10.0', T2T1: '2.6.0' },
231
- },
232
228
  {
233
229
  methods: ['getFirmwareHash'],
234
230
  min: { T1B1: '1.11.1', T2T1: '2.5.1' },
@@ -104,6 +104,9 @@ exports.deviceAuthenticityConfig = {
104
104
  '047c32e92dc23894b60b6c182f589a12e4e57f82e48176936f56646c14dd8f0d300fd4737e17501d71deb84127c272c5b797ccf30a7a4531846b9c79866f2892c6',
105
105
  '046482d01c4dbdac60327352d150b5e6d5772cd68732616a0abc5649c49111bc3ba0eb28aa424100efa27cdb98675395df4b9097097e92adecc39f5587306a9fac',
106
106
  '04f96a9fdecc4247c67e083a69037d1794230441270e4bda6d4151eb2e385d576d046d36734dd262e45c8cf3bbe24bdd11c1dc0e58437107d55cea3942f14b7d61',
107
+ '042678d71fcf002a5c6781ecbb48ec99a67c797a2a7a0a2aac2a2aa66681ea4c6df180bf2110ce259cb128aa8a8e966ae1138964a0175de597674ae59b74feac87',
108
+ '0452be582403337ee206509e88713ddc1e1aa7e8265de522988f6af7562c136ee62ea75ce320c713d7d6ed1ceefded828c3284ccdc7c89f1867336aff24566ef3f',
109
+ '04b3117b4173d5792d75988fc5788cdc79a17a4a2168de1d5fd029c56da6da48fd6c4f557531a4a7af924816fc7a7b8cec451d2920c91be52930333e57a1ff2f03',
107
110
  ],
108
111
  debug: {
109
112
  rootPubKeys: [
@@ -17,21 +17,21 @@ const parseFirmware = (json, deviceModel) => {
17
17
  exports.parseFirmware = parseFirmware;
18
18
  const getReleases = (deviceModel) => releases[deviceModel] || [];
19
19
  exports.getReleases = getReleases;
20
- const getChangelog = (releases, features) => {
20
+ const getChangelog = (releases2, features) => {
21
21
  if (features.bootloader_mode) {
22
22
  if (features.firmware_present && features.major_version === 1) {
23
23
  return null;
24
24
  }
25
25
  if (features.firmware_present && features.major_version === 2) {
26
- return releases.filter(r => utils_1.versionUtils.isNewer(r.version, [
26
+ return releases2.filter(r => utils_1.versionUtils.isNewer(r.version, [
27
27
  features.fw_major,
28
28
  features.fw_minor,
29
29
  features.fw_patch,
30
30
  ]));
31
31
  }
32
- return releases;
32
+ return releases2;
33
33
  }
34
- return releases.filter(r => utils_1.versionUtils.isNewer(r.version, [
34
+ return releases2.filter(r => utils_1.versionUtils.isNewer(r.version, [
35
35
  features.major_version,
36
36
  features.minor_version,
37
37
  features.patch_version,
@@ -53,20 +53,20 @@ const isRequired = (changelog) => {
53
53
  return changelog.some(item => item.required);
54
54
  };
55
55
  const isEqual = (release, latest) => utils_1.versionUtils.isEqual(release.version, latest.version);
56
- const getT1BootloaderVersion = (releases, features) => {
56
+ const getT1BootloaderVersion = (releases2, features) => {
57
57
  const { bootloader_mode, major_version, minor_version, patch_version } = features;
58
58
  const versionArray = [major_version, minor_version, patch_version];
59
59
  if (bootloader_mode) {
60
60
  return versionArray;
61
61
  }
62
- const release = releases.find(({ version }) => utils_1.versionUtils.isEqual(version, versionArray));
62
+ const release = releases2.find(({ version }) => utils_1.versionUtils.isEqual(version, versionArray));
63
63
  return (release === null || release === void 0 ? void 0 : release.bootloader_version) || [1, 0, 0];
64
64
  };
65
- const getIntermediaryVersion = (releases, features, offerLatest) => {
65
+ const getIntermediaryVersion = (releases2, features, offerLatest) => {
66
66
  if (features.major_version !== 1 || offerLatest) {
67
67
  return;
68
68
  }
69
- const bootloaderVersion = getT1BootloaderVersion(releases, features);
69
+ const bootloaderVersion = getT1BootloaderVersion(releases2, features);
70
70
  if (utils_1.versionUtils.isNewerOrEqual(bootloaderVersion, [1, 12, 0])) {
71
71
  return 3;
72
72
  }
@@ -34,6 +34,7 @@ export declare const models: {
34
34
  '2': string;
35
35
  '3': string;
36
36
  '4': string;
37
+ '5': string;
37
38
  };
38
39
  };
39
40
  T3W1: {
@@ -29,6 +29,7 @@ exports.models = {
29
29
  '2': 'Violet Ore',
30
30
  '3': 'Green Beryl',
31
31
  '4': 'Bitcoin Orange',
32
+ '5': 'Special Edition',
32
33
  },
33
34
  },
34
35
  T3W1: {
@@ -27,16 +27,16 @@ exports.parseBridgeJSON = parseBridgeJSON;
27
27
  const getBridgeInfo = () => info;
28
28
  exports.getBridgeInfo = getBridgeInfo;
29
29
  const suggestBridgeInstaller = (platform) => {
30
- const info = (0, exports.getBridgeInfo)();
31
- if (!info.packages.find(p => p.preferred)) {
30
+ const info2 = (0, exports.getBridgeInfo)();
31
+ if (!info2.packages.find(p => p.preferred)) {
32
32
  if (platform) {
33
- info.packages = info.packages.map(p => ({
33
+ info2.packages = info2.packages.map(p => ({
34
34
  ...p,
35
35
  preferred: p.platform.indexOf(platform) >= 0,
36
36
  }));
37
37
  }
38
38
  }
39
- return info;
39
+ return info2;
40
40
  };
41
41
  exports.suggestBridgeInstaller = suggestBridgeInstaller;
42
42
  //# sourceMappingURL=transportInfo.js.map
@@ -19,16 +19,16 @@ const info = {
19
19
  const getUdevInfo = () => info;
20
20
  exports.getUdevInfo = getUdevInfo;
21
21
  const suggestUdevInstaller = (platform) => {
22
- const info = (0, exports.getUdevInfo)();
23
- if (!info.packages.find(p => p.preferred)) {
22
+ const info2 = (0, exports.getUdevInfo)();
23
+ if (!info2.packages.find(p => p.preferred)) {
24
24
  if (platform) {
25
- info.packages = info.packages.map(p => ({
25
+ info2.packages = info2.packages.map(p => ({
26
26
  ...p,
27
27
  preferred: p.platform.indexOf(platform) >= 0,
28
28
  }));
29
29
  }
30
30
  }
31
- return info;
31
+ return info2;
32
32
  };
33
33
  exports.suggestUdevInstaller = suggestUdevInstaller;
34
34
  //# sourceMappingURL=udevInfo.js.map
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "9.4.3";
1
+ export declare const VERSION = "9.4.4";
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.4.3';
4
+ exports.VERSION = '9.4.4';
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
@@ -247,8 +247,8 @@ class Device extends utils_1.TypedEmitter {
247
247
  }
248
248
  setCancelableAction(callback) {
249
249
  this.cancelableAction = (e) => callback(e)
250
- .catch(e => {
251
- _log.debug('cancelableAction error', e);
250
+ .catch(e2 => {
251
+ _log.debug('cancelableAction error', e2);
252
252
  })
253
253
  .finally(() => {
254
254
  this.clearCancelableAction();
@@ -290,12 +290,12 @@ class Device extends utils_1.TypedEmitter {
290
290
  if (this.releasePromise) {
291
291
  await this.releasePromise;
292
292
  }
293
- const { staticSessionId, deriveCardano } = this.getState() || {};
294
- if (!this.isUsedHere() ||
295
- ((_a = this.commands) === null || _a === void 0 ? void 0 : _a.disposed) ||
296
- !staticSessionId ||
297
- (!deriveCardano && options.useCardanoDerivation)) {
293
+ const acquireNeeded = !this.isUsedHere() || ((_a = this.commands) === null || _a === void 0 ? void 0 : _a.disposed);
294
+ if (acquireNeeded) {
298
295
  await this.acquire();
296
+ }
297
+ const { staticSessionId, deriveCardano } = this.getState() || {};
298
+ if (acquireNeeded || !staticSessionId || (!deriveCardano && options.useCardanoDerivation)) {
299
299
  try {
300
300
  if (fn) {
301
301
  await this.initialize(!!options.useCardanoDerivation);
@@ -2,7 +2,7 @@ import { TypedEmitter } from '@trezor/utils';
2
2
  import { Transport, TRANSPORT } from '@trezor/transport';
3
3
  import { DEVICE, TransportInfo } from '../events';
4
4
  import { Device } from './Device';
5
- import { ConnectSettings, DeviceUniquePath, Device as DeviceTyped } from '../types';
5
+ import { ConnectSettings, DeviceUniquePath, Device as DeviceTyped, StaticSessionId } from '../types';
6
6
  interface DeviceListEvents {
7
7
  [TRANSPORT.START]: TransportInfo;
8
8
  [TRANSPORT.ERROR]: string;
@@ -56,6 +56,7 @@ export declare class DeviceList extends TypedEmitter<DeviceListEvents> implement
56
56
  getAllDevices(): Device[];
57
57
  getOnlyDevice(): Device | undefined;
58
58
  getDeviceByPath(path: DeviceUniquePath): Device | undefined;
59
+ getDeviceByStaticState(state: StaticSessionId): Device | undefined;
59
60
  transportType(): "BridgeTransport" | "NodeUsbTransport" | "WebUsbTransport" | "UdpTransport";
60
61
  getTransportInfo(): TransportInfo;
61
62
  dispose(): Promise<void>;
@@ -230,6 +230,10 @@ class DeviceList extends utils_1.TypedEmitter {
230
230
  getDeviceByPath(path) {
231
231
  return this.getAllDevices().find(d => d.getUniquePath() === path);
232
232
  }
233
+ getDeviceByStaticState(state) {
234
+ const deviceId = state.split('@')[1].split(':')[0];
235
+ return this.getAllDevices().find(d => { var _a; return ((_a = d.features) === null || _a === void 0 ? void 0 : _a.device_id) === deviceId; });
236
+ }
233
237
  transportType() {
234
238
  return this.transport.name;
235
239
  }
@@ -189,6 +189,7 @@ export interface UpdateCustomFee {
189
189
  export interface BundleProgress<R> {
190
190
  type: typeof UI_REQUEST.BUNDLE_PROGRESS;
191
191
  payload: {
192
+ total: number;
192
193
  progress: number;
193
194
  response: R;
194
195
  error?: string;
package/lib/factory.js CHANGED
@@ -126,7 +126,6 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
126
126
  firmwareUpdate: params => call({ ...params, method: 'firmwareUpdate' }),
127
127
  recoveryDevice: params => call({ ...params, method: 'recoveryDevice' }),
128
128
  getCoinInfo: params => call({ ...params, method: 'getCoinInfo' }),
129
- rebootToBootloader: params => call({ ...params, method: 'rebootToBootloader' }),
130
129
  setBrightness: params => call({ ...params, method: 'setBrightness' }),
131
130
  setBusy: params => call({ ...params, method: 'setBusy' }),
132
131
  setProxy: params => call({ ...params, method: 'setProxy' }),
@@ -58,7 +58,6 @@ import { nemSignTransaction } from './nemSignTransaction';
58
58
  import { off } from './off';
59
59
  import { on } from './on';
60
60
  import { pushTransaction } from './pushTransaction';
61
- import { rebootToBootloader } from './rebootToBootloader';
62
61
  import { recoveryDevice } from './recoveryDevice';
63
62
  import { removeAllListeners } from './removeAllListeners';
64
63
  import { requestLogin } from './requestLogin';
@@ -146,7 +145,6 @@ export interface TrezorConnect {
146
145
  off: typeof off;
147
146
  on: typeof on;
148
147
  pushTransaction: typeof pushTransaction;
149
- rebootToBootloader: typeof rebootToBootloader;
150
148
  recoveryDevice: typeof recoveryDevice;
151
149
  removeAllListeners: typeof removeAllListeners;
152
150
  requestLogin: typeof requestLogin;
@@ -54,7 +54,7 @@ const getUnavailableCapabilities = (features, coins) => {
54
54
  }
55
55
  else {
56
56
  const occurrences = coins.filter(coin => shortcut == coin.shortcut.toLowerCase());
57
- const allUnsupported = occurrences.every(info => !info.support || info.support[key] === false);
57
+ const allUnsupported = occurrences.every(info2 => !info2.support || info2.support[key] === false);
58
58
  if (allUnsupported) {
59
59
  list[shortcut] = 'no-support';
60
60
  }
@@ -29,7 +29,7 @@ const hasHexPrefix = (str) => str.slice(0, 2).toLowerCase() === '0x';
29
29
  exports.hasHexPrefix = hasHexPrefix;
30
30
  const stripHexPrefix = (str) => ((0, exports.hasHexPrefix)(str) ? str.slice(2) : str);
31
31
  exports.stripHexPrefix = stripHexPrefix;
32
- const addHexPrefix = (str) => (str && !(0, exports.hasHexPrefix)(str) ? `0x${str}` : str);
32
+ const addHexPrefix = (str) => str !== undefined && !(0, exports.hasHexPrefix)(str) ? `0x${str}` : str;
33
33
  exports.addHexPrefix = addHexPrefix;
34
34
  const isHexString = (value, length) => {
35
35
  if (typeof value !== 'string' || !value.match(/^(0x|0X)?[0-9A-Fa-f]*$/)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.4.3",
3
+ "version": "9.4.4",
4
4
  "author": "Trezor <info@trezor.io>",
5
5
  "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
6
6
  "description": "High-level javascript interface for Trezor hardware wallet.",
@@ -52,7 +52,6 @@
52
52
  "!**/*.map"
53
53
  ],
54
54
  "scripts": {
55
- "lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
56
55
  "test:unit": "jest --version && jest",
57
56
  "depcheck": "yarn g:depcheck",
58
57
  "type-check": "yarn g:tsc --build",
@@ -73,22 +72,23 @@
73
72
  "@ethereumjs/common": "^4.4.0",
74
73
  "@ethereumjs/tx": "^5.4.0",
75
74
  "@fivebinaries/coin-selection": "2.2.1",
76
- "@trezor/blockchain-link": "2.3.2",
77
- "@trezor/blockchain-link-types": "1.2.2",
78
- "@trezor/connect-analytics": "1.2.2",
79
- "@trezor/connect-common": "0.2.3",
80
- "@trezor/protobuf": "1.2.3",
81
- "@trezor/protocol": "1.2.1",
82
- "@trezor/schema-utils": "1.2.2",
83
- "@trezor/transport": "1.3.3",
84
- "@trezor/utils": "9.2.2",
85
- "@trezor/utxo-lib": "2.2.2",
75
+ "@trezor/blockchain-link": "2.3.3",
76
+ "@trezor/blockchain-link-types": "1.2.3",
77
+ "@trezor/connect-analytics": "1.2.3",
78
+ "@trezor/connect-common": "0.2.4",
79
+ "@trezor/protobuf": "1.2.4",
80
+ "@trezor/protocol": "1.2.2",
81
+ "@trezor/schema-utils": "1.2.3",
82
+ "@trezor/transport": "1.3.4",
83
+ "@trezor/utils": "9.2.3",
84
+ "@trezor/utxo-lib": "2.2.3",
86
85
  "blakejs": "^1.2.1",
87
86
  "bs58": "^6.0.0",
88
87
  "bs58check": "^4.0.0",
89
88
  "cross-fetch": "^4.0.0"
90
89
  },
91
90
  "devDependencies": {
91
+ "@trezor/eslint": "1.0.0",
92
92
  "@trezor/trezor-user-env-link": "1.0.2",
93
93
  "@types/karma": "^6.3.8",
94
94
  "babel-loader": "^9.1.3",
@@ -100,9 +100,11 @@
100
100
  "karma-jasmine-async": "^0.0.1",
101
101
  "karma-sourcemap-loader": "^0.4.0",
102
102
  "karma-webpack": "^5.0.1",
103
+ "node-fetch": "^2.6.4",
103
104
  "node-libs-browser": "^2.2.1",
104
105
  "ts-node": "^10.9.1",
105
106
  "tsx": "^4.16.3",
107
+ "web3-utils": "^4.3.2",
106
108
  "webpack": "^5.96.1",
107
109
  "ws": "^8.18.0"
108
110
  },
@@ -1,18 +0,0 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import { PROTO } from '../constants';
3
- export default class RebootToBootloader extends AbstractMethod<'rebootToBootloader', PROTO.RebootToBootloader> {
4
- init(): void;
5
- get info(): string;
6
- get confirmation(): {
7
- view: "device-management";
8
- customConfirmButton: {
9
- className: string;
10
- label: string;
11
- };
12
- label: string;
13
- };
14
- run(): Promise<{
15
- message: string;
16
- }>;
17
- }
18
- //# sourceMappingURL=rebootToBootloader.d.ts.map
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schema_utils_1 = require("@trezor/schema-utils");
4
- const AbstractMethod_1 = require("../core/AbstractMethod");
5
- const paramsValidator_1 = require("./common/paramsValidator");
6
- const events_1 = require("../events");
7
- const constants_1 = require("../constants");
8
- class RebootToBootloader extends AbstractMethod_1.AbstractMethod {
9
- init() {
10
- this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
11
- this.skipFinalReload = true;
12
- this.keepSession = false;
13
- this.requiredPermissions = ['management'];
14
- this.useDeviceState = false;
15
- this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
16
- const { payload } = this;
17
- (0, schema_utils_1.Assert)(constants_1.PROTO.RebootToBootloader, payload);
18
- this.params = {
19
- boot_command: payload.boot_command,
20
- firmware_header: payload.firmware_header,
21
- language_data_length: payload.language_data_length,
22
- };
23
- }
24
- get info() {
25
- return 'Reboot to bootloader';
26
- }
27
- get confirmation() {
28
- return {
29
- view: 'device-management',
30
- customConfirmButton: {
31
- className: 'confirm',
32
- label: `Reboot`,
33
- },
34
- label: 'Are you sure you want to reboot to bootloader?',
35
- };
36
- }
37
- async run() {
38
- const cmd = this.device.getCommands();
39
- const response = await cmd.typedCall('RebootToBootloader', 'Success', this.params);
40
- return response.message;
41
- }
42
- }
43
- exports.default = RebootToBootloader;
44
- //# sourceMappingURL=rebootToBootloader.js.map
@@ -1,4 +0,0 @@
1
- import type { PROTO } from '../../constants';
2
- import type { Params, Response } from '../params';
3
- export declare function rebootToBootloader(params?: Params<PROTO.RebootToBootloader>): Response<PROTO.Success>;
4
- //# sourceMappingURL=rebootToBootloader.d.ts.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=rebootToBootloader.js.map