@trezor/connect 9.6.3-beta.2 → 9.6.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 (163) hide show
  1. package/CHANGELOG.md +16 -9
  2. package/README.md +1 -1
  3. package/lib/api/applyFlags.d.ts +1 -1
  4. package/lib/api/applyFlags.js +2 -2
  5. package/lib/api/applySettings.d.ts +1 -1
  6. package/lib/api/authenticateDevice.js +4 -0
  7. package/lib/api/authorizeCoinjoin.d.ts +1 -1
  8. package/lib/api/backupDevice.d.ts +1 -1
  9. package/lib/api/backupDevice.js +2 -2
  10. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
  11. package/lib/api/bitcoin/inputs.d.ts +1 -1
  12. package/lib/api/bitcoin/transactionBytes.d.ts +2 -2
  13. package/lib/api/bleUnpair.js +1 -1
  14. package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -1
  15. package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
  16. package/lib/api/cardano/cardanoInputs.js +2 -2
  17. package/lib/api/changePin.d.ts +1 -1
  18. package/lib/api/changePin.js +2 -2
  19. package/lib/api/changeWipeCode.d.ts +1 -1
  20. package/lib/api/cipherKeyValue.d.ts +1 -1
  21. package/lib/api/eos/api/eosGetPublicKey.d.ts +1 -1
  22. package/lib/api/eos/api/eosSignTransaction.d.ts +1 -1
  23. package/lib/api/eos/eosSignTx.d.ts +20 -20
  24. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +5 -5
  25. package/lib/api/ethereum/api/ethereumSignMessage.d.ts +1 -2
  26. package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +1 -1
  27. package/lib/api/evoluGetNode.d.ts +1 -1
  28. package/lib/api/evoluGetNode.js +2 -2
  29. package/lib/api/firmware/calculateFirmwareHash.d.ts +9 -2
  30. package/lib/api/firmware/calculateFirmwareHash.js +11 -1
  31. package/lib/api/firmware/verifyAuthenticityProof.d.ts +3 -1
  32. package/lib/api/firmware/verifyAuthenticityProof.js +10 -15
  33. package/lib/api/getCoinInfo.d.ts +34 -34
  34. package/lib/api/getFeatures.d.ts +1 -0
  35. package/lib/api/getFirmwareHash.d.ts +1 -1
  36. package/lib/api/getFirmwareHash.js +2 -2
  37. package/lib/api/getNonce.d.ts +1 -1
  38. package/lib/api/getOwnershipId.d.ts +1 -1
  39. package/lib/api/getOwnershipId.js +2 -2
  40. package/lib/api/getOwnershipProof.d.ts +1 -1
  41. package/lib/api/getOwnershipProof.js +2 -2
  42. package/lib/api/getPublicKey.d.ts +5 -5
  43. package/lib/api/loadDevice.d.ts +1 -1
  44. package/lib/api/loadDevice.js +2 -2
  45. package/lib/api/nem/api/nemSignTransaction.d.ts +1 -1
  46. package/lib/api/nem/nemSignTx.d.ts +9 -9
  47. package/lib/api/recoveryDevice.d.ts +1 -1
  48. package/lib/api/requestLogin.d.ts +1 -1
  49. package/lib/api/ripple/api/rippleSignTransaction.d.ts +1 -1
  50. package/lib/api/setBrightness.d.ts +1 -1
  51. package/lib/api/setBrightness.js +2 -2
  52. package/lib/api/setBusy.d.ts +1 -1
  53. package/lib/api/setBusy.js +2 -2
  54. package/lib/api/showDeviceTutorial.d.ts +1 -1
  55. package/lib/api/signMessage.d.ts +1 -1
  56. package/lib/api/solana/api/solanaComposeTransaction.d.ts +6 -0
  57. package/lib/api/solana/api/solanaComposeTransaction.js +9 -0
  58. package/lib/api/solana/api/solanaSignTransaction.js +4 -4
  59. package/lib/api/tezos/api/tezosGetPublicKey.d.ts +1 -1
  60. package/lib/api/tezos/api/tezosSignTransaction.d.ts +1 -1
  61. package/lib/api/tezos/tezosSignTx.d.ts +17 -17
  62. package/lib/api/unlockPath.d.ts +1 -1
  63. package/lib/core/AbstractMethod.d.ts +4 -1
  64. package/lib/core/index.js +8 -1
  65. package/lib/core/onCallFirmwareUpdate.js +42 -51
  66. package/lib/data/coinInfo.d.ts +94 -93
  67. package/lib/data/config.js +9 -1
  68. package/lib/data/defaultFeeLevels.d.ts +1 -1
  69. package/lib/data/defaultFeeLevels.js +1 -1
  70. package/lib/data/deviceAuthenticityBlacklist.d.ts +3 -0
  71. package/lib/data/deviceAuthenticityBlacklist.js +11 -0
  72. package/lib/data/deviceAuthenticityBlacklistConfig.d.ts +11 -0
  73. package/lib/data/deviceAuthenticityBlacklistConfig.js +15 -0
  74. package/lib/data/deviceAuthenticityConfig.js +4 -140
  75. package/lib/data/deviceAuthenticityConfigTypes.d.ts +0 -9
  76. package/lib/data/deviceAuthenticityConfigTypes.js +3 -5
  77. package/lib/data/firmwareInfo.d.ts +12 -7
  78. package/lib/data/firmwareInfo.js +58 -15
  79. package/lib/data/transportInfo.d.ts +11 -1
  80. package/lib/data/udevInfo.d.ts +9 -1
  81. package/lib/data/version.d.ts +1 -1
  82. package/lib/data/version.js +1 -1
  83. package/lib/device/Device.d.ts +20 -10
  84. package/lib/device/Device.js +95 -23
  85. package/lib/device/DeviceCommands.d.ts +4 -4
  86. package/lib/device/DeviceCurrentSession.d.ts +242 -242
  87. package/lib/device/DeviceCurrentSession.js +1 -1
  88. package/lib/device/DeviceList.d.ts +7 -4
  89. package/lib/device/DeviceList.js +14 -4
  90. package/lib/device/StateStorage.d.ts +1 -1
  91. package/lib/device/checkFirmwareRevision.d.ts +1 -1
  92. package/lib/device/checkFirmwareRevision.js +2 -2
  93. package/lib/device/thp/handshake.d.ts +1 -1
  94. package/lib/device/thp/handshake.js +14 -3
  95. package/lib/device/thp/index.d.ts +1 -1
  96. package/lib/device/thp/index.js +29 -4
  97. package/lib/device/thp/pairing.js +1 -3
  98. package/lib/device/thp/session.js +1 -1
  99. package/lib/device/workflow/checkFirmwareHash.js +6 -1
  100. package/lib/device/workflow/handshake.js +3 -7
  101. package/lib/device/workflow/trezorPushNotification.d.ts +3 -0
  102. package/lib/device/workflow/trezorPushNotification.js +76 -0
  103. package/lib/device/workflow/validateState.js +3 -0
  104. package/lib/events/call.d.ts +1 -1
  105. package/lib/events/device.d.ts +11 -3
  106. package/lib/events/device.js +5 -1
  107. package/lib/events/popup.d.ts +1 -1
  108. package/lib/events/transport.d.ts +3 -21
  109. package/lib/events/ui-request.d.ts +15 -8
  110. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  111. package/lib/types/api/applyFlags.d.ts +1 -1
  112. package/lib/types/api/applySettings.d.ts +1 -0
  113. package/lib/types/api/authenticateDevice.d.ts +9 -10
  114. package/lib/types/api/authenticateDevice.js +2 -0
  115. package/lib/types/api/backupDevice.d.ts +1 -1
  116. package/lib/types/api/bitcoin/index.d.ts +1 -1
  117. package/lib/types/api/bleUnpair.d.ts +1 -1
  118. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +1 -1
  119. package/lib/types/api/cardanoComposeTransaction.d.ts +2 -2
  120. package/lib/types/api/cardanoComposeTransaction.js +2 -2
  121. package/lib/types/api/changePin.d.ts +1 -1
  122. package/lib/types/api/changeWipeCode.d.ts +1 -1
  123. package/lib/types/api/composeTransaction.d.ts +1 -1
  124. package/lib/types/api/discoverAccounts.d.ts +1 -1
  125. package/lib/types/api/discoverAccounts.js +1 -1
  126. package/lib/types/api/eosSignTransaction.d.ts +1 -1
  127. package/lib/types/api/ethereum/index.d.ts +8 -8
  128. package/lib/types/api/ethereumSignMessage.d.ts +1 -1
  129. package/lib/types/api/ethereumSignTypedData.d.ts +1 -1
  130. package/lib/types/api/ethereumVerifyMessage.d.ts +1 -1
  131. package/lib/types/api/getAccountInfo.d.ts +1 -1
  132. package/lib/types/api/getAddress.d.ts +6 -6
  133. package/lib/types/api/getFirmwareHash.d.ts +1 -1
  134. package/lib/types/api/nemGetAddress.d.ts +1 -1
  135. package/lib/types/api/nemSignTransaction.d.ts +1 -1
  136. package/lib/types/api/recoveryDevice.d.ts +2 -2
  137. package/lib/types/api/setBusy.d.ts +1 -1
  138. package/lib/types/api/setProxy.d.ts +1 -1
  139. package/lib/types/api/showDeviceTutorial.d.ts +1 -1
  140. package/lib/types/api/signMessage.d.ts +1 -1
  141. package/lib/types/api/solana/index.d.ts +26 -3
  142. package/lib/types/api/solana/index.js +19 -3
  143. package/lib/types/api/tezosSignTransaction.d.ts +1 -1
  144. package/lib/types/api/thpRemoveCredentials.d.ts +1 -1
  145. package/lib/types/api/unlockPath.d.ts +1 -1
  146. package/lib/types/api/verifyMessage.d.ts +1 -1
  147. package/lib/types/api/wipeDevice.d.ts +1 -1
  148. package/lib/types/device.d.ts +9 -4
  149. package/lib/types/device.js +5 -3
  150. package/lib/types/firmware.d.ts +1 -0
  151. package/lib/types/settings.d.ts +2 -2
  152. package/lib/types/workflow.d.ts +4 -0
  153. package/lib/utils/assetUtils.d.ts +6 -4
  154. package/lib/utils/assetUtils.js +13 -2
  155. package/lib/utils/assets-browser.d.ts +0 -4
  156. package/lib/utils/assets-browser.js +3 -11
  157. package/lib/utils/assets.native.js +1 -1
  158. package/lib/utils/deviceFeaturesUtils.d.ts +1 -1
  159. package/lib/utils/firmwareUtils.d.ts +7 -4
  160. package/lib/utils/firmwareUtils.js +21 -14
  161. package/lib/utils/pathUtils.d.ts +3 -2
  162. package/lib/utils/uiPromiseManager.d.ts +9 -9
  163. package/package.json +16 -15
