@trezor/connect 9.2.3 → 9.2.4-beta.2

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 (119) hide show
  1. package/CHANGELOG.md +77 -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/blockchainGetCurrentFiatRates.d.ts +1 -1
  14. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
  15. package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -4
  16. package/lib/api/cardano/api/cardanoGetAddress.js +9 -39
  17. package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +4 -3
  18. package/lib/api/cardano/api/cardanoGetPublicKey.js +9 -31
  19. package/lib/api/cardano/api/cardanoSignTransaction.d.ts +1 -13
  20. package/lib/api/cardano/api/cardanoSignTransaction.js +2 -75
  21. package/lib/api/cardano/cardanoAddressParameters.d.ts +1 -2
  22. package/lib/api/cardano/cardanoAddressParameters.js +4 -10
  23. package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -2
  24. package/lib/api/cardano/cardanoAuxiliaryData.js +2 -2
  25. package/lib/api/changeLanguage.d.ts +8 -1
  26. package/lib/api/changeLanguage.js +3 -7
  27. package/lib/api/eos/api/eosGetPublicKey.d.ts +4 -2
  28. package/lib/api/eos/api/eosGetPublicKey.js +6 -18
  29. package/lib/api/ethereum/api/ethereumGetAddress.d.ts +4 -3
  30. package/lib/api/ethereum/api/ethereumGetAddress.js +4 -20
  31. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +4 -2
  32. package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -10
  33. package/lib/api/firmware/index.d.ts +2 -0
  34. package/lib/api/firmware/index.js +5 -1
  35. package/lib/api/firmware/parseFirmwareHeaders.d.ts +5 -0
  36. package/lib/api/firmware/parseFirmwareHeaders.js +35 -0
  37. package/lib/api/firmware/uploadFirmware.d.ts +1 -1
  38. package/lib/api/firmware/uploadFirmware.js +9 -1
  39. package/lib/api/getAccountDescriptor.d.ts +5 -3
  40. package/lib/api/getAccountDescriptor.js +8 -21
  41. package/lib/api/getAccountInfo.d.ts +23 -7
  42. package/lib/api/getAccountInfo.js +12 -25
  43. package/lib/api/getAddress.d.ts +4 -3
  44. package/lib/api/getAddress.js +8 -22
  45. package/lib/api/getFeatures.d.ts +1 -0
  46. package/lib/api/getOwnershipId.d.ts +4 -2
  47. package/lib/api/getOwnershipId.js +4 -15
  48. package/lib/api/getOwnershipProof.d.ts +4 -2
  49. package/lib/api/getOwnershipProof.js +4 -15
  50. package/lib/api/getPublicKey.d.ts +5 -4
  51. package/lib/api/getPublicKey.js +12 -35
  52. package/lib/api/index.d.ts +0 -1
  53. package/lib/api/index.js +1 -3
  54. package/lib/api/nem/api/nemGetAddress.d.ts +4 -3
  55. package/lib/api/nem/api/nemGetAddress.js +4 -20
  56. package/lib/api/rebootToBootloader.d.ts +8 -2
  57. package/lib/api/rebootToBootloader.js +3 -10
  58. package/lib/api/recoveryDevice.d.ts +8 -1
  59. package/lib/api/recoveryDevice.js +3 -7
  60. package/lib/api/resetDevice.d.ts +4 -2
  61. package/lib/api/resetDevice.js +3 -10
  62. package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -3
  63. package/lib/api/ripple/api/rippleGetAddress.js +4 -20
  64. package/lib/api/solana/api/solanaGetAddress.d.ts +4 -3
  65. package/lib/api/solana/api/solanaGetAddress.js +7 -28
  66. package/lib/api/solana/api/solanaGetPublicKey.d.ts +4 -3
  67. package/lib/api/solana/api/solanaGetPublicKey.js +7 -27
  68. package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -3
  69. package/lib/api/stellar/api/stellarGetAddress.js +4 -20
  70. package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -3
  71. package/lib/api/tezos/api/tezosGetAddress.js +4 -20
  72. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +4 -2
  73. package/lib/api/tezos/api/tezosGetPublicKey.js +6 -18
  74. package/lib/api/wipeDevice.d.ts +8 -2
  75. package/lib/api/wipeDevice.js +3 -10
  76. package/lib/backend/Blockchain.d.ts +2 -2
  77. package/lib/constants/errors.d.ts +1 -0
  78. package/lib/constants/errors.js +1 -0
  79. package/lib/core/AbstractMethod.d.ts +4 -8
  80. package/lib/core/AbstractMethod.js +6 -28
  81. package/lib/core/index.d.ts +2 -1
  82. package/lib/core/index.js +258 -226
  83. package/lib/core/onCallFirmwareUpdate.d.ts +31 -0
  84. package/lib/core/onCallFirmwareUpdate.js +266 -0
  85. package/lib/data/DataManager.d.ts +10 -0
  86. package/lib/data/analyticsInfo.d.ts +2 -2
  87. package/lib/data/analyticsInfo.js +6 -7
  88. package/lib/data/config.d.ts +10 -0
  89. package/lib/data/config.js +15 -5
  90. package/lib/data/deviceAuthenticityConfig.js +8 -4
  91. package/lib/data/firmwareInfo.js +1 -1
  92. package/lib/data/version.d.ts +1 -1
  93. package/lib/data/version.js +5 -2
  94. package/lib/device/Device.d.ts +2 -2
  95. package/lib/device/Device.js +4 -4
  96. package/lib/device/DeviceCommands.d.ts +4 -16
  97. package/lib/device/DeviceCommands.js +10 -72
  98. package/lib/device/DeviceList.d.ts +7 -4
  99. package/lib/device/DeviceList.js +46 -40
  100. package/lib/events/blockchain.d.ts +2 -2
  101. package/lib/events/index.d.ts +1 -0
  102. package/lib/events/ui-request.d.ts +13 -1
  103. package/lib/events/ui-request.js +1 -0
  104. package/lib/index.js +2 -2
  105. package/lib/types/api/backupDevice.d.ts +2 -2
  106. package/lib/types/api/dispose.d.ts +1 -1
  107. package/lib/types/api/firmwareUpdate.d.ts +7 -6
  108. package/lib/types/api/firmwareUpdate.js +1 -3
  109. package/lib/types/index.d.ts +1 -1
  110. package/lib/types/settings.d.ts +1 -1
  111. package/lib/utils/popupPromiseManager.d.ts +8 -0
  112. package/lib/utils/popupPromiseManager.js +21 -0
  113. package/lib/utils/uiPromiseManager.d.ts +38 -0
  114. package/lib/utils/uiPromiseManager.js +47 -0
  115. package/lib/workers/workers-browser.d.ts +3 -1
  116. package/lib/workers/workers-browser.js +2 -2
  117. package/package.json +9 -9
  118. package/lib/api/firmwareUpdate.d.ts +0 -19
  119. package/lib/api/firmwareUpdate.js +0 -78
