@trezor/connect 9.1.3 → 9.1.5

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 (90) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +3 -1
  3. package/lib/api/authenticateDevice.d.ts +7 -0
  4. package/lib/api/authenticateDevice.js +51 -0
  5. package/lib/api/bitcoin/TransactionComposer.js +1 -9
  6. package/lib/api/bitcoin/inputs.d.ts +2 -2
  7. package/lib/api/bitcoin/outputs.d.ts +2 -2
  8. package/lib/api/cardanoGetPublicKey.d.ts +6 -2
  9. package/lib/api/cardanoGetPublicKey.js +7 -1
  10. package/lib/api/checkFirmwareAuthenticity.js +9 -8
  11. package/lib/api/common/paramsValidator.js +46 -52
  12. package/lib/api/eos/eosSignTx.js +1 -1
  13. package/lib/api/ethereum/ethereumDefinitions.js +3 -2
  14. package/lib/api/firmware/getBinary.js +1 -1
  15. package/lib/api/firmware/verifyAuthenticityProof.d.ts +14 -0
  16. package/lib/api/firmware/verifyAuthenticityProof.js +103 -0
  17. package/lib/api/firmware/x509certificate.d.ts +73 -0
  18. package/lib/api/firmware/x509certificate.js +203 -0
  19. package/lib/api/firmwareUpdate.js +4 -4
  20. package/lib/api/getAccountInfo.d.ts +1 -1
  21. package/lib/api/getAccountInfo.js +6 -6
  22. package/lib/api/getFirmwareHash.js +1 -4
  23. package/lib/api/getPublicKey.d.ts +2 -1
  24. package/lib/api/getPublicKey.js +7 -1
  25. package/lib/api/index.d.ts +1 -0
  26. package/lib/api/index.js +4 -2
  27. package/lib/api/rebootToBootloader.js +1 -4
  28. package/lib/api/signTransaction.js +1 -1
  29. package/lib/core/AbstractMethod.d.ts +5 -4
  30. package/lib/core/AbstractMethod.js +13 -11
  31. package/lib/core/index.d.ts +3 -2
  32. package/lib/core/index.js +23 -12
  33. package/lib/core/method.d.ts +1 -1
  34. package/lib/data/DataManager.d.ts +53 -7
  35. package/lib/data/DataManager.js +4 -2
  36. package/lib/data/coinInfo.d.ts +5 -5
  37. package/lib/data/coinInfo.js +1 -1
  38. package/lib/data/config.d.ts +52 -6
  39. package/lib/data/config.js +39 -28
  40. package/lib/data/connectSettings.js +3 -0
  41. package/lib/data/deviceAuthenticityConfig.d.ts +15 -0
  42. package/lib/data/deviceAuthenticityConfig.js +26 -0
  43. package/lib/data/firmwareInfo.d.ts +3 -2
  44. package/lib/data/firmwareInfo.js +19 -11
  45. package/lib/data/models.d.ts +21 -0
  46. package/lib/data/models.js +24 -0
  47. package/lib/data/version.d.ts +1 -1
  48. package/lib/data/version.js +1 -1
  49. package/lib/device/Device.d.ts +5 -3
  50. package/lib/device/Device.js +37 -22
  51. package/lib/device/DeviceCommands.js +4 -4
  52. package/lib/device/DeviceList.d.ts +2 -1
  53. package/lib/device/DeviceList.js +10 -3
  54. package/lib/events/iframe.d.ts +7 -1
  55. package/lib/events/iframe.js +1 -0
  56. package/lib/events/ui-promise.d.ts +10 -2
  57. package/lib/factory.js +1 -0
  58. package/lib/types/api/authenticateDevice.d.ts +21 -0
  59. package/lib/types/api/authenticateDevice.js +3 -0
  60. package/lib/types/api/authorizeCoinjoin.d.ts +2 -2
  61. package/lib/types/api/binance/index.d.ts +2 -1
  62. package/lib/types/api/bitcoin/index.d.ts +6 -5
  63. package/lib/types/api/cardano/index.d.ts +12 -12
  64. package/lib/types/api/cipherKeyValue.d.ts +2 -2
  65. package/lib/types/api/eos/index.d.ts +3 -2
  66. package/lib/types/api/ethereum/index.d.ts +5 -4
  67. package/lib/types/api/getAccountInfo.d.ts +1 -0
  68. package/lib/types/api/getOwnershipId.d.ts +2 -2
  69. package/lib/types/api/getOwnershipProof.d.ts +2 -2
  70. package/lib/types/api/index.d.ts +2 -0
  71. package/lib/types/api/nem/index.d.ts +2 -1
  72. package/lib/types/api/ripple/index.d.ts +2 -1
  73. package/lib/types/api/stellar/index.d.ts +2 -1
  74. package/lib/types/api/tezos/index.d.ts +3 -2
  75. package/lib/types/api/unlockPath.d.ts +2 -2
  76. package/lib/types/coinInfo.d.ts +3 -2
  77. package/lib/types/device.d.ts +6 -0
  78. package/lib/types/firmware.d.ts +8 -4
  79. package/lib/types/index.d.ts +1 -0
  80. package/lib/types/params.d.ts +14 -2
  81. package/lib/utils/assetUtils.js +6 -4
  82. package/lib/utils/debug.d.ts +9 -3
  83. package/lib/utils/debug.js +50 -17
  84. package/lib/utils/deviceFeaturesUtils.js +7 -7
  85. package/lib/utils/pathUtils.d.ts +3 -3
  86. package/package.json +14 -13
  87. package/lib/utils/deferred.d.ts +0 -18
  88. package/lib/utils/deferred.js +0 -66
  89. package/lib/utils/versionUtils.d.ts +0 -8
  90. package/lib/utils/versionUtils.js +0 -75
