@trezor/connect 9.4.8-beta.1 → 9.5.0-beta.1

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 (97) hide show
  1. package/CHANGELOG.md +33 -6
  2. package/README.md +1 -1
  3. package/lib/api/authorizeCoinjoin.js +1 -1
  4. package/lib/api/binance/api/binanceGetAddress.js +2 -4
  5. package/lib/api/binance/api/binanceGetPublicKey.js +1 -0
  6. package/lib/api/binance/api/binanceSignTransaction.js +1 -2
  7. package/lib/api/bitcoin/Fees.js +4 -1
  8. package/lib/api/bitcoin/TransactionComposer.js +9 -2
  9. package/lib/api/bitcoin/enhanceSignTx.js +1 -2
  10. package/lib/api/bitcoin/refTx.js +4 -6
  11. package/lib/api/blockchainDisconnect.js +1 -1
  12. package/lib/api/blockchainSubscribe.js +1 -2
  13. package/lib/api/blockchainUnsubscribe.js +1 -2
  14. package/lib/api/cardano/api/cardanoComposeTransaction.js +1 -1
  15. package/lib/api/cardano/api/cardanoGetAddress.js +2 -4
  16. package/lib/api/cardano/api/cardanoGetPublicKey.js +1 -0
  17. package/lib/api/cardano/cardanoAuxiliaryData.js +2 -2
  18. package/lib/api/cardano/cardanoUtils.js +5 -6
  19. package/lib/api/cipherKeyValue.js +1 -0
  20. package/lib/api/common/Discovery.js +16 -1
  21. package/lib/api/common/paramsValidator.js +2 -2
  22. package/lib/api/composeTransaction.js +6 -6
  23. package/lib/api/eos/api/eosGetPublicKey.js +1 -0
  24. package/lib/api/ethereum/api/ethereumGetAddress.js +2 -4
  25. package/lib/api/ethereum/api/ethereumGetPublicKey.js +1 -0
  26. package/lib/api/ethereum/api/ethereumSignMessage.js +1 -2
  27. package/lib/api/ethereum/api/ethereumSignTransaction.js +1 -1
  28. package/lib/api/ethereum/api/ethereumSignTypedData.js +1 -1
  29. package/lib/api/ethereum/ethereumDefinitions.js +2 -2
  30. package/lib/api/ethereum/ethereumSignTx.d.ts +2 -2
  31. package/lib/api/ethereum/ethereumSignTx.js +3 -2
  32. package/lib/api/firmware/verifyAuthenticityProof.js +3 -3
  33. package/lib/api/getAccountDescriptor.js +2 -4
  34. package/lib/api/getAccountInfo.js +4 -5
  35. package/lib/api/getAddress.js +5 -8
  36. package/lib/api/getDeviceState.js +1 -1
  37. package/lib/api/getOwnershipId.js +1 -0
  38. package/lib/api/getOwnershipProof.js +1 -0
  39. package/lib/api/getPublicKey.js +3 -2
  40. package/lib/api/nem/api/nemGetAddress.js +2 -4
  41. package/lib/api/nem/api/nemSignTransaction.js +1 -2
  42. package/lib/api/requestLogin.js +1 -0
  43. package/lib/api/ripple/api/rippleGetAddress.js +2 -4
  44. package/lib/api/signMessage.js +1 -2
  45. package/lib/api/signTransaction.js +6 -8
  46. package/lib/api/solana/additionalInfo.js +2 -3
  47. package/lib/api/solana/api/solanaComposeTransaction.js +2 -3
  48. package/lib/api/solana/api/solanaGetAddress.js +2 -4
  49. package/lib/api/solana/api/solanaGetPublicKey.js +1 -0
  50. package/lib/api/solana/solanaUtils.js +6 -5
  51. package/lib/api/stellar/api/stellarGetAddress.js +2 -4
  52. package/lib/api/tezos/api/tezosGetAddress.js +2 -4
  53. package/lib/api/tezos/api/tezosGetPublicKey.js +1 -0
  54. package/lib/backend/BackendManager.js +11 -16
  55. package/lib/backend/Blockchain.js +10 -4
  56. package/lib/backend/BlockchainLink.js +1 -1
  57. package/lib/constants/errors.js +2 -0
  58. package/lib/core/AbstractMethod.js +30 -5
  59. package/lib/core/index.js +24 -34
  60. package/lib/core/onCallFirmwareUpdate.d.ts +3 -2
  61. package/lib/core/onCallFirmwareUpdate.js +12 -59
  62. package/lib/data/DataManager.js +3 -2
  63. package/lib/data/analyticsInfo.js +10 -11
  64. package/lib/data/connectSettings.js +1 -2
  65. package/lib/data/defaultFeeLevels.js +4 -7
  66. package/lib/data/deviceAuthenticityConfig.js +16 -1
  67. package/lib/data/firmwareInfo.js +5 -6
  68. package/lib/data/version.d.ts +1 -1
  69. package/lib/data/version.js +1 -1
  70. package/lib/device/Device.d.ts +10 -2
  71. package/lib/device/Device.js +73 -56
  72. package/lib/device/DeviceCommands.d.ts +5 -1
  73. package/lib/device/DeviceCommands.js +7 -2
  74. package/lib/device/DeviceList.d.ts +2 -0
  75. package/lib/device/DeviceList.js +44 -24
  76. package/lib/device/StateStorage.js +5 -6
  77. package/lib/device/checkFirmwareRevision.js +11 -6
  78. package/lib/device/prompts.js +4 -7
  79. package/lib/events/call.d.ts +1 -0
  80. package/lib/events/call.js +3 -3
  81. package/lib/impl/core-in-module.js +25 -23
  82. package/lib/impl/dynamic.js +7 -1
  83. package/lib/index.js +9 -12
  84. package/lib/types/api/ethereum/index.d.ts +4 -4
  85. package/lib/types/api/ethereum/index.js +2 -2
  86. package/lib/types/api/firmwareUpdate.d.ts +1 -8
  87. package/lib/utils/assets.js +1 -1
  88. package/lib/utils/assets.native.js +1 -1
  89. package/lib/utils/hdnodeUtils.js +1 -2
  90. package/lib/utils/interactionTimeout.js +2 -2
  91. package/lib/utils/popupPromiseManager.js +2 -2
  92. package/lib/utils/proxy-event-emitter.js +1 -0
  93. package/lib/utils/uiPromiseManager.js +3 -4
  94. package/lib/utils/urlUtils.js +5 -8
  95. package/package.json +12 -12
  96. package/lib/utils/abortablePromise.d.ts +0 -5
  97. package/lib/utils/abortablePromise.js +0 -17