@@ -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
  }>;
@@ -15,6 +15,7 @@ class TezosGetAddress 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)('Tezos'), this.firmwareRange);
20
21
  this.hasBundle = !!this.payload.bundle;
@@ -35,7 +36,6 @@ class TezosGetAddress 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 TezosGetAddress 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();
@@ -2,10 +2,12 @@ import { AbstractMethod } from '../../../core/AbstractMethod';
2
2
  import type { PROTO } from '../../../constants';
3
3
  export default class TezosGetPublicKey extends AbstractMethod<'tezosGetPublicKey', PROTO.TezosGetPublicKey[]> {
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;
@@ -28,25 +28,13 @@ class TezosGetPublicKey extends AbstractMethod_1.AbstractMethod {
28
28
  get info() {
29
29
  return 'Export Tezos 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 Tezos public keys';
39
- }
40
- else {
41
- label = `Export Tezos 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 Tezos public keys'
36
+ : `Export Tezos 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 = [];
@@ -1,8 +1,14 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  export default class WipeDevice extends AbstractMethod<'wipeDevice'> {
3
- confirmed?: boolean;
4
3
  init(): void;
5
- confirmation(): Promise<boolean>;
4
+ get confirmation(): {
5
+ view: "device-management";
6
+ customConfirmButton: {
7
+ className: string;
8
+ label: string;
9
+ };
10
+ label: string;
11
+ };
6
12
  get info(): string;
7
13
  run(): Promise<{
8
14
  message: string;
@@ -10,22 +10,15 @@ class WipeDevice extends AbstractMethod_1.AbstractMethod {
10
10
  this.requiredPermissions = ['management'];
11
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
12
12
  }
13
- async confirmation() {
14
- if (this.confirmed)
15
- return true;
16
- await this.getPopupPromise().promise;
17
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
18
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
13
+ get confirmation() {
14
+ return {
19
15
  view: 'device-management',
20
16
  customConfirmButton: {
21
17
  className: 'wipe',
22
18
  label: `Wipe ${this.device.toMessageObject().label}`,
23
19
  },
24
20
  label: 'Are you sure you want to wipe your device?',
25
- }));
26
- const uiResp = await uiPromise.promise;
27
- this.confirmed = uiResp.payload;
28
- return this.confirmed;
21
+ };
29
22
  }
30
23
  get info() {
31
24
  return 'Wipe device';
@@ -31,7 +31,7 @@ export declare class Blockchain {
31
31
  token?: string;
32
32
  }): Promise<{
33
33
  ts: number;
34
- rates: import("@trezor/blockchain-link").FiatRatesLegacy;
34
+ rates: import("@trezor/blockchain-link").FiatRatesBySymbol;
35
35
  }>;
36
36
  getFiatRatesForTimestamps(params: {
37
37
  currencies?: string[];
@@ -40,7 +40,7 @@ export declare class Blockchain {
40
40
  }): Promise<{
41
41
  tickers: {
42
42
  ts: number;
43
- rates: import("@trezor/blockchain-link").FiatRatesLegacy;
43
+ rates: import("@trezor/blockchain-link").FiatRatesBySymbol;
44
44
  }[];
45
45
  }>;
46
46
  getAccountBalanceHistory(params: BlockchainLinkParams<'getAccountBalanceHistory'>): Promise<import("@trezor/blockchain-link").AccountBalanceHistory[]>;
@@ -33,6 +33,7 @@ export declare const ERROR_CODES: {
33
33
  Device_UsedElsewhere: string;
34
34
  Device_InvalidState: string;
35
35
  Device_CallInProgress: string;
36
+ Device_MultipleNotSupported: string;
36
37
  };
37
38
  export declare class TrezorError extends Error {
38
39
  code: string;
@@ -36,6 +36,7 @@ exports.ERROR_CODES = {
36
36
  Device_UsedElsewhere: 'Device is used in another window',
37
37
  Device_InvalidState: 'Passphrase is incorrect',
38
38
  Device_CallInProgress: 'Device call in progress',
39
+ Device_MultipleNotSupported: 'Multiple devices are not supported',
39
40
  };
40
41
  class TrezorError extends Error {
41
42
  constructor(code, message) {
@@ -1,6 +1,5 @@
1
- import { Deferred } from '@trezor/utils';
2
1
  import { NETWORK } from '../constants';
3
- import { CallMethodPayload, CallMethodResponse, UiRequestButtonData, UiPromiseCreator, CoreEventMessage } from '../events';
2
+ import { CallMethodPayload, CallMethodResponse, UiRequestButtonData, UiPromiseCreator, CoreEventMessage, UiRequestConfirmation } from '../events';
4
3
  import type { Device } from '../device/Device';
5
4
  import type { FirmwareRange } from '../types';
6
5
  export type Payload<M> = Extract<CallMethodPayload, {
@@ -25,6 +24,7 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
25
24
  name: Name;
26
25
  payload: Payload<Name>;
27
26
  get info(): string;
27
+ get confirmation(): UiRequestConfirmation['payload'] | undefined;
28
28
  useUi: boolean;
29
29
  useDevice: boolean;
30
30
  useDeviceState: boolean;
@@ -37,24 +37,20 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
37
37
  requireDeviceMode: string[];
38
38
  network: NETWORK.NetworkType;
39
39
  useCardanoDerivation: boolean;
40
- confirmation?(): Promise<boolean | undefined>;
41
- noBackupConfirmation?(allowSuppression?: boolean): Promise<boolean>;
40
+ noBackupConfirmationMode: 'never' | 'always' | 'popup-only';
42
41
  getButtonRequestData?(code: string): UiRequestButtonData | undefined;
43
42
  postMessage: (message: CoreEventMessage) => void;
44
- getPopupPromise: () => Deferred<void>;
45
43
  createUiPromise: UiPromiseCreator;
46
- removeUiPromise: (promise: Deferred<any>) => void;
47
44
  initAsync?(): Promise<void>;
48
45
  constructor(message: {
49
46
  id?: number;
50
47
  payload: Payload<Name>;
51
48
  });
52
49
  setDevice(device: Device): void;
53
- requestPermissions(): Promise<boolean>;
54
50
  private getOriginPermissions;
55
51
  checkPermissions(): void;
56
52
  savePermissions(temporary?: boolean): void;
57
- checkFirmwareRange(isUsingPopup?: boolean): Promise<"ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined>;
53
+ checkFirmwareRange(): "ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined;
58
54
  isManagementRestricted(): boolean | undefined;
59
55
  abstract init(): void;
60
56
  abstract run(): Promise<MethodReturnType<Name>>;
@@ -17,6 +17,9 @@ class AbstractMethod {
17
17
  get info() {
18
18
  return '';
19
19
  }
20
+ get confirmation() {
21
+ return undefined;
22
+ }
20
23
  constructor(message) {
21
24
  var _a, _b;
22
25
  const { payload } = message;
@@ -59,6 +62,7 @@ class AbstractMethod {
59
62
  typeof payload.useCardanoDerivation === 'boolean'
60
63
  ? payload.useCardanoDerivation
61
64
  : payload.method.startsWith('cardano');
65
+ this.noBackupConfirmationMode = 'never';
62
66
  }
63
67
  setDevice(device) {
64
68
  this.device = device;
@@ -66,21 +70,6 @@ class AbstractMethod {
66
70
  const originalFn = this.createUiPromise;
67
71
  this.createUiPromise = (t, d) => originalFn(t, d || device);
68
72
  }
69
- async requestPermissions() {
70
- await this.getPopupPromise().promise;
71
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_PERMISSION);
72
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_PERMISSION, {
73
- permissions: this.requiredPermissions,
74
- device: this.device.toMessageObject(),
75
- }));
76
- const uiResp = await uiPromise.promise;
77
- const { granted, remember } = uiResp.payload;
78
- if (granted) {
79
- this.savePermissions(!remember);
80
- return true;
81
- }
82
- return false;
83
- }
84
73
  getOriginPermissions() {
85
74
  var _a;
86
75
  const origin = DataManager_1.DataManager.getSettings('origin');
@@ -128,7 +117,7 @@ class AbstractMethod {
128
117
  this.postMessage((0, events_1.createDeviceMessage)(events_1.DEVICE.CONNECT, this.device.toMessageObject()));
129
118
  }
130
119
  }
131
- async checkFirmwareRange(isUsingPopup) {
120
+ checkFirmwareRange() {
132
121
  if (this.skipFirmwareCheck) {
133
122
  return;
134
123
  }
@@ -151,18 +140,7 @@ class AbstractMethod {
151
140
  return events_1.UI.FIRMWARE_OLD;
152
141
  }
153
142
  if (range.max !== '0' && utils_1.versionUtils.isNewer(version, range.max)) {
154
- if (isUsingPopup) {
155
- await this.getPopupPromise().promise;
156
- const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
157
- this.postMessage((0, events_1.createUiMessage)(events_1.UI.FIRMWARE_NOT_COMPATIBLE, device.toMessageObject()));
158
- const uiResp = await uiPromise.promise;
159
- if (!uiResp.payload) {
160
- throw constants_1.ERRORS.TypedError('Method_PermissionsNotGranted');
161
- }
162
- }
163
- else {
164
- return events_1.UI.FIRMWARE_NOT_COMPATIBLE;
165
- }
143
+ return events_1.UI.FIRMWARE_NOT_COMPATIBLE;
166
144
  }
167
145
  }
168
146
  isManagementRestricted() {
@@ -5,8 +5,9 @@ import { AbstractMethod } from './AbstractMethod';
5
5
  import { LogWriter } from '../utils/debug';
6
6
  import type { ConnectSettings } from '../types';
7
7
  export declare class Core extends EventEmitter {
8
+ abortController: AbortController;
8
9
  handleMessage(message: CoreRequestMessage): void;
9
- dispose(): Promise<void>;
10
+ dispose(): void;
10
11
  getCurrentMethod(): Promise<AbstractMethod<any, undefined>>;
11
12
  getTransportInfo(): TransportInfo | undefined;
12
13
  enumerate(): void;