@trezor/connect 9.2.3 → 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 (104) hide show
  1. package/CHANGELOG.md +43 -5
  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/cardano/api/cardanoGetAddress.d.ts +4 -3
  14. package/lib/api/cardano/api/cardanoGetAddress.js +8 -22
  15. package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +4 -3
  16. package/lib/api/cardano/api/cardanoGetPublicKey.js +9 -31
  17. package/lib/api/changeLanguage.d.ts +8 -1
  18. package/lib/api/changeLanguage.js +3 -7
  19. package/lib/api/eos/api/eosGetPublicKey.d.ts +4 -2
  20. package/lib/api/eos/api/eosGetPublicKey.js +6 -18
  21. package/lib/api/ethereum/api/ethereumGetAddress.d.ts +4 -3
  22. package/lib/api/ethereum/api/ethereumGetAddress.js +4 -20
  23. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +4 -2
  24. package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -10
  25. package/lib/api/firmware/index.d.ts +2 -0
  26. package/lib/api/firmware/index.js +5 -1
  27. package/lib/api/firmware/parseFirmwareHeaders.d.ts +5 -0
  28. package/lib/api/firmware/parseFirmwareHeaders.js +35 -0
  29. package/lib/api/firmware/uploadFirmware.d.ts +1 -1
  30. package/lib/api/firmware/uploadFirmware.js +9 -1
  31. package/lib/api/getAccountDescriptor.d.ts +5 -3
  32. package/lib/api/getAccountDescriptor.js +8 -21
  33. package/lib/api/getAccountInfo.d.ts +23 -7
  34. package/lib/api/getAccountInfo.js +12 -25
  35. package/lib/api/getAddress.d.ts +4 -3
  36. package/lib/api/getAddress.js +8 -22
  37. package/lib/api/getFeatures.d.ts +1 -0
  38. package/lib/api/getOwnershipId.d.ts +4 -2
  39. package/lib/api/getOwnershipId.js +4 -15
  40. package/lib/api/getOwnershipProof.d.ts +4 -2
  41. package/lib/api/getOwnershipProof.js +4 -15
  42. package/lib/api/getPublicKey.d.ts +5 -4
  43. package/lib/api/getPublicKey.js +12 -35
  44. package/lib/api/index.d.ts +0 -1
  45. package/lib/api/index.js +1 -3
  46. package/lib/api/nem/api/nemGetAddress.d.ts +4 -3
  47. package/lib/api/nem/api/nemGetAddress.js +4 -20
  48. package/lib/api/rebootToBootloader.d.ts +8 -2
  49. package/lib/api/rebootToBootloader.js +3 -10
  50. package/lib/api/recoveryDevice.d.ts +8 -1
  51. package/lib/api/recoveryDevice.js +3 -7
  52. package/lib/api/resetDevice.d.ts +4 -2
  53. package/lib/api/resetDevice.js +3 -10
  54. package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -3
  55. package/lib/api/ripple/api/rippleGetAddress.js +4 -20
  56. package/lib/api/solana/api/solanaGetAddress.d.ts +4 -3
  57. package/lib/api/solana/api/solanaGetAddress.js +7 -28
  58. package/lib/api/solana/api/solanaGetPublicKey.d.ts +4 -3
  59. package/lib/api/solana/api/solanaGetPublicKey.js +7 -27
  60. package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -3
  61. package/lib/api/stellar/api/stellarGetAddress.js +4 -20
  62. package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -3
  63. package/lib/api/tezos/api/tezosGetAddress.js +4 -20
  64. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +4 -2
  65. package/lib/api/tezos/api/tezosGetPublicKey.js +6 -18
  66. package/lib/api/wipeDevice.d.ts +8 -2
  67. package/lib/api/wipeDevice.js +3 -10
  68. package/lib/constants/errors.d.ts +1 -0
  69. package/lib/constants/errors.js +1 -0
  70. package/lib/core/AbstractMethod.d.ts +4 -8
  71. package/lib/core/AbstractMethod.js +6 -28
  72. package/lib/core/index.d.ts +2 -1
  73. package/lib/core/index.js +254 -225
  74. package/lib/core/onCallFirmwareUpdate.d.ts +31 -0
  75. package/lib/core/onCallFirmwareUpdate.js +259 -0
  76. package/lib/data/analyticsInfo.d.ts +2 -2
  77. package/lib/data/analyticsInfo.js +6 -7
  78. package/lib/data/deviceAuthenticityConfig.js +8 -4
  79. package/lib/data/firmwareInfo.js +1 -1
  80. package/lib/data/version.d.ts +1 -1
  81. package/lib/data/version.js +1 -1
  82. package/lib/device/Device.d.ts +1 -1
  83. package/lib/device/Device.js +2 -2
  84. package/lib/device/DeviceCommands.d.ts +2 -14
  85. package/lib/device/DeviceCommands.js +1 -43
  86. package/lib/device/DeviceList.d.ts +1 -1
  87. package/lib/device/DeviceList.js +20 -15
  88. package/lib/events/index.d.ts +1 -0
  89. package/lib/events/ui-request.d.ts +13 -1
  90. package/lib/events/ui-request.js +1 -0
  91. package/lib/index.js +2 -2
  92. package/lib/types/api/backupDevice.d.ts +2 -2
  93. package/lib/types/api/dispose.d.ts +1 -1
  94. package/lib/types/api/firmwareUpdate.d.ts +7 -6
  95. package/lib/types/api/firmwareUpdate.js +1 -3
  96. package/lib/utils/popupPromiseManager.d.ts +8 -0
  97. package/lib/utils/popupPromiseManager.js +21 -0
  98. package/lib/utils/uiPromiseManager.d.ts +38 -0
  99. package/lib/utils/uiPromiseManager.js +47 -0
  100. package/lib/workers/workers-browser.d.ts +3 -1
  101. package/lib/workers/workers-browser.js +2 -2
  102. package/package.json +6 -6
  103. package/lib/api/firmwareUpdate.d.ts +0 -19
  104. package/lib/api/firmwareUpdate.js +0 -78