package/CHANGELOG.md CHANGED
@@ -1,19 +1,22 @@
1
1
  | Package | Stable | Canary |
2
2
  | :------------------------------: | :----: | :----------: |
3
- | npm @trezor/connect | 9.4.7 | 9.4.8-beta.1 |
4
- | npm @trezor/connect-web | 9.4.7 | 9.4.8-beta.1 |
5
- | npm @trezor/connect-webextension | 9.4.7 | 9.4.8-beta.1 |
3
+ | npm @trezor/connect | 9.4.7 | 9.5.0-beta.1 |
4
+ | npm @trezor/connect-web | 9.4.7 | 9.5.0-beta.1 |
5
+ | npm @trezor/connect-webextension | 9.4.7 | 9.5.0-beta.1 |
6
6
  | npm @trezor/connect-mobile | - | 0.0.1-beta.1 |
7
7
 
8
8
  | Deployment | Stable | Canary |
9
9
  | :----------------: | :----: | :----------: |
10
- | connect.trezor.io/ | 9.4.7 | 9.4.8-beta.1 |
10
+ | connect.trezor.io/ | 9.4.7 | 9.5.0-beta.1 |
11
11
 
12
12
  Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
13
13
 
14
- # 9.4.8-beta.1
14
+ # 9.5.0-beta.1
15
15
 
16
- Starting with this release we include esm builds in our npm packages.
16
+ Starting with this release we changed de target in all `@trezor` packages to ES2022. It might be problematic in some very old environment or if you use Typescript with lower than ES2022 you might have to add ES2022 lib to your tsconfig. We are also include esm builds in our npm packages. For now only in `@trezor/connect-plugin-stellar` and `@trezor/connect-plugin-ethereum`.
17
+
18
+ Another important change comes from 013f14a where we ping trezor-bridge and if it comes online connect would ditch webusb transport and start using bridge instead.
19
+ This should help potential inconsistent states of device communication.
17
20
 
18
21
  ## Feature
19
22
 
@@ -23,6 +26,10 @@ Starting with this release we include esm builds in our npm packages.
23
26
  - blockchain methods now have support for various L2 ETH networks (26ff8ea, 38614db)
24
27
  - solana and Token-2022 tokens (9abc7d9)
25
28
  - show h instead of apostrophe in taproot xpub to be consistent with firmware (82e7d84)
29
+ - remove Hash-Check from FW upgrade (it is performed on-device-connect anyway) (7413e2c)
30
+ - enable taproot in connect discovery in popup (b1ea07e)
31
+ - add fw binaries for 2.8.8 and 1.13.0 (6ef1768), firmware update will be offered
32
+ - feat(connect): upgrade to bridge when it starts (013f14a)
26
33
 
27
34
  ## Fixes
28
35
 
@@ -37,6 +44,26 @@ Starting with this release we include esm builds in our npm packages.
37
44
  - resetDevice typed error (8795800)
38
45
  - clear initial GetFeatures timeout (c0a9ecc)
39
46
  - ethereum decimal places (c40929b)
