@trezor/connect 9.2.1 → 9.2.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 (44) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -1
  4. package/lib/api/binance/binanceSignTx.d.ts +1 -1
  5. package/lib/api/bitcoin/Fees.d.ts +2 -2
  6. package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
  7. package/lib/api/blockchainEstimateFee.js +1 -0
  8. package/lib/api/changeLanguage.js +11 -5
  9. package/lib/api/eos/eosSignTx.d.ts +58 -58
  10. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +6 -6
  11. package/lib/api/getCoinInfo.d.ts +22 -22
  12. package/lib/api/getFeatures.d.ts +10 -10
  13. package/lib/api/getPublicKey.d.ts +6 -6
  14. package/lib/api/nem/nemSignTx.d.ts +13 -13
  15. package/lib/api/stellar/stellarSignTx.d.ts +1 -1
  16. package/lib/api/tezos/tezosSignTx.d.ts +18 -18
  17. package/lib/core/index.js +33 -4
  18. package/lib/data/coinInfo.d.ts +117 -117
  19. package/lib/data/config.js +15 -1
  20. package/lib/data/defaultFeeLevels.js +9 -1
  21. package/lib/data/deviceAuthenticityConfig.js +4 -1
  22. package/lib/data/firmwareInfo.d.ts +1 -1
  23. package/lib/data/version.d.ts +1 -1
  24. package/lib/data/version.js +1 -1
  25. package/lib/device/Device.d.ts +3 -2
  26. package/lib/device/Device.js +2 -1
  27. package/lib/device/DeviceCommands.d.ts +7 -7
  28. package/lib/device/resolveDescriptorForTaproot.js +21 -16
  29. package/lib/events/device.d.ts +1 -0
  30. package/lib/events/device.js +1 -0
  31. package/lib/types/api/applySettings.d.ts +6 -6
  32. package/lib/types/api/getAddress.d.ts +5 -5
  33. package/lib/types/api/getPublicKey.js +4 -1
  34. package/lib/types/api/recoveryDevice.d.ts +1 -1
  35. package/lib/types/params.js +6 -2
  36. package/lib/utils/{assets-native.d.ts → assets.native.d.ts} +1 -1
  37. package/lib/utils/{assets-native.js → assets.native.js} +1 -1
  38. package/lib/utils/debug.d.ts +5 -31
  39. package/lib/utils/debug.js +8 -110
  40. package/lib/utils/hdnodeUtils.d.ts +3 -3
  41. package/lib/utils/pathUtils.d.ts +3 -3
  42. package/lib/workers/{workers-react-native.d.ts → workers.native.d.ts} +1 -1
  43. package/lib/workers/{workers-react-native.js → workers.native.js} +1 -1
  44. package/package.json +39 -19