package/CHANGELOG.md CHANGED
@@ -1,8 +1,46 @@
1
- | Package | latest stable | latest canary |
2
- | ---------------------------- | :-----------: | :-----------: |
3
- | @trezor/connect | 9.2.2 | 9.2.3 |
4
- | @trezor/connect-web | 9.2.2 | 9.2.3 |
5
- | @trezor/connect-webextension | 9.2.2 | 9.2.3 |
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
6
44
 
7
45
  # 9.2.3
8
46
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.2.3
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 = [];
@@ -6,7 +6,6 @@ type Params = PROTO.CardanoGetAddress & {
6
6
  export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress', 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 CardanoGetAddress extends AbstractMethod<'cardanoGetAddress
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_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<{
20
21
  address: string;
21
22
  }>;
@@ -16,6 +16,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
16
16
  this.progress = 0;
17
17
  }
18
18
  init() {
19
+ this.noBackupConfirmationMode = 'always';
19
20
  this.requiredPermissions = ['read'];
20
21
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
21
22
  this.hasBundle = !!this.payload.bundle;
@@ -41,7 +42,6 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
41
42
  this.params.length === 1 &&
42
43
  typeof this.params[0].address === 'string' &&
43
44
  this.params[0].show_display;
44
- this.confirmed = useEventListener;
45
45
  this.useUi = !useEventListener;
46
46
  }
47
47
  get info() {
@@ -59,27 +59,13 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
59
59
  };
60
60
  }
61
61
  }
62
- async confirmation() {
63
- if (this.confirmed)
64
- return true;
65
- await this.getPopupPromise().promise;
66
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
67
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
68
- view: 'export-address',
69
- label: this.info,
70
- }));
71
- const uiResp = await uiPromise.promise;
72
- this.confirmed = uiResp.payload;
73
- return this.confirmed;
74
- }
75
- async noBackupConfirmation() {
76
- await this.getPopupPromise().promise;
77
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
78
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
79
- view: 'no-backup',
80
- }));
81
- const uiResp = await uiPromise.promise;
82
- return uiResp.payload;
62
+ get confirmation() {
63
+ return !this.useUi
64
+ ? undefined
65
+ : {
66
+ view: 'export-address',
67
+ label: this.info,
68
+ };
83
69
  }