@@ -11,11 +11,21 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
11
11
  url: string[];
12
12
  } | undefined;
13
13
  label: string;
14
+ name: string;
14
15
  blockTime: number;
15
16
  minFee: number;
16
17
  maxFee: number;
17
18
  minPriorityFee: number;
18
- name: string;
19
+ defaultFees: {
20
+ feePerTx?: string | undefined;
21
+ feeLimit?: string | undefined;
22
+ baseFeePerGas?: string | undefined;
23
+ maxFeePerGas?: string | undefined;
24
+ maxPriorityFeePerGas?: string | undefined;
25
+ label: "normal" | "custom" | "high" | "economy" | "low";
26
+ blocks: number;
27
+ feePerUnit: string;
28
+ }[];
19
29
  shortcut: string;
20
30
  slip44: number;
21
31
  support: {
@@ -29,21 +39,11 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
29
39
  connect: boolean;
30
40
  };
31
41
  decimals: number;
32
- defaultFees: {
33
- feePerTx?: string | undefined;
34
- feeLimit?: string | undefined;
35
- baseFeePerGas?: string | undefined;
36
- maxFeePerGas?: string | undefined;
37
- maxPriorityFeePerGas?: string | undefined;
38
- label: "normal" | "custom" | "high" | "economy" | "low";
39
- blocks: number;
40
- feePerUnit: string;
41
- }[];
42
42
  } & {
43
+ taproot?: boolean | undefined;
43
44
  cashAddrPrefix?: string | undefined;
44
45
  xPubMagicSegwitNative?: number | undefined;
45
46
  xPubMagicSegwit?: number | undefined;
46
- taproot?: boolean | undefined;
47
47
  type: "bitcoin";
48
48
  dustLimit: number;
49
49
  curveName: string;
@@ -74,11 +74,21 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
74
74
  url: string[];
75
75
  } | undefined;
