@trezor/connect 9.4.2 → 9.4.3-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 (214) hide show
  1. package/CHANGELOG.md +90 -9
  2. package/README.md +1 -1
  3. package/lib/api/applyFlags.js +1 -1
  4. package/lib/api/applySettings.js +1 -1
  5. package/lib/api/authenticateDevice.js +1 -1
  6. package/lib/api/authorizeCoinjoin.js +1 -1
  7. package/lib/api/backupDevice.js +1 -1
  8. package/lib/api/binance/api/binanceGetAddress.js +2 -1
  9. package/lib/api/binance/api/binanceGetPublicKey.js +2 -1
  10. package/lib/api/binance/api/binanceSignTransaction.js +2 -1
  11. package/lib/api/binance/binanceSignTx.js +1 -1
  12. package/lib/api/bitcoin/Fees.js +2 -2
  13. package/lib/api/bitcoin/TransactionComposer.d.ts +3 -3
  14. package/lib/api/bitcoin/TransactionComposer.js +2 -2
  15. package/lib/api/bitcoin/refTx.js +1 -1
  16. package/lib/api/blockchainDisconnect.js +1 -1
  17. package/lib/api/blockchainEvmRpcCall.d.ts +16 -0
  18. package/lib/api/blockchainEvmRpcCall.js +45 -0
  19. package/lib/api/cancelCoinjoinAuthorization.js +1 -1
  20. package/lib/api/cardano/api/cardanoGetAddress.js +2 -1
  21. package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +2 -1
  22. package/lib/api/cardano/api/cardanoGetPublicKey.js +2 -1
  23. package/lib/api/cardano/api/cardanoSignTransaction.js +2 -1
  24. package/lib/api/cardano/cardanoAddressParameters.js +1 -1
  25. package/lib/api/cardano/cardanoAuxiliaryData.js +1 -1
  26. package/lib/api/cardano/cardanoCertificate.js +1 -1
  27. package/lib/api/cardano/cardanoInputs.d.ts +8 -8
  28. package/lib/api/cardano/cardanoInputs.js +1 -1
  29. package/lib/api/cardano/cardanoOutputs.d.ts +22 -22
  30. package/lib/api/cardano/cardanoOutputs.js +1 -1
  31. package/lib/api/cardano/cardanoTokenBundle.d.ts +6 -6
  32. package/lib/api/cardano/cardanoTokenBundle.js +1 -1
  33. package/lib/api/changeLanguage.js +1 -1
  34. package/lib/api/changePin.js +1 -1
  35. package/lib/api/cipherKeyValue.js +1 -1
  36. package/lib/api/common/paramsValidator.js +1 -1
  37. package/lib/api/composeTransaction.d.ts +9 -3
  38. package/lib/api/composeTransaction.js +7 -4
  39. package/lib/api/eos/api/eosGetPublicKey.js +2 -1
  40. package/lib/api/eos/api/eosSignTransaction.js +2 -1
  41. package/lib/api/eos/eosSignTx.d.ts +3 -3
  42. package/lib/api/ethereum/api/ethereumGetAddress.js +2 -1
  43. package/lib/api/ethereum/api/ethereumGetPublicKey.js +2 -1
  44. package/lib/api/ethereum/api/ethereumSignMessage.d.ts +1 -1
  45. package/lib/api/ethereum/api/ethereumSignMessage.js +2 -1
  46. package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +1 -1
  47. package/lib/api/ethereum/api/ethereumSignTransaction.js +13 -7
  48. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +58 -57
  49. package/lib/api/ethereum/api/ethereumSignTypedData.js +3 -2
  50. package/lib/api/ethereum/api/ethereumVerifyMessage.js +2 -1
  51. package/lib/api/ethereum/ethereumDefinitions.d.ts +21 -21
  52. package/lib/api/ethereum/ethereumDefinitions.js +6 -5
  53. package/lib/api/firmware/getBinary.d.ts +4 -5
  54. package/lib/api/firmware/getBinary.js +12 -13
  55. package/lib/api/firmware/getBinaryForFirmwareUpgrade.d.ts +3 -3
  56. package/lib/api/firmware/getBinaryForFirmwareUpgrade.js +2 -2
  57. package/lib/api/firmware/index.d.ts +1 -1
  58. package/lib/api/firmware/index.js +2 -1
  59. package/lib/api/firmware/x509certificate.js +3 -5
  60. package/lib/api/getAccountDescriptor.js +1 -1
  61. package/lib/api/getAddress.js +1 -1
  62. package/lib/api/getCoinInfo.d.ts +3 -0
  63. package/lib/api/getCoinInfo.js +1 -1
  64. package/lib/api/getFirmwareHash.js +1 -1
  65. package/lib/api/getOwnershipId.js +1 -1
  66. package/lib/api/getOwnershipProof.js +1 -1
  67. package/lib/api/getPublicKey.js +1 -1
  68. package/lib/api/index.d.ts +2 -1
  69. package/lib/api/index.js +5 -3
  70. package/lib/api/loadDevice.d.ts +14 -0
  71. package/lib/api/loadDevice.js +44 -0
  72. package/lib/api/nem/api/nemGetAddress.js +2 -1
  73. package/lib/api/nem/api/nemSignTransaction.js +2 -1
  74. package/lib/api/pushTransaction.js +1 -1
  75. package/lib/api/rebootToBootloader.js +1 -1
  76. package/lib/api/recoveryDevice.js +1 -1
  77. package/lib/api/requestLogin.js +1 -1
  78. package/lib/api/resetDevice.js +1 -2
  79. package/lib/api/ripple/api/rippleGetAddress.js +2 -1
  80. package/lib/api/ripple/api/rippleSignTransaction.js +2 -1
  81. package/lib/api/setBrightness.js +1 -1
  82. package/lib/api/setBusy.js +1 -1
  83. package/lib/api/signMessage.js +1 -1
  84. package/lib/api/solana/api/solanaGetAddress.js +2 -1
  85. package/lib/api/solana/api/solanaGetPublicKey.js +2 -1
  86. package/lib/api/solana/api/solanaSignTransaction.js +2 -1
  87. package/lib/api/stellar/api/stellarGetAddress.js +2 -1
  88. package/lib/api/stellar/api/stellarSignTransaction.js +2 -1
  89. package/lib/api/stellar/stellarSignTx.js +1 -1
  90. package/lib/api/tezos/api/tezosGetAddress.js +2 -1
  91. package/lib/api/tezos/api/tezosGetPublicKey.js +2 -1
  92. package/lib/api/tezos/api/tezosSignTransaction.js +2 -1
  93. package/lib/api/tezos/tezosSignTx.js +1 -1
  94. package/lib/api/unlockPath.js +1 -1
  95. package/lib/api/verifyMessage.js +1 -1
  96. package/lib/backend/Blockchain.d.ts +3 -0
  97. package/lib/backend/Blockchain.js +6 -6
  98. package/lib/constants/errors.d.ts +49 -38
  99. package/lib/constants/errors.js +10 -0
  100. package/lib/constants/firmware.d.ts +2 -0
  101. package/lib/constants/firmware.js +5 -0
  102. package/lib/constants/index.d.ts +2 -0
  103. package/lib/constants/index.js +4 -1
  104. package/lib/constants/nem.d.ts +3 -3
  105. package/lib/constants/utxo.d.ts +3 -0
  106. package/lib/constants/utxo.js +5 -0
  107. package/lib/core/AbstractMethod.d.ts +13 -5
  108. package/lib/core/AbstractMethod.js +50 -24
  109. package/lib/core/index.js +41 -30
  110. package/lib/core/onCallFirmwareUpdate.d.ts +2 -2
  111. package/lib/core/onCallFirmwareUpdate.js +6 -6
  112. package/lib/data/DataManager.d.ts +0 -181
  113. package/lib/data/DataManager.js +40 -6
  114. package/lib/data/analyticsInfo.js +4 -2
  115. package/lib/data/coinInfo.d.ts +14 -0
  116. package/lib/data/config.d.ts +20 -22
  117. package/lib/data/config.js +15 -40
  118. package/lib/data/connectSettings.js +10 -4
  119. package/lib/data/deviceAuthenticityConfig.js +20 -0
  120. package/lib/data/deviceAuthenticityConfigTypes.d.ts +32 -23
  121. package/lib/data/firmwareInfo.d.ts +1 -1
  122. package/lib/data/models.d.ts +9 -0
  123. package/lib/data/models.js +9 -0
  124. package/lib/data/version.d.ts +2 -1
  125. package/lib/data/version.js +3 -2
  126. package/lib/device/Device.d.ts +144 -36
  127. package/lib/device/Device.js +270 -113
  128. package/lib/device/DeviceCommands.js +4 -4
  129. package/lib/device/DeviceList.d.ts +13 -21
  130. package/lib/device/DeviceList.js +54 -168
  131. package/lib/device/checkFirmwareRevision.js +4 -4
  132. package/lib/device/prompts.js +3 -2
  133. package/lib/device/resolveDescriptorForTaproot.d.ts +1 -1
  134. package/lib/events/call.d.ts +5 -5
  135. package/lib/events/call.js +2 -2
  136. package/lib/events/core.d.ts +4 -3
  137. package/lib/events/device.d.ts +0 -6
  138. package/lib/events/device.js +0 -6
  139. package/lib/events/transport.d.ts +1 -1
  140. package/lib/factory.d.ts +6 -6
  141. package/lib/factory.js +132 -136
  142. package/lib/impl/dynamic.d.ts +33 -0
  143. package/lib/impl/dynamic.js +75 -0
  144. package/lib/index-browser.d.ts +3 -1
  145. package/lib/index-browser.js +0 -3
  146. package/lib/index.d.ts +3 -1
  147. package/lib/index.js +1 -13
  148. package/lib/types/api/applySettings.d.ts +13 -13
  149. package/lib/types/api/authenticateDevice.d.ts +33 -24
  150. package/lib/types/api/authorizeCoinjoin.d.ts +10 -10
  151. package/lib/types/api/binance/index.d.ts +143 -143
  152. package/lib/types/api/binance/index.js +1 -1
  153. package/lib/types/api/bitcoin/index.d.ts +11 -11
  154. package/lib/types/api/bitcoin/index.js +1 -1
  155. package/lib/types/api/blockchainEvmRpcCall.d.ts +4 -0
  156. package/lib/types/api/{checkFirmwareAuthenticity.js → blockchainEvmRpcCall.js} +1 -1
  157. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +1 -1
  158. package/lib/types/api/cardano/index.d.ts +507 -507
  159. package/lib/types/api/changeLanguage.d.ts +6 -6
  160. package/lib/types/api/cipherKeyValue.d.ts +8 -8
  161. package/lib/types/api/cipherKeyValue.js +1 -1
  162. package/lib/types/api/composeTransaction.d.ts +13 -7
  163. package/lib/types/api/eos/index.d.ts +525 -525
  164. package/lib/types/api/eos/index.js +1 -1
  165. package/lib/types/api/ethereum/index.d.ts +100 -100
  166. package/lib/types/api/firmwareUpdate.d.ts +5 -5
  167. package/lib/types/api/getAccountDescriptor.d.ts +4 -4
  168. package/lib/types/api/getAddress.d.ts +32 -32
  169. package/lib/types/api/getOwnershipId.d.ts +24 -24
  170. package/lib/types/api/getOwnershipProof.d.ts +28 -28
  171. package/lib/types/api/getPublicKey.d.ts +24 -24
  172. package/lib/types/api/getPublicKey.js +1 -1
  173. package/lib/types/api/index.d.ts +4 -8
  174. package/lib/types/api/init.d.ts +4 -2
  175. package/lib/types/api/loadDevice.d.ts +4 -0
  176. package/lib/types/api/loadDevice.js +3 -0
  177. package/lib/types/api/nem/index.d.ts +612 -612
  178. package/lib/types/api/nem/index.js +1 -1
  179. package/lib/types/api/nemGetAddress.d.ts +6 -6
  180. package/lib/types/api/pushTransaction.d.ts +3 -3
  181. package/lib/types/api/recoveryDevice.d.ts +9 -9
  182. package/lib/types/api/requestLogin.d.ts +25 -25
  183. package/lib/types/api/ripple/index.d.ts +21 -21
  184. package/lib/types/api/ripple/index.js +1 -1
  185. package/lib/types/api/solana/index.d.ts +23 -23
  186. package/lib/types/api/solana/index.js +1 -1
  187. package/lib/types/api/stellar/index.d.ts +582 -582
  188. package/lib/types/api/stellar/index.js +1 -1
  189. package/lib/types/api/tezos/index.d.ts +120 -120
  190. package/lib/types/api/tezos/index.js +1 -1
  191. package/lib/types/api/unlockPath.d.ts +2 -2
  192. package/lib/types/coinInfo.d.ts +231 -224
  193. package/lib/types/device.d.ts +33 -14
  194. package/lib/types/device.js +3 -1
  195. package/lib/types/fees.d.ts +19 -19
  196. package/lib/types/firmware.d.ts +1 -1
  197. package/lib/types/params.d.ts +23 -19
  198. package/lib/types/settings.d.ts +17 -10
  199. package/lib/types/utils.d.ts +1 -0
  200. package/lib/types/utils.js +3 -0
  201. package/lib/utils/addressUtils.js +2 -2
  202. package/lib/utils/assetUtils.d.ts +1 -1
  203. package/lib/utils/assetUtils.js +6 -6
  204. package/lib/utils/assets.js +1 -1
  205. package/lib/utils/assets.native.js +1 -1
  206. package/lib/utils/deviceFeaturesUtils.js +1 -1
  207. package/lib/utils/proxy-event-emitter.d.ts +21 -0
  208. package/lib/utils/proxy-event-emitter.js +65 -0
  209. package/lib/utils/uiPromiseManager.d.ts +2 -1
  210. package/lib/utils/uiPromiseManager.js +3 -3
  211. package/package.json +12 -12
  212. package/lib/api/checkFirmwareAuthenticity.d.ts +0 -11
  213. package/lib/api/checkFirmwareAuthenticity.js +0 -56
  214. package/lib/types/api/checkFirmwareAuthenticity.d.ts +0 -11