@@ -1,5 +1,6 @@
1
1
  import { applyFlags } from './applyFlags';
2
2
  import { applySettings } from './applySettings';
3
+ import { authenticateDevice } from './authenticateDevice';
3
4
  import { authorizeCoinjoin } from './authorizeCoinjoin';
4
5
  import { backupDevice } from './backupDevice';
5
6
  import { binanceGetAddress } from './binanceGetAddress';
@@ -80,6 +81,7 @@ import { showDeviceTutorial } from './showDeviceTutorial';
80
81
  export interface TrezorConnect {
81
82
  applyFlags: typeof applyFlags;
82
83
  applySettings: typeof applySettings;
84
+ authenticateDevice: typeof authenticateDevice;
83
85
  authorizeCoinjoin: typeof authorizeCoinjoin;
84
86
  cancelCoinjoinAuthorization: typeof cancelCoinjoinAuthorization;
85
87
  showDeviceTutorial: typeof showDeviceTutorial;
@@ -1,4 +1,5 @@
1
1
  import type { PROTO, NEM } from '../../../constants';
2
+ import type { DerivationPath } from '../../params';
2
3
  export interface MosaicID {
3
4
  namespaceId: string;
4
5
  name: string;
@@ -84,7 +85,7 @@ export type NEMMultisigTransaction = TransactionCommon & {
84
85
  };
85
86
  export type NEMTransaction = NEMRegularTransaction | NEMMultisigTransaction;
86
87
  export interface NEMSignTransaction {
87
- path: string | number[];
88
+ path: DerivationPath;
88
89
  transaction: NEMTransaction;
89
90
  }
90
91
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
1
+ import type { DerivationPath } from '../../params';
1
2
  export interface RipplePayment {
2
3
  amount: string;
3
4
  destination: string;
@@ -11,7 +12,7 @@ export interface RippleTransaction {
11
12
  payment: RipplePayment;
12
13
  }
13
14
  export interface RippleSignTransaction {
14
- path: string | number[];
15
+ path: DerivationPath;
15
16
  transaction: RippleTransaction;
16
17
  }
17
18
  export interface RippleSignedTx {
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { PROTO } from '../../../constants';
3
+ import type { DerivationPath } from '../../params';
3
4
  export interface StellarAsset {
4
5
  type: PROTO.StellarAssetType;
5
6
  code?: string;
@@ -142,7 +143,7 @@ export interface StellarTransaction {
142
143
  operations: StellarOperation[];
143
144
  }
144
145
  export interface StellarSignTransaction {
145
- path: string | number[];
146
+ path: DerivationPath;
146
147
  networkPassphrase: string;
147
148
  transaction: StellarTransaction;
148
149
  }
@@ -1,3 +1,4 @@
1
+ import type { DerivationPath } from '../../params';
1
2
  export interface TezosRevealOperation {
2
3
  source: string;
3
4
  fee: number;
@@ -30,7 +31,7 @@ export interface TezosOriginationOperation {
30
31
  source: string;
31
32
  balance: number;
32
33
  delegate?: string;
33
- script: string | number[];
34
+ script: DerivationPath;
34
35
  fee: number;
35
36
  counter: number;
36
37
  gas_limit: number;
@@ -51,7 +52,7 @@ export interface TezosOperation {
51
52
  delegation?: TezosDelegationOperation;
52
53
  }
53
54
  export interface TezosSignTransaction {
54
- path: string | number[];
55
+ path: DerivationPath;
55
56
  branch: string;
56
57
  operation: TezosOperation;
57
58
  }
@@ -1,7 +1,7 @@
1
1
  import type { PROTO } from '../../constants';
2
- import type { Params, Response } from '../params';
2
+ import type { Params, Response, DerivationPath } from '../params';
3
3
  export interface UnlockPathParams {
4
- path: string | number[];
4
+ path: DerivationPath;
5
5
  mac?: string;
6
6
  }
7
7
  export declare function unlockPath(params: Params<UnlockPathParams>): Response<PROTO.UnlockPath>;
@@ -1,8 +1,9 @@
1
1
  import { FeeLevel } from './fees';
2
2
  export interface CoinSupport {
3
3
  connect: boolean;
4
- trezor1: string;
5
- trezor2: string;
4
+ T1B1: string;
5
+ T2T1: string;
6
+ T2B1: string;
6
7
  }
7
8
  export interface Network {
8
9
  messagePrefix: string;
@@ -20,6 +20,8 @@ export type KnownDevice = {
20
20
  firmware: DeviceFirmwareStatus;
21
21
  firmwareRelease?: ReleaseInfo | null;
22
22
  firmwareType?: FirmwareType;
23
+ name: string;
24
+ color?: string;
23
25
  status: DeviceStatus;
24
26
  mode: DeviceMode;
25
27
  state?: string;
@@ -36,6 +38,8 @@ export type UnknownDevice = {
36
38
  firmware?: typeof undefined;
37
39
  firmwareRelease?: typeof undefined;
38
40
  firmwareType?: typeof undefined;
41
+ name: string;
42
+ color?: typeof undefined;
39
43
  status?: typeof undefined;
40
44
  mode?: typeof undefined;
41
45
  state?: typeof undefined;
@@ -51,6 +55,8 @@ export type UnreadableDevice = {
51
55
  firmware?: typeof undefined;
52
56
  firmwareRelease?: typeof undefined;
53
57
  firmwareType?: typeof undefined;
58
+ name: string;
59
+ color?: typeof undefined;
54
60
  status?: typeof undefined;
55
61
  mode?: typeof undefined;
56
62
  state?: typeof undefined;
@@ -1,20 +1,24 @@
1
1
  export interface FirmwareRange {
2
- '1': {
2
+ T1B1: {
3
3
  min: string;
4
4
  max: string;
5
5
  };
6
- '2': {
6
+ T2T1: {
7
+ min: string;
8
+ max: string;
9
+ };
10
+ T2B1: {
7
11
  min: string;
8
12
  max: string;
9
13
  };
10
14
  }
11
- export type VersionArray = [1 | 2, number, number];
15
+ export type VersionArray = [number, number, number];
12
16
  export type FirmwareRelease = {
13
17
  required: boolean;
14
18
  url: string;
15
19
  fingerprint: string;
16
20
  changelog: string;
17
- min_bridge_version: [number, number, number];
21
+ min_bridge_version: VersionArray;
18
22
  version: VersionArray;
19
23
  min_firmware_version: VersionArray;
20
24
  min_bootloader_version: VersionArray;
@@ -16,5 +16,6 @@ export * from './api/stellar';
16
16
  export * from './api/tezos';
17
17
  export type { ComposeOutput, PrecomposedTransaction } from './api/composeTransaction';
18
18
  export type { RecoveryDevice } from './api/recoveryDevice';
19
+ export type { AuthenticateDeviceResult } from './api/authenticateDevice';
19
20
  export type { TokenInfo, TokenTransfer, InternalTransfer, FiatRates, Target as TransactionTarget, AccountBalanceHistory as BlockchainAccountBalanceHistory, } from '@trezor/blockchain-link';
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -34,8 +34,19 @@ export interface Success<T> {
34
34
  payload: T;
35
35
  }
36
36
  export type Response<T> = Promise<Success<T> | Unsuccessful>;
37
+ export type DerivationPath = string | number[];
38
+ type ProtoWithExtendedAddressN<T, A, R> = Omit<Extract<T, {
39
+ address_n: A;
40
+ }>, 'address_n'> & {
41
+ address_n: R;
42
+ };
43
+ type ProtoWithoutAddressN<T, A> = Exclude<T, {
44
+ address_n: A;
45
+ }>;
46
+ export type ProtoWithDerivationPath<T> = ProtoWithoutAddressN<T, number[]> | ProtoWithExtendedAddressN<T, number[], DerivationPath>;
47
+ export type ProtoWithAddressN<P extends ProtoWithDerivationPath<any>> = P extends ProtoWithDerivationPath<infer T> ? T : unknown;
37
48
  export interface GetAddress {
38
- path: string | number[];
49
+ path: DerivationPath;
39
50
  address?: string;
40
51
  showOnTrezor?: boolean;
41
52
  }
@@ -45,8 +56,9 @@ export interface Address {
45
56
  serializedPath: string;
46
57
  }
47
58
  export interface GetPublicKey {
48
- path: string | number[];
59
+ path: DerivationPath;
49
60
  showOnTrezor?: boolean;
61
+ suppressBackupWarning?: boolean;
50
62
  }
51
63
  export interface PublicKey {
52
64
  publicKey: string;
@@ -10,10 +10,12 @@ const getAssetByUrl = (url) => {
10
10
  return require('@trezor/connect-common/files/coins-eth.json');
11
11
  case './data/bridge/releases.json':
12
12
  return require('@trezor/connect-common/files/bridge/releases.json');
13
- case './data/firmware/1/releases.json':
14
- return require('@trezor/connect-common/files/firmware/1/releases.json');
15
- case './data/firmware/2/releases.json':
16
- return require('@trezor/connect-common/files/firmware/2/releases.json');
13
+ case './data/firmware/t1b1/releases.json':
14
+ return require('@trezor/connect-common/files/firmware/t1b1/releases.json');
15
+ case './data/firmware/t2t1/releases.json':
16
+ return require('@trezor/connect-common/files/firmware/t2t1/releases.json');
17
+ case './data/firmware/t2b1/releases.json':
18
+ return require('@trezor/connect-common/files/firmware/t2b1/releases.json');
17
19
  case './data/messages/messages.json':
18
20
  return require('@trezor/protobuf/messages.json');
19
21
  default:
@@ -1,22 +1,28 @@
1
- type LogMessage = {
1
+ export type LogMessage = {
2
2
  level: string;
3
3
  prefix: string;
4
4
  message: any[];
5
5
  timestamp: number;
6
6
  };
7
+ export type LogWriter = {
8
+ add: (message: LogMessage) => void;
9
+ };
7
10
  declare class Log {
8
11
  prefix: string;
9
12
  enabled: boolean;
10
13
  css: string;
11
14
  messages: LogMessage[];
12
- constructor(prefix: string, enabled: boolean);
15
+ logWriter: LogWriter | undefined;
16
+ constructor(prefix: string, enabled: boolean, logWriter?: LogWriter);
13
17
  addMessage(level: string, prefix: string, ...args: any[]): void;
18
+ setWriter(logWriter: any): void;
14
19
  log(...args: any[]): void;
15
20
  error(...args: any[]): void;
16
21
  warn(...args: any[]): void;
17
22
  debug(...args: any[]): void;
18
23
  }
19
- export declare const initLog: (prefix: string, enabled?: boolean) => Log;
24
+ export declare const initLog: (prefix: string, enabled?: boolean, logWriter?: LogWriter) => Log;
25
+ export declare const setLogWriter: (logWriterFactory: () => LogWriter | undefined) => void;
20
26
  export declare const enableLog: (enabled?: boolean) => void;
21
27
  export declare const enableLogByPrefix: (prefix: string, enabled: boolean) => void;
22
28
  export declare const getLog: () => LogMessage[];
@@ -1,51 +1,73 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLog = exports.enableLogByPrefix = exports.enableLog = exports.initLog = void 0;
3
+ exports.getLog = exports.enableLogByPrefix = exports.enableLog = exports.setLogWriter = exports.initLog = void 0;
4
+ const green = '#bada55';
5
+ const blue = '#20abd8';
6
+ const orange = '#f4a744';
7
+ const yellow = '#fbd948';
4
8
  const colors = {
5
- '@trezor/connect': 'color: #f4a742; background: #000;',
6
- IFrame: 'color: #f4a742; background: #000;',
7
- Core: 'color: #f4a742; background: #000;',
8
- DescriptorStream: 'color: #77ab59; background: #000;',
9
- DeviceList: 'color: #77ab59; background: #000;',
10
- Device: 'color: #bada55; background: #000;',
11
- DeviceCommands: 'color: #bada55; background: #000;',
12
- '@trezor/transport': 'color: #bada55; background: #000;',
9
+ '@trezor/connect': `color: ${blue}; background: #000;`,
10
+ '@trezor/connect-web': `color: ${blue}; background: #000;`,
11
+ IFrame: `color: ${orange}; background: #000;`,
12
+ Core: `color: ${orange}; background: #000;`,
13
+ DeviceList: `color: ${green}; background: #000;`,
14
+ Device: `color: ${green}; background: #000;`,
15
+ DeviceCommands: `color: ${green}; background: #000;`,
16
+ '@trezor/transport': `color: ${green}; background: #000;`,
17
+ InteractionTimeout: `color: ${green}; background: #000;`,
18
+ '@trezor/connect-popup': `color: ${yellow}; background: #000;`,
13
19
  };
14
20
  const MAX_ENTRIES = 100;
15
21
  class Log {
16
- constructor(prefix, enabled) {
22
+ constructor(prefix, enabled, logWriter) {
17
23
  this.prefix = prefix;
18
24
  this.enabled = enabled;
19
25
  this.messages = [];
20
26
  this.css = typeof window !== 'undefined' && colors[prefix] ? colors[prefix] : '';
27
+ if (logWriter) {
28
+ this.logWriter = logWriter;
29
+ }
21
30
  }
22
31
  addMessage(level, prefix, ...args) {
23
- this.messages.push({
32
+ const message = {
24
33
  level,
25
34
  prefix,
35
+ css: this.css,
26
36
  message: args,
27
37
  timestamp: Date.now(),
28
- });
38
+ };
39
+ this.messages.push(message);
40
+ if (this.logWriter) {
41
+ try {
42
+ this.logWriter.add(message);
43
+ }
44
+ catch (err) {
45
+ console.error('There was an error adding log message', err, message);
46
+ }
47
+ }
29
48
  if (this.messages.length > MAX_ENTRIES) {
30
49
  this.messages.shift();
31
50
  }
32
51
  }
52
+ setWriter(logWriter) {
53
+ this.logWriter = logWriter;
54
+ }
33
55
  log(...args) {
34
56
  this.addMessage('log', this.prefix, ...args);
35
57
  if (this.enabled) {
36
- console.log(this.prefix, ...args);
58
+ console.log(`%c${this.prefix}`, this.css, ...args);
37
59
  }
38
60
  }
39
61
  error(...args) {
40
62
  this.addMessage('error', this.prefix, ...args);
41
63
  if (this.enabled) {
42
- console.error(this.prefix, ...args);
64
+ console.error(`%c${this.prefix}`, this.css, ...args);
43
65
  }
44
66
  }
45
67
  warn(...args) {
46
68
  this.addMessage('warn', this.prefix, ...args);
47
69
  if (this.enabled) {
48
- console.warn(this.prefix, ...args);
70
+ console.warn(`%c${this.prefix}`, this.css, ...args);
49
71
  }
50
72
  }
51
73
  debug(...args) {
@@ -61,12 +83,23 @@ class Log {
61
83
  }
62
84
  }
63
85
  const _logs = {};
64
- const initLog = (prefix, enabled) => {
65
- const instance = new Log(prefix, !!enabled);
86
+ let writer;
87
+ const initLog = (prefix, enabled, logWriter) => {
88
+ const instanceWriter = logWriter || writer;
89
+ const instance = new Log(prefix, !!enabled, instanceWriter);
66
90
  _logs[prefix] = instance;
67
91
  return instance;
68
92
  };
69
93
  exports.initLog = initLog;
94
+ const setLogWriter = (logWriterFactory) => {
95
+ Object.keys(_logs).forEach(key => {
96
+ writer = logWriterFactory();
97
+ if (writer) {
98
+ _logs[key].setWriter(writer);
99
+ }
100
+ });
101
+ };
102
+ exports.setLogWriter = setLogWriter;
70
103
  const enableLog = (enabled) => {
71
104
  Object.keys(_logs).forEach(key => {
72
105
  _logs[key].enabled = !!enabled;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureInternalModelFeature = exports.parseRevision = exports.getUnavailableCapabilities = exports.parseCapabilities = void 0;
4
- const versionUtils_1 = require("./versionUtils");
4
+ const utils_1 = require("@trezor/utils");
5
5
  const config_1 = require("../data/config");
6
6
  const types_1 = require("../types");
7
7
  const DEFAULT_CAPABILITIES_T1 = [
@@ -43,7 +43,7 @@ const getUnavailableCapabilities = (features, coins) => {
43
43
  if (!capabilities)
44
44
  return list;
45
45
  const fw = [features.major_version, features.minor_version, features.patch_version];
46
- const key = `trezor${features.major_version}`;
46
+ const key = features.internal_model;
47
47
  const supported = coins.filter(info => {
48
48
  if (!info.support || typeof info.support[key] !== 'string') {
49
49
  list[info.shortcut.toLowerCase()] = 'no-support';
@@ -78,7 +78,7 @@ const getUnavailableCapabilities = (features, coins) => {
78
78
  supported
79
79
  .filter(info => !unavailable.includes(info))
80
80
  .forEach(info => {
81
- if ((0, versionUtils_1.versionCompare)(info.support[key], fw) > 0) {
81
+ if (utils_1.versionUtils.isNewer(info.support[key], fw.join('.'))) {
82
82
  list[info.shortcut.toLowerCase()] = 'update-required';
83
83
  unavailable.push(info);
84
84
  }
@@ -86,15 +86,15 @@ const getUnavailableCapabilities = (features, coins) => {
86
86
  config_1.config.supportedFirmware.forEach(s => {
87
87
  if (!s.capabilities)
88
88
  return;
89
- const min = s.min ? s.min[fw[0] - 1] : null;
90
- const max = s.max ? s.max[fw[0] - 1] : null;
91
- if (min && (min === '0' || (0, versionUtils_1.versionCompare)(min, fw) > 0)) {
89
+ const min = s.min ? s.min[key] : null;
90
+ const max = s.max ? s.max[key] : null;
91
+ if (min && (min === '0' || utils_1.versionUtils.isNewer(min, fw.join('.')))) {
92
92
  const value = min === '0' ? 'no-support' : 'update-required';
93
93
  s.capabilities.forEach(m => {
94
94
  list[m] = value;
95
95
  });
96
96
  }
97
- if (max && (0, versionUtils_1.versionCompare)(max, fw) < 0) {
97
+ if (max && !utils_1.versionUtils.isNewerOrEqual(max, fw.join('.'))) {
98
98
  s.capabilities.forEach(m => {
99
99
  list[m] = 'trezor-connect-outdated';
100
100
  });
@@ -1,5 +1,5 @@
1
1
  import { PROTO } from '../constants';
2
- import type { CoinInfo } from '../types';
2
+ import type { CoinInfo, DerivationPath, ProtoWithDerivationPath, ProtoWithAddressN } from '../types';
3
3
  export declare const HD_HARDENED = 2147483648;
4
4
  export declare const toHardened: (n: number) => number;
5
5
  export declare const fromHardened: (n: number) => number;
@@ -11,10 +11,10 @@ export declare const isTaprootPath: (path: number[] | undefined) => boolean;
11
11
  export declare const getAccountType: (path: number[] | undefined) => "p2pkh" | "p2sh" | "p2tr" | "p2wpkh";
12
12
  export declare const getScriptType: (path: number[] | undefined) => PROTO.InternalInputScriptType | undefined;
13
13
  export declare const getOutputScriptType: (path?: number[]) => PROTO.ChangeOutputScriptType | undefined;
14
- export declare const validatePath: (path: string | number[], length?: number, base?: boolean) => number[];
14
+ export declare const validatePath: (path: DerivationPath, length?: number, base?: boolean) => number[];
15
15
  export declare const getSerializedPath: (path: number[]) => string;
16
16
  export declare const getPathFromIndex: (bip44purpose: number, bip44cointype: number, index: number) => number[];
17
17
  export declare const getIndexFromPath: (path: number[]) => number;
18
- export declare const fixPath: <T extends PROTO.TxInputType | PROTO.TxOutputType>(utxo: T) => T;
18
+ export declare const fixPath: <T extends ProtoWithDerivationPath<PROTO.TxInputType> | ProtoWithDerivationPath<PROTO.TxOutputType>>(utxo: T) => ProtoWithAddressN<T>;
19
19
  export declare const getLabel: (label: string, coinInfo?: CoinInfo) => string;
20
20
  //# sourceMappingURL=pathUtils.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.1.3",
3
+ "version": "9.1.5",
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,28 +49,26 @@
49
49
  "prepublish": "yarn tsx ../../scripts/prepublish.js"
50
50
  },
51
51
  "dependencies": {
52
- "@trezor/blockchain-link": "2.1.16",
53
- "@trezor/blockchain-link-types": "1.0.5",
54
- "@trezor/connect-analytics": "1.0.6",
55
- "@trezor/connect-common": "0.0.20",
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",
52
+ "@trezor/blockchain-link": "2.1.18",
53
+ "@trezor/blockchain-link-types": "1.0.7",
54
+ "@trezor/connect-analytics": "1.0.8",
55
+ "@trezor/connect-common": "0.0.22",
56
+ "@trezor/protobuf": "1.0.2",
57
+ "@trezor/protocol": "1.0.2",
58
+ "@trezor/transport": "1.1.17",
59
+ "@trezor/utils": "9.0.14",
60
+ "@trezor/utxo-lib": "1.0.12",
61
61
  "bignumber.js": "^9.1.1",
62
62
  "blakejs": "^1.2.1",
63
63
  "bs58": "^5.0.0",
64
64
  "bs58check": "^3.0.1",
65
65
  "cross-fetch": "^3.1.6",
66
- "events": "^3.3.0",
67
- "randombytes": "2.1.0"
66
+ "events": "^3.3.0"
68
67
  },
69
68
  "devDependencies": {
70
69
  "@trezor/trezor-user-env-link": "1.0.2",
71
70
  "@types/karma": "^6.3.4",
72
71
  "@types/parse-uri": "^1.0.0",
73
- "@types/randombytes": "^2.0.0",
74
72
  "jest": "^29.5.0",
75
73
  "jest-environment-jsdom": "^29.5.0",
76
74
  "karma": "^6.4.2",
@@ -86,5 +84,8 @@
86
84
  "typescript": "4.9.5",
87
85
  "webpack": "^5.87.0",
88
86
  "ws": "7.5.9"
87
+ },
88
+ "peerDependencies": {
89
+ "tslib": "^2.6.2"
89
90
  }
90
91
  }
@@ -1,18 +0,0 @@
1
- export type Deferred<T, I = any, D = any> = {
2
- id?: I;
3
- data?: D;
4
- promise: Promise<T>;
5
- resolve: (t: T) => void;
6
- reject: (e: Error) => void;
7
- };
8
- export type AsyncDeferred<T> = {
9
- promise: Promise<T>;
10
- resolve: (t: T) => void;
11
- reject: (e: Error) => void;
12
- run: (...args: any[]) => any;
13
- };
14
- export declare function create<T, I = any, D = any>(arg?: I, data?: D): Deferred<T, I, D>;
15
- export declare function createAsync<T>(innerFn: (...args: any[]) => any): AsyncDeferred<T>;
16
- export declare function resolveTimeoutPromise<T>(delay: number, result: T): Promise<T>;
17
- export declare const rejectTimeoutPromise: (delay: number, error: Error) => Promise<any>;
18
- //# sourceMappingURL=deferred.d.ts.map
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rejectTimeoutPromise = exports.resolveTimeoutPromise = exports.createAsync = exports.create = void 0;
4
- function create(arg, data) {
5
- let localResolve = (_t) => { };
6
- let localReject = (_e) => { };
7
- let id;
8
- const promise = new Promise(async (resolve, reject) => {
9
- localResolve = resolve;
10
- localReject = reject;
11
- if (typeof arg === 'function') {
12
- try {
13
- await arg();
14
- }
15
- catch (error) {
16
- reject(error);
17
- }
18
- }
19
- if (typeof arg === 'string')
20
- id = arg;
21
- });
22
- return {
23
- id,
24
- data,
25
- resolve: localResolve,
26
- reject: localReject,
27
- promise,
28
- };
29
- }
30
- exports.create = create;
31
- function createAsync(innerFn) {
32
- let localResolve = (_t) => { };
33
- let localReject = _e => { };
34
- const promise = new Promise((resolve, reject) => {
35
- localResolve = resolve;
36
- localReject = reject;
37
- });
38
- const inner = async () => {
39
- await innerFn();
40
- };
41
- return {
42
- resolve: localResolve,
43
- reject: localReject,
44
- promise,
45
- run: () => {
46
- inner();
47
- return promise;
48
- },
49
- };
50
- }
51
- exports.createAsync = createAsync;
52
- function resolveTimeoutPromise(delay, result) {
53
- return new Promise(resolve => {
54
- setTimeout(() => {
55
- resolve(result);
56
- }, delay);
57
- });
58
- }
59
- exports.resolveTimeoutPromise = resolveTimeoutPromise;
60
- const rejectTimeoutPromise = (delay, error) => new Promise((_resolve, reject) => {
61
- setTimeout(() => {
62
- reject(error);
63
- }, delay);
64
- });
65
- exports.rejectTimeoutPromise = rejectTimeoutPromise;
66
- //# sourceMappingURL=deferred.js.map
@@ -1,8 +0,0 @@
1
- import type { VersionArray } from '../types';
2
- export declare const isValidVersionString: (version: string) => boolean;
3
- export declare const isValidVersionArray: (version: (number | null)[]) => boolean;
4
- export declare const isVersionArray: (arr: (number | null)[]) => arr is VersionArray;
5
- export declare const normalizeVersionArray: (version: number[]) => number[];
6
- export declare const versionSplit: (version: string) => number[];
7
- export declare const versionCompare: (a: string | number[], b: string | number[]) => 1 | 0 | -1;
8
- //# sourceMappingURL=versionUtils.d.ts.map