@trezor/connect 9.0.11 → 9.1.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 (171) hide show
  1. package/CHANGELOG.md +22 -3
  2. package/README.md +20 -3
  3. package/lib/api/backupDevice.d.ts +1 -1
  4. package/lib/api/binanceGetAddress.d.ts +1 -0
  5. package/lib/api/binanceGetAddress.js +4 -4
  6. package/lib/api/binanceGetPublicKey.d.ts +1 -0
  7. package/lib/api/binanceGetPublicKey.js +3 -1
  8. package/lib/api/binanceSignTransaction.d.ts +2 -1
  9. package/lib/api/binanceSignTransaction.js +3 -1
  10. package/lib/api/bitcoin/Fees.d.ts +2 -2
  11. package/lib/api/bitcoin/Fees.js +32 -90
  12. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -2
  13. package/lib/api/bitcoin/TransactionComposer.js +3 -2
  14. package/lib/api/bitcoin/createPendingTx.d.ts +1 -0
  15. package/lib/api/bitcoin/createPendingTx.js +1 -0
  16. package/lib/api/bitcoin/refTx.d.ts +10 -2
  17. package/lib/api/bitcoin/refTx.js +46 -19
  18. package/lib/api/blockchainDisconnect.d.ts +1 -0
  19. package/lib/api/blockchainDisconnect.js +3 -1
  20. package/lib/api/blockchainEstimateFee.js +1 -1
  21. package/lib/api/blockchainSetCustomBackend.d.ts +1 -0
  22. package/lib/api/blockchainSetCustomBackend.js +3 -1
  23. package/lib/api/cancelCoinjoinAuthorization.d.ts +8 -0
  24. package/lib/api/cancelCoinjoinAuthorization.js +27 -0
  25. package/lib/api/cardanoGetAddress.d.ts +1 -0
  26. package/lib/api/cardanoGetAddress.js +4 -4
  27. package/lib/api/cardanoGetNativeScriptHash.d.ts +1 -0
  28. package/lib/api/cardanoGetNativeScriptHash.js +3 -1
  29. package/lib/api/cardanoGetPublicKey.d.ts +2 -0
  30. package/lib/api/cardanoGetPublicKey.js +12 -1
  31. package/lib/api/cardanoSignTransaction.d.ts +1 -0
  32. package/lib/api/cardanoSignTransaction.js +3 -1
  33. package/lib/api/checkFirmwareAuthenticity.js +2 -1
  34. package/lib/api/cipherKeyValue.d.ts +1 -0
  35. package/lib/api/cipherKeyValue.js +5 -2
  36. package/lib/api/composeTransaction.d.ts +3 -0
  37. package/lib/api/composeTransaction.js +9 -7
  38. package/lib/api/eosGetPublicKey.d.ts +1 -0
  39. package/lib/api/eosGetPublicKey.js +3 -1
  40. package/lib/api/eosSignTransaction.d.ts +1 -0
  41. package/lib/api/eosSignTransaction.js +3 -1
  42. package/lib/api/ethereum/ethereumDefinitions.d.ts +28 -6
  43. package/lib/api/ethereum/ethereumDefinitions.js +60 -1
  44. package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
  45. package/lib/api/ethereumGetAddress.d.ts +2 -0
  46. package/lib/api/ethereumGetAddress.js +28 -26
  47. package/lib/api/ethereumGetPublicKey.d.ts +1 -0
  48. package/lib/api/ethereumGetPublicKey.js +8 -10
  49. package/lib/api/ethereumSignMessage.d.ts +10 -1
  50. package/lib/api/ethereumSignMessage.js +14 -13
  51. package/lib/api/ethereumSignTransaction.d.ts +6 -0
  52. package/lib/api/ethereumSignTransaction.js +18 -5
  53. package/lib/api/ethereumSignTypedData.d.ts +6 -0
  54. package/lib/api/ethereumSignTypedData.js +15 -13
  55. package/lib/api/ethereumVerifyMessage.d.ts +1 -0
  56. package/lib/api/ethereumVerifyMessage.js +3 -1
  57. package/lib/api/getAccountInfo.d.ts +3 -0
  58. package/lib/api/getAccountInfo.js +3 -1
  59. package/lib/api/getAddress.d.ts +1 -0
  60. package/lib/api/getAddress.js +8 -10
  61. package/lib/api/getFeatures.d.ts +1 -1
  62. package/lib/api/getOwnershipId.d.ts +1 -0
  63. package/lib/api/getOwnershipId.js +3 -1
  64. package/lib/api/getOwnershipProof.d.ts +1 -0
  65. package/lib/api/getOwnershipProof.js +3 -1
  66. package/lib/api/getPublicKey.d.ts +2 -0
  67. package/lib/api/getPublicKey.js +12 -1
  68. package/lib/api/index.d.ts +2 -0
  69. package/lib/api/index.js +6 -2
  70. package/lib/api/nemGetAddress.d.ts +1 -0
  71. package/lib/api/nemGetAddress.js +4 -4
  72. package/lib/api/nemSignTransaction.d.ts +1 -0
  73. package/lib/api/nemSignTransaction.js +3 -1
  74. package/lib/api/rebootToBootloader.d.ts +2 -1
  75. package/lib/api/rebootToBootloader.js +4 -2
  76. package/lib/api/requestLogin.d.ts +1 -0
  77. package/lib/api/requestLogin.js +3 -1
  78. package/lib/api/resetDevice.d.ts +1 -0
  79. package/lib/api/resetDevice.js +3 -1
  80. package/lib/api/rippleGetAddress.d.ts +1 -0
  81. package/lib/api/rippleGetAddress.js +4 -4
  82. package/lib/api/rippleSignTransaction.d.ts +1 -0
  83. package/lib/api/rippleSignTransaction.js +3 -1
  84. package/lib/api/showDeviceTutorial.d.ts +8 -0
  85. package/lib/api/showDeviceTutorial.js +23 -0
  86. package/lib/api/signMessage.d.ts +1 -0
  87. package/lib/api/signMessage.js +5 -1
  88. package/lib/api/signTransaction.d.ts +1 -0
  89. package/lib/api/signTransaction.js +16 -4
  90. package/lib/api/stellarGetAddress.d.ts +1 -0
  91. package/lib/api/stellarGetAddress.js +4 -4
  92. package/lib/api/stellarSignTransaction.d.ts +1 -0
  93. package/lib/api/stellarSignTransaction.js +3 -1
  94. package/lib/api/tezosGetAddress.d.ts +1 -0
  95. package/lib/api/tezosGetAddress.js +4 -4
  96. package/lib/api/tezosGetPublicKey.d.ts +1 -0
  97. package/lib/api/tezosGetPublicKey.js +3 -1
  98. package/lib/api/tezosSignTransaction.d.ts +1 -0
  99. package/lib/api/tezosSignTransaction.js +3 -1
  100. package/lib/api/verifyMessage.d.ts +1 -0
  101. package/lib/api/verifyMessage.js +7 -2
  102. package/lib/api/wipeDevice.d.ts +2 -1
  103. package/lib/api/wipeDevice.js +3 -1
  104. package/lib/backend/Blockchain.d.ts +1 -3
  105. package/lib/backend/Blockchain.js +10 -6
  106. package/lib/constants/errors.d.ts +0 -3
  107. package/lib/constants/errors.js +1 -4
  108. package/lib/constants/index.d.ts +1 -1
  109. package/lib/constants/index.js +1 -1
  110. package/lib/core/AbstractMethod.d.ts +3 -1
  111. package/lib/core/AbstractMethod.js +3 -1
  112. package/lib/core/index.d.ts +5 -6
  113. package/lib/core/index.js +53 -51
  114. package/lib/core/method.d.ts +1 -1
  115. package/lib/data/DataManager.js +4 -1
  116. package/lib/data/analyticsInfo.js +1 -1
  117. package/lib/data/coinInfo.d.ts +9 -1
  118. package/lib/data/coinInfo.js +16 -54
  119. package/lib/data/config.js +12 -2
  120. package/lib/data/defaultFeeLevels.d.ts +17 -0
  121. package/lib/data/defaultFeeLevels.js +84 -0
  122. package/lib/data/version.d.ts +1 -1
  123. package/lib/data/version.js +1 -1
  124. package/lib/device/Device.d.ts +10 -12
  125. package/lib/device/Device.js +69 -102
  126. package/lib/device/DeviceCommands.d.ts +4 -3
  127. package/lib/device/DeviceCommands.js +46 -19
  128. package/lib/device/DeviceList.d.ts +15 -25
  129. package/lib/device/DeviceList.js +224 -258
  130. package/lib/events/popup.d.ts +8 -1
  131. package/lib/events/popup.js +1 -0
  132. package/lib/events/transport.d.ts +2 -9
  133. package/lib/events/transport.js +3 -10
  134. package/lib/events/ui-request.d.ts +2 -2
  135. package/lib/factory.js +2 -0
  136. package/lib/index.js +7 -7
  137. package/lib/types/account.d.ts +1 -20
  138. package/lib/types/api/bitcoin/index.d.ts +2 -0
  139. package/lib/types/api/blockchainEstimateFee.d.ts +2 -5
  140. package/lib/types/api/cancelCoinjoinAuthorization.d.ts +8 -0
  141. package/lib/types/api/cancelCoinjoinAuthorization.js +3 -0
  142. package/lib/types/api/index.d.ts +4 -0
  143. package/lib/types/api/showDeviceTutorial.d.ts +4 -0
  144. package/lib/types/api/showDeviceTutorial.js +3 -0
  145. package/lib/types/coinInfo.d.ts +5 -17
  146. package/lib/types/device.d.ts +5 -2
  147. package/lib/types/device.js +8 -0
  148. package/lib/types/fees.d.ts +26 -0
  149. package/lib/types/fees.js +3 -0
  150. package/lib/types/index.d.ts +2 -1
  151. package/lib/types/index.js +1 -0
  152. package/lib/types/settings.d.ts +1 -1
  153. package/lib/utils/assetUtils.js +3 -1
  154. package/lib/utils/debug.js +2 -1
  155. package/lib/utils/deviceFeaturesUtils.d.ts +2 -1
  156. package/lib/utils/deviceFeaturesUtils.js +12 -1
  157. package/lib/utils/urlUtils.d.ts +10 -3
  158. package/lib/utils/urlUtils.js +5 -9
  159. package/lib/workers/workers-browser.d.ts +1 -3
  160. package/lib/workers/workers-browser.js +1 -7
  161. package/lib/workers/workers-react-native.d.ts +1 -3
  162. package/lib/workers/workers-react-native.js +1 -7
  163. package/lib/workers/workers.d.ts +1 -5
  164. package/lib/workers/workers.js +1 -5
  165. package/package.json +17 -12
  166. package/lib/device/DescriptorStream.d.ts +0 -28
  167. package/lib/device/DescriptorStream.js +0 -139
  168. package/lib/utils/objectUtils.d.ts +0 -10
  169. package/lib/utils/objectUtils.js +0 -37
  170. package/lib/workers/RNUsbPlugin.d.ts +0 -31
  171. package/lib/workers/RNUsbPlugin.js +0 -65
