@trezor/connect 9.0.4 → 9.0.6

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 (125) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/lib/api/binanceGetAddress.d.ts +1 -1
  4. package/lib/api/binanceSignTransaction.d.ts +1 -1
  5. package/lib/api/bitcoin/Fees.d.ts +1 -1
  6. package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
  7. package/lib/api/bitcoin/refTx.js +1 -1
  8. package/lib/api/bitcoin/signtxVerify.d.ts +1 -1
  9. package/lib/api/blockchainDisconnect.d.ts +1 -1
  10. package/lib/api/blockchainEstimateFee.d.ts +1 -1
  11. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
  12. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
  13. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
  14. package/lib/api/blockchainGetTransactions.d.ts +1 -1
  15. package/lib/api/blockchainSetCustomBackend.d.ts +1 -1
  16. package/lib/api/blockchainSubscribe.d.ts +1 -1
  17. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -1
  18. package/lib/api/blockchainUnsubscribe.d.ts +1 -1
  19. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -1
  20. package/lib/api/cardano/cardanoCertificate.d.ts +2 -2
  21. package/lib/api/cardano/cardanoInputs.d.ts +3 -3
  22. package/lib/api/cardano/cardanoOutputs.d.ts +1 -1
  23. package/lib/api/cardano/cardanoTokenBundle.d.ts +1 -1
  24. package/lib/api/cardanoGetAddress.d.ts +1 -1
  25. package/lib/api/cardanoSignTransaction.d.ts +1 -1
  26. package/lib/api/checkFirmwareAuthenticity.js +3 -1
  27. package/lib/api/common/Discovery.d.ts +2 -2
  28. package/lib/api/common/paramsValidator.d.ts +2 -2
  29. package/lib/api/composeTransaction.d.ts +1 -1
  30. package/lib/api/eos/eosSignTx.js +1 -1
  31. package/lib/api/eosSignTransaction.d.ts +1 -1
  32. package/lib/api/ethereumGetAddress.d.ts +1 -1
  33. package/lib/api/ethereumGetPublicKey.d.ts +1 -1
  34. package/lib/api/ethereumSignTransaction.d.ts +1 -1
  35. package/lib/api/ethereumSignTypedData.d.ts +1 -1
  36. package/lib/api/firmware/uploadFirmware.d.ts +2 -2
  37. package/lib/api/firmwareUpdate.d.ts +1 -1
  38. package/lib/api/firmwareUpdate.js +1 -1
  39. package/lib/api/getAccountInfo.d.ts +1 -1
  40. package/lib/api/getAddress.d.ts +1 -1
  41. package/lib/api/getCoinInfo.d.ts +2 -2
  42. package/lib/api/getPublicKey.d.ts +1 -1
  43. package/lib/api/nemGetAddress.d.ts +1 -1
  44. package/lib/api/pushTransaction.d.ts +1 -1
  45. package/lib/api/rippleGetAddress.d.ts +1 -1
  46. package/lib/api/setBusy.js +5 -1
  47. package/lib/api/setProxy.js +3 -4
  48. package/lib/api/signTransaction.d.ts +3 -1
  49. package/lib/api/signTransaction.js +41 -38
  50. package/lib/api/stellarGetAddress.d.ts +1 -1
  51. package/lib/api/stellarSignTransaction.d.ts +1 -1
  52. package/lib/api/tezosGetAddress.d.ts +1 -1
  53. package/lib/backend/BackendManager.d.ts +1 -1
  54. package/lib/backend/BackendManager.js +0 -4
  55. package/lib/backend/Blockchain.d.ts +3 -9
  56. package/lib/backend/Blockchain.js +2 -17
  57. package/lib/constants/network.d.ts +1 -1
  58. package/lib/core/AbstractMethod.d.ts +4 -4
  59. package/lib/core/AbstractMethod.js +7 -5
  60. package/lib/core/index.d.ts +1 -1
  61. package/lib/core/index.js +9 -5
  62. package/lib/data/DataManager.d.ts +1 -1
  63. package/lib/data/analyticsInfo.d.ts +6 -0
  64. package/lib/data/analyticsInfo.js +37 -0
  65. package/lib/data/config.js +2 -5
  66. package/lib/data/version.d.ts +1 -1
  67. package/lib/data/version.js +1 -1
  68. package/lib/device/AbortController.d.ts +1 -1
  69. package/lib/device/DescriptorStream.d.ts +1 -1
  70. package/lib/device/Device.d.ts +3 -3
  71. package/lib/device/Device.js +13 -6
  72. package/lib/device/DeviceCommands.d.ts +7 -7
  73. package/lib/device/DeviceCommands.js +3 -1
  74. package/lib/device/DeviceList.d.ts +2 -2
  75. package/lib/device/DeviceList.js +2 -2
  76. package/lib/events/blockchain.d.ts +4 -5
  77. package/lib/events/call.d.ts +10 -10
  78. package/lib/events/core.d.ts +3 -2
  79. package/lib/events/device.d.ts +3 -3
  80. package/lib/events/iframe.d.ts +2 -2
  81. package/lib/events/popup.d.ts +2 -2
  82. package/lib/events/transport.d.ts +8 -4
  83. package/lib/events/transport.js +1 -1
  84. package/lib/events/ui-promise.d.ts +2 -2
  85. package/lib/events/ui-request.d.ts +9 -7
  86. package/lib/events/ui-response.d.ts +2 -2
  87. package/lib/factory.d.ts +2 -1
  88. package/lib/factory.js +2 -1
  89. package/lib/index-browser.js +1 -0
  90. package/lib/index.js +6 -2
  91. package/lib/types/account.d.ts +2 -2
  92. package/lib/types/api/binance/index.d.ts +1 -1
  93. package/lib/types/api/bitcoin/index.d.ts +2 -2
  94. package/lib/types/api/blockchainGetTransactions.d.ts +1 -1
  95. package/lib/types/api/blockchainSetCustomBackend.d.ts +1 -1
  96. package/lib/types/api/blockchainSubscribe.d.ts +1 -1
  97. package/lib/types/api/blockchainSubscribeFiatRates.d.ts +1 -1
  98. package/lib/types/api/cardano/index.d.ts +2 -2
  99. package/lib/types/api/composeTransaction.d.ts +3 -3
  100. package/lib/types/api/dispose.d.ts +1 -1
  101. package/lib/types/api/eos/index.d.ts +1 -1
  102. package/lib/types/api/getAddress.d.ts +1 -1
  103. package/lib/types/api/index.d.ts +2 -0
  104. package/lib/types/api/nem/index.d.ts +9 -9
  105. package/lib/types/api/off.d.ts +2 -2
  106. package/lib/types/api/on.d.ts +2 -2
  107. package/lib/types/api/pushTransaction.d.ts +1 -1
  108. package/lib/types/api/requestWebUSBDevice.d.ts +2 -0
  109. package/lib/types/api/requestWebUSBDevice.js +3 -0
  110. package/lib/types/api/setProxy.d.ts +1 -2
  111. package/lib/types/api/stellar/index.d.ts +2 -2
  112. package/lib/types/coinInfo.d.ts +3 -3
  113. package/lib/types/device.d.ts +13 -13
  114. package/lib/types/firmware.d.ts +3 -3
  115. package/lib/types/params.d.ts +3 -3
  116. package/lib/types/settings.d.ts +1 -2
  117. package/lib/types/utils.d.ts +2 -2
  118. package/lib/utils/accountUtils.d.ts +1 -1
  119. package/lib/utils/browserUtils.d.ts +2 -2
  120. package/lib/utils/debug.d.ts +1 -1
  121. package/lib/utils/deferred.d.ts +2 -2
  122. package/lib/utils/interactionTimeout.d.ts +1 -1
  123. package/lib/workers/RNUsbPlugin.d.ts +1 -1
  124. package/lib/workers/workers.d.ts +1 -1
  125. package/package.json +84 -80
