@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
@@ -21,7 +21,6 @@ export { default as changePin } from './changePin';
21
21
  export { default as changeWipeCode } from './changeWipeCode';
22
22
  export { default as cipherKeyValue } from './cipherKeyValue';
23
23
  export { default as composeTransaction } from './composeTransaction';
24
- export { default as firmwareUpdate } from './firmwareUpdate';
25
24
  export { default as getAccountDescriptor } from './getAccountDescriptor';
26
25
  export { default as getAccountInfo } from './getAccountInfo';
27
26
  export { default as getAddress } from './getAddress';
package/lib/api/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = 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.firmwareUpdate = 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.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
6
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = 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.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
7
7
  var applyFlags_1 = require("./applyFlags");
8
8
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
9
9
  var applySettings_1 = require("./applySettings");
@@ -50,8 +50,6 @@ var cipherKeyValue_1 = require("./cipherKeyValue");
50
50
  Object.defineProperty(exports, "cipherKeyValue", { enumerable: true, get: function () { return __importDefault(cipherKeyValue_1).default; } });
51
51
  var composeTransaction_1 = require("./composeTransaction");
52
52
  Object.defineProperty(exports, "composeTransaction", { enumerable: true, get: function () { return __importDefault(composeTransaction_1).default; } });
53
- var firmwareUpdate_1 = require("./firmwareUpdate");
54
- Object.defineProperty(exports, "firmwareUpdate", { enumerable: true, get: function () { return __importDefault(firmwareUpdate_1).default; } });
55
53
  var getAccountDescriptor_1 = require("./getAccountDescriptor");
56
54
  Object.defineProperty(exports, "getAccountDescriptor", { enumerable: true, get: function () { return __importDefault(getAccountDescriptor_1).default; } });
57
55
  var getAccountInfo_1 = require("./getAccountInfo");
@@ -6,7 +6,6 @@ type Params = PROTO.NEMGetAddress & {
6
6
  export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', 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 NEMGetAddress extends AbstractMethod<'nemGetAddress', Param
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
+ };
19
20
  _call({ address_n, network, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -18,6 +18,7 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
18
18
  this.progress = 0;
19
19
  }
20
20
  init() {
21
+ this.noBackupConfirmationMode = 'always';
21
22
  this.requiredPermissions = ['read'];
22
23
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('NEM'), this.firmwareRange);
23
24
  this.hasBundle = !!this.payload.bundle;
@@ -39,7 +40,6 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
39
40
  this.params.length === 1 &&
40
41
  typeof this.params[0].address === 'string' &&
41
42
  this.params[0].show_display;
42
- this.confirmed = useEventListener;
43
43
  this.useUi = !useEventListener;
44
44
  }
45
45
  get info() {
@@ -69,27 +69,11 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
69
69
  };
70
70
  }
71
71
  }
72
- async confirmation() {
73
- if (this.confirmed)
74
- return true;
75
- await this.getPopupPromise().promise;
76
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
77
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
72
+ get confirmation() {
73
+ return {
78
74
  view: 'export-address',
79
75
  label: this.info,
80
- }));
81
- const uiResp = await uiPromise.promise;
82
- this.confirmed = uiResp.payload;
83
- return this.confirmed;
84
- }
85
- async noBackupConfirmation() {
86
- await this.getPopupPromise().promise;
87
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
88
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
89
- view: 'no-backup',
90
- }));
91
- const uiResp = await uiPromise.promise;
92
- return uiResp.payload;
76
+ };
93
77
  }
94
78
  async _call({ address_n, network, show_display, chunkify }) {
95
79
  const cmd = this.device.getCommands();
@@ -3,6 +3,7 @@ import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  tx: string;
5
5
  coinInfo: CoinInfo;
6
+ identity?: string;
6
7
  };