package/lib/factory.js CHANGED
@@ -111,6 +111,8 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
111
111
  applyFlags: params => call({ ...params, method: 'applyFlags' }),
112
112
  applySettings: params => call({ ...params, method: 'applySettings' }),
113
113
  authorizeCoinjoin: params => call({ ...params, method: 'authorizeCoinjoin' }),
114
+ cancelCoinjoinAuthorization: params => call({ ...params, method: 'cancelCoinjoinAuthorization' }),
115
+ showDeviceTutorial: params => call({ ...params, method: 'showDeviceTutorial' }),
114
116
  backupDevice: params => call({ ...params, method: 'backupDevice' }),
115
117
  changePin: params => call({ ...params, method: 'changePin' }),
116
118
  firmwareUpdate: params => call({ ...params, method: 'firmwareUpdate' }),
package/lib/index.js CHANGED
@@ -36,7 +36,7 @@ const handleMessage = (message) => {
36
36
  if (!_core)
37
37
  return;
38
38
  if (type === events_2.UI.REQUEST_UI_WINDOW) {
39
- _core.handleMessage({ event: events_2.UI_EVENT, type: events_2.POPUP.HANDSHAKE }, true);
39
+ _core.handleMessage({ event: events_2.UI_EVENT, type: events_2.POPUP.HANDSHAKE });
40
40
  return;
41
41
  }
42
42
  if (type === events_2.POPUP.CANCEL_POPUP_REQUEST)
@@ -84,10 +84,10 @@ function postMessage(message, usePromise = true) {
84
84
  _messageID++;
85
85
  exports.messagePromises[_messageID] = (0, utils_1.createDeferred)();
86
86
  const { promise } = exports.messagePromises[_messageID];
87
- _core.handleMessage({ ...message, id: _messageID }, true);
87
+ _core.handleMessage({ ...message, id: _messageID });
88
88
  return promise;
89
89
  }
90
- _core.handleMessage(message, true);
90
+ _core.handleMessage(message);
91
91
  }
