@trezor/connect 9.2.2 → 9.2.4-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 (174) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +1 -1
  3. package/lib/api/applyFlags.d.ts +8 -1
  4. package/lib/api/applyFlags.js +3 -8
  5. package/lib/api/applySettings.d.ts +8 -1
  6. package/lib/api/applySettings.js +3 -8
  7. package/lib/api/backupDevice.d.ts +10 -2
  8. package/lib/api/backupDevice.js +12 -9
  9. package/lib/api/binance/api/binanceGetAddress.d.ts +4 -3
  10. package/lib/api/binance/api/binanceGetAddress.js +8 -22
  11. package/lib/api/binance/api/binanceGetPublicKey.d.ts +4 -2
  12. package/lib/api/binance/api/binanceGetPublicKey.js +6 -18
  13. package/lib/api/blockchainDisconnect.d.ts +1 -0
  14. package/lib/api/blockchainDisconnect.js +3 -4
  15. package/lib/api/blockchainEstimateFee.d.ts +1 -0
  16. package/lib/api/blockchainEstimateFee.js +6 -4
  17. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
  18. package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
  19. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
  20. package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
  21. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
  22. package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
  23. package/lib/api/blockchainGetTransactions.d.ts +1 -0
  24. package/lib/api/blockchainGetTransactions.js +3 -1
  25. package/lib/api/blockchainSetCustomBackend.js +1 -5
  26. package/lib/api/blockchainSubscribe.d.ts +2 -0
  27. package/lib/api/blockchainSubscribe.js +13 -2
  28. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
  29. package/lib/api/blockchainSubscribeFiatRates.js +3 -1
  30. package/lib/api/blockchainUnsubscribe.d.ts +1 -0
  31. package/lib/api/blockchainUnsubscribe.js +5 -2
  32. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
  33. package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
  34. package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -3
  35. package/lib/api/cardano/api/cardanoGetAddress.js +8 -22
  36. package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +4 -3
  37. package/lib/api/cardano/api/cardanoGetPublicKey.js +9 -31
  38. package/lib/api/changeLanguage.d.ts +8 -2
  39. package/lib/api/changeLanguage.js +10 -51
  40. package/lib/api/composeTransaction.d.ts +2 -0
  41. package/lib/api/composeTransaction.js +10 -5
  42. package/lib/api/eos/api/eosGetPublicKey.d.ts +4 -2
  43. package/lib/api/eos/api/eosGetPublicKey.js +6 -18
  44. package/lib/api/eos/eosSignTx.d.ts +3 -3
  45. package/lib/api/ethereum/api/ethereumGetAddress.d.ts +4 -3
  46. package/lib/api/ethereum/api/ethereumGetAddress.js +4 -20
  47. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +4 -2
  48. package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -10
  49. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
  50. package/lib/api/ethereum/ethereumDefinitions.js +1 -0
  51. package/lib/api/firmware/index.d.ts +2 -0
  52. package/lib/api/firmware/index.js +5 -1
  53. package/lib/api/firmware/parseFirmwareHeaders.d.ts +5 -0
  54. package/lib/api/firmware/parseFirmwareHeaders.js +35 -0
  55. package/lib/api/firmware/uploadFirmware.d.ts +1 -1
  56. package/lib/api/firmware/uploadFirmware.js +9 -1
  57. package/lib/api/getAccountDescriptor.d.ts +5 -3
  58. package/lib/api/getAccountDescriptor.js +8 -21
  59. package/lib/api/getAccountInfo.d.ts +23 -7
  60. package/lib/api/getAccountInfo.js +16 -28
  61. package/lib/api/getAddress.d.ts +4 -3
  62. package/lib/api/getAddress.js +8 -22
  63. package/lib/api/getCoinInfo.d.ts +3 -0
  64. package/lib/api/getFeatures.d.ts +1 -0
  65. package/lib/api/getOwnershipId.d.ts +4 -2
  66. package/lib/api/getOwnershipId.js +4 -15
  67. package/lib/api/getOwnershipProof.d.ts +4 -2
  68. package/lib/api/getOwnershipProof.js +4 -15
  69. package/lib/api/getPublicKey.d.ts +5 -4
  70. package/lib/api/getPublicKey.js +12 -35
  71. package/lib/api/index.d.ts +0 -1
  72. package/lib/api/index.js +1 -3
  73. package/lib/api/nem/api/nemGetAddress.d.ts +4 -3
  74. package/lib/api/nem/api/nemGetAddress.js +4 -20
  75. package/lib/api/pushTransaction.d.ts +1 -0
  76. package/lib/api/pushTransaction.js +2 -1
  77. package/lib/api/rebootToBootloader.d.ts +8 -2
  78. package/lib/api/rebootToBootloader.js +3 -10
  79. package/lib/api/recoveryDevice.d.ts +8 -1
  80. package/lib/api/recoveryDevice.js +3 -7
  81. package/lib/api/resetDevice.d.ts +5 -3
  82. package/lib/api/resetDevice.js +5 -12
  83. package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -3
  84. package/lib/api/ripple/api/rippleGetAddress.js +4 -20
  85. package/lib/api/signTransaction.d.ts +1 -0
  86. package/lib/api/signTransaction.js +5 -3
  87. package/lib/api/solana/api/solanaGetAddress.d.ts +4 -3
  88. package/lib/api/solana/api/solanaGetAddress.js +7 -28
  89. package/lib/api/solana/api/solanaGetPublicKey.d.ts +4 -3
  90. package/lib/api/solana/api/solanaGetPublicKey.js +7 -27
  91. package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -3
  92. package/lib/api/stellar/api/stellarGetAddress.js +4 -20
  93. package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -3
  94. package/lib/api/tezos/api/tezosGetAddress.js +4 -20
  95. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +4 -2
  96. package/lib/api/tezos/api/tezosGetPublicKey.js +6 -18
  97. package/lib/api/wipeDevice.d.ts +8 -2
  98. package/lib/api/wipeDevice.js +3 -10
  99. package/lib/backend/BackendManager.d.ts +6 -4
  100. package/lib/backend/BackendManager.js +36 -28
  101. package/lib/backend/Blockchain.d.ts +15 -4
  102. package/lib/backend/Blockchain.js +27 -17
  103. package/lib/backend/BlockchainLink.d.ts +3 -3
  104. package/lib/backend/BlockchainLink.js +3 -3
  105. package/lib/constants/errors.d.ts +1 -0
  106. package/lib/constants/errors.js +1 -0
  107. package/lib/core/AbstractMethod.d.ts +4 -8
  108. package/lib/core/AbstractMethod.js +7 -28
  109. package/lib/core/index.d.ts +2 -1
  110. package/lib/core/index.js +260 -231
  111. package/lib/core/onCallFirmwareUpdate.d.ts +31 -0
  112. package/lib/core/onCallFirmwareUpdate.js +259 -0
  113. package/lib/data/DataManager.d.ts +22 -0
  114. package/lib/data/DataManager.js +7 -3
  115. package/lib/data/analyticsInfo.d.ts +2 -2
  116. package/lib/data/analyticsInfo.js +6 -7
  117. package/lib/data/coinInfo.d.ts +14 -0
  118. package/lib/data/config.d.ts +22 -0
  119. package/lib/data/config.js +5 -1
  120. package/lib/data/connectSettings.js +3 -0
  121. package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
  122. package/lib/data/deviceAuthenticityConfig.js +27 -3
  123. package/lib/data/firmwareInfo.js +2 -6
  124. package/lib/data/getLanguage.d.ts +6 -0
  125. package/lib/data/getLanguage.js +10 -0
  126. package/lib/data/models.d.ts +9 -0
  127. package/lib/data/models.js +9 -0
  128. package/lib/data/version.d.ts +1 -1
  129. package/lib/data/version.js +1 -1
  130. package/lib/device/Device.d.ts +13 -2
  131. package/lib/device/Device.js +55 -7
  132. package/lib/device/DeviceCommands.d.ts +3 -15
  133. package/lib/device/DeviceCommands.js +1 -43
  134. package/lib/device/DeviceList.d.ts +1 -1
  135. package/lib/device/DeviceList.js +22 -19
  136. package/lib/events/blockchain.d.ts +3 -0
  137. package/lib/events/index.d.ts +1 -0
  138. package/lib/events/ui-request.d.ts +13 -1
  139. package/lib/events/ui-request.js +1 -0
  140. package/lib/index.js +2 -2
  141. package/lib/types/api/authenticateDevice.d.ts +9 -0
  142. package/lib/types/api/backupDevice.d.ts +2 -2
  143. package/lib/types/api/bitcoin/index.d.ts +1 -0
  144. package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
  145. package/lib/types/api/blockchainSubscribe.d.ts +1 -0
  146. package/lib/types/api/composeTransaction.d.ts +2 -0
  147. package/lib/types/api/dispose.d.ts +1 -1
  148. package/lib/types/api/firmwareUpdate.d.ts +7 -6
  149. package/lib/types/api/firmwareUpdate.js +1 -3
  150. package/lib/types/api/getAccountInfo.d.ts +1 -0
  151. package/lib/types/api/getCoinInfo.d.ts +4 -2
  152. package/lib/types/api/nemGetAddress.d.ts +11 -4
  153. package/lib/types/api/nemGetAddress.js +9 -0
  154. package/lib/types/api/pushTransaction.d.ts +1 -0
  155. package/lib/types/api/pushTransaction.js +1 -0
  156. package/lib/types/api/resetDevice.d.ts +1 -15
  157. package/lib/types/api/resetDevice.js +0 -9
  158. package/lib/types/api/setBusy.d.ts +2 -2
  159. package/lib/types/coinInfo.d.ts +15 -7
  160. package/lib/types/coinInfo.js +8 -6
  161. package/lib/types/firmware.d.ts +5 -15
  162. package/lib/types/params.d.ts +1 -0
  163. package/lib/types/params.js +1 -2
  164. package/lib/types/settings.d.ts +1 -0
  165. package/lib/utils/assetUtils.js +18 -8
  166. package/lib/utils/popupPromiseManager.d.ts +8 -0
  167. package/lib/utils/popupPromiseManager.js +21 -0
  168. package/lib/utils/uiPromiseManager.d.ts +38 -0
  169. package/lib/utils/uiPromiseManager.js +47 -0
  170. package/lib/workers/workers-browser.d.ts +3 -1
  171. package/lib/workers/workers-browser.js +2 -2
  172. package/package.json +10 -10
  173. package/lib/api/firmwareUpdate.d.ts +0 -19
  174. package/lib/api/firmwareUpdate.js +0 -78