7
8
  export default class PushTransaction extends AbstractMethod<'pushTransaction', Params> {
8
9
  init(): void;
@@ -24,10 +24,11 @@ class PushTransaction extends AbstractMethod_1.AbstractMethod {
24
24
  this.params = {
25
25
  tx: payload.tx,
26
26
  coinInfo,
27
+ identity: payload.identity,
27
28
  };
28
29
  }
29
30
  async run() {
30
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
31
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
31
32
  const txid = await backend.pushTransaction(this.params.tx);
32
33
  return {
33
34
  txid,
@@ -1,10 +1,16 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  export default class RebootToBootloader extends AbstractMethod<'rebootToBootloader', PROTO.RebootToBootloader> {
4
- confirmed?: boolean;
5
4
  init(): void;
6
5
  get info(): string;
7
- confirmation(): Promise<boolean>;
6
+ get confirmation(): {
7
+ view: "device-management";
8
+ customConfirmButton: {
9
+ className: string;
10
+ label: string;
11
+ };
12
+ label: string;
13
+ };
8
14
  run(): Promise<{
9
15
  message: string;
10
16
  }>;
@@ -24,22 +24,15 @@ class RebootToBootloader extends AbstractMethod_1.AbstractMethod {
24
24
  get info() {
25
25
  return 'Reboot to bootloader';
26
26
  }
27
- async confirmation() {
28
- if (this.confirmed)
29
- return true;
30
- await this.getPopupPromise().promise;
31
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
32
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
27
+ get confirmation() {
28
+ return {
33
29
  view: 'device-management',
34
30
  customConfirmButton: {
35
31
  className: 'confirm',
36
32
  label: `Reboot`,
37
33
  },
38
34
  label: 'Are you sure you want to reboot to bootloader?',
39
- }));
40
- const uiResp = await uiPromise.promise;
41
- this.confirmed = uiResp.payload;
42
- return this.confirmed;
35
+ };
43
36
  }
44
37
  async run() {
45
38
  const cmd = this.device.getCommands();
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  export default class RecoveryDevice extends AbstractMethod<'recoveryDevice', PROTO.RecoveryDevice> {
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
  }>;
@@ -24,19 +24,15 @@ class RecoveryDevice extends AbstractMethod_1.AbstractMethod {
24
24
  this.allowDeviceMode = [...this.allowDeviceMode, events_1.UI.INITIALIZE];
25
25
  this.useDeviceState = false;
26
26
  }
27
- async confirmation() {
28
- await this.getPopupPromise().promise;
29
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
30
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
27
+ get confirmation() {
28
+ return {
31
29
  view: 'device-management',
32
30
  customConfirmButton: {
33
31
  className: 'confirm',
34
32
  label: 'Proceed',
35
33
  },
36
34
  label: 'Do you want to recover device from seed?',
37
- }));
38
- const uiResp = await uiPromise.promise;
39
- return uiResp.payload;
35
+ };
40
36
  }
41
37
  async run() {
42
38
  const cmd = this.device.getCommands();
@@ -1,10 +1,12 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
- import type { PROTO } from '../constants';
2
+ import { PROTO } from '../constants';
3
3
  export default class ResetDevice extends AbstractMethod<'resetDevice', PROTO.ResetDevice> {
4
- confirmed?: boolean;
5
4
  init(): void;
6
5
  get info(): string;
7
- confirmation(): Promise<boolean>;
6
+ get confirmation(): {
7
+ view: "device-management";
8
+ label: string;
9
+ };
8
10
  run(): Promise<{
9
11
  message: string;
10
12
  }>;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
4
  const events_1 = require("../events");
5
5
  const paramsValidator_1 = require("./common/paramsValidator");
6
+ const constants_1 = require("../constants");
6
7
  const schema_utils_1 = require("@trezor/schema-utils");
7
- const resetDevice_1 = require("../types/api/resetDevice");
8
8
  class ResetDevice extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
10
  this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
@@ -12,7 +12,7 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
12
12
  this.requiredPermissions = ['management'];
13
13
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
14
14
  const { payload } = this;
15
- (0, schema_utils_1.Assert)(resetDevice_1.ResetDevice, payload);
15
+ (0, schema_utils_1.Assert)(constants_1.PROTO.ResetDevice, payload);
16
16
  this.params = {
17
17
  display_random: payload.display_random,
18
18
  strength: payload.strength || 256,
@@ -29,18 +29,11 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
29
29
  get info() {
30
30
  return 'Setup device';
31
31
  }
32
- async confirmation() {
33
- if (this.confirmed)
34
- return true;
35
- await this.getPopupPromise().promise;
36
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
37
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
32
+ get confirmation() {
33
+ return {
38
34
  view: 'device-management',
39
35
  label: 'Do you really you want to create a new wallet?',
40
- }));
41
- const uiResp = await uiPromise.promise;
42
- this.confirmed = uiResp.payload;
43
- return this.confirmed;
36
+ };
44
37
  }
45
38
  async run() {
46
39
  const cmd = this.device.getCommands();
@@ -6,7 +6,6 @@ type Params = PROTO.RippleGetAddress & {
6
6
  export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress', 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 RippleGetAddress extends AbstractMethod<'rippleGetAddress',
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
+ };
19
20
  _call({ address_n, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -15,6 +15,7 @@ class RippleGetAddress 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)('Ripple'), this.firmwareRange);
20
21
  this.hasBundle = !!this.payload.bundle;
@@ -35,7 +36,6 @@ class RippleGetAddress 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,11 @@ class RippleGetAddress 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, {
56
+ get confirmation() {
57
+ return {
62
58
  view: 'export-address',
63
59
  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;
60
+ };
77
61
  }
78
62
  async _call({ address_n, show_display, chunkify }) {
79
63
  const cmd = this.device.getCommands();
@@ -11,6 +11,7 @@ type Params = {
11
11
  addresses?: AccountAddresses;
12
12
  options: TransactionOptions;
13
13
  coinInfo: BitcoinNetworkInfo;
14
+ identity?: string;
14
15
  push: boolean;
15
16
  unlockPath?: PROTO.UnlockPath;
16
17
  };
@@ -16,6 +16,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
16
16
  const { payload } = this;
17
17
  (0, paramsValidator_1.validateParams)(payload, [
18
18
  { name: 'coin', type: 'string', required: true },
19
+ { name: 'identity', type: 'string' },
19
20
  { name: 'inputs', type: 'array', required: true },
20
21
  { name: 'outputs', type: 'array', required: true },
21
22
  { name: 'paymentRequests', type: 'array', allowEmpty: true },
@@ -90,6 +91,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
90
91
  chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
91
92
  },
92
93
  coinInfo,
94
+ identity: payload.identity,
93
95
  push: typeof payload.push === 'boolean' ? payload.push : false,
94
96
  unlockPath: payload.unlockPath,
95
97
  };
@@ -114,7 +116,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
114
116
  return account.addresses;
115
117
  }
116
118
  async fetchRefTxs(useLegacySignProcess) {
117
- const { params: { inputs, outputs, options, coinInfo, addresses }, } = this;
119
+ const { params: { inputs, outputs, options, coinInfo, identity, addresses }, } = this;
118
120
  const requiredRefTxs = (0, bitcoin_1.requireReferencedTransactions)(inputs, options, coinInfo);
119
121
  const refTxsIds = requiredRefTxs ? (0, bitcoin_1.getReferencedTransactions)(inputs) : [];
120
122
  const origTxsIds = !useLegacySignProcess ? (0, bitcoin_1.getOrigTransactions)(inputs, outputs) : [];
@@ -122,7 +124,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
122
124
  return [];
123
125
  }
124
126
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
125
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
127
+ const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
126
128
  const refTxs = !refTxsIds.length
127
129
  ? []
128
130
  : await blockchain
@@ -184,7 +186,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
184
186
  }
185
187
  if (params.push) {
186
188
  (0, BlockchainLink_1.isBackendSupported)(params.coinInfo);
187
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(params.coinInfo, this.postMessage);
189
+ const blockchain = await (0, BlockchainLink_1.initBlockchain)(params.coinInfo, this.postMessage, params.identity);
188
190
  const txid = await blockchain.pushTransaction(response.serializedTx);
189
191
  return {
190
192
  ...response,
@@ -6,7 +6,6 @@ type Params = PROTO.SolanaGetAddress & {
6
6
  export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress', Params[]> {
7
7
  hasBundle?: boolean;
8
8
  progress: number;
9
- confirmed?: boolean;
10
9
  init(): void;
11
10
  get info(): "Export solana address" | "Export multiple Solana addresses";
12
11
  getButtonRequestData(code: string): {
@@ -14,8 +13,10 @@ export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress',
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
+ };
19
20
  _call({ address_n, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -15,6 +15,7 @@ class SolanaGetAddress 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)('Solana'), this.firmwareRange);
20
21
  this.hasBundle = !!this.payload.bundle;
@@ -35,7 +36,6 @@ class SolanaGetAddress 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,34 +53,13 @@ class SolanaGetAddress 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
- let label;
62
- if (this.params.length > 1) {
63
- label = 'Export multiple Solana addresses';
64
- }
65
- else {
66
- label = `Export Solana address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
67
- }
68
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
56
+ get confirmation() {
57
+ return {
69
58
  view: 'export-address',
70
- label,
71
- }));
72
- const uiResp = await uiPromise.promise;
73
- this.confirmed = uiResp.payload;
74
- return this.confirmed;
75
- }
76
- async noBackupConfirmation() {
77
- await this.getPopupPromise().promise;
78
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
79
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
80
- view: 'no-backup',
81
- }));
82
- const uiResp = await uiPromise.promise;
83
- return uiResp.payload;
59
+ label: this.params.length > 1
60
+ ? 'Export multiple Solana addresses'
61
+ : `Export Solana address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
62
+ };
84
63
  }
85
64
  async _call({ address_n, show_display, chunkify }) {
86
65
  const cmd = this.device.getCommands();
@@ -2,11 +2,12 @@ import { PROTO } from '../../../constants';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
3
  export default class SolanaGetPublicKey extends AbstractMethod<'solanaGetPublicKey', PROTO.SolanaGetPublicKey[]> {
4
4
  hasBundle?: boolean;
5
- confirmed?: boolean;
6
5
  init(): void;
7
6
  get info(): string;
8
- confirmation(): Promise<boolean>;
9
- noBackupConfirmation(): Promise<boolean>;
7
+ get confirmation(): {
8
+ view: "export-xpub";
9
+ label: string;
10
+ };
10
11
  run(): Promise<({
11
12
  path: number[];
12
13
  publicKey: string;
@@ -9,6 +9,7 @@ const schema_utils_1 = require("@trezor/schema-utils");
9
9
  const types_1 = require("../../../types");
10
10
  class SolanaGetPublicKey extends AbstractMethod_1.AbstractMethod {
11
11
  init() {
12
+ this.noBackupConfirmationMode = 'always';
12
13
  this.requiredPermissions = ['read'];
13
14
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Solana'), this.firmwareRange);
14
15
  this.hasBundle = !!this.payload.bundle;
@@ -27,34 +28,13 @@ class SolanaGetPublicKey extends AbstractMethod_1.AbstractMethod {
27
28
  get info() {
28
29
  return 'Export Solana public key';
29
30
  }
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 Solana public keys';
38
- }
39
- else {
40
- label = `Export Solana 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, {
31
+ get confirmation() {
32
+ return {
43
33
  view: 'export-xpub',
44
- label,
45
- }));
46
- const uiResp = await uiPromise.promise;
47
- this.confirmed = uiResp.payload;
48
- return this.confirmed;
49
- }
50
- async noBackupConfirmation() {
51
- await this.getPopupPromise().promise;
52
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
53
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
54
- view: 'no-backup',
55
- }));
56
- const uiResp = await uiPromise.promise;
57
- return uiResp.payload;
34
+ label: this.params.length > 1
35
+ ? 'Export multiple Solana public keys'
36
+ : `Export Solana public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
37
+ };
58
38
  }
59
39
  async run() {
60
40
  const responses = [];
@@ -6,7 +6,6 @@ type Params = PROTO.StellarGetAddress & {
6
6
  export default class StellarGetAddress extends AbstractMethod<'stellarGetAddress', 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 StellarGetAddress extends AbstractMethod<'stellarGetAddress
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
+ };
19
20
  _call({ address_n, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -15,6 +15,7 @@ class StellarGetAddress 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)('Stellar'), this.firmwareRange);
20
21
  this.hasBundle = !!this.payload.bundle;
@@ -35,7 +36,6 @@ class StellarGetAddress 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,11 @@ class StellarGetAddress 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, {
56
+ get confirmation() {
57
+ return {
62
58
  view: 'export-address',
63
59
  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;
60
+ };
77
61
  }
78
62
  async _call({ address_n, show_display, chunkify }) {
79
63
  const cmd = this.device.getCommands();
@@ -6,7 +6,6 @@ type Params = PROTO.TezosGetAddress & {
6
6
  export default class TezosGetAddress extends AbstractMethod<'tezosGetAddress', 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 TezosGetAddress extends AbstractMethod<'tezosGetAddress', P
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
+ };
19
20
  _call({ address_n, show_display, chunkify }: Params): Promise<{
20
21
  address: string;
21
22
  }>;