92
92
  const init = async (settings = {}) => {
93
93
  var _a;
@@ -105,7 +105,7 @@ const init = async (settings = {}) => {
105
105
  _settings.lazyLoad = false;
106
106
  return;
107
107
  }
108
- _core = await (0, core_1.init)(_settings);
108
+ _core = await (0, core_1.initCore)(_settings);
109
109
  _core.on(events_2.CORE_EVENT, handleMessage);
110
110
  await (0, core_1.initTransport)(_settings);
111
111
  };
@@ -138,7 +138,7 @@ const uiResponse = (response) => {
138
138
  throw constants_1.ERRORS.TypedError('Init_NotInitialized');
139
139
  }
140
140
  const { type, payload } = response;
141
- _core.handleMessage({ event: events_2.UI_EVENT, type, payload }, true);
141
+ _core.handleMessage({ event: events_2.UI_EVENT, type, payload });
142
142
  };
143
143
  const requestLogin = async (params) => {
144
144
  if (typeof params.callback === 'function') {
@@ -152,14 +152,14 @@ const requestLogin = async (params) => {
152
152
  event: events_2.UI_EVENT,
153
153
  type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
154
154
  payload,
155
- }, true);
155
+ });
156
156
  }
157
157
  catch (error) {
158
158
  _core === null || _core === void 0 ? void 0 : _core.handleMessage({
159
159
  event: events_2.UI_EVENT,
160
160
  type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
161
161
  payload: error.message,
162
- }, true);
162
+ });
163
163
  }
164
164
  }
165
165
  };
@@ -1,5 +1,5 @@
1
1
  import type { AccountInfo as AccountInfoBase, AccountAddresses, Utxo as AccountUtxo } from '@trezor/blockchain-link';
2
- export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, } from '@trezor/blockchain-link';
2
+ export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, Transaction as AccountTransaction, } from '@trezor/blockchain-link';
3
3
  export type DiscoveryAccountType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh';