package/CHANGELOG.md CHANGED
@@ -1,3 +1,105 @@
1
+ | Package | stable | canary |
2
+ | -------------------------------- | :----: | :----------: |
3
+ | npm @trezor/connect | 9.2.2 | 9.2.4-beta.1 |
4
+ | npm @trezor/connect-web | 9.2.2 | 9.2.4-beta.1 |
5
+ | npm @trezor/connect-webextension | 9.2.2 | 9.2.4-beta.1 |
6
+ | connect.trezor.io/9 | 9.2.2 | x |
7
+
8
+ # 9.2.4-beta.1
9
+
10
+ - feat(connect): BackupDevice now has params (4120912)
11
+ - chore(connect): update protobuf messages (41bff13)
12
+ - chore(connect): add new TS3 CA pubkeys and update timestamp (3ae06ac)
13
+ - chore(connect): remove deprecated code, bump required fw to 1.8.1/2.1.0, fix typo in log, rename firmwareUpdate_v2 to firmwareUpdate (8af325a, 2f14ff6 649a197, b39030c, b67170c)
14
+ - chore(connect): popupPromise improvement, pin retries, invalidDeviceState, flattened onCall/inner (320c5a9,6515f13, 7666994, 99ac0e5, 4aa2b46, fa0974d, 9188727, 08a093b, dd6437e, 27d5a44)
15
+ - fix(connect): intermediary reconnect improved, device authenticity, multi-apps synchronization, reading translations, bin_outputs in txcache (115c718, de1b969, 140ec9a a881142, 88d7608, 0bb13d3)
16
+ - fix(connect): bin_outputs in txcache (0bb13d3)
17
+
18
+ ## connect-popup
19
+
20
+ In general measures to address popup closing unexpectedly were taken. Update of content-script.js will be needed to make these changes effective.
21
+
22
+ - fix(connect-popup): update text in selectAccount (21f4382)
23
+ - fix(connect-popup): add delay before popup bootstrap to allow contentscript load (00b2056)
24
+ - fix(connect-popup): webextension example e2e (b9cce02)
25
+ - fix(connect-popup): typo in a comment (8e21eeb)
26
+ - fix(connect-popup): queue messages sent before init (8850665)
27
+ - fix(connect-popup): delay popup.js loading to allow content script to init (92d15bc)
28
+ - fix(connect-popup): wait for POPUP.LOADED in webextension (cb18673)
29
+
30
+ ## connect-explorer
31
+
32
+ Connect-explorer has been completely revamped into a new design :tada:
33
+
34
+ ## Dependencies update
35
+
36
+ - npm-release: @trezor/blockchain-link-utils 1.0.18-beta.1
37
+ - npm-release: @trezor/blockchain-link-types 1.0.17-beta.1
38
+ - npm-release: @trezor/analytics 1.0.17-beta.1
39
+ - npm-release: @trezor/connect-common 0.0.33-beta.1
40
+ - npm-release: @trezor/env-utils 1.0.17-beta.1
41
+ - npm-release: @trezor/protobuf 1.0.13-beta.1
42
+ - npm-release: @trezor/schema-utils 1.0.4-beta.1
43
+ - npm-release: @trezor/protocol 1.0.9-beta.1
44
+
45
+ # 9.2.3
46
+
47
+ - fix(connect): worker-loader for solana and hanged calls over webusb (46c0e96, 172fa22)
48
+ - chore(connect): improve type for releases and pick model and coin support type (996e96d, 273591e)
49
+ - feat(connect): add T3T1 pubkeys and T3T1 releases.json (edca868, a984008, 1bc4569)
50
+ - feat(connect): add `_extendWebextensionLifetime` option (720b61b)
51
+ - feat(connect): allow separate accounts/blocks subscription (98e3b28)
52
+ - feat(connect): support identity in blockchain methods (2fbb57f)
53
+ - test(connect): fix BackendManager tests (0318aea)
54
+ - feat(connect): support identities in BackendManager (76767be)
55
+ - feat(connect): automatically update language blob when outdated and move changeLanguage logic to Device (425b52b, 04d4fb8)
56
+ - fix(connect): always show device selection when bridge and using core in popup (5f1191e)
57
+
58
+ ## connect-example
59
+
60
+ - Use `_extendWebextensionLifetime` for extending life time of service worker in example mv3-sw (fe537c0)
61
+
62
+ ## connect-webextension
63
+
64
+ - Reconnection when service worker goes inactive and option to extend life of service worker (39dcde0, 0377b28)
65
+
66
+ ## connect-explorer-nextra and connect-explorer-theme
67
+
68
+ - Improve schemas documentation and styling (367f458, a23fa02, ee7c4f6, 667c802, 05b68fa, 6c2e298, 9150147, 81591dc, bb84950, 8ca02e6, c8f144a, 003854c, 8951663, b284b25, d14c026, d69dee1, 1c82b8f)
69
+
70
+ ## mobile
71
+
72
+ - fix Connect firmware assets import #12090) (4abe34e)
73
+
74
+ ## trezor-user-env-link
75
+
76
+ - Type updates (68be4d2)
77
+
78
+ ## connect-popup
79
+
80
+ - test new webextension select device behavior and check remember device by default for mv3 webextension (1aab629, eb6cf5d)
81
+
82
+ ## protobuf
83
+
84
+ - clean up type of backup_type in schema (19b7bb2)
85
+
86
+ ## connect-common
87
+
88
+ - Add Czech to available FW translations (4a1aa82)
89
+
90
+ ## Dependencies update
91
+
92
+ - npm-release: @trezor/blockchain-link 2.1.29
93
+ - npm-release: @trezor/blockchain-link-utils 1.0.17
94
+ - npm-release: @trezor/blockchain-link-types 1.0.16
95
+ - npm-release: @trezor/connect-common 0.0.32
96
+ - npm-release: @trezor/env-utils 1.0.16
97
+ - npm-release: @trezor/transport 1.1.28
98
+ - npm-release: @trezor/protobuf 1.0.12
99
+ - npm-release: @trezor/protocol 1.0.8
100
+ - npm-release: @trezor/utxo-lib 2.0.9
101
+ - npm-release: @trezor/connect 9.2.3
102
+
1
103
  # 9.2.2