@@ -18,31 +18,20 @@ export declare const createTx: (address_n: number[], branch: string, operation:
18
18
  source: Uint8Array;
19
19
  amount: string | number;
20
20
  fee: string | number;
21
- gas_limit: number;
22
21
  destination: {
23
22
  hash: Uint8Array;
24
23
  tag: number;
25
24
  };
26
25
  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;
40
29
  reveal?: {
41
- public_key: Uint8Array;
42
30
  source: Uint8Array;
31
+ public_key: Uint8Array;
43
32
  fee: string | number;
44
- gas_limit: number;
45
33
  counter: number;
34
+ gas_limit: number;
46
35
  storage_limit: number;
47
36
  } | undefined;
48
37
  origination?: {
@@ -51,20 +40,31 @@ export declare const createTx: (address_n: number[], branch: string, operation:
51
40
  spendable?: boolean | undefined;
52
41
  delegatable?: boolean | undefined;
53
42
  source: Uint8Array;
54
- script: string | number[];
55
43
  fee: string | number;
56
- gas_limit: number;
44
+ script: string | number[];
57
45
  counter: number;
46
+ gas_limit: number;
58
47
  storage_limit: number;
59
48
  balance: number;
60
49
  } | undefined;
61
50
  delegation?: {
62
51
  source: Uint8Array;
63
52
  fee: string | number;
64
- delegate: Uint8Array;
65
- gas_limit: number;
66
53
  counter: number;
54
+ gas_limit: number;
67
55
  storage_limit: number;
56
+ delegate: Uint8Array;
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;
package/lib/core/index.js CHANGED
@@ -114,6 +114,7 @@ const initDevice = async (method) => {
114
114
  let showDeviceSelection = isWebUsb;
115
115
  const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
116
116
  const origin = DataManager_1.DataManager.getSettings('origin');
117
+ const useCoreInPopup = DataManager_1.DataManager.getSettings('useCoreInPopup');
117
118
  const { preferredDevice } = connect_common_1.storage.load().origin[origin] || {};
118
119
  const preferredDeviceInList = preferredDevice && _deviceList.getDevice(preferredDevice.path);
119
120
  if (preferredDevice && !preferredDeviceInList) {
@@ -129,9 +130,10 @@ const initDevice = async (method) => {
129
130
  }
130
131
  else {
131
132
  const devices = _deviceList.asArray();
132
- if (devices.length === 1 && !isWebUsb) {
133
+ if (devices.length === 1 && (!isWebUsb || !isUsingPopup)) {
133
134
  device = _deviceList.getDevice(devices[0].path);
134
- showDeviceSelection = !!(device === null || device === void 0 ? void 0 : device.unreadableError) || device.isUnacquired();
135
+ showDeviceSelection =
136
+ !!(device === null || device === void 0 ? void 0 : device.unreadableError) || device.isUnacquired() || !!useCoreInPopup;
135
137
  }
136
138
  else {
137
139
  showDeviceSelection = true;
@@ -159,11 +161,11 @@ const initDevice = async (method) => {
159
161
  if (uiPromise) {
160
162
  const { payload } = await uiPromise.promise;
161
163
  if (payload.remember) {
162
- const { path, state } = payload.device;
164
+ const { label, path, state } = payload.device;
163
165
  connect_common_1.storage.save(store => {
164
166
  store.origin[origin] = {
165
167
  ...store.origin[origin],
166
- preferredDevice: { path, state },
168
+ preferredDevice: { label, path, state },
167
169
  };
168
170
  return store;
169
171
  });
@@ -186,6 +188,8 @@ const onCall = async (message) => {
186
188
  const trustedHost = DataManager_1.DataManager.getSettings('trustedHost');
187
189
  const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
188
190
  const origin = DataManager_1.DataManager.getSettings('origin');
191
+ const env = DataManager_1.DataManager.getSettings('env');
192
+ const useCoreInPopup = DataManager_1.DataManager.getSettings('useCoreInPopup');
189
193
  const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
190
194
  if (preferredDevice && !message.payload.device) {
191
195
  message.payload.device = preferredDevice;
@@ -294,6 +298,31 @@ const onCall = async (message) => {
294
298
  device.on(events_2.DEVICE.PASSPHRASE_ON_DEVICE, () => {
295
299
  postMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_PASSPHRASE_ON_DEVICE, { device: device.toMessageObject() }));
296
300
  });
301
+ device.on(events_2.DEVICE.SAVE_STATE, (state) => {
302
+ connect_common_1.storage.saveForOrigin(store => {
303
+ if (useCoreInPopup && env === 'webextension') {
304
+ return {
305
+ ...store,
306
+ preferredDevice: store.preferredDevice
307
+ ? {
308
+ ...store.preferredDevice,
309
+ internalState: state,
310
+ internalStateExpiration: Date.now() + 1000 * 60 * 15,
311
+ }
312
+ : undefined,
313
+ };
314
+ }
315
+ return store;
316
+ }, origin);
317
+ });
318
+ if (!device.getInternalState() && useCoreInPopup && env === 'webextension') {
319
+ const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
320
+ if ((preferredDevice === null || preferredDevice === void 0 ? void 0 : preferredDevice.internalState) &&
321
+ (preferredDevice === null || preferredDevice === void 0 ? void 0 : preferredDevice.internalStateExpiration) &&
322
+ preferredDevice.internalStateExpiration > new Date().getTime()) {
323
+ device.setInternalState(preferredDevice.internalState);
324
+ }
325
+ }
297
326
  try {
298
327
  let PIN_TRIES = 1;
299
328
  const MAX_PIN_TRIES = 3;