47
+ - fix(connect): gracefully handle offline FW revision check in react native (a969076)
48
+ - fix(connect-explorer): pass description for nested parameters (fc44b51)
49
+ - fix(connect): allow to: null in ethereumSignTransaction for contract deployment (1aa34bf)
50
+
51
+ ## Chores
52
+
53
+ - use target ES2022 from root tsconfig.lib (2b75843, 83b4e69, a0395a2, d52b30b)
54
+ - docs(connect-mobile): improve description of deeplinking protocol (aa1436e)
55
+ - chore(connect-common): update authenticity config (6ba9ead)
56
+ - unify timeout utils (fd9f509, dedff02, 4b57c17)
57
+ - chore: update solana and everstake deps (cf806ff)
58
+ - chore(connect-plugin-ethereum): update dep (91da7e7)
59
+ - chore(connect-plugin-stellar): update dep (daffb20)
60
+ - chore(suite): bump webpack (eab0cc7)
61
+ - chore(suite-desktop): bump electron-builder (306a3cf)
62
+ - chore(suite-desktop): bump electron (4641b02)
63
+ - npm-prerelease: @trezor/connect-common 0.3.0-beta.1 (e661c40)
64
+ - npm-prerelease: @trezor/connect-plugin-stellar 9.1.0-beta.1 (ec3e39f)
65
+ - npm-prerelease: @trezor/connect-plugin-ethereum 9.1.0-beta.1 (5513fee)
66
+ - chore(suite-native): update expo-linking (0e80d40)
40
67
 
41
68
  ## Chores
42
69
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.4.8-beta.1
3
+ API version 9.5.0-beta.1
4
4
 