2
104
 
3
105
  Main focus of this release is to allow saving device sessions in webextension, so user's don't have to enter the passphrase repeatedly.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.2.2
3
+ API version 9.2.4-beta.1
4
4
 
5
5
  [![Build Status](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml/badge.svg)](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
6
6
  [![NPM](https://img.shields.io/npm/v/@trezor/connect.svg)](https://www.npmjs.org/package/@trezor/connect)
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  export default class ApplyFlags extends AbstractMethod<'applyFlags', PROTO.ApplyFlags> {
4
4
  init(): void;
5
- confirmation(): Promise<boolean>;
5
+ get confirmation(): {
6
+ view: "device-management";
7
+ customConfirmButton: {
8
+ className: string;
9
+ label: string;
10
+ };
11
+ label: string;
12
+ };
6
13
  run(): Promise<{
7
14
  message: string;
8
15
  }>;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const events_1 = require("../events");
5
4
  const constants_1 = require("../constants");
6
5
  const schema_utils_1 = require("@trezor/schema-utils");
7
6
  class ApplyFlags extends AbstractMethod_1.AbstractMethod {
@@ -14,19 +13,15 @@ class ApplyFlags extends AbstractMethod_1.AbstractMethod {
14
13
  flags: payload.flags,
15
14
  };
16
15
  }
17
- async confirmation() {
18
- await this.getPopupPromise().promise;
19
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
20
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
16
+ get confirmation() {
17
+ return {
21
18
  view: 'device-management',
22
19
  customConfirmButton: {
23
20
  className: 'confirm',
24
21
  label: 'Proceed',
25
22
  },
26
23
  label: 'Do you really want to apply flags?',
27
- }));
28
- const uiResp = await uiPromise.promise;
29
- return uiResp.payload;
24
+ };
30
25
  }
31
26
  async run() {
32
27
  const cmd = this.device.getCommands();
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  export default class ApplySettings extends AbstractMethod<'applySettings', PROTO.ApplySettings> {
4
4
  init(): void;
5
- confirmation(): Promise<boolean>;
5
+ get confirmation(): {
6
+ view: "device-management";
7
+ customConfirmButton: {
8
+ className: string;
9
+ label: string;
10
+ };
11
+ label: string;
12
+ };
6
13
  run(): Promise<{
7
14
  message: string;
8
15
  }>;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const events_1 = require("../events");
5
4
  const schema_utils_1 = require("@trezor/schema-utils");
6
5
  const applySettings_1 = require("../types/api/applySettings");
7
6
  class ApplySettings extends AbstractMethod_1.AbstractMethod {
@@ -23,19 +22,15 @@ class ApplySettings extends AbstractMethod_1.AbstractMethod {
23
22
  _passphrase_source: payload.passphrase_source,
24
23
  };
25
24
  }
26
- async confirmation() {
27
- await this.getPopupPromise().promise;
28
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
29
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
25
+ get confirmation() {
26
+ return {
30
27
  view: 'device-management',
31
28
  customConfirmButton: {
32
29
  className: 'confirm',
33
30
  label: 'Proceed',
34
31
  },
35
32
  label: 'Do you really want to change device settings?',
36
- }));
37
- const uiResp = await uiPromise.promise;
38
- return uiResp.payload;
33
+ };
39
34
  }
40
35
  async run() {
41
36
  const cmd = this.device.getCommands();
@@ -1,7 +1,15 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
- export default class BackupDevice extends AbstractMethod<'backupDevice'> {
2
+ import { PROTO } from '../constants';
3
+ export default class BackupDevice extends AbstractMethod<'backupDevice', PROTO.BackupDevice> {
3
4
  init(): void;
4
- confirmation(): Promise<boolean>;
5
+ get confirmation(): {
6
+ view: "device-management";
7
+ customConfirmButton: {
8
+ className: string;
9
+ label: string;
10
+ };
11
+ label: string;
12
+ };
5
13
  run(): Promise<{
6
14
  message: string;
7
15
  }>;
@@ -1,29 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const events_1 = require("../events");
4
+ const constants_1 = require("../constants");
5
+ const schema_utils_1 = require("@trezor/schema-utils");
5
6
  class BackupDevice extends AbstractMethod_1.AbstractMethod {
6
7
  init() {
7
8
  this.requiredPermissions = ['management'];
8
9
  this.useDeviceState = false;
10
+ const { payload } = this;
11
+ (0, schema_utils_1.Assert)(constants_1.PROTO.BackupDevice, payload);
12
+ this.params = {
13
+ group_threshold: payload.group_threshold,
14
+ groups: payload.groups,
15
+ };
9
16
  }
10
- async confirmation() {
11
- await this.getPopupPromise().promise;
12
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
13
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
17
+ get confirmation() {
18
+ return {
14
19
  view: 'device-management',
15
20
  customConfirmButton: {
16
21
  className: 'confirm',
17
22
  label: 'Proceed',
18
23
  },
19
24
  label: 'Do you want to initiate backup procedure?',
20
- }));
21
- const uiResp = await uiPromise.promise;
22
- return uiResp.payload;
25
+ };
23
26
  }
24
27
  async run() {
25
28
  const cmd = this.device.getCommands();
26
- const response = await cmd.typedCall('BackupDevice', 'Success');
29
+ const response = await cmd.typedCall('BackupDevice', 'Success', this.params);
27
30
  return response.message;
28
31
  }
29
32
  }
@@ -6,7 +6,6 @@ type Params = PROTO.BinanceGetAddress & {
6
6
  export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress', Params[]> {
7
7
  hasBundle?: boolean;
8
8
  progress: number;
9
- confirmed?: boolean;
10
9
  init(): void;
11
10
  get info(): string;
12
11
  getButtonRequestData(code: string): {
@@ -14,8 +13,10 @@ export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress
14
13
  serializedPath: string;
15
14
  address: string;
16
15
  } | undefined;
17
- confirmation(): Promise<boolean>;
18
- noBackupConfirmation(): Promise<boolean>;
16
+ get confirmation(): {
17
+ view: "export-address";
18
+ label: string;
19
+ } | undefined;
19
20
  _call({ address_n, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -15,6 +15,7 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
15
15
  this.progress = 0;
16
16
  }
17
17
  init() {
18
+ this.noBackupConfirmationMode = 'always';
18
19
  this.requiredPermissions = ['read'];
19
20
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
20
21
  this.hasBundle = !!this.payload.bundle;
@@ -35,7 +36,6 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
35
36
  this.params.length === 1 &&
36
37
  typeof this.params[0].address === 'string' &&
37
38
  this.params[0].show_display;
38
- this.confirmed = useEventListener;
39
39
  this.useUi = !useEventListener;
40
40
  }
41
41
  get info() {
@@ -53,27 +53,13 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
53
53
  };
54
54
  }
55
55
  }
56
- async confirmation() {
57
- if (this.confirmed)
58
- return true;
59
- await this.getPopupPromise().promise;
60
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
61
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
62
- view: 'export-address',
63
- label: this.info,
64
- }));
65
- const uiResp = await uiPromise.promise;
66
- this.confirmed = uiResp.payload;
67
- return this.confirmed;
68
- }
69
- async noBackupConfirmation() {
70
- await this.getPopupPromise().promise;
71
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
72
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
73
- view: 'no-backup',
74
- }));
75
- const uiResp = await uiPromise.promise;
76
- return uiResp.payload;
56
+ get confirmation() {
57
+ return !this.useUi
58
+ ? undefined
59
+ : {
60
+ view: 'export-address',
61
+ label: this.info,
62
+ };
77
63
  }