84
70
  async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }) {
85
71
  const cmd = this.device.getCommands();
@@ -5,11 +5,12 @@ interface Params extends PROTO.CardanoGetPublicKey {
5
5
  }
6
6
  export default class CardanoGetPublicKey extends AbstractMethod<'cardanoGetPublicKey', Params[]> {
7
7
  hasBundle?: boolean;
8
- confirmed?: boolean;
9
8
  init(): void;
10
9
  get info(): string;
11
- confirmation(): Promise<boolean>;
12
- noBackupConfirmation(allowSuppression?: boolean): Promise<boolean>;
10
+ get confirmation(): {
11
+ view: "export-xpub";
12
+ label: string;
13
+ };
13
14
  run(): Promise<import("../../../types").CardanoPublicKey | import("../../../types").CardanoPublicKey[]>;
14
15
  }
15
16
  export {};
@@ -29,42 +29,20 @@ class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
29
29
  suppress_backup_warning: batch.suppressBackupWarning,
30
30
  };
31
31
  });
32
+ this.noBackupConfirmationMode = this.params.every(batch => batch.suppressBackupWarning || !batch.show_display)
33
+ ? 'popup-only'
34
+ : 'always';
32
35
  }
33
36
  get info() {
34
37
  return 'Export Cardano public key';
35
38
  }
36
- async confirmation() {
37
- if (this.confirmed)
38
- return true;
39
- await this.getPopupPromise().promise;
40
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
41
- let label;
42
- if (this.params.length > 1) {
43
- label = 'Export multiple Cardano public keys';
44
- }
45
- else {
46
- label = `Export Cardano public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
47
- }
48
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
39
+ get confirmation() {
40
+ return {
49
41
  view: 'export-xpub',
50
- label,
51
- }));
52
- const uiResp = await uiPromise.promise;
53
- this.confirmed = uiResp.payload;
54
- return this.confirmed;
55
- }
56
- async noBackupConfirmation(allowSuppression) {
57
- if (allowSuppression &&
58
- this.params.every(batch => batch.suppressBackupWarning || !batch.show_display)) {
59
- return true;
60
- }
61
- await this.getPopupPromise().promise;
62
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
63
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
64
- view: 'no-backup',
65
- }));
66
- const uiResp = await uiPromise.promise;
67
- return uiResp.payload;
42
+ label: this.params.length > 1
43
+ ? 'Export multiple Cardano public keys'
44
+ : `Export Cardano public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
45
+ };
68
46
  }
69
47
  async run() {
70
48
  const responses = [];
@@ -2,7 +2,14 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { ChangeLanguage as ChangeLanguageSchema } from '../types/api/changeLanguage';
3
3
  export default class ChangeLanguage extends AbstractMethod<'changeLanguage', ChangeLanguageSchema> {
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
  }>;
@@ -14,19 +14,15 @@ class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
14
14
  (0, schema_utils_1.Assert)(changeLanguage_1.ChangeLanguage, payload);
15
15
  this.params = payload;
16
16
  }
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, {
17
+ get confirmation() {
18
+ return {
21
19
  view: 'device-management',
22
20
  customConfirmButton: {
23
21
  className: 'confirm',
24
22
  label: 'Proceed',
25
23
  },
26
24
  label: 'Do you want to change language?',
27
- }));
28
- const uiResp = await uiPromise.promise;
29
- return uiResp.payload;
25
+ };
30
26
  }