76
76
  label: string;
77
+ name: string;
77
78
  blockTime: number;
78
79
  minFee: number;
79
80
  maxFee: number;
80
81
  minPriorityFee: number;
81
- name: string;
82
+ defaultFees: {
83
+ feePerTx?: string | undefined;
84
+ feeLimit?: string | undefined;
85
+ baseFeePerGas?: string | undefined;
86
+ maxFeePerGas?: string | undefined;
87
+ maxPriorityFeePerGas?: string | undefined;
88
+ label: "normal" | "custom" | "high" | "economy" | "low";
89
+ blocks: number;
90
+ feePerUnit: string;
91
+ }[];
82
92
  shortcut: string;
83
93
  slip44: number;
84
94
  support: {
@@ -92,16 +102,6 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
92
102
  connect: boolean;
93
103
  };
94
104
  decimals: number;
95
- defaultFees: {
96
- feePerTx?: string | undefined;
97
- feeLimit?: string | undefined;
98
- baseFeePerGas?: string | undefined;
99
- maxFeePerGas?: string | undefined;
100
- maxPriorityFeePerGas?: string | undefined;
101
- label: "normal" | "custom" | "high" | "economy" | "low";
102
- blocks: number;
103
- feePerUnit: string;
104
- }[];
105
105
  } & {
106
106
  network?: undefined;
107
107
  type: "ethereum";
@@ -112,11 +112,21 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
112
112
  url: string[];
113
113
  } | undefined;