78
64
  async _call({ address_n, show_display, chunkify }) {
79
65
  const cmd = this.device.getCommands();
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../../../core/AbstractMethod';
2
2
  import type { PROTO } from '../../../constants';
3
3
  export default class BinanceGetPublicKey extends AbstractMethod<'binanceGetPublicKey', PROTO.BinanceGetPublicKey[]> {
4
4
  hasBundle?: boolean;
5
- confirmed?: boolean;
6
5
  init(): void;
7
6
  get info(): string;
8
- confirmation(): Promise<boolean>;
7
+ get confirmation(): {
8
+ view: "export-address";
9
+ label: string;
10
+ };
9
11
  run(): Promise<{
10
12
  path: number[];
11
13
  publicKey: string;
@@ -27,25 +27,13 @@ class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
27
27
  get info() {
28
28
  return 'Export Binance public key';
29
29
  }
30
- async confirmation() {
31
- if (this.confirmed)
32
- return true;
33
- await this.getPopupPromise().promise;
34
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
35
- let label;
36
- if (this.params.length > 1) {
37
- label = 'Export multiple Binance public keys';
38
- }
39
- else {
40
- label = `Export Binance public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
41
- }
42
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
30
+ get confirmation() {
31
+ return {
43
32
  view: 'export-address',
44
- label,
45
- }));
46
- const uiResp = await uiPromise.promise;
47
- this.confirmed = uiResp.payload;
48
- return this.confirmed;
33
+ label: this.params.length > 1
34
+ ? 'Export multiple Binance public keys'
35
+ : `Export Binance public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
36
+ };
49
37
  }
50
38
  async run() {
51
39
  const responses = [];
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  };
6
7
  export default class BlockchainDisconnect extends AbstractMethod<'blockchainDisconnect', Params> {
7
8
  init(): void;
@@ -20,16 +20,15 @@ class BlockchainDisconnect extends AbstractMethod_1.AbstractMethod {
20
20
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
21
21
  this.params = {
22
22
  coinInfo,
23
+ identity: payload.identity,
23
24
  };
24
25
  }
25
26
  get info() {
26
27
  return '';
27
28
  }
28
29
  run() {
29
- const backend = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut);
30
- if (backend) {
31
- backend.disconnect();
32
- }
30
+ const backend = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut, this.params.identity);
31
+ backend === null || backend === void 0 ? void 0 : backend.disconnect();
33
32
  return Promise.resolve({ disconnected: true });
34
33
  }
35
34
  }
@@ -2,6 +2,7 @@ import { Payload, MethodReturnType, AbstractMethod } from '../core/AbstractMetho
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  request: Payload<'blockchainEstimateFee'>['request'];
6
7
  };