4
4
  export interface AccountInfo extends AccountInfoBase {
5
5
  path?: string;
@@ -15,23 +15,4 @@ export interface DiscoveryAccount {
15
15
  balance?: string;
16
16
  addresses?: AccountAddresses;
17
17
  }
18
- export interface FeeLevel {
19
- label: 'high' | 'normal' | 'economy' | 'low' | 'custom';
20
- feePerUnit: string;
21
- blocks: number;
22
- feeLimit?: string;
23
- feePerTx?: string;
24
- }
25
- export type SelectFeeLevel = {
26
- name: string;
27
- fee: '0';
28
- feePerByte?: undefined;
29
- disabled: true;
30
- } | {
31
- name: string;
32
- fee: string;
33
- feePerByte: string;
34
- minutes: number;
35
- total: string;
36
- };
37
18
  //# sourceMappingURL=account.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import type { PROTO } from '../../../constants';
2
2
  import type { AccountAddresses } from '@trezor/blockchain-link';
3
3
  import type { Transaction as BlockbookTransaction } from '@trezor/blockchain-link-types/lib/blockbook';
4
+ import { AccountTransaction } from '../../account';
4
5
  export interface SignMessage {
5
6
  path: string | number[];
6
7
  coin: string;
@@ -55,6 +56,7 @@ export interface SignTransaction {
55
56
  refTxs?: RefTransaction[];
56
57
  account?: {
57
58
  addresses: AccountAddresses;
59
+ transactions?: AccountTransaction[];
58
60
  };
59
61
  coin: string;
60
62
  locktime?: number;
@@ -1,5 +1,5 @@
1
1
  import type { BlockchainLinkParams, BlockchainLinkResponse } from '@trezor/blockchain-link';
2
- import type { FeeLevel } from '../account';
2
+ import type { FeeLevel, FeeInfo } from '../fees';
3
3
  import type { CommonParamsWithCoin, Response } from '../params';
4
4
  export interface BlockchainEstimateFee {
5
5
  request?: BlockchainLinkParams<'estimateFee'> & {
@@ -11,10 +11,7 @@ export interface BlockchainEstimateFeeLevel {
11
11
  feeLevels: 'preloaded' | 'smart';
12
12
  };
13
13
  }
14
- interface EstimatedFee {
15
- blockTime: number;
16
- minFee: number;
17
- maxFee: number;
14
+ interface EstimatedFee extends Omit<FeeInfo, 'dustLimit'> {
18
15
  dustLimit?: number;
19
16
  }
20
17
  export interface BlockchainEstimatedFee extends EstimatedFee {
@@ -0,0 +1,8 @@
1
+ import type { PROTO } from '../../constants';
2
+ import type { Params, Response } from '../params';
3
+ interface CancelCoinjoinAuthorization {
4
+ preauthorized?: boolean;
5
+ }
6
+ export declare function cancelCoinjoinAuthorization(params: Params<CancelCoinjoinAuthorization>): Response<PROTO.Success>;
7
+ export {};
8
+ //# sourceMappingURL=cancelCoinjoinAuthorization.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=cancelCoinjoinAuthorization.js.map
@@ -75,10 +75,14 @@ import { unlockPath } from './unlockPath';
75
75
  import { verifyMessage } from './verifyMessage';
76
76
  import { wipeDevice } from './wipeDevice';
77
77
  import { checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
78
+ import { cancelCoinjoinAuthorization } from './cancelCoinjoinAuthorization';
79
+ import { showDeviceTutorial } from './showDeviceTutorial';
78
80
  export interface TrezorConnect {
79
81
  applyFlags: typeof applyFlags;
80
82
  applySettings: typeof applySettings;
81
83
  authorizeCoinjoin: typeof authorizeCoinjoin;
84
+ cancelCoinjoinAuthorization: typeof cancelCoinjoinAuthorization;
85
+ showDeviceTutorial: typeof showDeviceTutorial;
82
86
  backupDevice: typeof backupDevice;
83
87
  binanceGetAddress: typeof binanceGetAddress;
84
88
  binanceGetPublicKey: typeof binanceGetPublicKey;
@@ -0,0 +1,4 @@
1
+ import type { PROTO } from '../../constants';
2
+ import type { CommonParams, Response } from '../params';
3
+ export declare function showDeviceTutorial(params: CommonParams): Response<PROTO.Success>;
4
+ //# sourceMappingURL=showDeviceTutorial.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=showDeviceTutorial.js.map
@@ -1,3 +1,4 @@
1
+ import { FeeLevel } from './fees';
1
2
  export interface CoinSupport {
2
3
  connect: boolean;
3
4
  trezor1: string;
@@ -19,10 +20,6 @@ export interface BlockchainLink {
19
20
  type: string;
20
21
  url: string[];
21
22
  }
22
- export type BitcoinDefaultFeesKeys = 'High' | 'Normal' | 'Economy' | 'Low';
23
- export type BitcoinDefaultFees = {
24
- [key in BitcoinDefaultFeesKeys]: number;
25
- };
26
23
  interface Common {
27
24
  label: string;
28
25
  name: string;
@@ -31,9 +28,10 @@ interface Common {
31
28
  support: CoinSupport;
32
29
  decimals: number;
33
30
  blockchainLink?: BlockchainLink;
34
- blocktime: number;
31
+ blockTime: number;
35
32
  minFee: number;
36
33
  maxFee: number;
34
+ defaultFees: FeeLevel[];
37
35
  }
38
36
  export interface BitcoinNetworkInfo extends Common {
39
37
  type: 'bitcoin';
@@ -46,7 +44,6 @@ export interface BitcoinNetworkInfo extends Common {
46
44
  maxFeeSatoshiKb: number;
47
45
  minAddressLength: number;
48
46
  minFeeSatoshiKb: number;
49
- defaultFees: BitcoinDefaultFees;
50
47
  segwit: boolean;
51
48
  xPubMagic: number;
52
49
  xPubMagicSegwitNative?: number;
@@ -54,25 +51,16 @@ export interface BitcoinNetworkInfo extends Common {
54
51
  taproot?: boolean;
55
52
  network: Network;
56
53
  isBitcoin: boolean;
57
- blocks?: number;
58
54
  }
59
55
  export interface EthereumNetworkInfo extends Common {
60
56
  type: 'ethereum';
61
- chain: string;
62
57
  chainId: number;
63
- rskip60: boolean;
64
- defaultFees: Array<{
65
- label: 'high' | 'normal' | 'low';
66
- feePerUnit: string;
67
- feeLimit: string;
68
- }>;
69
- network: typeof undefined;
58
+ network?: typeof undefined;
70
59
  }
71
60
  export interface MiscNetworkInfo extends Common {
72
61
  type: 'misc' | 'nem';
73
62
  curve: string;
74
- defaultFees: BitcoinDefaultFees;
75
- network: typeof undefined;
63
+ network?: typeof undefined;
76
64
  }
77
65
  export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo;
78
66
  export {};
@@ -4,7 +4,10 @@ export type DeviceStatus = 'available' | 'occupied' | 'used';
4
4
  export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless';
5
5
  export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none';
6
6
  export type UnavailableCapability = 'no-capability' | 'no-support' | 'update-required' | 'trezor-connect-outdated';
7
- export type FirmwareType = 'bitcoin-only' | 'regular';
7
+ export declare enum FirmwareType {
8
+ BitcoinOnly = "bitcoin-only",
9
+ Regular = "regular"
10
+ }
8
11
  export type UnavailableCapabilities = {
9
12
  [key: string]: UnavailableCapability;
10
13
  };
@@ -55,6 +58,7 @@ export type UnreadableDevice = {
55
58
  };
56
59
  export type Device = KnownDevice | UnknownDevice | UnreadableDevice;
57
60
  export type Features = PROTO.Features;
61
+ export { DeviceModelInternal } from '@trezor/protobuf/lib/messages';
58
62
  type FeaturesNarrowing = {
59
63
  major_version: 2;
60
64
  fw_major: null;
@@ -92,5 +96,4 @@ type FeaturesNarrowing = {
92
96
  firmware_present: true;
93
97
  };
94
98
  export type StrictFeatures = Features & FeaturesNarrowing;
95
- export {};
96
99
  //# sourceMappingURL=device.d.ts.map
@@ -1,3 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceModelInternal = exports.FirmwareType = void 0;
4
+ var FirmwareType;
5
+ (function (FirmwareType) {
6
+ FirmwareType["BitcoinOnly"] = "bitcoin-only";
7
+ FirmwareType["Regular"] = "regular";
8
+ })(FirmwareType = exports.FirmwareType || (exports.FirmwareType = {}));
9
+ var messages_1 = require("@trezor/protobuf/lib/messages");
10
+ Object.defineProperty(exports, "DeviceModelInternal", { enumerable: true, get: function () { return messages_1.DeviceModelInternal; } });
3
11
  //# sourceMappingURL=device.js.map
@@ -0,0 +1,26 @@
1
+ export interface FeeInfo {
2
+ blockTime: number;
3
+ minFee: number;
4
+ maxFee: number;
5
+ dustLimit: number;
6
+ }
7
+ export interface FeeLevel {
8
+ label: 'high' | 'normal' | 'economy' | 'low' | 'custom';
9
+ feePerUnit: string;
10
+ blocks: number;
11
+ feeLimit?: string;
12
+ feePerTx?: string;
13
+ }
14
+ export type SelectFeeLevel = {
15
+ name: string;
16
+ fee: '0';
17
+ feePerByte?: undefined;
18
+ disabled: true;
19
+ } | {
20
+ name: string;
21
+ fee: string;
22
+ feePerByte: string;
23
+ minutes: number;
24
+ total: string;
25
+ };
26
+ //# sourceMappingURL=fees.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=fees.js.map
@@ -2,6 +2,7 @@ export * from './api';
2
2
  export * from './account';
3
3
  export * from './coinInfo';
4
4
  export * from './device';
5
+ export * from './fees';
5
6
  export * from './firmware';
6
7
  export * from './params';
7
8
  export * from './settings';
@@ -15,5 +16,5 @@ export * from './api/stellar';
15
16
  export * from './api/tezos';
16
17
  export type { ComposeOutput, PrecomposedTransaction } from './api/composeTransaction';
17
18
  export type { RecoveryDevice } from './api/recoveryDevice';
18
- export type { TokenInfo, TokenTransfer, InternalTransfer, FiatRates, Transaction as AccountTransaction, Target as TransactionTarget, AccountBalanceHistory as BlockchainAccountBalanceHistory, } from '@trezor/blockchain-link';
19
+ export type { TokenInfo, TokenTransfer, InternalTransfer, FiatRates, Target as TransactionTarget, AccountBalanceHistory as BlockchainAccountBalanceHistory, } from '@trezor/blockchain-link';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -5,6 +5,7 @@ tslib_1.__exportStar(require("./api"), exports);
5
5
  tslib_1.__exportStar(require("./account"), exports);
6
6
  tslib_1.__exportStar(require("./coinInfo"), exports);
7
7
  tslib_1.__exportStar(require("./device"), exports);
8
+ tslib_1.__exportStar(require("./fees"), exports);
8
9
  tslib_1.__exportStar(require("./firmware"), exports);
9
10
  tslib_1.__exportStar(require("./params"), exports);
10
11
  tslib_1.__exportStar(require("./settings"), exports);
@@ -15,7 +15,7 @@ export interface ConnectSettings {
15
15
  popup?: boolean;
16
16
  transportReconnect?: boolean;
17
17
  webusb?: boolean;
18
- transports?: Transport['name'][];
18
+ transports?: (Transport['name'] | Transport)[];
19
19
  pendingTransportEvent?: boolean;
20
20
  lazyLoad?: boolean;
21
21
  interactionTimeout?: number;
@@ -6,6 +6,8 @@ const getAssetByUrl = (url) => {
6
6
  switch (fileUrl) {
7
7
  case './data/coins.json':
8
8
  return require('@trezor/connect-common/files/coins.json');
9
+ case './data/coins-eth.json':
10
+ return require('@trezor/connect-common/files/coins-eth.json');
9
11
  case './data/bridge/releases.json':
10
12
  return require('@trezor/connect-common/files/bridge/releases.json');
11
13
  case './data/firmware/1/releases.json':
@@ -13,7 +15,7 @@ const getAssetByUrl = (url) => {
13
15
  case './data/firmware/2/releases.json':
14
16
  return require('@trezor/connect-common/files/firmware/2/releases.json');
15
17
  case './data/messages/messages.json':
16
- return require('@trezor/transport/messages.json');
18
+ return require('@trezor/protobuf/messages.json');
17
19
  default:
18
20
  return null;
19
21
  }
@@ -9,6 +9,7 @@ const colors = {
9
9
  DeviceList: 'color: #77ab59; background: #000;',
10
10
  Device: 'color: #bada55; background: #000;',
11
11
  DeviceCommands: 'color: #bada55; background: #000;',
12
+ '@trezor/transport': 'color: #bada55; background: #000;',
12
13
  };
13
14
  const MAX_ENTRIES = 100;
14
15
  class Log {
@@ -23,7 +24,7 @@ class Log {
23
24
  level,
24
25
  prefix,
25
26
  message: args,
26
- timestamp: new Date().getTime(),
27
+ timestamp: Date.now(),
27
28
  });
28
29
  if (this.messages.length > MAX_ENTRIES) {
29
30
  this.messages.shift();
@@ -1,6 +1,7 @@
1
1
  import { PROTO } from '../constants';
2
- import type { Features, CoinInfo, UnavailableCapabilities } from '../types';
2
+ import { Features, CoinInfo, UnavailableCapabilities, DeviceModelInternal } from '../types';
3
3
  export declare const parseCapabilities: (features?: Features) => PROTO.Capability[];
4
4
  export declare const getUnavailableCapabilities: (features: Features, coins: CoinInfo[]) => UnavailableCapabilities;
5
5
  export declare const parseRevision: (features: Features) => string | null;
6
+ export declare const ensureInternalModelFeature: (model: Features['model']) => DeviceModelInternal;
6
7
  //# sourceMappingURL=deviceFeaturesUtils.d.ts.map
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseRevision = exports.getUnavailableCapabilities = exports.parseCapabilities = void 0;
3
+ exports.ensureInternalModelFeature = exports.parseRevision = exports.getUnavailableCapabilities = exports.parseCapabilities = void 0;
4
4
  const versionUtils_1 = require("./versionUtils");
5
5
  const config_1 = require("../data/config");
6
+ const types_1 = require("../types");
6
7
  const DEFAULT_CAPABILITIES_T1 = [
7
8
  'Capability_Bitcoin',
8
9
  'Capability_Bitcoin_like',
@@ -112,4 +113,14 @@ const parseRevision = (features) => {
112
113
  return /^([a-f0-9])*$/gi.test(revisionUtf8) ? revisionUtf8 : revision;
113
114
  };
114
115
  exports.parseRevision = parseRevision;
116
+ const ensureInternalModelFeature = (model) => {
117
+ switch (model.toUpperCase()) {
118
+ case 'T':
119
+ return types_1.DeviceModelInternal.T2T1;
120
+ case '1':
121
+ default:
122
+ return types_1.DeviceModelInternal.T1B1;
123
+ }
124
+ };
125
+ exports.ensureInternalModelFeature = ensureInternalModelFeature;
115
126
  //# sourceMappingURL=deviceFeaturesUtils.js.map
@@ -1,6 +1,13 @@
1
1
  export declare const getOrigin: (url: unknown) => string;
2
2
  export declare const getHost: (url: unknown) => string | undefined;
3
- export declare const getOnionDomain: <T extends string | string[]>(url: T, dict: {
4
- [domain: string]: string;
5
- }) => T;
3
+ interface GetOnionDomain {
4
+ (url: string, dict: {
5
+ [domain: string]: string;
6
+ }): string;
7
+ (url: string[], dict: {
8
+ [domain: string]: string;
9
+ }): string[];
10
+ }
11
+ export declare const getOnionDomain: GetOnionDomain;
12
+ export {};
6
13
  //# sourceMappingURL=urlUtils.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOnionDomain = exports.getHost = exports.getOrigin = void 0;
4
+ const utils_1 = require("@trezor/utils");
4
5
  const getOrigin = (url) => {
5
6
  var _a;
6
7
  if (typeof url !== 'string')
@@ -27,15 +28,10 @@ const getHost = (url) => {
27
28
  exports.getHost = getHost;
28
29
  const getOnionDomain = (url, dict) => {
29
30
  var _a;
30
- if (Array.isArray(url)) {
31
- return url.map(u => (0, exports.getOnionDomain)(u, dict));
32
- }
33
- if (typeof url === 'string') {
34
- const [, protocol, subdomain, domain, rest] = (_a = url.match(/^(http|ws)s?:\/\/([^:/]+\.)?([^/.]+\.[^/.]+)(\/.*)?$/i)) !== null && _a !== void 0 ? _a : [];
35
- if (!domain || !dict[domain])
36
- return url;
37
- return `${protocol}://${subdomain || ''}${dict[domain]}${rest || ''}`;
38
- }
31
+ if (Array.isArray(url))
32
+ return url.map(u => { var _a; return (_a = (0, utils_1.urlToOnion)(u, dict)) !== null && _a !== void 0 ? _a : u; });
33
+ if (typeof url === 'string')
34
+ return (_a = (0, utils_1.urlToOnion)(url, dict)) !== null && _a !== void 0 ? _a : url;
39
35
  return url;
40
36
  };
41
37
  exports.getOnionDomain = getOnionDomain;
@@ -1,8 +1,6 @@
1
1
  import BlockbookWorker from '@trezor/blockchain-link/lib/workers/blockbook';
2
2
  import RippleWorker from '@trezor/blockchain-link/lib/workers/ripple';
3
3
  import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
4
- declare const WebUsbPlugin: () => import("packages/transport/lib/lowlevel/withSharedConnections").default;
5
- declare const ReactNativeUsbPlugin: undefined;
6
4
  declare const ElectrumWorker: undefined;
7
- export { WebUsbPlugin, ReactNativeUsbPlugin, BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, };
5
+ export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker };
8
6
  //# sourceMappingURL=workers-browser.d.ts.map
@@ -1,19 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
3
+ exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const sharedConnectionWorker_1 = tslib_1.__importDefault(require("@trezor/transport/lib/lowlevel/sharedConnectionWorker"));
6
5
  const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
7
6
  exports.BlockbookWorker = blockbook_1.default;
8
7
  const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/ripple"));
9
8
  exports.RippleWorker = ripple_1.default;
10
9
  const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockfrost"));
11
10
  exports.BlockfrostWorker = blockfrost_1.default;
12
- const transport_1 = tslib_1.__importDefault(require("@trezor/transport"));
13
- const WebUsbPlugin = () => new transport_1.default.Lowlevel(new transport_1.default.WebUsb(), typeof SharedWorker !== 'undefined' ? () => new sharedConnectionWorker_1.default() : null);
14
- exports.WebUsbPlugin = WebUsbPlugin;
15
- const ReactNativeUsbPlugin = undefined;
16
- exports.ReactNativeUsbPlugin = ReactNativeUsbPlugin;
17
11
  const ElectrumWorker = undefined;
18
12
  exports.ElectrumWorker = ElectrumWorker;
19
13
  //# sourceMappingURL=workers-browser.js.map
@@ -1,8 +1,6 @@
1
1
  import BlockbookWorker from '@trezor/blockchain-link/lib/workers/blockbook';
2
2
  import RippleWorker from '@trezor/blockchain-link/lib/workers/ripple';
3
3
  import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
4
- declare const WebUsbPlugin: undefined;
5
4
  declare const ElectrumWorker: undefined;
6
- declare const ReactNativeUsbPlugin: () => import("packages/transport/lib/lowlevel/withSharedConnections").default;
7
- export { WebUsbPlugin, ReactNativeUsbPlugin, BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, };
5
+ export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker };
8
6
  //# sourceMappingURL=workers-react-native.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
3
+ exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
6
6
  exports.BlockbookWorker = blockbook_1.default;
@@ -8,12 +8,6 @@ const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/wo
8
8
  exports.RippleWorker = ripple_1.default;
9
9
  const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockfrost"));
10
10
  exports.BlockfrostWorker = blockfrost_1.default;
11
- const transport_1 = tslib_1.__importDefault(require("@trezor/transport"));
12
- const RNUsbPlugin_1 = require("./RNUsbPlugin");
13
- const WebUsbPlugin = undefined;
14
- exports.WebUsbPlugin = WebUsbPlugin;
15
11
  const ElectrumWorker = undefined;
16
12
  exports.ElectrumWorker = ElectrumWorker;
17
- const ReactNativeUsbPlugin = () => new transport_1.default.Lowlevel(new RNUsbPlugin_1.ReactNativePlugin(), undefined);
18
- exports.ReactNativeUsbPlugin = ReactNativeUsbPlugin;
19
13
  //# sourceMappingURL=workers-react-native.js.map
@@ -2,9 +2,5 @@ import BlockbookWorker from '@trezor/blockchain-link/lib/workers/blockbook';
2
2
  import RippleWorker from '@trezor/blockchain-link/lib/workers/ripple';
3
3
  import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
4
4
  import ElectrumWorker from '@trezor/blockchain-link/lib/workers/electrum';
5
- import type { Transport } from '@trezor/transport';
6
- type TransportWrapper = () => Transport;
7
- declare const WebUsbPlugin: TransportWrapper | typeof undefined;
8
- declare const ReactNativeUsbPlugin: TransportWrapper | typeof undefined;
9
- export { WebUsbPlugin, ReactNativeUsbPlugin, BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, };
5
+ export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker };
10
6
  //# sourceMappingURL=workers.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = exports.ReactNativeUsbPlugin = exports.WebUsbPlugin = void 0;
3
+ exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
6
6
  exports.BlockbookWorker = blockbook_1.default;
@@ -10,8 +10,4 @@ const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/li
10
10
  exports.BlockfrostWorker = blockfrost_1.default;
11
11
  const electrum_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/electrum"));
12
12
  exports.ElectrumWorker = electrum_1.default;
13
- const WebUsbPlugin = undefined;
14
- exports.WebUsbPlugin = WebUsbPlugin;
15
- const ReactNativeUsbPlugin = undefined;
16
- exports.ReactNativeUsbPlugin = ReactNativeUsbPlugin;
17
13
  //# sourceMappingURL=workers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.0.11",
3
+ "version": "9.1.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.",
@@ -49,22 +49,26 @@
49
49
  "prepublish": "yarn tsx ../../scripts/prepublish.js"
50
50
  },
51
51
  "dependencies": {
52
- "@trezor/blockchain-link": "2.1.13",
53
- "@trezor/connect-analytics": "1.0.2",
54
- "@trezor/connect-common": "0.0.16",
55
- "@trezor/transport": "1.1.12",
56
- "@trezor/utils": "9.0.9",
57
- "@trezor/utxo-lib": "1.0.7",
52
+ "@trezor/blockchain-link": "2.1.16",
53
+ "@trezor/blockchain-link-types": "1.0.5",
54
+ "@trezor/connect-analytics": "1.0.5",
55
+ "@trezor/connect-common": "0.0.19",
56
+ "@trezor/protobuf": "1.0.0",
57
+ "@trezor/protocol": "1.0.0",
58
+ "@trezor/transport": "1.1.15",
59
+ "@trezor/utils": "9.0.12",
60
+ "@trezor/utxo-lib": "1.0.10",
58
61
  "bignumber.js": "^9.1.1",
59
62
  "blakejs": "^1.2.1",
63
+ "bs58": "^5.0.0",
64
+ "bs58check": "^3.0.1",
60
65
  "cross-fetch": "^3.1.6",
61
66
  "events": "^3.3.0",
62
- "randombytes": "2.1.0",
63
- "tslib": "2.5.2"
67
+ "randombytes": "2.1.0"
64
68
  },
65
69
  "devDependencies": {
66
70
  "@trezor/trezor-user-env-link": "1.0.2",
67
- "@types/karma": "^6.3.3",
71
+ "@types/karma": "^6.3.4",
68
72
  "@types/parse-uri": "^1.0.0",
69
73
  "@types/randombytes": "^2.0.0",
70
74
  "jest": "^29.5.0",
@@ -77,9 +81,10 @@
77
81
  "karma-sourcemap-loader": "^0.4.0",
78
82
  "karma-webpack": "^5.0.0",
79
83
  "rimraf": "^5.0.1",
80
- "ts-loader": "^9.4.2",
81
84
  "ts-node": "^10.9.1",
82
85
  "tsx": "^3.12.7",
83
- "typescript": "4.9.5"
86
+ "typescript": "4.9.5",
87
+ "webpack": "^5.87.0",
88
+ "ws": "7.5.9"
84
89
  }
85
90
  }