@@ -1,3 +1,4 @@
1
+ import { Descriptor } from '@trezor/transport';
1
2
  import type { PROTO } from '../constants';
2
3
  import type { ReleaseInfo } from './firmware';
3
4
  export type DeviceStatus = 'available' | 'occupied' | 'used';
@@ -12,26 +13,41 @@ export type StaticSessionId = `${string}@${string}:${number}`;
12
13
  export type DeviceState = {
13
14
  sessionId?: string;
14
15
  staticSessionId?: StaticSessionId;
16
+ deriveCardano?: boolean;
15
17
  };
16
18
  export type UnavailableCapabilities = {
17
19
  [key: string]: UnavailableCapability;
18
20
  };
21
+ export type FirmwareRevisionCheckError = 'revision-mismatch' | 'firmware-version-unknown' | 'cannot-perform-check-offline' | 'other-error';
19
22
  export type FirmwareRevisionCheckResult = {
20
23
  success: true;
21
24
  } | {
22
25
  success: false;
23
- error: 'revision-mismatch' | 'firmware-version-unknown' | 'firmware-version-unknown' | 'cannot-perform-check-offline';
26
+ error: FirmwareRevisionCheckError;
24
27
  };
25
- export type KnownDevice = {
28
+ export type FirmwareHashCheckError = 'hash-mismatch' | 'check-skipped' | 'check-unsupported' | 'unknown-release' | 'other-error';
29
+ export type FirmwareHashCheckResult = {
30
+ success: true;
31
+ } | {
32
+ success: false;
33
+ error: FirmwareHashCheckError;
34
+ };
35
+ export type DeviceUniquePath = string & {
36
+ __type: 'DeviceUniquePath';
37
+ };
38
+ export declare const DeviceUniquePath: (id: string) => DeviceUniquePath;
39
+ type BaseDevice = {
40
+ path: DeviceUniquePath;
41
+ name: string;
42
+ };
43
+ export type KnownDevice = BaseDevice & {
26
44
  type: 'acquired';
27
45
  id: string | null;
28
- path: string;
29
46
  label: string;
30
47
  error?: typeof undefined;
31
48
  firmware: DeviceFirmwareStatus;
32
49
  firmwareRelease?: ReleaseInfo | null;
33
50
  firmwareType?: FirmwareType;
34
- name: string;
35
51
  color?: string;
36
52
  status: DeviceStatus;
37
53
  mode: DeviceMode;
@@ -42,19 +58,20 @@ export type KnownDevice = {
42
58
  availableTranslations: string[];
43
59
  authenticityChecks?: {
44
60
  firmwareRevision: FirmwareRevisionCheckResult | null;
61
+ firmwareHash: FirmwareHashCheckResult | null;
45
62
  };
63
+ transportSessionOwner?: undefined;
64
+ transportDescriptorType?: typeof undefined;
46
65
  };
47
- export type UnknownDevice = {
66
+ export type UnknownDevice = BaseDevice & {
48
67
  type: 'unacquired';
49
- id?: null;
50
- path: string;
51
- label: string;
68
+ label: 'Unacquired device';
69
+ id?: typeof undefined;
52
70
  error?: typeof undefined;
53
71
  features?: typeof undefined;
54
72
  firmware?: typeof undefined;
55
73
  firmwareRelease?: typeof undefined;
56
74
  firmwareType?: typeof undefined;
57
- name: string;
58
75
  color?: typeof undefined;
59
76
  status?: typeof undefined;
60
77
  mode?: typeof undefined;
@@ -62,18 +79,18 @@ export type UnknownDevice = {
62
79
  state?: typeof undefined;
63
80
  unavailableCapabilities?: typeof undefined;
64
81
  availableTranslations?: typeof undefined;
82
+ transportSessionOwner?: string;
83
+ transportDescriptorType?: typeof undefined;
65
84
  };
66
- export type UnreadableDevice = {
85
+ export type UnreadableDevice = BaseDevice & {
67
86
  type: 'unreadable';
68
- id?: null;
69
- path: string;
70
- label: string;
87
+ label: 'Unreadable device';
71
88
  error: string;
89
+ id?: typeof undefined;
72
90
  features?: typeof undefined;
73
91
  firmware?: typeof undefined;
74
92
  firmwareRelease?: typeof undefined;
75
93
  firmwareType?: typeof undefined;
76
- name: string;
77
94
  color?: typeof undefined;
78
95
  status?: typeof undefined;
79
96
  mode?: typeof undefined;
@@ -81,6 +98,8 @@ export type UnreadableDevice = {
81
98
  state?: typeof undefined;
82
99
  unavailableCapabilities?: typeof undefined;
83
100
  availableTranslations?: typeof undefined;
101
+ transportSessionOwner?: undefined;
102
+ transportDescriptorType: Descriptor['type'];
84
103
  };
85
104
  export type Device = KnownDevice | UnknownDevice | UnreadableDevice;
86
105
  export type Features = PROTO.Features;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceModelInternal = exports.FirmwareType = void 0;
3
+ exports.DeviceModelInternal = exports.DeviceUniquePath = exports.FirmwareType = void 0;
4
4
  var FirmwareType;
5
5
  (function (FirmwareType) {
6
6
  FirmwareType["BitcoinOnly"] = "bitcoin-only";
7
7
  FirmwareType["Regular"] = "regular";
8
8
  })(FirmwareType || (exports.FirmwareType = FirmwareType = {}));
9
+ const DeviceUniquePath = (id) => id;
10
+ exports.DeviceUniquePath = DeviceUniquePath;
9
11
  var protobuf_1 = require("@trezor/protobuf");
10
12
  Object.defineProperty(exports, "DeviceModelInternal", { enumerable: true, get: function () { return protobuf_1.DeviceModelInternal; } });
11
13
  //# sourceMappingURL=device.js.map
@@ -1,30 +1,30 @@
1
1
  import { Static } from '@trezor/schema-utils';
2
2
  export type FeeInfo = Static<typeof FeeInfo>;
3
3
  export declare const FeeInfo: import("@trezor/schema-utils").TObject<{
4
- blockTime: import("@sinclair/typebox").TNumber;
5
- minFee: import("@sinclair/typebox").TNumber;
6
- maxFee: import("@sinclair/typebox").TNumber;
7
- dustLimit: import("@sinclair/typebox").TNumber;
4
+ blockTime: import("@trezor/schema-utils").TNumber;
5
+ minFee: import("@trezor/schema-utils").TNumber;
6
+ maxFee: import("@trezor/schema-utils").TNumber;
7
+ dustLimit: import("@trezor/schema-utils").TNumber;
8
8
  }>;
9
9
  export type FeeLevel = Static<typeof FeeLevel>;
10
10
  export declare const FeeLevel: import("@trezor/schema-utils").TObject<{
11
- label: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"economy">, import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"custom">]>;
12
- feePerUnit: import("@sinclair/typebox").TString;
13
- blocks: import("@sinclair/typebox").TNumber;
14
- feeLimit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
15
- feePerTx: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ label: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<"high">, import("@trezor/schema-utils").TLiteral<"normal">, import("@trezor/schema-utils").TLiteral<"economy">, import("@trezor/schema-utils").TLiteral<"low">, import("@trezor/schema-utils").TLiteral<"custom">]>;
12
+ feePerUnit: import("@trezor/schema-utils").TString;
13
+ blocks: import("@trezor/schema-utils").TNumber;
14
+ feeLimit: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
15
+ feePerTx: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
16
16
  }>;
17
17
  export type SelectFeeLevel = Static<typeof SelectFeeLevel>;
18
- export declare const SelectFeeLevel: import("@sinclair/typebox").TUnion<[import("@trezor/schema-utils").TObject<{
19
- name: import("@sinclair/typebox").TString;
20
- fee: import("@sinclair/typebox").TLiteral<"0">;
21
- feePerByte: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
22
- disabled: import("@sinclair/typebox").TLiteral<true>;
18
+ export declare const SelectFeeLevel: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TObject<{
19
+ name: import("@trezor/schema-utils").TString;
20
+ fee: import("@trezor/schema-utils").TLiteral<"0">;
21
+ feePerByte: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TUndefined>;
22
+ disabled: import("@trezor/schema-utils").TLiteral<true>;
23
23
  }>, import("@trezor/schema-utils").TObject<{
24
- name: import("@sinclair/typebox").TString;
25
- fee: import("@sinclair/typebox").TString;
26
- feePerByte: import("@sinclair/typebox").TString;
27
- minutes: import("@sinclair/typebox").TNumber;
28
- total: import("@sinclair/typebox").TString;
24
+ name: import("@trezor/schema-utils").TString;
25
+ fee: import("@trezor/schema-utils").TString;
26
+ feePerByte: import("@trezor/schema-utils").TString;
27
+ minutes: import("@trezor/schema-utils").TNumber;
28
+ total: import("@trezor/schema-utils").TString;
29
29
  }>]>;
30
30
  //# sourceMappingURL=fees.d.ts.map
@@ -21,7 +21,7 @@ export type FirmwareRelease = {
21
21
  translations?: string[];
22
22
  };
23
23
  export type IntermediaryVersion = 1 | 2 | 3;
24
- export declare const IntermediaryVersion: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<1>, import("@sinclair/typebox").TLiteral<2>, import("@sinclair/typebox").TLiteral<3>]>;
24
+ export declare const IntermediaryVersion: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TLiteral<1>, import("@trezor/schema-utils").TLiteral<2>, import("@trezor/schema-utils").TLiteral<3>]>;
25
25
  export type ReleaseInfo = {
26
26
  changelog: FirmwareRelease[] | null;
27
27
  release: FirmwareRelease;
@@ -1,12 +1,15 @@
1
1
  import { TSchema, Static } from '@trezor/schema-utils';
2
- import { DeviceState } from './device';
2
+ import { DeviceState, DeviceUniquePath } from './device';
3
+ import { ErrorCode } from '../constants/errors';
3
4
  export interface DeviceIdentity {
4
- path?: string;
5
- state?: string | DeviceState;
5
+ path?: DeviceUniquePath;
6
+ state?: DeviceState;
6
7
  instance?: number;
7
8
  }
8
9
  export interface CommonParams {
9
- device?: DeviceIdentity;
10
+ device?: DeviceIdentity & {
11
+ state?: DeviceState | string;
12
+ };
10
13
  useEmptyPassphrase?: boolean;
11
14
  useEventListener?: boolean;
12
15
  allowSeedlessDevice?: boolean;
@@ -15,6 +18,7 @@ export interface CommonParams {
15
18
  skipFinalReload?: boolean;
16
19
  useCardanoDerivation?: boolean;
17
20
  chunkify?: boolean;
21
+ __info?: boolean;
18
22
  }
19
23
  export type Params<T> = CommonParams & T & {
20
24
  bundle?: undefined;
@@ -23,7 +27,7 @@ interface Bundle<T> {
23
27
  bundle: T[];
24
28
  }
25
29
  export declare const Bundle: <T extends TSchema>(type: T) => import("@trezor/schema-utils").TObject<{
26
- bundle: import("@sinclair/typebox").TArray<T>;
30
+ bundle: import("@trezor/schema-utils").TArray<T>;
27
31
  }>;
28
32
  export type BundledParams<T> = CommonParams & Bundle<T>;
29
33
  export interface CommonParamsWithCoin extends CommonParams {
@@ -34,7 +38,7 @@ export interface Unsuccessful {
34
38
  success: false;
35
39
  payload: {
36
40
  error: string;
37
- code?: string;
41
+ code?: ErrorCode;
38
42
  };
39
43
  }
40
44
  export interface Success<T> {
@@ -46,7 +50,7 @@ export interface SuccessWithDevice<T> extends Success<T> {
46
50
  }
47
51
  export type Response<T> = Promise<SuccessWithDevice<T> | Unsuccessful>;
48
52
  export type DerivationPath = string | number[];
49
- export declare const DerivationPath: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>;
53
+ export declare const DerivationPath: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TString, import("@trezor/schema-utils").TArray<import("@trezor/schema-utils").TNumber>]>;
50
54
  type ProtoWithExtendedAddressN<T, A, R> = Omit<Extract<T, {
51
55
  address_n: A;
52
56
  }>, 'address_n'> & {
@@ -59,11 +63,11 @@ export type ProtoWithDerivationPath<T> = ProtoWithoutAddressN<T, number[]> | Pro
59
63
  export type ProtoWithAddressN<P extends ProtoWithDerivationPath<any>> = P extends ProtoWithDerivationPath<infer T> ? T : unknown;
60
64
  export type GetAddress = Static<typeof GetAddress>;
61
65
  export declare const GetAddress: import("@trezor/schema-utils").TObject<{
62
- path: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>;
63
- address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
64
- showOnTrezor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
65
- chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
66
- useEventListener: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
66
+ path: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TString, import("@trezor/schema-utils").TArray<import("@trezor/schema-utils").TNumber>]>;
67
+ address: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TString>;
68
+ showOnTrezor: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
69
+ chunkify: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
70
+ useEventListener: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
67
71
  }>;
68
72
  export interface Address {
69
73
  address: string;
@@ -72,16 +76,16 @@ export interface Address {
72
76
  }
73
77
  export type GetPublicKey = Static<typeof GetPublicKey>;
74
78
  export declare const GetPublicKey: import("@trezor/schema-utils").TObject<{
75
- path: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>;
76
- showOnTrezor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
77
- suppressBackupWarning: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
78
- chunkify: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
79
+ path: import("@trezor/schema-utils").TUnion<[import("@trezor/schema-utils").TString, import("@trezor/schema-utils").TArray<import("@trezor/schema-utils").TNumber>]>;
80
+ showOnTrezor: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
81
+ suppressBackupWarning: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
82
+ chunkify: import("@trezor/schema-utils").TOptional<import("@trezor/schema-utils").TBoolean>;
79
83
  }>;
80
84
  export type PublicKey = Static<typeof PublicKey>;
81
85
  export declare const PublicKey: import("@trezor/schema-utils").TObject<{
82
- publicKey: import("@sinclair/typebox").TString;
83
- path: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>;
84
- serializedPath: import("@sinclair/typebox").TString;
86
+ publicKey: import("@trezor/schema-utils").TString;
87
+ path: import("@trezor/schema-utils").TArray<import("@trezor/schema-utils").TNumber>;
88
+ serializedPath: import("@trezor/schema-utils").TString;
85
89
  }>;
86
90
  export {};
87
91
  //# sourceMappingURL=params.d.ts.map
@@ -10,22 +10,16 @@ export interface ConnectSettingsPublic {
10
10
  manifest?: Manifest;
11
11
  connectSrc?: string;
12
12
  debug?: boolean;
13
- hostLabel?: string;
14
- hostIcon?: string;
15
13
  popup?: boolean;
16
14
  transportReconnect?: boolean;
17
- webusb?: boolean;
18
15
  transports?: (Transport['name'] | Transport | (new (...args: any[]) => Transport))[];
19
16
  pendingTransportEvent?: boolean;
20
17
  lazyLoad?: boolean;
21
18
  interactionTimeout?: number;
22
19
  trustedHost: boolean;
23
- coreMode?: 'auto' | 'popup' | 'iframe';
24
- _extendWebextensionLifetime?: boolean;
25
- _sessionsBackgroundUrl?: string;
26
- deeplinkOpen?: (url: string) => void;
27
- deeplinkCallbackUrl?: string;
28
- deeplinkUrl?: string;
20
+ _sessionsBackgroundUrl?: null | string;
21
+ binFilesBaseUrl?: string;
22
+ enableFirmwareHashCheck?: boolean;
29
23
  }
30
24
  export interface ConnectSettingsInternal {
31
25
  origin?: string;
@@ -42,5 +36,18 @@ export interface ConnectSettingsInternal {
42
36
  sharedLogger?: boolean;
43
37
  useCoreInPopup?: boolean;
44
38
  }
45
- export type ConnectSettings = ConnectSettingsPublic & ConnectSettingsInternal;
39
+ export interface ConnectSettingsWeb {
40
+ hostLabel?: string;
41
+ hostIcon?: string;
42
+ coreMode?: 'auto' | 'popup' | 'iframe' | 'deeplink';
43
+ }
44
+ export interface ConnectSettingsWebextension {
45
+ _extendWebextensionLifetime?: boolean;
46
+ }
47
+ export interface ConnectSettingsMobile {
48
+ deeplinkUrl: string;
49
+ deeplinkOpen?: (url: string) => void;
50
+ deeplinkCallbackUrl?: string;
51
+ }
52
+ export type ConnectSettings = ConnectSettingsPublic & ConnectSettingsInternal & ConnectSettingsWeb & ConnectSettingsWebextension & ConnectSettingsMobile;
46
53
  //# sourceMappingURL=settings.d.ts.map
@@ -12,4 +12,5 @@ export type MessageFactoryFn<Group, Event> = UnionToIntersection<Event extends {
12
12
  type: Event['type'];
13
13
  payload: undefined;
14
14
  } : never>;
15
+ export declare const typedObjectKeys: <T extends Record<any, any>>(obj: T) => Array<keyof T>;
15
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typedObjectKeys = void 0;
4
+ const typedObjectKeys = (obj) => Object.keys(obj);
5
+ exports.typedObjectKeys = typedObjectKeys;
3
6
  //# sourceMappingURL=utils.js.map
@@ -9,7 +9,7 @@ const isValidBase58Address = (address, network) => {
9
9
  return false;
10
10
  }
11
11
  }
12
- catch (e) {
12
+ catch {
13
13
  return false;
14
14
  }
15
15
  return true;
@@ -21,7 +21,7 @@ const isValidBech32Address = (address, network) => {
21
21
  return false;
22
22
  }
23
23
  }
24
- catch (e) {
24
+ catch {
25
25
  return false;
26
26
  }
27
27
  return true;
@@ -1,2 +1,2 @@
1
- export declare const getAssetByUrl: (url: string) => any;
1
+ export declare const tryLocalAssetRequire: (url: string) => any;
2
2
  //# sourceMappingURL=assetUtils.d.ts.map
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAssetByUrl = void 0;
3
+ exports.tryLocalAssetRequire = void 0;
4
+ const utils_1 = require("@trezor/utils");
4
5
  const types_1 = require("../types");
5
- const isDeviceModel = (model) => {
6
- return Object.values(types_1.DeviceModelInternal).includes(model);
7
- };
6
+ const isDeviceModel = (model) => (0, utils_1.isArrayMember)(model, Object.values(types_1.DeviceModelInternal));
8
7
  const firmwareAssets = {
9
8
  [types_1.DeviceModelInternal.T1B1]: require('@trezor/connect-common/files/firmware/t1b1/releases.json'),
10
9
  [types_1.DeviceModelInternal.T2T1]: require('@trezor/connect-common/files/firmware/t2t1/releases.json'),
11
10
  [types_1.DeviceModelInternal.T2B1]: require('@trezor/connect-common/files/firmware/t2b1/releases.json'),
12
11
  [types_1.DeviceModelInternal.T3B1]: require('@trezor/connect-common/files/firmware/t3b1/releases.json'),
13
12
  [types_1.DeviceModelInternal.T3T1]: require('@trezor/connect-common/files/firmware/t3t1/releases.json'),
13
+ [types_1.DeviceModelInternal.T3W1]: require('@trezor/connect-common/files/firmware/t3w1/releases.json'),
14
14
  };
15
- const getAssetByUrl = (url) => {
15
+ const tryLocalAssetRequire = (url) => {
16
16
  const fileUrl = url.split('?')[0];
17
17
  switch (fileUrl) {
18
18
  case './data/coins.json':
@@ -33,5 +33,5 @@ const getAssetByUrl = (url) => {
33
33
  }
34
34
  return null;
35
35
  };
36
- exports.getAssetByUrl = getAssetByUrl;
36
+ exports.tryLocalAssetRequire = tryLocalAssetRequire;
37
37
  //# sourceMappingURL=assetUtils.js.map
@@ -10,7 +10,7 @@ if (global && typeof global.fetch !== 'function') {
10
10
  global.fetch = cross_fetch_1.default;
11
11
  }
12
12
  function httpRequest(url, type, options, skipLocalForceDownload) {
13
- const asset = skipLocalForceDownload ? null : (0, assetUtils_1.getAssetByUrl)(url);
13
+ const asset = skipLocalForceDownload ? null : (0, assetUtils_1.tryLocalAssetRequire)(url);
14
14
  if (!asset) {
15
15
  return /^https?/.test(url) ? (0, assets_browser_1.httpRequest)(url, type, options) : fs_1.promises.readFile(url);
16
16
  }
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.httpRequest = void 0;
4
4
  const assetUtils_1 = require("./assetUtils");
5
- const httpRequest = (url, _type) => (0, assetUtils_1.getAssetByUrl)(url);
5
+ const httpRequest = (url, _type) => (0, assetUtils_1.tryLocalAssetRequire)(url);
6
6
  exports.httpRequest = httpRequest;
7
7
  //# sourceMappingURL=assets.native.js.map
@@ -88,7 +88,7 @@ const getUnavailableCapabilities = (features, coins) => {
88
88
  if (info.shortcut === 'SOL' || info.shortcut === 'DSOL') {
89
89
  return !capabilities.includes('Capability_Solana');
90
90
  }
91
- return !capabilities.includes(`Capability_${info.name}`);
91
+ return !(0, utils_1.isArrayMember)(`Capability_${info.name}`, capabilities);
92
92
  });
93
93
  unavailable.forEach(info => {
94
94
  list[info.shortcut.toLowerCase()] = 'no-capability';
@@ -0,0 +1,21 @@
1
+ import EventEmitter from 'events';
2
+ export declare class ProxyEventEmitter implements EventEmitter {
3
+ private eventEmitters;
4
+ constructor(eventEmitters: EventEmitter[]);
5
+ emit(eventName: string | symbol, ...args: any[]): boolean;
6
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
7
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
8
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
9
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
10
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
11
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
12
+ removeAllListeners(event?: string | symbol | undefined): this;
13
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
14
+ setMaxListeners(n: number): this;
15
+ eventNames(): (string | symbol)[];
16
+ getMaxListeners(): number;
17
+ listenerCount(eventName: string | symbol, listener?: FunctionConstructor | undefined): number;
18
+ rawListeners(eventName: string | symbol): Function[];
19
+ listeners(eventName: string | symbol): Function[];
20
+ }
21
+ //# sourceMappingURL=proxy-event-emitter.d.ts.map
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProxyEventEmitter = void 0;
4
+ class ProxyEventEmitter {
5
+ constructor(eventEmitters) {
6
+ this.eventEmitters = eventEmitters;
7
+ }
8
+ emit(eventName, ...args) {
9
+ this.eventEmitters.forEach(emitter => emitter.emit(eventName, ...args));
10
+ return true;
11
+ }
12
+ on(eventName, listener) {
13
+ this.eventEmitters.forEach(emitter => emitter.on(eventName, listener));
14
+ return this;
15
+ }
16
+ off(eventName, listener) {
17
+ this.eventEmitters.forEach(emitter => emitter.off(eventName, listener));
18
+ return this;
19
+ }
20
+ once(eventName, listener) {
21
+ this.eventEmitters.forEach(emitter => emitter.once(eventName, listener));
22
+ return this;
23
+ }
24
+ addListener(eventName, listener) {
25
+ this.eventEmitters.forEach(emitter => emitter.addListener(eventName, listener));
26
+ return this;
27
+ }
28
+ prependListener(eventName, listener) {
29
+ this.eventEmitters.forEach(emitter => emitter.prependListener(eventName, listener));
30
+ return this;
31
+ }
32
+ prependOnceListener(eventName, listener) {
33
+ this.eventEmitters.forEach(emitter => emitter.prependOnceListener(eventName, listener));
34
+ return this;
35
+ }
36
+ removeAllListeners(event) {
37
+ this.eventEmitters.forEach(emitter => emitter.removeAllListeners(event));
38
+ return this;
39
+ }
40
+ removeListener(eventName, listener) {
41
+ this.eventEmitters.forEach(emitter => emitter.removeListener(eventName, listener));
42
+ return this;
43
+ }
44
+ setMaxListeners(n) {
45
+ this.eventEmitters.forEach(emitter => emitter.setMaxListeners(n));
46
+ return this;
47
+ }
48
+ eventNames() {
49
+ return this.eventEmitters[0].eventNames();
50
+ }
51
+ getMaxListeners() {
52
+ return this.eventEmitters[0].getMaxListeners();
53
+ }
54
+ listenerCount(eventName, listener) {
55
+ return this.eventEmitters[0].listenerCount(eventName, listener);
56
+ }
57
+ rawListeners(eventName) {
58
+ return this.eventEmitters[0].rawListeners(eventName);
59
+ }
60
+ listeners(eventName) {
61
+ return this.eventEmitters[0].listeners(eventName);
62
+ }
63
+ }
64
+ exports.ProxyEventEmitter = ProxyEventEmitter;
65
+ //# sourceMappingURL=proxy-event-emitter.js.map
@@ -1,10 +1,11 @@
1
1
  import { UiPromiseCreator, UiPromiseResponse } from '../events';
2
+ import { DeviceUniquePath } from '../types/device';
2
3
  export declare const createUiPromiseManager: (interactionTimeout: () => void) => {
3
4
  exists: (type: UiPromiseResponse["type"]) => boolean;
4
5
  create: UiPromiseCreator;
5
6
  resolve: (event: UiPromiseResponse) => boolean;
6
7
  rejectAll: (error: Error) => void;
7
- disconnected: (devicePath: string) => boolean;
8
+ disconnected: (devicePath: DeviceUniquePath) => boolean;
8
9
  get: <T extends UiPromiseResponse["type"]>(type: T) => Promise<Extract<import("../events").UiResponsePopupHandshake, {
9
10
  type: T;
10
11
  }> | Extract<import("../events").UiResponsePermission, {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUiPromiseManager = void 0;
4
- const events_1 = require("../events");
5
4
  const utils_1 = require("@trezor/utils");
5
+ const events_1 = require("../events");
6
6
  const createUiPromiseManager = (interactionTimeout) => {
7
7
  let _uiPromises = [];
8
8
  const exists = (type) => _uiPromises.some(p => p.id === type);
@@ -28,10 +28,10 @@ const createUiPromiseManager = (interactionTimeout) => {
28
28
  _uiPromises = [];
29
29
  };
30
30
  const disconnected = (devicePath) => {
31
- const [toResolve, toKeep] = (0, utils_1.arrayPartition)(_uiPromises, (p) => { var _a; return ((_a = p.device) === null || _a === void 0 ? void 0 : _a.getDevicePath()) === devicePath && p.id === events_1.DEVICE.DISCONNECT; });
31
+ const [toResolve, toKeep] = (0, utils_1.arrayPartition)(_uiPromises, (p) => { var _a; return ((_a = p.device) === null || _a === void 0 ? void 0 : _a.getUniquePath()) === devicePath && p.id === events_1.DEVICE.DISCONNECT; });
32
32
  toResolve.forEach(p => p.resolve({ type: events_1.DEVICE.DISCONNECT }));
33
33
  _uiPromises = toKeep;
34
- return !!toResolve.length || toKeep.some(p => { var _a; return ((_a = p.device) === null || _a === void 0 ? void 0 : _a.getDevicePath()) === devicePath; });
34
+ return !!toResolve.length || toKeep.some(p => { var _a; return ((_a = p.device) === null || _a === void 0 ? void 0 : _a.getUniquePath()) === devicePath; });
35
35
  };
36
36
  const get = (type) => {
37
37
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.4.2",
3
+ "version": "9.4.3-beta.2",
4
4
  "author": "Trezor <info@trezor.io>",
5
5
  "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
6
6
  "description": "High-level javascript interface for Trezor hardware wallet.",
@@ -70,19 +70,19 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@babel/preset-typescript": "^7.24.7",
73
- "@ethereumjs/common": "^4.3.0",
74
- "@ethereumjs/tx": "^5.3.0",
73
+ "@ethereumjs/common": "^4.4.0",
74
+ "@ethereumjs/tx": "^5.4.0",
75
75
  "@fivebinaries/coin-selection": "2.2.1",
76
- "@trezor/blockchain-link": "2.3.1",
77
- "@trezor/blockchain-link-types": "1.2.1",
76
+ "@trezor/blockchain-link": "2.3.2-beta.2",
77
+ "@trezor/blockchain-link-types": "1.2.2-beta.2",
78
78
  "@trezor/connect-analytics": "1.2.1",
79
- "@trezor/connect-common": "0.2.2",
80
- "@trezor/protobuf": "1.2.2",
79
+ "@trezor/connect-common": "0.2.3-beta.2",
80
+ "@trezor/protobuf": "1.2.3-beta.2",
81
81
  "@trezor/protocol": "1.2.1",
82
- "@trezor/schema-utils": "1.2.1",
83
- "@trezor/transport": "1.3.2",
84
- "@trezor/utils": "9.2.1",
85
- "@trezor/utxo-lib": "2.2.1",
82
+ "@trezor/schema-utils": "1.2.2-beta.1",
83
+ "@trezor/transport": "1.3.3-beta.2",
84
+ "@trezor/utils": "9.2.2-beta.2",
85
+ "@trezor/utxo-lib": "2.2.2-beta.1",
86
86
  "blakejs": "^1.2.1",
87
87
  "bs58": "^6.0.0",
88
88
  "bs58check": "^4.0.0",
@@ -103,7 +103,7 @@
103
103
  "node-libs-browser": "^2.2.1",
104
104
  "ts-node": "^10.9.1",
105
105
  "tsx": "^4.16.3",
106
- "webpack": "^5.94.0",
106
+ "webpack": "^5.96.1",
107
107
  "ws": "^8.18.0"
108
108
  },
109
109
  "peerDependencies": {
@@ -1,11 +0,0 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import { CheckFirmwareAuthenticityParams } from '../types/api/checkFirmwareAuthenticity';
3
- export default class CheckFirmwareAuthenticity extends AbstractMethod<'checkFirmwareAuthenticity', CheckFirmwareAuthenticityParams> {
4
- init(): void;
5
- run(): Promise<{
6
- expectedFirmwareHash: string;
7
- actualFirmwareHash: string;
8
- valid: boolean;
9
- }>;
10
- }
11
- //# sourceMappingURL=checkFirmwareAuthenticity.d.ts.map