7
8
  export default class BlockchainEstimateFee extends AbstractMethod<'blockchainEstimateFee', Params> {
@@ -13,9 +13,10 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
13
13
  const { payload } = this;
14
14
  (0, paramsValidator_1.validateParams)(payload, [
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  { name: 'request', type: 'object' },
17
18
  ]);
18
- const { request } = payload;
19
+ const { request, identity } = payload;
19
20
  if (request) {
20
21
  (0, paramsValidator_1.validateParams)(request, [
21
22
  { name: 'blocks', type: 'array' },
@@ -40,11 +41,12 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
40
41
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
41
42
  this.params = {
42
43
  coinInfo,
44
+ identity,
43
45
  request,
44
46
  };
45
47
  }
46
48
  async run() {
47
- const { coinInfo, request } = this.params;
49
+ const { coinInfo, identity, request } = this.params;
48
50
  const feeInfo = {
49
51
  blockTime: coinInfo.blockTime,
50
52
  minFee: coinInfo.minFee,
@@ -55,13 +57,13 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
55
57
  if (request && request.feeLevels) {
56
58
  const fees = new Fees_1.FeeLevels(coinInfo);
57
59
  if (request.feeLevels === 'smart' && coinInfo.shortcut !== 'DOGE') {
58
- const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
60
+ const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
59
61
  await fees.load(backend);
60
62
  }
61
63
  feeInfo.levels = fees.levels;
62
64
  }
63
65
  else {
64
- const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
66
+ const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
65
67
  feeInfo.levels = await backend.estimateFee(request || {});
66
68
  }
67
69
  return feeInfo;
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  request: Omit<Payload<'blockchainGetAccountBalanceHistory'>, 'method' | 'coin'>;
6
7
  };
7
8
  export default class BlockchainGetAccountBalanceHistory extends AbstractMethod<'blockchainGetAccountBalanceHistory', Params> {
@@ -12,6 +12,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
12
12
  const { payload } = this;
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'coin', type: 'string', required: true },
15
+ { name: 'identity', type: 'string' },
15
16
  { name: 'descriptor', type: 'string', required: true },
16
17
  { name: 'from', type: 'number' },
17
18
  { name: 'to', type: 'number' },
@@ -24,6 +25,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
24
25
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
25
26
  this.params = {
26
27
  coinInfo,
28
+ identity: payload.identity,
27
29
  request: {
28
30
  descriptor: payload.descriptor,
29
31
  from: payload.from,
@@ -33,7 +35,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
33
35
  };
34
36
  }
35
37
  async run() {
36
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
38
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
37
39
  return backend.getAccountBalanceHistory(this.params.request);
38
40
  }
39
41
  }
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  currencies: Payload<'blockchainGetCurrentFiatRates'>['currencies'];
6
7
  token: Payload<'blockchainGetCurrentFiatRates'>['token'];
7
8
  };
@@ -14,6 +14,7 @@ class BlockchainGetCurrentFiatRates extends AbstractMethod_1.AbstractMethod {
14
14
  { name: 'currencies', type: 'array', required: false },
15
15
  { name: 'token', type: 'string' },
16
16
  { name: 'coin', type: 'string', required: true },
17
+ { name: 'identity', type: 'string' },
17
18
  ]);
18
19
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
19
20
  if (!coinInfo) {
@@ -24,10 +25,11 @@ class BlockchainGetCurrentFiatRates extends AbstractMethod_1.AbstractMethod {
24
25
  currencies: payload.currencies,
25
26
  token: payload.token,
26
27
  coinInfo,
28
+ identity: payload.identity,
27
29
  };
28
30
  }
29
31
  async run() {
30
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
32
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
31
33
  return backend.getCurrentFiatRates({
32
34
  currencies: this.params.currencies,
33
35
  token: this.params.token,
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  currencies: Payload<'blockchainGetFiatRatesForTimestamps'>['currencies'];
6
7
  timestamps: Payload<'blockchainGetFiatRatesForTimestamps'>['timestamps'];
7
8
  token: Payload<'blockchainGetFiatRatesForTimestamps'>['token'];
@@ -15,6 +15,7 @@ class BlockchainGetFiatRatesForTimestamps extends AbstractMethod_1.AbstractMetho
15
15
  { name: 'timestamps', type: 'array', required: true },
16
16
  { name: 'token', type: 'string' },
17
17
  { name: 'coin', type: 'string', required: true },
18
+ { name: 'identity', type: 'string' },
18
19
  ]);
19
20
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
20
21
  if (!coinInfo) {
@@ -26,10 +27,11 @@ class BlockchainGetFiatRatesForTimestamps extends AbstractMethod_1.AbstractMetho
26
27
  timestamps: payload.timestamps,
27
28
  token: payload.token,
28
29
  coinInfo,
30
+ identity: payload.identity,
29
31
  };
30
32
  }
31
33
  async run() {
32
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
34
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
33
35
  return backend.getFiatRatesForTimestamps({
34
36
  currencies: this.params.currencies,
35
37
  timestamps: this.params.timestamps,
@@ -3,6 +3,7 @@ import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  txs: string[];
5
5
  coinInfo: CoinInfo;
6
+ identity?: string;
6
7
  };
7
8
  export default class BlockchainGetTransactions extends AbstractMethod<'blockchainGetTransactions', Params> {
8
9
  init(): void;
@@ -13,6 +13,7 @@ class BlockchainGetTransactions extends AbstractMethod_1.AbstractMethod {
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'txs', type: 'array', required: true },
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  ]);
17
18
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
18
19
  if (!coinInfo) {
@@ -22,10 +23,11 @@ class BlockchainGetTransactions extends AbstractMethod_1.AbstractMethod {
22
23
  this.params = {
23
24
  txs: payload.txs,
24
25
  coinInfo,
26
+ identity: payload.identity,
25
27
  };
26
28
  }
27
29
  async run() {
28
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
30
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
29
31
  return backend.getTransactions(this.params.txs);
30
32
  }
31
33
  }
@@ -28,11 +28,7 @@ class BlockchainSetCustomBackend extends AbstractMethod_1.AbstractMethod {
28
28
  return '';
29
29
  }
30
30
  async run() {
31
- const current = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut);
32
- if (current) {
33
- current.disconnect();
34
- await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
35
- }
31
+ await (0, BlockchainLink_1.reconnectAllBackends)(this.params.coinInfo);
36
32
  return true;
37
33
  }
38
34
  }
@@ -2,7 +2,9 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  accounts: Payload<'blockchainSubscribe'>['accounts'];
5
+ blocks: boolean;
5
6
  coinInfo: CoinInfo;
7
+ identity?: string;
6
8
  };
7
9
  export default class BlockchainSubscribe extends AbstractMethod<'blockchainSubscribe', Params> {
8
10
  init(): void;