package/CHANGELOG.md ADDED
@@ -0,0 +1,74 @@
1
+ # 9.0.6
2
+
3
+ - fix: list tslib as direct dependency
4
+ - fix: various improvement and fixes regarding RBF (https://github.com/trezor/trezor-suite/pull/7378)
5
+ - change: increase handshake timeout in popup to 90 seconds
6
+ - change: TrezorConnect.dispose is now async and resolves only after connected device is released
7
+
8
+ # 9.0.5
9
+
10
+ - added: analytics in popup
11
+ - fixed: `signTransaction` with litecoin mimble wimble pegout inputs
12
+ - fixed: `composeTransaction` cases when composing tx with multiple outputs where at least one is above MAX_SAFE_INTEGER
13
+ - updated: @trezor/blockchain-link 2.6.1
14
+ - updated: @trezor/connect-common 0.0.11
15
+ - updated: @trezor/transport 1.1.6
16
+ - updated: @trezor/utils 9.0.4
17
+ - updated: @trezor/utxo-lib 1.0.2
18
+
19
+ # 9.0.4
20
+
21
+ - @trezor/blockchain-link 2.1.5
22
+ - added `setBusy` method
23
+ - added `goerli` (TGOR) coin support
24
+ - added `serialize` and `coinjoinRequest` option to `signTransaction` method
25
+ - added `preauthorized` option to `authorizeCoinJoin` method
26
+ - Cardano: added support for [CIP36 Catalyst registration format](https://cips.cardano.org/cips/cip36/) in `cardanoSignTransaction` method
27
+ - `auxiliaryData.catalystRegistrationParameters` is deprecated, use `auxiliaryData.governanceRegistrationParameters` instead
28
+
29
+ # 9.0.3
30
+
31
+ - typescript: removed `EosGetPublicKey` type, use `GetPublicKey` type instead
32
+ - fix default bip48 script types. [#6393](https://github.com/trezor/trezor-suite/pull/6393) and [#6407](https://github.com/trezor/trezor-suite/pull/6407)
33
+ - added `unlockPath` method
34
+ - added `SLIP 25` support
35
+ - fixed bitcoin extended descriptor (xpubSegwit) for taproot accounts
36
+
37
+ # 9.0.2
38
+
39
+ - improved passphrase dialog in popup window
40
+ - if popup window does not load in a predefined period of time, error screen with troubleshooting tips is shown
41
+
42
+ # 9.0.1
43
+
44
+ - @trezor/blockchain-link 2.1.4
45
+
46
+ # 9.0.0
47
+
48
+ ## Breaking changes:
49
+
50
+ - Changed codebase to typescript.
51
+ - Removed `Lisk` methods from api.
52
+ - Removed `customMethod` api method.
53
+ - Exported constants:
54
+ - `CARDANO.ADDRESS_TYPE` => `PROTO.CardanoAddressType`
55
+ - `CARDANO.CERTIFICATE_TYPE` => `PROTO.CardanoCertificateType`
56
+ - `CARDANO.POOL_RELAY_TYPE` => `PROTO.CardanoPoolRelayType`
57
+ - `CardanoCertificateType`
58
+ - `CardanoNativeScriptType` => `PROTO.CardanoNativeScriptType`
59
+ - `CardanoNativeScriptHashDisplayFormat` => `PROTO.CardanoNativeScriptHashDisplayFormat`
60
+ - `CardanoPoolRelayType` => `PROTO.CardanoPoolRelayType`
61
+ - `CardanoTxSigningMode` => `PROTO.CardanoTxSigningMode`
62
+ - `CardanoTxWitnessType` => `PROTO.CardanoTxWitnessType`
63
+ - removed unused `DEVICE.WAIT_FOR_SELECTION`
64
+ - removed unused `UI.CHANGE_ACCOUNT`
65
+ - Minimum firmware requirements bumped:
66
+ - 2.4.2 CardanoSignTransaction
67
+
68
+ ## Added:
69
+
70
+ - `getOwnershipId` method
71
+ - `getOwnershipProof` method
72
+ - `authorizeCoinJoin` method
73
+ - `getFirmwareHash` method
74
+ - [support for babbage features in cardano](https://github.com/trezor/trezor-suite/commit/efe9c78a2f74a1b7653b3fddf6cca35ba38d3ae9)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.0.4
3
+ API version 9.0.6
4
4
 
5
5
  [![Build Status](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml/badge.svg)](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
6
6
  [![NPM](https://img.shields.io/npm/v/@trezor/connect.svg)](https://www.npmjs.org/package/@trezor/connect)
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
- declare type Params = PROTO.BinanceGetAddress & {
3
+ type Params = PROTO.BinanceGetAddress & {
4
4
  address?: string;
5
5
  };
6
6
  export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress', Params[]> {
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { BinancePreparedTransaction } from '../types/api/binance';
3
- declare type Params = {
3
+ type Params = {
4
4
  path: number[];
5
5
  transaction: BinancePreparedTransaction;
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import { Blockchain } from '../../backend/BlockchainLink';
2
2
  import type { CoinInfo } from '../../types';
3
3
  import type { FeeLevel } from '../../types/account';
4
- declare type Blocks = Array<string | undefined>;
4
+ type Blocks = Array<string | undefined>;
5
5
  export declare class FeeLevels {
6
6
  coinInfo: CoinInfo;
7
7
  levels: FeeLevel[];
@@ -4,7 +4,7 @@ import { Blockchain } from '../../backend/BlockchainLink';
4
4
  import type { BitcoinNetworkInfo } from '../../types';
5
5
  import type { DiscoveryAccount, SelectFeeLevel } from '../../types/account';
6
6
  import type { PrecomposeParams } from '../../types/api/composeTransaction';
7
- declare type Options = {
7
+ type Options = {
8
8
  account: DiscoveryAccount;
9
9
  utxo: PrecomposeParams['account']['utxo'];
10
10
  outputs: ComposeOutput[];
@@ -161,7 +161,7 @@ exports.transformReferencedTransactions = transformReferencedTransactions;
161
161
  const validateReferencedTransactions = (txs, inputs, outputs) => {
162
162
  if (!Array.isArray(txs) || txs.length === 0)
163
163
  return;
164
- const refTxs = (0, exports.getReferencedTransactions)(inputs);
164
+ const refTxs = (0, exports.requireReferencedTransactions)(inputs) ? (0, exports.getReferencedTransactions)(inputs) : [];
165
165
  const origTxs = (0, exports.getOrigTransactions)(inputs, outputs);
166
166
  const transformedTxs = txs.map(tx => {
167
167
  (0, paramsValidator_1.validateParams)(tx, [
@@ -1,7 +1,7 @@
1
1
  import { PROTO } from '../../constants';
2
2
  import type { BitcoinNetworkInfo } from '../../types';
3
3
  import type { DeviceCommands } from '../../device/DeviceCommands';
4
- declare type GetHDNode = DeviceCommands['getHDNode'];
4
+ type GetHDNode = DeviceCommands['getHDNode'];
5
5
  export declare const verifyTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo, unlockPath?: PROTO.UnlockPath) => Promise<import("packages/utxo-lib/lib/transaction/base").TransactionBase<undefined> | import("packages/utxo-lib/lib/transaction/base").TransactionBase<import("packages/utxo-lib/lib/transaction/dash").DashSpecific> | import("packages/utxo-lib/lib/transaction/base").TransactionBase<import("packages/utxo-lib/lib/transaction/zcash").ZcashSpecific>>;
6
6
  export declare const verifyTicketTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo) => Promise<void>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  };
6
6
  export default class BlockchainDisconnect extends AbstractMethod<'blockchainDisconnect', Params> {
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  request: Payload<'blockchainEstimateFee'>['request'];
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  request: Omit<Payload<'blockchainGetAccountBalanceHistory'>, 'method' | 'coin'>;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  currencies: Payload<'blockchainGetCurrentFiatRates'>['currencies'];
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  timestamps: Payload<'blockchainGetFiatRatesForTimestamps'>['timestamps'];
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  txs: string[];
5
5
  coinInfo: CoinInfo;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  };
6
6
  export default class BlockchainSetCustomBackend extends AbstractMethod<'blockchainSetCustomBackend', Params> {
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  accounts: Payload<'blockchainSubscribe'>['accounts'];
5
5
  coinInfo: CoinInfo;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  currency: Payload<'blockchainSubscribeFiatRates'>['currency'];
5
5
  coinInfo: CoinInfo;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  accounts: Payload<'blockchainUnsubscribe'>['accounts'];
5
5
  coinInfo: CoinInfo;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  };
6
6
  export default class BlockchainUnsubscribeFiatRates extends AbstractMethod<'blockchainUnsubscribeFiatRates', Params> {
@@ -1,11 +1,11 @@
1
1
  import { PROTO } from '../../constants';
2
2
  import type { CardanoCertificate } from '../../types/api/cardano';
3
- export declare type CertificateWithPoolOwnersAndRelays = {
3
+ export type CertificateWithPoolOwnersAndRelays = {
4
4
  certificate: PROTO.CardanoTxCertificate;
5
5
  poolOwners: PROTO.CardanoPoolOwner[];
6
6
  poolRelays: PROTO.CardanoPoolRelayParameters[];
7
7
  };
8
- export declare type PoolParametersWithOwnersAndRelays = {
8
+ export type PoolParametersWithOwnersAndRelays = {
9
9
  poolParameters?: PROTO.CardanoPoolParametersType;
10
10
  poolOwners: PROTO.CardanoPoolOwner[];
11
11
  poolRelays: PROTO.CardanoPoolRelayParameters[];
@@ -1,10 +1,10 @@
1
1
  import type { PROTO } from '../../constants';
2
- export declare type Path = number[];
3
- export declare type InputWithPath = {
2
+ export type Path = number[];
3
+ export type InputWithPath = {
4
4
  input: PROTO.CardanoTxInput;
5
5
  path?: Path;
6
6
  };
7
- export declare type CollateralInputWithPath = {
7
+ export type CollateralInputWithPath = {
8
8
  collateralInput: PROTO.CardanoTxCollateralInput;
9
9
  path?: Path;
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import type { AssetGroupWithTokens } from './cardanoTokenBundle';
2
2
  import { PROTO } from '../../constants';
3
- export declare type OutputWithData = {
3
+ export type OutputWithData = {
4
4
  output: PROTO.CardanoTxOutput;
5
5
  tokenBundle?: AssetGroupWithTokens[];
6
6
  inlineDatum?: string;
@@ -1,6 +1,6 @@
1
1
  import type { PROTO } from '../../constants';
2
2
  import type { CardanoAssetGroup } from '../../types/api/cardano';
3
- export declare type AssetGroupWithTokens = {
3
+ export type AssetGroupWithTokens = {
4
4
  policyId: string;
5
5
  tokens: PROTO.CardanoToken[];
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
- declare type Params = PROTO.CardanoGetAddress & {
3
+ type Params = PROTO.CardanoGetAddress & {
4
4
  address?: string;
5
5
  };
6
6
  export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress', Params[]> {
@@ -17,7 +17,7 @@ declare const CardanoSignTransactionFeatures: Readonly<{
17
17
  Babbage: string[];
18
18
  GovernanceRegistrationCIP36: string[];
19
19
  }>;
20
- export declare type CardanoSignTransactionParams = {
20
+ export type CardanoSignTransactionParams = {
21
21
  signingMode: PROTO.CardanoTxSigningMode;
22
22
  inputsWithPath: InputWithPath[];
23
23
  outputsWithData: OutputWithData[];
@@ -28,7 +28,9 @@ class CheckFirmwareAuthenticity extends AbstractMethod_1.AbstractMethod {
28
28
  throw constants_1.ERRORS.TypedError('Runtime', 'checkFirmwareAuthenticity: firmware binary not found');
29
29
  }
30
30
  const { hash: expectedFirmwareHash, challenge } = (0, firmware_1.calculateFirmwareHash)(device.features.major_version, (0, firmware_1.stripFwHeaders)(fw), (0, randombytes_1.default)(32));
31
- const result = await this.device.commands.typedCall('GetFirmwareHash', 'FirmwareHash', {
31
+ const result = await this.device
32
+ .getCommands()
33
+ .typedCall('GetFirmwareHash', 'FirmwareHash', {
32
34
  challenge,
33
35
  });
34
36
  const { message } = result;
@@ -5,11 +5,11 @@ import { Blockchain } from '../../backend/BlockchainLink';
5
5
  import { DeviceCommands } from '../../device/DeviceCommands';
6
6
  import type { CoinInfo, DiscoveryAccountType, DiscoveryAccount } from '../../types';
7
7
  import type { GetAccountInfo } from '../../types/api/getAccountInfo';
8
- declare type DiscoveryType = {
8
+ type DiscoveryType = {
9
9
  type: DiscoveryAccountType;
10
10
  getPath: (index: number) => number[];
11
11
  };
12
- declare type DiscoveryOptions = {
12
+ type DiscoveryOptions = {
13
13
  blockchain: Blockchain;
14
14
  commands: DeviceCommands;
15
15
  limit?: number;
@@ -1,6 +1,6 @@
1
1
  import type { CoinInfo, FirmwareRange } from '../../types';
2
- declare type ParamType = 'string' | 'number' | 'array' | 'array-buffer' | 'boolean' | 'uint' | 'object';
3
- declare type Param = {
2
+ type ParamType = 'string' | 'number' | 'array' | 'array-buffer' | 'boolean' | 'uint' | 'object';
3
+ type Param = {
4
4
  name: string;
5
5
  type?: ParamType | ParamType[];
6
6
  required?: boolean;
@@ -4,7 +4,7 @@ import { TransactionComposer } from './bitcoin';
4
4
  import type { ComposeOutput, ComposeResult } from '@trezor/utxo-lib';
5
5
  import type { BitcoinNetworkInfo, DiscoveryAccount, AccountUtxo } from '../types';
6
6
  import type { SignedTransaction, PrecomposeParams, PrecomposedTransaction } from '../types/api/composeTransaction';
7
- declare type Params = {
7
+ type Params = {
8
8
  outputs: ComposeOutput[];
9
9
  coinInfo: BitcoinNetworkInfo;
10
10
  push: boolean;
@@ -99,7 +99,7 @@ const parseQuantity = (s) => {
99
99
  const parseAuth = (a) => {
100
100
  const keyToBuffer = (pk) => {
101
101
  const len = pk.indexOf('EOS') === 0 ? 3 : 7;
102
- const key = bs58.decode(pk.substring(len));
102
+ const key = Buffer.from(bs58.decode(pk.substring(len)));
103
103
  return {
104
104
  type: 0,
105
105
  key: key.slice(0, key.length - 4).toString('hex'),
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
- declare type Params = {
3
+ type Params = {
4
4
  path: number[];
5
5
  chain_id: string;
6
6
  header: PROTO.EosTxHeader;
@@ -1,7 +1,7 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  import type { EthereumNetworkInfo } from '../types';
4
- declare type Params = PROTO.EthereumGetAddress & {
4
+ type Params = PROTO.EthereumGetAddress & {
5
5
  address?: string;
6
6
  network?: EthereumNetworkInfo;
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { PROTO } from '../constants';
3
3
  import type { EthereumNetworkInfo } from '../types';
4
- declare type Params = PROTO.EthereumGetPublicKey & {
4
+ type Params = PROTO.EthereumGetPublicKey & {
5
5
  network?: EthereumNetworkInfo;
6
6
  };
7
7
  export default class EthereumGetPublicKey extends AbstractMethod<'ethereumGetPublicKey', Params[]> {
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { EthereumTransaction, EthereumTransactionEIP1559 } from '../types/api/ethereum';
3
- declare type Params = {
3
+ type Params = {
4
4
  path: number[];
5
5
  tx: ({
6
6
  type: 'legacy';
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { EthereumSignTypedDataTypes, EthereumSignTypedData as EthereumSignTypedDataParams, EthereumSignTypedHash as EthereumSignTypedHashParams } from '../types/api/ethereum';
3
- declare type Params = (Omit<EthereumSignTypedDataParams<EthereumSignTypedDataTypes>, 'path'> | Omit<EthereumSignTypedHashParams<EthereumSignTypedDataTypes>, 'path'>) & {
3
+ type Params = (Omit<EthereumSignTypedDataParams<EthereumSignTypedDataTypes>, 'path'> | Omit<EthereumSignTypedHashParams<EthereumSignTypedDataTypes>, 'path'>) & {
4
4
  address_n: number[];
5
5
  };
6
6
  export default class EthereumSignTypedData extends AbstractMethod<'ethereumSignTypedData', Params> {
@@ -1,6 +1,6 @@
1
- import { CoreMessage } from '../../events';
1
+ import { PostMessage } from '../../events';
2
2
  import { PROTO } from '../../constants';
3
3
  import type { Device } from '../../device/Device';
4
4
  import type { TypedCall } from '../../device/DeviceCommands';
5
- export declare const uploadFirmware: (typedCall: TypedCall, postMessage: (message: CoreMessage) => void, device: Device, { payload }: PROTO.FirmwareUpload) => Promise<PROTO.Success>;
5
+ export declare const uploadFirmware: (typedCall: TypedCall, postMessage: PostMessage, device: Device, { payload }: PROTO.FirmwareUpload) => Promise<PROTO.Success>;
6
6
  //# sourceMappingURL=uploadFirmware.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
- declare type Params = {
2
+ type Params = {
3
3
  binary?: ArrayBuffer;
4
4
  version?: number[];
5
5
  btcOnly?: boolean;
@@ -73,7 +73,7 @@ class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
73
73
  }
74
74
  }
75
75
  catch (err) {
76
- throw constants_1.ERRORS.TypedError('Method_FirmwareUpdate_DownloadFailed', 'Failed to download firmware binary');
76
+ throw constants_1.ERRORS.TypedError('Method_FirmwareUpdate_DownloadFailed', `Failed to download firmware binary ${err.message}`);
77
77
  }
78
78
  const stripped = (0, firmware_1.stripFwHeaders)(binary);
79
79
  await (0, firmware_1.uploadFirmware)(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: (0, firmware_1.shouldStripFwHeaders)(device.features) ? stripped : binary });
@@ -2,7 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { Discovery } from './common/Discovery';
3
3
  import type { CoinInfo, AccountInfo, AccountUtxo } from '../types';
4
4
  import type { GetAccountInfo as GetAccountInfoParams } from '../types/api/getAccountInfo';
5
- declare type Request = GetAccountInfoParams & {
5
+ type Request = GetAccountInfoParams & {
6
6
  address_n: number[];
7
7
  coinInfo: CoinInfo;
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  import type { BitcoinNetworkInfo } from '../types';
4
- declare type Params = PROTO.GetAddress & {
4
+ type Params = PROTO.GetAddress & {
5
5
  address?: string;
6
6
  coinInfo: BitcoinNetworkInfo;
7
7
  unlockPath?: PROTO.UnlockPath;
@@ -1,11 +1,11 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  coinInfo: CoinInfo;
5
5
  };
6
6
  export default class GetCoinInfo extends AbstractMethod<'getCoinInfo', Params> {
7
7
  init(): void;
8
- run(): Promise<import("../types").BitcoinNetworkInfo | import("../types").EthereumNetworkInfo | import("../types").MiscNetworkInfo>;
8
+ run(): Promise<CoinInfo>;
9
9
  }
10
10
  export {};
11
11
  //# sourceMappingURL=getCoinInfo.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { BitcoinNetworkInfo } from '../types';
3
3
  import type { PROTO } from '../constants';
4
- declare type Params = PROTO.GetPublicKey & {
4
+ type Params = PROTO.GetPublicKey & {
5
5
  coinInfo?: BitcoinNetworkInfo;
6
6
  unlockPath?: PROTO.UnlockPath;
7
7
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
- declare type Params = PROTO.NEMGetAddress & {
3
+ type Params = PROTO.NEMGetAddress & {
4
4
  address?: string;
5
5
  };
6
6
  export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', Params[]> {
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
- declare type Params = {
3
+ type Params = {
4
4
  tx: string;
5
5
  coinInfo: CoinInfo;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
- declare type Params = PROTO.RippleGetAddress & {
3
+ type Params = PROTO.RippleGetAddress & {
4
4
  address?: string;
5
5
  };
6
6
  export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress', Params[]> {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
+ const events_1 = require("../events");
4
5
  const paramsValidator_1 = require("./common/paramsValidator");
5
6
  class SetBusy extends AbstractMethod_1.AbstractMethod {
6
7
  init() {
7
8
  this.useDeviceState = false;
8
9
  this.requiredPermissions = ['management'];
9
- this.keepSession = true;
10
10
  const { payload } = this;
11
11
  (0, paramsValidator_1.validateParams)(payload, [{ name: 'expiry_ms', type: 'number' }]);
12
12
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
@@ -20,6 +20,10 @@ class SetBusy extends AbstractMethod_1.AbstractMethod {
20
20
  async run() {
21
21
  const cmd = this.device.getCommands();
22
22
  const { message } = await cmd.typedCall('SetBusy', 'Success', this.params);
23
+ if (this.keepSession && !!this.params.expiry_ms) {
24
+ this.device.features.busy = true;
25
+ this.postMessage((0, events_1.createDeviceMessage)(events_1.DEVICE.CHANGED, this.device.toMessageObject()));
26
+ }
23
27
  return message;
24
28
  }
25
29
  }
@@ -9,14 +9,13 @@ class SetProxy extends AbstractMethod_1.AbstractMethod {
9
9
  this.requiredPermissions = [];
10
10
  this.useDevice = false;
11
11
  this.useUi = false;
12
- (0, paramsValidator_1.validateParams)(this.payload, [{ name: 'useOnionLinks', type: 'boolean' }]);
12
+ (0, paramsValidator_1.validateParams)(this.payload, []);
13
13
  }
14
14
  async run() {
15
- const { proxy, useOnionLinks } = DataManager_1.DataManager.getSettings();
16
- const isChanged = proxy !== this.payload.proxy || useOnionLinks !== this.payload.useOnionLinks;
15
+ const { proxy } = DataManager_1.DataManager.getSettings();
16
+ const isChanged = proxy !== this.payload.proxy;
17
17
  if (isChanged) {
18
18
  DataManager_1.DataManager.settings.proxy = this.payload.proxy;
19
- DataManager_1.DataManager.settings.useOnionLinks = this.payload.useOnionLinks;
20
19
  await (0, BlockchainLink_1.reconnectAllBackends)();
21
20
  }
22
21
  return { message: 'Success' };
@@ -2,7 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { PROTO } from '../constants';
3
3
  import type { BitcoinNetworkInfo, AccountAddresses } from '../types';
4
4
  import type { RefTransaction, TransactionOptions } from '../types/api/bitcoin';
5
- declare type Params = {
5
+ type Params = {
6
6
  inputs: PROTO.TxInputType[];
7
7
  outputs: PROTO.TxOutputType[];
8
8
  paymentRequests: PROTO.TxAckPaymentRequest[];
@@ -16,6 +16,8 @@ declare type Params = {
16
16
  };
17
17
  export default class SignTransaction extends AbstractMethod<'signTransaction', Params> {
18
18
  init(): void;
19
+ private fetchAddresses;
20
+ private fetchRefTxs;
19
21
  run(): Promise<import("../types").SignedTransaction>;
20
22
  }
21
23
  export {};