114
114
  label: string;
115
+ name: string;
115
116
  blockTime: number;
116
117
  minFee: number;
117
118
  maxFee: number;
118
119
  minPriorityFee: number;
119
- name: string;
120
+ defaultFees: {
121
+ feePerTx?: string | undefined;
122
+ feeLimit?: string | undefined;
123
+ baseFeePerGas?: string | undefined;
124
+ maxFeePerGas?: string | undefined;
125
+ maxPriorityFeePerGas?: string | undefined;
126
+ label: "normal" | "custom" | "high" | "economy" | "low";
127
+ blocks: number;
128
+ feePerUnit: string;
129
+ }[];
120
130
  shortcut: string;
121
131
  slip44: number;
122
132
  support: {
@@ -130,16 +140,6 @@ export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
130
140
  connect: boolean;
131
141
  };
132
142
  decimals: number;
133
- defaultFees: {
134
- feePerTx?: string | undefined;
135
- feeLimit?: string | undefined;
136
- baseFeePerGas?: string | undefined;
137
- maxFeePerGas?: string | undefined;
138
- maxPriorityFeePerGas?: string | undefined;
139
- label: "normal" | "custom" | "high" | "economy" | "low";
140
- blocks: number;
141
- feePerUnit: string;
142
- }[];
143
143
  } & {
144
144
  network?: undefined;
145
145
  type: "nem" | "misc";
@@ -17,6 +17,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
17
17
  recovery_type?: "NormalRecovery" | "DryRun" | "UnlockRepeatedBackup" | undefined;
18
18
  optiga_sec?: number | undefined;
19
19
  soc?: number | undefined;
20
+ firmware_corrupted?: boolean | undefined;
20
21
  vendor: string;
21
22
  major_version: number;
22
23
  minor_version: number;
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class GetFirmwareHash extends AbstractMethod<'getFirmwareHash', PROTO.GetFirmwareHash> {
4
4
  init(): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const protobuf_1 = require("@trezor/protobuf");
3
4
  const schema_utils_1 = require("@trezor/schema-utils");
4
- const constants_1 = require("../constants");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  const events_1 = require("../events");
7
7
  const paramsValidator_1 = require("./common/paramsValidator");
@@ -12,7 +12,7 @@ class GetFirmwareHash extends AbstractMethod_1.AbstractMethod {
12
12
  this.useDeviceState = false;
13
13
  this.allowDeviceMode = [events_1.UI.INITIALIZE];
14
14
  const { payload } = this;
15
- (0, schema_utils_1.Assert)(constants_1.PROTO.GetFirmwareHash, payload);
15
+ (0, schema_utils_1.Assert)(protobuf_1.MessagesSchema.GetFirmwareHash, payload);
16
16
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
17
17
  this.params = {
18
18
  challenge: payload.challenge,
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class GetNonce extends AbstractMethod<'getNonce', PROTO.GetNonce> {
4
4
  init(): void;
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class GetOwnershipId extends AbstractMethod<'getOwnershipId', PROTO.GetOwnershipId[]> {
4
4
  hasBundle?: boolean;
@@ -5,7 +5,7 @@ const paramsValidator_1 = require("./common/paramsValidator");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  const coinInfo_1 = require("../data/coinInfo");
7
7
  const events_1 = require("../events");
8
- const exports_1 = require("../exports");
8
+ const types_1 = require("../types");
9
9
  const getOwnershipId_1 = require("../types/api/getOwnershipId");
10
10
  const pathUtils_1 = require("../utils/pathUtils");
11
11
  class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
@@ -16,7 +16,7 @@ class GetOwnershipId extends AbstractMethod_1.AbstractMethod {
16
16
  const payload = !this.payload.bundle
17
17
  ? { ...this.payload, bundle: [this.payload] }
18
18
  : this.payload;
19
- (0, schema_utils_1.Assert)((0, exports_1.Bundle)(getOwnershipId_1.GetOwnershipId), payload);
19
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(getOwnershipId_1.GetOwnershipId), payload);
20
20
  this.params = payload.bundle.map(batch => {
21
21
  const address_n = (0, pathUtils_1.validatePath)(batch.path, 1);
22
22
  const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(batch.coin || address_n);
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class GetOwnershipProof extends AbstractMethod<'getOwnershipProof', PROTO.GetOwnershipProof[]> {
4
4
  hasBundle?: boolean;
@@ -5,7 +5,7 @@ const paramsValidator_1 = require("./common/paramsValidator");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  const coinInfo_1 = require("../data/coinInfo");
7
7
  const events_1 = require("../events");
8
- const exports_1 = require("../exports");
8
+ const types_1 = require("../types");
9
9
  const getOwnershipProof_1 = require("../types/api/getOwnershipProof");
10
10
  const pathUtils_1 = require("../utils/pathUtils");
11
11
  class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
@@ -16,7 +16,7 @@ class GetOwnershipProof extends AbstractMethod_1.AbstractMethod {
16
16
  const payload = !this.payload.bundle
17
17
  ? { ...this.payload, bundle: [this.payload] }
18
18
  : this.payload;
19
- (0, schema_utils_1.Assert)((0, exports_1.Bundle)(getOwnershipProof_1.GetOwnershipProof), payload);
19
+ (0, schema_utils_1.Assert)((0, types_1.Bundle)(getOwnershipProof_1.GetOwnershipProof), payload);
20
20
  this.params = payload.bundle.map(batch => {
21
21
  const address_n = (0, pathUtils_1.validatePath)(batch.path, 1);
22
22
  const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(batch.coin || address_n);
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  import type { BitcoinNetworkInfo } from '../types';
4
4
  type Params = PROTO.GetPublicKey & {
@@ -24,9 +24,9 @@ export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[
24
24
  descriptorChecksum?: string | undefined;
25
25
  depth: number;
26
26
  fingerprint: number;
27
- chainCode: string;
28
- childNum: number;
29
27
  xpub: string;
28
+ childNum: number;
29
+ chainCode: string;
30
30
  }) | ({
31
31
  path: number[];
32
32
  publicKey: string;
@@ -37,9 +37,9 @@ export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[
37
37
  descriptorChecksum?: string | undefined;
38
38
  depth: number;
39
39
  fingerprint: number;
40
- chainCode: string;
41
- childNum: number;
42
40
  xpub: string;
41
+ childNum: number;
42
+ chainCode: string;
43
43
  })[]>;
44
44
  }
45
45
  export {};
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class LoadDevice extends AbstractMethod<'loadDevice', PROTO.LoadDevice> {
4
4
  init(): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const protobuf_1 = require("@trezor/protobuf");
3
4
  const schema_utils_1 = require("@trezor/schema-utils");
4
- const constants_1 = require("../constants");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  const events_1 = require("../events");
7
7
  const paramsValidator_1 = require("./common/paramsValidator");
@@ -13,7 +13,7 @@ class LoadDevice extends AbstractMethod_1.AbstractMethod {
13
13
  this.skipFinalReload = false;
14
14
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
15
15
  const { payload } = this;
16
- (0, schema_utils_1.Assert)(constants_1.PROTO.LoadDevice, payload);
16
+ (0, schema_utils_1.Assert)(protobuf_1.MessagesSchema.LoadDevice, payload);
17
17
  this.params = {
18
18
  mnemonics: payload.mnemonics,
19
19
  pin: payload.pin,
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
3
  export default class NEMSignTransaction extends AbstractMethod<'nemSignTransaction', PROTO.NEMSignTx> {
4
4
  init(): void;
@@ -3,11 +3,11 @@ import * as $T from '../../types/api/nem';
3
3
  export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chunkify?: boolean) => {
4
4
  chunkify?: boolean | undefined;
5
5
  multisig?: {
6
- address_n?: number[] | undefined;
7
6
  network?: number | undefined;
7
+ address_n?: number[] | undefined;
8
8
  signer?: string | undefined;
9
- timestamp: number;
10
9
  fee: string | number;
10
+ timestamp: number;
11
11
  deadline: number;
12
12
  } | undefined;
13
13
  transfer?: {
@@ -34,16 +34,16 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
34
34
  definition: {
35
35
  name?: string | undefined;
36
36
  fee?: string | number | undefined;
37
- networks?: number[] | undefined;
38
- levy?: PROTO.NEMMosaicLevy | undefined;
39
- divisibility?: number | undefined;
40
- transferable?: boolean | undefined;
41
37
  ticker?: string | undefined;
38
+ divisibility?: number | undefined;
39
+ levy?: PROTO.NEMMosaicLevy | undefined;
42
40
  levy_address?: string | undefined;
43
41
  levy_namespace?: string | undefined;
44
42
  levy_mosaic?: string | undefined;
45
43
  supply?: number | undefined;
46
44
  mutable_supply?: boolean | undefined;
45
+ transferable?: boolean | undefined;
46
+ networks?: number[] | undefined;
47
47
  description: string;
48
48
  namespace: string;
49
49
  mosaic: string;
@@ -51,9 +51,9 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
51
51
  } | undefined;
52
52
  supply_change?: {
53
53
  type: PROTO.NEMSupplyChangeType;
54
- delta: number;
55
54
  namespace: string;
56
55
  mosaic: string;
56
+ delta: number;
57
57
  } | undefined;
58
58
  aggregate_modification?: {
59
59
  modifications?: {
@@ -67,11 +67,11 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
67
67
  mode: PROTO.NEMImportanceTransferMode;
68
68
  } | undefined;
69
69
  transaction: {
70
- address_n?: number[] | undefined;
71
70
  network?: number | undefined;
71
+ address_n?: number[] | undefined;
72
72
  signer?: string | undefined;
73
- timestamp: number;
74
73
  fee: string | number;
74
+ timestamp: number;
75
75
  deadline: number;
76
76
  };
77
77
  };
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class RecoveryDevice extends AbstractMethod<'recoveryDevice', PROTO.RecoveryDevice> {
4
4
  init(): void;
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class RequestLogin extends AbstractMethod<'requestLogin', PROTO.SignIdentity> {
4
4
  asyncChallenge?: boolean;
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
3
  export default class RippleSignTransaction extends AbstractMethod<'rippleSignTransaction', PROTO.RippleSignTx> {
4
4
  init(): void;
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class SetBrightness extends AbstractMethod<'setBrightness', PROTO.SetBrightness> {
4
4
  init(): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const protobuf_1 = require("@trezor/protobuf");
3
4
  const schema_utils_1 = require("@trezor/schema-utils");
4
- const constants_1 = require("../constants");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  class SetBrightness extends AbstractMethod_1.AbstractMethod {
7
7
  init() {
@@ -9,7 +9,7 @@ class SetBrightness extends AbstractMethod_1.AbstractMethod {
9
9
  this.skipFinalReload = false;
10
10
  this.useDeviceState = false;
11
11
  const { payload } = this;
12
- (0, schema_utils_1.Assert)(constants_1.PROTO.SetBrightness, payload);
12
+ (0, schema_utils_1.Assert)(protobuf_1.MessagesSchema.SetBrightness, payload);
13
13
  this.params = {
14
14
  value: payload.value,
15
15
  };
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class SetBusy extends AbstractMethod<'setBusy', PROTO.SetBusy> {
4
4
  init(): void;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const protobuf_1 = require("@trezor/protobuf");
3
4
  const schema_utils_1 = require("@trezor/schema-utils");
4
- const constants_1 = require("../constants");
5
5
  const AbstractMethod_1 = require("../core/AbstractMethod");
6
6
  const events_1 = require("../events");
7
7
  const paramsValidator_1 = require("./common/paramsValidator");
@@ -11,7 +11,7 @@ class SetBusy extends AbstractMethod_1.AbstractMethod {
11
11
  this.requiredPermissions = ['management'];
12
12
  this.skipFinalReload = false;
13
13
  const { payload } = this;
14
- (0, schema_utils_1.Assert)(constants_1.PROTO.SetBusy, payload);
14
+ (0, schema_utils_1.Assert)(protobuf_1.MessagesSchema.SetBusy, payload);
15
15
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, undefined, this.firmwareRange);
16
16
  this.params = {
17
17
  expiry_ms: payload.expiry_ms,
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class ShowDeviceTutorial extends AbstractMethod<'showDeviceTutorial', PROTO.ShowDeviceTutorial> {
4
4
  init(): void;
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  import type { BitcoinNetworkInfo } from '../types';
4
4
  export default class SignMessage extends AbstractMethod<'signMessage', PROTO.SignMessage> {
@@ -8,6 +8,12 @@ export default class SolanaComposeTransaction extends AbstractMethod<'solanaComp
8
8
  init(): void;
9
9
  get info(): string;
10
10
  run(): Promise<{
11
+ serializedTx: string;
12
+ additionalInfo: {
13
+ newAccountProgramName?: undefined;
14
+ tokenAccountInfo?: undefined;
15
+ };
16
+ } | {
11
17
  serializedTx: string;
12
18
  additionalInfo: {
13
19
  newAccountProgramName: "spl-token" | "spl-token-2022" | undefined;
@@ -29,6 +29,15 @@ class SolanaComposeTransaction extends AbstractMethod_1.AbstractMethod {
29
29
  }
30
30
  async run() {
31
31
  const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
32
+ if (this.params.serializedTx) {
33
+ return {
34
+ serializedTx: this.params.serializedTx,
35
+ additionalInfo: {},
36
+ };
37
+ }
38
+ if (!this.params.toAddress) {
39
+ throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'toAddress not found');
40
+ }
32
41
  const [recipientAccountOwner, recipientTokenAccounts] = this.params.token
33
42
  ? await (0, solanaUtils_1.fetchAccountOwnerAndTokenInfoForAddress)(backend, this.params.toAddress, this.params.token.mint, this.params.token.program)
34
43
  : [undefined, undefined];
@@ -174,16 +174,16 @@ class SolanaSignTransaction extends AbstractMethod_1.AbstractMethod {
174
174
  const cmd = this.device.getCommands();
175
175
  if (this.params.serialize) {
176
176
  const tx = await (0, solanaUtils_1.createTransactionShimFromHex)(this.params.serialized_tx);
177
- const { message } = await cmd.typedCall('SolanaSignTx', 'SolanaTxSignature', {
178
- ...this.params,
179
- serialized_tx: tx.serializeMessage(),
180
- });
181
177
  const addressCall = await cmd.typedCall('SolanaGetAddress', 'SolanaAddress', {
182
178
  address_n: this.params.address_n,
183
179
  show_display: false,
184
180
  chunkify: false,
185
181
  });
186
182
  const { address } = addressCall.message;
183
+ const { message } = await cmd.typedCall('SolanaSignTx', 'SolanaTxSignature', {
184
+ ...this.params,
185
+ serialized_tx: tx.serializeMessage(),
186
+ });
187
187
  tx.addSignature(address, message.signature);
188
188
  const signedSerializedTx = tx.serialize();
189
189
  return { signature: message.signature, serializedTx: signedSerializedTx };
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
3
  export default class TezosGetPublicKey extends AbstractMethod<'tezosGetPublicKey', PROTO.TezosGetPublicKey[]> {
4
4
  hasBundle?: boolean;
@@ -1,4 +1,4 @@
1
- import type { PROTO } from '../../../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../../../core/AbstractMethod';
3
3
  export default class TezosSignTransaction extends AbstractMethod<'tezosSignTransaction', PROTO.TezosSignTx> {
4
4
  init(): void;
@@ -17,21 +17,32 @@ export declare const createTx: (address_n: number[], branch: string, operation:
17
17
  } | undefined;
18
18
  fee: string | number;
19
19
  amount: string | number;
20
+ gas_limit: number;
20
21
  destination: {
21
22
  hash: Uint8Array<ArrayBufferLike>;
22
23
  tag: number;
23
24
  };
24
25
  source: Uint8Array<ArrayBufferLike>;
25
26
  counter: number;
26
- gas_limit: number;
27
27
  storage_limit: number;
28
28
  } | undefined;
29
+ proposal?: {
30
+ source: string;
31
+ period: number;
32
+ proposals: string[];
33
+ } | undefined;
34
+ ballot?: {
35
+ source: string;
36
+ period: number;
37
+ proposal: string;
38
+ ballot: PROTO.TezosBallotType;
39
+ } | undefined;
29
40
  reveal?: {
30
41
  fee: string | number;
31
42
  public_key: Uint8Array<ArrayBufferLike>;
43
+ gas_limit: number;
32
44
  source: Uint8Array<ArrayBufferLike>;
33
45
  counter: number;
34
- gas_limit: number;
35
46
  storage_limit: number;
36
47
  } | undefined;
37
48
  origination?: {
@@ -41,30 +52,19 @@ export declare const createTx: (address_n: number[], branch: string, operation:
41
52
  delegatable?: boolean | undefined;
42
53
  fee: string | number;
43
54
  script: string | number[];
44
- balance: number;
55
+ gas_limit: number;
45
56
  source: Uint8Array<ArrayBufferLike>;
46
57
  counter: number;
47
- gas_limit: number;
48
58
  storage_limit: number;
59
+ balance: number;
49
60
  } | undefined;
50
61
  delegation?: {
51
62
  fee: string | number;
63
+ delegate: Uint8Array<ArrayBufferLike>;
64
+ gas_limit: number;
52
65
  source: Uint8Array<ArrayBufferLike>;
53
66
  counter: number;
54
- gas_limit: number;
55
67
  storage_limit: number;
56
- delegate: Uint8Array<ArrayBufferLike>;
57
- } | undefined;
58
- proposal?: {
59
- source: string;
60
- period: number;
61
- proposals: string[];
62
- } | undefined;
63
- ballot?: {
64
- source: string;
65
- period: number;
66
- proposal: string;
67
- ballot: PROTO.TezosBallotType;
68
68
  } | undefined;
69
69
  address_n: number[];
70
70
  branch: Uint8Array<ArrayBufferLike>;
@@ -1,4 +1,4 @@
1
- import { PROTO } from '../constants';
1
+ import { MessagesSchema as PROTO } from '@trezor/protobuf';
2
2
  import { AbstractMethod } from '../core/AbstractMethod';
3
3
  export default class UnlockPath extends AbstractMethod<'unlockPath', PROTO.UnlockPath> {
4
4
  init(): void;
@@ -2,7 +2,10 @@ import { Capability } from '@trezor/protobuf/lib/messages';
2
2
  import { NETWORK } from '../constants';
3
3
  import type { Device } from '../device/Device';
4
4
  import { CallMethodPayload, CallMethodResponse, CoreEventMessage, UI, UiPromiseCreator, UiRequestButtonData, UiRequestConfirmation } from '../events';
5
- import type { ConnectSettings, DeviceState, FirmwareRange, PrecomposeResultFinal } from '../types';
5
+ import type { PrecomposeResultFinal } from '../types/api/composeTransaction';
6
+ import type { DeviceState } from '../types/device';
7
+ import type { FirmwareRange } from '../types/firmware';
8
+ import type { ConnectSettings } from '../types/settings';
6
9
  export type Payload<M> = Extract<CallMethodPayload, {
7
10
  method: M;
8
11
  }> & {
package/lib/core/index.js CHANGED
@@ -43,7 +43,7 @@ const initDevice = async (context, methodCallDevice) => {
43
43
  if (methodCallDevice?.state?.staticSessionId) {
44
44
  device = deviceList.getDeviceByStaticState(methodCallDevice.state.staticSessionId);
45
45
  }
46
- else if (methodCallDevice?.path) {
46
+ if (!device && methodCallDevice?.path) {
47
47
  device = deviceList.getDeviceByPath(methodCallDevice.path);
48
48
  }
49
49
  if (preferredDevice && !device) {
@@ -613,6 +613,13 @@ const initDeviceList = (context) => {
613
613
  deviceList.on(events_2.DEVICE.CHANGED, device => {
614
614
  sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CHANGED, device.toMessageObject()));
615
615
  });
616
+ deviceList.on(events_2.DEVICE.TREZOR_PUSH_NOTIFICATION, payload => {
617
+ sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.TREZOR_PUSH_NOTIFICATION, {
618
+ device: payload.device.toMessageObject(),
619
+ mode: payload.mode,
620
+ type: payload.type,
621
+ }));
622
+ });
616
623
  deviceList.on(transport_1.TRANSPORT.START, transport => sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.START, transport)));
617
624
  deviceList.on(transport_1.TRANSPORT.ERROR, error => {
618
625
  _log.warn('TRANSPORT.ERROR', error.error);