5
5
  [![Build Status](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml/badge.svg)](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
6
6
  [![NPM](https://img.shields.io/npm/v/@trezor/connect.svg)](https://www.npmjs.org/package/@trezor/connect)
@@ -21,7 +21,7 @@ class AuthorizeCoinjoin extends AbstractMethod_1.AbstractMethod {
21
21
  max_coordinator_fee_rate: payload.maxCoordinatorFeeRate,
22
22
  max_fee_per_kvbyte: payload.maxFeePerKvbyte,
23
23
  address_n,
24
- coin_name: coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.name,
24
+ coin_name: coinInfo?.name,
25
25
  script_type,
26
26
  amount_unit: payload.amountUnit,
27
27
  };
@@ -10,10 +10,8 @@ const getAddress_1 = require("../../../types/api/getAddress");
10
10
  const pathUtils_1 = require("../../../utils/pathUtils");
11
11
  const paramsValidator_1 = require("../../common/paramsValidator");
12
12
  class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
13
- constructor() {
14
- super(...arguments);
15
- this.progress = 0;
16
- }
13
+ hasBundle;
14
+ progress = 0;
17
15
  init() {
18
16
  this.noBackupConfirmationMode = 'always';
19
17
  this.requiredPermissions = ['read'];
@@ -8,6 +8,7 @@ const types_1 = require("../../../types");
8
8
  const pathUtils_1 = require("../../../utils/pathUtils");
9
9
  const paramsValidator_1 = require("../../common/paramsValidator");
10
10
  class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
11
+ hasBundle;
11
12
  init() {
12
13
  this.requiredPermissions = ['read'];
13
14
  this.requiredDeviceCapabilities = ['Capability_Binance'];
@@ -10,7 +10,6 @@ const paramsValidator_1 = require("../../common/paramsValidator");
10
10
  const helper = tslib_1.__importStar(require("../binanceSignTx"));
11
11
  class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
12
12
  init() {
13
- var _a;
14
13
  this.requiredPermissions = ['read', 'write'];
15
14
  this.requiredDeviceCapabilities = ['Capability_Binance'];
16
15
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
@@ -21,7 +20,7 @@ class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
21
20
  this.params = {
22
21
  path,
23
22
  transaction,
24
- chunkify: (_a = payload.chunkify) !== null && _a !== void 0 ? _a : false,
23
+ chunkify: payload.chunkify ?? false,
25
24
  };
26
25
  }
27
26
  get info() {
@@ -47,8 +47,11 @@ const findBlocksForFee = (feePerUnit, blocks) => {
47
47
  return blocks.indexOf(lower);
48
48
  };
49
49
  class FeeLevels {
50
+ coinInfo;
51
+ levels;
52
+ longTermFeeRate;
53
+ blocks = [];
50
54
  constructor(coinInfo) {
51
- this.blocks = [];
52
55
  this.coinInfo = coinInfo;
53
56
  this.levels = coinInfo.defaultFees;
54
57
  }
@@ -5,9 +5,16 @@ const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
5
5
  const utxo_lib_1 = require("@trezor/utxo-lib");
6
6
  const Fees_1 = require("./Fees");
7
7
  class TransactionComposer {
8
+ account;
9
+ utxos;
10
+ outputs;
11
+ coinInfo;
12
+ blockHeight = 0;
13
+ baseFee;
14
+ sortingStrategy;
15
+ feeLevels;
16
+ composed = {};
8
17
  constructor(options) {
9
- this.blockHeight = 0;
10
- this.composed = {};
11
18
  this.account = options.account;
12
19
  this.outputs = options.outputs;
13
20
  this.coinInfo = options.coinInfo;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enhanceSignTx = void 0;
4
4
  const BlockchainLink_1 = require("../../backend/BlockchainLink");
5
5
  const enhanceSignTx = (options, coinInfo) => {
6
- var _a;
7
6
  if (coinInfo.shortcut === 'ZEC' || coinInfo.shortcut === 'TAZ') {
8
7
  if (typeof options.overwintered !== 'boolean') {
9
8
  options.overwintered = true;
@@ -16,7 +15,7 @@ const enhanceSignTx = (options, coinInfo) => {
16
15
  }
17
16
  if (typeof options.branch_id !== 'number') {
18
17
  const backend = (0, BlockchainLink_1.findBackend)(coinInfo.shortcut);
19
- if (backend && ((_a = backend.serverInfo) === null || _a === void 0 ? void 0 : _a.consensusBranchId)) {
18
+ if (backend && backend.serverInfo?.consensusBranchId) {
20
19
  options.branch_id = backend.serverInfo.consensusBranchId;
21
20
  }
22
21
  else {
@@ -8,7 +8,7 @@ const constants_1 = require("../../constants");
8
8
  const errors_1 = require("../../constants/errors");
9
9
  const pathUtils_1 = require("../../utils/pathUtils");
10
10
  const requireReferencedTransactions = (inputs, options = {}, coinInfo) => {
11
- if ((coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.shortcut) === 'ZEC' || (coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.shortcut) === 'TAZ') {
11
+ if (coinInfo?.shortcut === 'ZEC' || coinInfo?.shortcut === 'TAZ') {
12
12
  return !(options.version && options.version >= 5);
13
13
  }
14
14
  const inputTypes = ['SPENDTAPROOT', 'EXTERNAL'];
@@ -75,10 +75,9 @@ const parseOutputScript = (output, network) => {
75
75
  };
76
76
  const transformOrigTransaction = (tx, coinInfo, currentInputs, addresses) => {
77
77
  const inputsMap = (input, i) => {
78
- var _a;
79
78
  const prev_hash = utils_1.bufferUtils.reverseBuffer(input.hash).toString('hex');
80
79
  const currentInput = currentInputs.find(inp => inp.prev_hash === prev_hash && inp.prev_index === input.index);
81
- if (!(currentInput === null || currentInput === void 0 ? void 0 : currentInput.address_n)) {
80
+ if (!currentInput?.address_n) {
82
81
  throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid input at ${tx.getId()} [${i}]`);
83
82
  }
84
83
  return {
@@ -91,17 +90,16 @@ const transformOrigTransaction = (tx, coinInfo, currentInputs, addresses) => {
91
90
  multisig: undefined,
92
91
  amount: currentInput.amount,
93
92
  decred_tree: undefined,
94
- witness: (_a = tx.getWitness(i)) === null || _a === void 0 ? void 0 : _a.toString('hex'),
93
+ witness: tx.getWitness(i)?.toString('hex'),
95
94
  ownership_proof: undefined,
96
95
  commitment_data: undefined,
97
96
  };
98
97
  };
99
98
  const outputsMap = (output, i) => {
100
- var _a, _b;
101
99
  const parsed = parseOutputScript(output.script, coinInfo.network);
102
100
  switch (parsed.type) {
103
101
  case 'data': {
104
- const op_return_data = (_b = (_a = parsed.data) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.toString('hex');
102
+ const op_return_data = parsed.data?.shift()?.toString('hex');
105
103
  if (typeof op_return_data !== 'string') {
106
104
  throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid op_return_data at ${tx.getId()} [${i}]`);
107
105
  }
@@ -28,7 +28,7 @@ class BlockchainDisconnect extends AbstractMethod_1.AbstractMethod {
28
28
  }
29
29
  run() {
30
30
  const backend = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut, this.params.identity);
31
- backend === null || backend === void 0 ? void 0 : backend.disconnect();
31
+ backend?.disconnect();
32
32
  return Promise.resolve({ disconnected: true });
33
33
  }
34
34
  }
@@ -7,7 +7,6 @@ const BlockchainLink_1 = require("../backend/BlockchainLink");
7
7
  const coinInfo_1 = require("../data/coinInfo");
8
8
  class BlockchainSubscribe extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
- var _a;
11
10
  this.useDevice = false;
12
11
  this.useUi = false;
13
12
  const { payload } = this;
@@ -29,7 +28,7 @@ class BlockchainSubscribe extends AbstractMethod_1.AbstractMethod {
29
28
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
30
29
  this.params = {
31
30
  accounts: payload.accounts,
32
- blocks: (_a = payload.blocks) !== null && _a !== void 0 ? _a : true,
31
+ blocks: payload.blocks ?? true,
33
32
  coinInfo,
34
33
  identity: payload.identity,
35
34
  };
@@ -7,7 +7,6 @@ const BlockchainLink_1 = require("../backend/BlockchainLink");
7
7
  const coinInfo_1 = require("../data/coinInfo");
8
8
  class BlockchainUnsubscribe extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
- var _a;
11
10
  this.useDevice = false;
12
11
  this.useUi = false;
13
12
  const { payload } = this;
@@ -31,7 +30,7 @@ class BlockchainUnsubscribe extends AbstractMethod_1.AbstractMethod {
31
30
  accounts: payload.accounts,
32
31
  coinInfo,
33
32
  identity: payload.identity,
34
- blocks: (_a = payload.blocks) !== null && _a !== void 0 ? _a : false,
33
+ blocks: payload.blocks ?? false,
35
34
  };
36
35
  }
37
36
  async run() {
@@ -24,7 +24,7 @@ class CardanoComposeTransaction extends AbstractMethod_1.AbstractMethod {
24
24
  const txPlan = (0, cardanoUtils_1.composeTxPlan)(account.descriptor, account.utxo, outputs, certificates, withdrawals, changeAddress.address, !!testnet, { feeParams: feePerUnit ? { a: feePerUnit } : undefined });
25
25
  return {
26
26
  fee: txPlan.fee,
27
- feePerByte: feePerUnit !== null && feePerUnit !== void 0 ? feePerUnit : '0',
27
+ feePerByte: feePerUnit ?? '0',
28
28
  deposit: txPlan.deposit,
29
29
  totalSpent: txPlan.totalSpent,
30
30
  max: txPlan.max,
@@ -11,10 +11,8 @@ const pathUtils_1 = require("../../../utils/pathUtils");
11
11
  const paramsValidator_1 = require("../../common/paramsValidator");
12
12
  const cardanoAddressParameters_1 = require("../cardanoAddressParameters");
13
13
  class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
14
- constructor() {
15
- super(...arguments);
16
- this.progress = 0;
17
- }
14
+ hasBundle;
15
+ progress = 0;
18
16
  init() {
19
17
  this.noBackupConfirmationMode = 'always';
20
18
  this.requiredPermissions = ['read'];
@@ -10,6 +10,7 @@ const cardano_1 = require("../../../types/api/cardano");
10
10
  const pathUtils_1 = require("../../../utils/pathUtils");
11
11
  const paramsValidator_1 = require("../../common/paramsValidator");
12
12
  class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
13
+ hasBundle;
13
14
  init() {
14
15
  this.requiredPermissions = ['read'];
15
16
  this.requiredDeviceCapabilities = ['Capability_Cardano'];
@@ -45,7 +45,7 @@ const transformCvoteRegistrationParameters = (cVoteRegistrationParameters) => {
45
45
  : undefined,
46
46
  nonce: cVoteRegistrationParameters.nonce,
47
47
  format: cVoteRegistrationParameters.format,
48
- delegations: delegations === null || delegations === void 0 ? void 0 : delegations.map(transformDelegation),
48
+ delegations: delegations?.map(transformDelegation),
49
49
  voting_purpose: cVoteRegistrationParameters.votingPurpose,
50
50
  payment_address: cVoteRegistrationParameters.paymentAddress,
51
51
  };
@@ -64,7 +64,7 @@ const transformAuxiliaryData = (auxiliaryData) => {
64
64
  exports.transformAuxiliaryData = transformAuxiliaryData;
65
65
  const modifyAuxiliaryDataForBackwardsCompatibility = (auxiliary_data) => {
66
66
  const { cvote_registration_parameters } = auxiliary_data;
67
- if (cvote_registration_parameters === null || cvote_registration_parameters === void 0 ? void 0 : cvote_registration_parameters.payment_address_parameters) {
67
+ if (cvote_registration_parameters?.payment_address_parameters) {
68
68
  cvote_registration_parameters.payment_address_parameters =
69
69
  (0, cardanoAddressParameters_1.modifyAddressParametersForBackwardsCompatibility)(cvote_registration_parameters.payment_address_parameters);
70
70
  return {
@@ -6,7 +6,7 @@ const constants_1 = require("../../constants");
6
6
  const CARDANO_DEFAULT_TTL_OFFSET = 7200;
7
7
  const transformUtxos = (utxos) => {
8
8
  const result = [];
9
- utxos === null || utxos === void 0 ? void 0 : utxos.forEach(utxo => {
9
+ utxos?.forEach(utxo => {
10
10
  const foundItem = result.find(res => res.txHash === utxo.txid && res.outputIndex === utxo.vout);
11
11
  if (utxo.cardanoSpecific) {
12
12
  if (!foundItem) {
@@ -28,7 +28,6 @@ exports.transformUtxos = transformUtxos;
28
28
  const prepareCertificates = (certs) => {
29
29
  const convertedCerts = [];
30
30
  certs.forEach(cert => {
31
- var _a, _b, _c, _d;
32
31
  switch (cert.type) {
33
32
  case constants_1.PROTO.CardanoCertificateType.STAKE_DELEGATION:
34
33
  convertedCerts.push({
@@ -43,8 +42,8 @@ const prepareCertificates = (certs) => {
43
42
  });
44
43
  break;
45
44
  case constants_1.PROTO.CardanoCertificateType.VOTE_DELEGATION:
46
- if (((_a = cert.dRep) === null || _a === void 0 ? void 0 : _a.type) === constants_1.PROTO.CardanoDRepType.ABSTAIN ||
47
- ((_b = cert.dRep) === null || _b === void 0 ? void 0 : _b.type) === constants_1.PROTO.CardanoDRepType.NO_CONFIDENCE) {
45
+ if (cert.dRep?.type === constants_1.PROTO.CardanoDRepType.ABSTAIN ||
46
+ cert.dRep?.type === constants_1.PROTO.CardanoDRepType.NO_CONFIDENCE) {
48
47
  convertedCerts.push({
49
48
  type: cert.type,
50
49
  dRep: {
@@ -52,7 +51,7 @@ const prepareCertificates = (certs) => {
52
51
  },
53
52
  });
54
53
  }
55
- else if (((_c = cert.dRep) === null || _c === void 0 ? void 0 : _c.type) === constants_1.PROTO.CardanoDRepType.KEY_HASH) {
54
+ else if (cert.dRep?.type === constants_1.PROTO.CardanoDRepType.KEY_HASH) {
56
55
  convertedCerts.push({
57
56
  type: cert.type,
58
57
  dRep: {
@@ -61,7 +60,7 @@ const prepareCertificates = (certs) => {
61
60
  },
62
61
  });
63
62
  }
64
- else if (((_d = cert.dRep) === null || _d === void 0 ? void 0 : _d.type) === constants_1.PROTO.CardanoDRepType.SCRIPT_HASH) {
63
+ else if (cert.dRep?.type === constants_1.PROTO.CardanoDRepType.SCRIPT_HASH) {
65
64
  convertedCerts.push({
66
65
  type: cert.type,
67
66
  dRep: {
@@ -8,6 +8,7 @@ const cipherKeyValue_1 = require("../types/api/cipherKeyValue");
8
8
  const params_1 = require("../types/params");
9
9
  const pathUtils_1 = require("../utils/pathUtils");
10
10
  class CipherKeyValue extends AbstractMethod_1.AbstractMethod {
11
+ hasBundle;
11
12
  init() {
12
13
  this.requiredPermissions = ['read', 'write'];
13
14
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
@@ -7,9 +7,18 @@ const constants_1 = require("../../constants");
7
7
  const accountUtils_1 = require("../../utils/accountUtils");
8
8
  const formatUtils_1 = require("../../utils/formatUtils");
9
9
  class Discovery extends events_1.default {
10
+ types = [];
11
+ typeIndex;
12
+ accounts;
13
+ coinInfo;
14
+ blockchain;
15
+ commands;
16
+ index;
17
+ interrupted;
18
+ completed;
19
+ derivationType;
10
20
  constructor(options) {
11
21
  super();
12
- this.types = [];
13
22
  this.accounts = [];
14
23
  this.index = 0;
15
24
  this.typeIndex = 0;
@@ -28,6 +37,12 @@ class Discovery extends events_1.default {
28
37
  getPath: getDescriptor.bind(this, 84),
29
38
  });
30
39
  }
40
+ if (coinInfo.taproot) {
41
+ this.types.push({
42
+ type: 'p2tr',
43
+ getPath: getDescriptor.bind(this, 86),
44
+ });
45
+ }
31
46
  if (coinInfo.xPubMagicSegwit) {
32
47
  this.types.push({
33
48
  type: 'p2sh',
@@ -83,8 +83,8 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
83
83
  }
84
84
  });
85
85
  }
86
- const coinType = coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.type;
87
- const shortcut = coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.shortcut.toLowerCase();
86
+ const coinType = coinInfo?.type;
87
+ const shortcut = coinInfo?.shortcut.toLowerCase();
88
88
  const configRules = config_1.config.supportedFirmware
89
89
  .filter(rule => {
90
90
  if (rule.methods) {
@@ -15,6 +15,7 @@ const coinInfo_1 = require("../data/coinInfo");
15
15
  const formatUtils_1 = require("../utils/formatUtils");
16
16
  const pathUtils = tslib_1.__importStar(require("../utils/pathUtils"));
17
17
  class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
18
+ discovery;
18
19
  init() {
19
20
  this.requiredPermissions = ['read', 'write'];
20
21
  const { payload } = this;
@@ -66,8 +67,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
66
67
  }
67
68
  }
68
69
  get info() {
69
- var _a;
70
- const sendMax = ((_a = this.params) === null || _a === void 0 ? void 0 : _a.outputs.find(o => o.type === 'send-max')) !== undefined;
70
+ const sendMax = this.params?.outputs.find(o => o.type === 'send-max') !== undefined;
71
71
  if (sendMax) {
72
72
  return 'Send maximum amount';
73
73
  }
@@ -91,7 +91,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
91
91
  coinInfo,
92
92
  outputs,
93
93
  baseFee,
94
- sortingStrategy: sortingStrategy !== null && sortingStrategy !== void 0 ? sortingStrategy : utxo_1.DEFAULT_SORTING_STRATEGY,
94
+ sortingStrategy: sortingStrategy ?? utxo_1.DEFAULT_SORTING_STRATEGY,
95
95
  });
96
96
  const blockchain = await this.getBlockchain();
97
97
  await composer.init(blockchain);
@@ -179,7 +179,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
179
179
  discovery.removeAllListeners();
180
180
  discovery.stop();
181
181
  if (!discovery.completed) {
182
- await (0, resolveAfter_1.resolveAfter)(501).promise;
182
+ await (0, resolveAfter_1.resolveAfter)(501);
183
183
  }
184
184
  const account = discovery.accounts[uiResp.payload];
185
185
  this.params.coinInfo = (0, coinInfo_1.fixCoinInfoNetwork)(this.params.coinInfo, account.address_n);
@@ -197,13 +197,13 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
197
197
  utxos,
198
198
  coinInfo,
199
199
  outputs,
200
- sortingStrategy: skipPermutation === true ? 'none' : sortingStrategy !== null && sortingStrategy !== void 0 ? sortingStrategy : utxo_1.DEFAULT_SORTING_STRATEGY,
200
+ sortingStrategy: skipPermutation === true ? 'none' : sortingStrategy ?? utxo_1.DEFAULT_SORTING_STRATEGY,
201
201
  });
202
202
  await composer.init(blockchain);
203
203
  const hasFunds = composer.composeAllFeeLevels();
204
204
  if (!hasFunds) {
205
205
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.INSUFFICIENT_FUNDS));
206
- await (0, resolveAfter_1.resolveAfter)(2000, null).promise;
206
+ await (0, resolveAfter_1.resolveAfter)(2000);
207
207
  return 'change-account';
208
208
  }
209
209
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.SELECT_FEE, {
@@ -8,6 +8,7 @@ const types_1 = require("../../../types");
8
8
  const pathUtils_1 = require("../../../utils/pathUtils");
9
9
  const paramsValidator_1 = require("../../common/paramsValidator");
10
10
  class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
11
+ hasBundle;
11
12
  init() {
12
13
  this.requiredPermissions = ['read'];
13
14
  this.requiredDeviceCapabilities = ['Capability_EOS'];
@@ -13,10 +13,8 @@ const pathUtils_1 = require("../../../utils/pathUtils");
13
13
  const paramsValidator_1 = require("../../common/paramsValidator");
14
14
  const ethereumDefinitions_1 = require("../ethereumDefinitions");
15
15
  class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
16
- constructor() {
17
- super(...arguments);
18
- this.progress = 0;
19
- }
16
+ hasBundle;
17
+ progress = 0;
20
18
  init() {
21
19
  this.noBackupConfirmationMode = 'always';
22
20
  this.requiredPermissions = ['read'];
@@ -9,6 +9,7 @@ const ethereumUtils_1 = require("../../../utils/ethereumUtils");
9
9
  const pathUtils_1 = require("../../../utils/pathUtils");
10
10
  const paramsValidator_1 = require("../../common/paramsValidator");
11
11
  class EthereumGetPublicKey extends AbstractMethod_1.AbstractMethod {
12
+ hasBundle;
12
13
  init() {
13
14
  this.requiredPermissions = ['read'];
14
15
  this.requiredDeviceCapabilities = ['Capability_Ethereum'];
@@ -39,11 +39,10 @@ class EthereumSignMessage extends AbstractMethod_1.AbstractMethod {
39
39
  return (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK message', (0, coinInfo_1.getEthereumNetwork)(this.params.address_n));
40
40
  }
41
41
  async run() {
42
- var _a;
43
42
  const cmd = this.device.getCommands();
44
43
  const { address_n, message } = this.params;
45
44
  const response = await cmd.typedCall('EthereumSignMessage', 'EthereumMessageSignature', {
46
- encoded_network: (_a = this.params.definitions) === null || _a === void 0 ? void 0 : _a.encoded_network,
45
+ encoded_network: this.params.definitions?.encoded_network,
47
46
  address_n,
48
47
  message,
49
48
  });
@@ -48,7 +48,7 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
48
48
  const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
49
49
  chainId: this.params.tx.chainId,
50
50
  slip44,
51
- contractAddress: this.params.tx.data ? this.params.tx.to : undefined,
51
+ contractAddress: this.params.tx.data && this.params.tx.to != null ? this.params.tx.to : undefined,
52
52
  });
53
53
  this.params.definitions = definitions;
54
54
  const decoded = (0, ethereumDefinitions_1.decodeEthereumDefinition)(definitions);
@@ -86,7 +86,7 @@ class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
86
86
  address_n,
87
87
  domain_separator_hash,
88
88
  message_hash,
89
- encoded_network: definitions === null || definitions === void 0 ? void 0 : definitions.encoded_network,
89
+ encoded_network: definitions?.encoded_network,
90
90
  });
91
91
  const { address, signature } = response.message;
92
92
  return {
@@ -14,7 +14,7 @@ const getEthereumDefinitions = async ({ chainId, slip44, contractAddress, }) =>
14
14
  throw new Error('argument chainId or slip44 is required');
15
15
  }
16
16
  try {
17
- const networkDefinitionUrl = `https://data.trezor.io/firmware/eth-definitions/${chainId ? 'chain-id' : 'slip44'}/${chainId !== null && chainId !== void 0 ? chainId : slip44}/network.dat`;
17
+ const networkDefinitionUrl = `https://data.trezor.io/firmware/eth-definitions/${chainId ? 'chain-id' : 'slip44'}/${chainId ?? slip44}/network.dat`;
18
18
  const networkDefinition = await (0, cross_fetch_1.default)(networkDefinitionUrl);
19
19
  if (networkDefinition.status === 200) {
20
20
  definitions.encoded_network = await networkDefinition.arrayBuffer();
@@ -29,7 +29,7 @@ const getEthereumDefinitions = async ({ chainId, slip44, contractAddress, }) =>
29
29
  try {
30
30
  if (contractAddress) {
31
31
  const lowerCaseContractAddress = contractAddress.toLowerCase();
32
- const tokenDefinitionUrl = `https://data.trezor.io/firmware/eth-definitions/${chainId ? 'chain-id' : 'slip44'}/${chainId !== null && chainId !== void 0 ? chainId : slip44}/token-${lowerCaseContractAddress}.dat`;
32
+ const tokenDefinitionUrl = `https://data.trezor.io/firmware/eth-definitions/${chainId ? 'chain-id' : 'slip44'}/${chainId ?? slip44}/token-${lowerCaseContractAddress}.dat`;
33
33
  const tokenDefinition = await (0, cross_fetch_1.default)(tokenDefinitionUrl);
34
34
  if (tokenDefinition.status === 200) {
35
35
  definitions.encoded_token = await tokenDefinition.arrayBuffer();
@@ -8,12 +8,12 @@ export declare const serializeEthereumTx: (tx: EthereumTransactionEIP1559 | Ethe
8
8
  r: `0x${string}`;
9
9
  s: `0x${string}`;
10
10
  }, isLegacy: boolean) => string;
11
- export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, tx_type?: number, definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
11
+ export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, tx_type?: number, definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
12
12
  v: `0x${string}`;
13
13
  r: `0x${string}`;
14
14
  s: `0x${string}`;
15
15
  }>;
16
- export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, access_list?: EthereumAccessList[], definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
16
+ export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, access_list?: EthereumAccessList[], definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
17
17
  v: `0x${string}`;
18
18
  r: `0x${string}`;
19
19
  s: `0x${string}`;
@@ -47,6 +47,7 @@ const serializeEthereumTx = (tx, signature, isLegacy) => {
47
47
  const txData = deepHexPrefix({
48
48
  ...tx,
49
49
  ...signature,
50
+ to: tx.to || undefined,
50
51
  type: isLegacy ? 0 : 2,
51
52
  ...(isLegacy
52
53
  ? {
@@ -82,7 +83,7 @@ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_pr
82
83
  nonce: stripLeadingZeroes(nonce),
83
84
  gas_price: stripLeadingZeroes(gas_price),
84
85
  gas_limit: stripLeadingZeroes(gas_limit),
85
- to,
86
+ to: to || undefined,
86
87
  value: stripLeadingZeroes(value),
87
88
  definitions,
88
89
  chunkify,
@@ -113,7 +114,7 @@ const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit,
113
114
  max_gas_fee: stripLeadingZeroes(max_gas_fee),
114
115
  max_priority_fee: stripLeadingZeroes(max_priority_fee),
115
116
  gas_limit: stripLeadingZeroes(gas_limit),
116
- to,
117
+ to: to || undefined,
117
118
  value: stripLeadingZeroes(value),
118
119
  data_length: length,
119
120
  data_initial_chunk: first,
@@ -64,12 +64,12 @@ const verifyAuthenticityProof = async ({ certificates, signature, challenge, con
64
64
  });
65
65
  const caPubKey = Buffer.from(caCert.tbsCertificate.subjectPublicKeyInfo.bits.bytes).toString('hex');
66
66
  const rootPubKeys = allowDebugKeys
67
- ? modelConfig.rootPubKeys.concat((debug === null || debug === void 0 ? void 0 : debug.rootPubKeys) || [])
67
+ ? modelConfig.rootPubKeys.concat(debug?.rootPubKeys || [])
68
68
  : modelConfig.rootPubKeys;
69
69
  const isCertSignedByRootPubkey = await Promise.all(rootPubKeys.map(rootPubKey => verifySignature(Buffer.from(rootPubKey, 'hex'), caCert.tbsCertificate.asn1.raw, caCert.signatureValue.bits.bytes)));
70
70
  const rootPubKeyIndex = isCertSignedByRootPubkey.findIndex(valid => !!valid);
71
71
  const rootPubKey = rootPubKeys[rootPubKeyIndex];
72
- const isDebugRootPubKey = debug === null || debug === void 0 ? void 0 : debug.rootPubKeys.includes(rootPubKey);
72
+ const isDebugRootPubKey = debug?.rootPubKeys.includes(rootPubKey);
73
73
  const caCertValidityFrom = caCert.tbsCertificate.validity.from.getTime();
74
74
  if (caCertValidityFrom > new Date().getTime()) {
75
75
  throw new Error(`CA validity from ${caCertValidityFrom} cant't be in the future!`);
@@ -106,7 +106,7 @@ const verifyAuthenticityProof = async ({ certificates, signature, challenge, con
106
106
  const isSignatureValid = await verifySignature(Buffer.from(deviceCert.tbsCertificate.subjectPublicKeyInfo.bits.bytes), prefixedChallenge, (0, x509certificate_1.fixSignature)(Buffer.from(signature, 'hex')));
107
107
  if (rootPubKey && isDeviceCertValid && isSignatureValid) {
108
108
  if ((!isDebugRootPubKey && !caPubKeys.includes(caPubKey)) ||
109
- (isDebugRootPubKey && !(debug === null || debug === void 0 ? void 0 : debug.caPubKeys.includes(caPubKey)))) {
109
+ (isDebugRootPubKey && !debug?.caPubKeys.includes(caPubKey))) {
110
110
  const configExpired = new Date(config.timestamp).getTime() < caCertValidityFrom;
111
111
  return {
112
112
  valid: false,