31
27
  run() {
32
28
  const { language, binary } = this.params;
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../../../core/AbstractMethod';
2
2
  import type { PROTO } from '../../../constants';
3
3
  export default class EosGetPublicKey extends AbstractMethod<'eosGetPublicKey', PROTO.EosGetPublicKey[]> {
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
  serializedPath: string;
@@ -28,25 +28,13 @@ class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
28
28
  get info() {
29
29
  return 'Export Eos public key';
30
30
  }
31
- async confirmation() {
32
- if (this.confirmed)
33
- return true;
34
- await this.getPopupPromise().promise;
35
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
36
- let label;
37
- if (this.params.length > 1) {
38
- label = 'Export multiple Eos public keys';
39
- }
40
- else {
41
- label = `Export Eos public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
42
- }
43
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
31
+ get confirmation() {
32
+ return {
44
33
  view: 'export-address',
45
- label,
46
- }));
47
- const uiResp = await uiPromise.promise;
48
- this.confirmed = uiResp.payload;
49
- return this.confirmed;
34
+ label: this.params.length > 1
35
+ ? 'Export multiple Eos public keys'
36
+ : `Export Eos public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
37
+ };
50
38
  }
51
39
  async run() {
52
40
  const responses = [];
@@ -9,7 +9,6 @@ type Params = PROTO.EthereumGetAddress & {
9
9
  export default class EthereumGetAddress extends AbstractMethod<'ethereumGetAddress', Params[]> {
10
10
  hasBundle?: boolean;
11
11
  progress: number;
12
- confirmed?: boolean;
13
12
  init(): void;
14
13
  initAsync(): Promise<void>;
15
14
  get info(): string;
@@ -18,8 +17,10 @@ export default class EthereumGetAddress extends AbstractMethod<'ethereumGetAddre
18
17
  serializedPath: string;
19
18
  address: string;
20
19
  } | undefined;
21
- confirmation(): Promise<boolean>;
22
- noBackupConfirmation(): Promise<boolean>;
20
+ get confirmation(): {
21
+ view: "export-address";
22
+ label: string;
23
+ };
23
24
  _call({ address_n, show_display, encoded_network, chunkify }: Params): Promise<{
24
25
  path: number[];
25
26
  serializedPath: string;
@@ -18,6 +18,7 @@ class EthereumGetAddress 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.hasBundle = !!this.payload.bundle;
23
24
  const payload = !this.payload.bundle
@@ -40,7 +41,6 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
40
41
  this.params.length === 1 &&
41
42
  typeof this.params[0].address === 'string' &&
42
43
  this.params[0].show_display;
43
- this.confirmed = useEventListener;
44
44
  this.useUi = !useEventListener;
45
45
  }
46
46
  async initAsync() {
@@ -80,27 +80,11 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
80
80
  };
81
81
  }
82
82
  }
83
- async confirmation() {
84
- if (this.confirmed)
85
- return true;
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, {
83
+ get confirmation() {
84
+ return {
89
85
  view: 'export-address',
90
86
  label: this.info,
91
- }));
92
- const uiResp = await uiPromise.promise;
93
- this.confirmed = uiResp.payload;
94
- return this.confirmed;
95
- }
96
- async noBackupConfirmation() {
97
- await this.getPopupPromise().promise;
98
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
99
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
100
- view: 'no-backup',
101
- }));
102
- const uiResp = await uiPromise.promise;
103
- return uiResp.payload;
87
+ };
104
88
  }
105
89
  _call({ address_n, show_display, encoded_network, chunkify }) {
106
90
  const cmd = this.device.getCommands();
@@ -6,10 +6,12 @@ type Params = PROTO.EthereumGetPublicKey & {
6
6
  };
7
7
  export default class EthereumGetPublicKey extends AbstractMethod<'ethereumGetPublicKey', Params[]> {
8
8
  hasBundle?: boolean;
9
- confirmed?: boolean;
10
9
  init(): void;
11
10
  get info(): string;
12
- confirmation(): Promise<boolean>;
11
+ get confirmation(): {
12
+ view: "export-xpub";
13
+ label: string;
14
+ };
13
15
  run(): Promise<{
14
16
  xpubSegwit?: string | undefined;
15
17
  descriptorChecksum?: string | undefined;