@trezor/connect 9.0.2 → 9.0.3

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 (53) hide show
  1. package/README.md +5 -5
  2. package/lib/api/bitcoin/TransactionComposer.js +2 -1
  3. package/lib/api/bitcoin/outputs.js +2 -4
  4. package/lib/api/bitcoin/signtxVerify.d.ts +3 -3
  5. package/lib/api/bitcoin/signtxVerify.js +16 -15
  6. package/lib/api/getAddress.d.ts +2 -1
  7. package/lib/api/getAddress.js +12 -1
  8. package/lib/api/getPublicKey.d.ts +1 -0
  9. package/lib/api/getPublicKey.js +22 -7
  10. package/lib/api/index.d.ts +1 -0
  11. package/lib/api/index.js +3 -1
  12. package/lib/api/signTransaction.d.ts +1 -0
  13. package/lib/api/signTransaction.js +14 -2
  14. package/lib/api/unlockPath.d.ts +10 -0
  15. package/lib/api/unlockPath.js +35 -0
  16. package/lib/core/index.d.ts +1 -1
  17. package/lib/core/method.d.ts +1 -1
  18. package/lib/data/config.js +1 -1
  19. package/lib/data/version.d.ts +1 -1
  20. package/lib/data/version.js +1 -1
  21. package/lib/device/DeviceCommands.d.ts +7 -2
  22. package/lib/device/DeviceCommands.js +37 -25
  23. package/lib/factory.js +1 -0
  24. package/lib/types/api/bitcoin/index.d.ts +1 -0
  25. package/lib/types/api/cardano/index.d.ts +3 -7
  26. package/lib/types/api/eos/index.d.ts +0 -4
  27. package/lib/types/api/eosGetPublicKey.d.ts +4 -4
  28. package/lib/types/api/getAddress.d.ts +1 -0
  29. package/lib/types/api/getPublicKey.d.ts +5 -0
  30. package/lib/types/api/index.d.ts +2 -0
  31. package/lib/types/api/unlockPath.d.ts +8 -0
  32. package/lib/types/api/unlockPath.js +3 -0
  33. package/lib/utils/pathUtils.d.ts +2 -3
  34. package/lib/utils/pathUtils.js +42 -15
  35. package/package.json +12 -2
  36. package/lib/api/bitcoin/__fixtures__/inputs.d.ts +0 -112
  37. package/lib/api/bitcoin/__fixtures__/inputs.js +0 -102
  38. package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +0 -147
  39. package/lib/api/bitcoin/__fixtures__/signtxVerify.js +0 -216
  40. package/lib/api/common/__fixtures__/paramsValidator.d.ts +0 -596
  41. package/lib/api/common/__fixtures__/paramsValidator.js +0 -355
  42. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +0 -225
  43. package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +0 -341
  44. package/lib/utils/__fixtures__/accountUtils.d.ts +0 -4
  45. package/lib/utils/__fixtures__/accountUtils.js +0 -32
  46. package/lib/utils/__fixtures__/addressUtils.d.ts +0 -10
  47. package/lib/utils/__fixtures__/addressUtils.js +0 -214
  48. package/lib/utils/__fixtures__/ethereumUtils.d.ts +0 -3
  49. package/lib/utils/__fixtures__/ethereumUtils.js +0 -20
  50. package/lib/utils/__fixtures__/formatUtils.d.ts +0 -3
  51. package/lib/utils/__fixtures__/formatUtils.js +0 -15
  52. package/lib/utils/__fixtures__/hdnodeUtils.d.ts +0 -186
  53. package/lib/utils/__fixtures__/hdnodeUtils.js +0 -206
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.0.2
3
+ API version 9.0.3
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)
@@ -8,7 +8,7 @@ API version 9.0.2
8
8
 
9
9
  Trezor Connect is a platform for easy integration of Trezor into 3rd party services, as well as into Trezor Suite. It provides an API with functionality to access public keys, sign transactions and authenticate users.
10
10
 
11
- This package is intended to be used in node.js environment. If you wan't to build a web application please refer to [@trezor/connect-web package](../connect-web/README.md).
11
+ This package is intended to be used in node.js environment. If you wan't to build a web application please refer to [@trezor/connect-web package](https://github.com/trezor/trezor-suite/blob/develop/packages/connect-web/README.md).
12
12
 
13
13
  ## Installation
14
14
 
@@ -32,7 +32,7 @@ ES6
32
32
  import TrezorConnect from '@trezor/connect';
33
33
  ```
34
34
 
35
- For more instructions [refer to this document](../../docs/packages/connect/index.md)
35
+ For more instructions [refer to this document](https://github.com/trezor/trezor-suite/blob/develop/docs/packages/connect/index.md)
36
36
 
37
37
  ## Version 9 (stable)
38
38
 
@@ -61,11 +61,11 @@ For deployment process of trezor-connect v8 refer to [trezor/connect repository]
61
61
 
62
62
  Interactive API explorer is available on https://connect.trezor.io/9/#/
63
63
 
64
- Documentation is available [docs/packages/connect](../../docs/packages/connect/index.md)
64
+ Documentation is available [docs/packages/connect](https://github.com/trezor/trezor-suite/blob/develop/docs/packages/connect/index.md)
65
65
 
66
66
  ## Examples
67
67
 
68
- A collection of examples on how to implement @trezor/connect in various environments is available in [packages/connect-examples](../connect-examples/README.md)
68
+ A collection of examples on how to implement @trezor/connect in various environments is available in [packages/connect-examples](https://github.com/trezor/trezor-suite/tree/develop/packages/connect-examples)
69
69
 
70
70
  ## Tests
71
71
 
@@ -28,11 +28,12 @@ class TransactionComposer {
28
28
  if (!u.required && new bignumber_js_1.default(u.amount).lte(this.coinInfo.dustLimit))
29
29
  return [];
30
30
  const addressPath = (0, pathUtils_1.getHDPath)(u.path);
31
+ const [chain, index] = addressPath.slice(addressPath.length - 2);
31
32
  return {
32
33
  index: u.vout,
33
34
  transactionHash: u.txid,
34
35
  value: u.amount,
35
- addressPath: [addressPath[3], addressPath[4]],
36
+ addressPath: [chain, index],
36
37
  height: u.blockHeight,
37
38
  tsize: 0,
38
39
  vsize: 0,
@@ -22,10 +22,8 @@ const validateTrezorOutputs = (outputs, coinInfo) => {
22
22
  Object.prototype.hasOwnProperty.call(output, 'address')) {
23
23
  throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Cannot use address and address_n in one output');
24
24
  }
25
- if (output.address_n) {
26
- const scriptType = (0, pathUtils_1.getOutputScriptType)(output.address_n);
27
- if (output.script_type !== scriptType)
28
- throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Output change script_type should be set to ${scriptType}`);
25
+ if (output.address_n && !output.script_type) {
26
+ output.script_type = (0, pathUtils_1.getOutputScriptType)(output.address_n);
29
27
  }
30
28
  if ('address' in output &&
31
29
  typeof output.address === 'string' &&
@@ -1,8 +1,8 @@
1
1
  import { PROTO } from '../../constants';
2
2
  import type { BitcoinNetworkInfo } from '../../types';
3
- import type { HDNodeResponse } from '../../types/api/getPublicKey';
4
- declare type GetHDNode = (path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean) => Promise<HDNodeResponse>;
5
- export declare const verifyTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo) => 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>>;
3
+ import type { DeviceCommands } from '../../device/DeviceCommands';
4
+ declare type GetHDNode = DeviceCommands['getHDNode'];
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 {};
8
8
  //# sourceMappingURL=signtxVerify.d.ts.map
@@ -3,17 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verifyTicketTx = exports.verifyTx = void 0;
4
4
  const utxo_lib_1 = require("@trezor/utxo-lib");
5
5
  const constants_1 = require("../../constants");
6
- const pathUtils_1 = require("../../utils/pathUtils");
7
- const derivePubKeyHash = async (address_n, getHDNode, coinInfo) => {
6
+ const derivePubKeyHash = async (address_n, getHDNode, coinInfo, unlockPath) => {
8
7
  if (address_n.length === 5) {
9
- const response = await getHDNode(address_n.slice(0, 4), coinInfo);
8
+ const response = await getHDNode({ address_n: address_n.slice(0, 4) }, { coinInfo, unlockPath });
10
9
  const node = utxo_lib_1.bip32.fromBase58(response.xpub, coinInfo.network);
11
10
  return node.derive(address_n[address_n.length - 1]);
12
11
  }
13
- const response = await getHDNode(address_n, coinInfo);
12
+ const response = await getHDNode({ address_n }, { coinInfo, unlockPath });
14
13
  return utxo_lib_1.bip32.fromBase58(response.xpub, coinInfo.network);
15
14
  };
16
- const deriveOutputScript = async (getHDNode, output, coinInfo) => {
15
+ const deriveOutputScript = async (getHDNode, output, coinInfo, unlockPath) => {
17
16
  if ('multisig' in output)
18
17
  return;
19
18
  if ('op_return_data' in output) {
@@ -26,32 +25,34 @@ const deriveOutputScript = async (getHDNode, output, coinInfo) => {
26
25
  if (!output.address_n) {
27
26
  throw constants_1.ERRORS.TypedError('Runtime', 'deriveOutputScript: Neither address or address_n is set');
28
27
  }
29
- const scriptType = (0, pathUtils_1.getOutputScriptType)(output.address_n);
30
- const node = await derivePubKeyHash(output.address_n, getHDNode, coinInfo);
28
+ const node = await derivePubKeyHash(output.address_n, getHDNode, coinInfo, unlockPath);
31
29
  const payment = { hash: node.identifier, network: coinInfo.network };
32
- if (scriptType === 'PAYTOADDRESS') {
30
+ if (output.script_type === 'PAYTOADDRESS') {
33
31
  return utxo_lib_1.payments.p2pkh(payment).output;
34
32
  }
35
- if (scriptType === 'PAYTOSCRIPTHASH') {
33
+ if (output.script_type === 'PAYTOSCRIPTHASH') {
36
34
  return utxo_lib_1.payments.p2sh(payment).output;
37
35
  }
38
- if (scriptType === 'PAYTOP2SHWITNESS') {
36
+ if (output.script_type === 'PAYTOP2SHWITNESS') {
39
37
  return utxo_lib_1.payments.p2sh({
40
38
  redeem: utxo_lib_1.payments.p2wpkh(payment),
41
39
  }).output;
42
40
  }
43
- if (scriptType === 'PAYTOWITNESS') {
41
+ if (output.script_type === 'PAYTOWITNESS') {
44
42
  return utxo_lib_1.payments.p2wpkh(payment).output;
45
43
  }
46
- if (scriptType === 'PAYTOTAPROOT') {
44
+ if (output.script_type === 'PAYTOTAPROOT') {
47
45
  return utxo_lib_1.payments.p2tr({
48
46
  pubkey: node.publicKey,
49
47
  network: coinInfo.network,
50
48
  }).output;
51
49
  }
52
- throw constants_1.ERRORS.TypedError('Runtime', `deriveOutputScript: Unknown script type ${scriptType}`);
50
+ if (output.script_type === 'PAYTOMULTISIG') {
51
+ throw constants_1.ERRORS.TypedError('Runtime', `deriveOutputScript: script_type PAYTOMULTISIG not expected without multisig defined`);
52
+ }
53
+ throw constants_1.ERRORS.TypedError('Runtime', `deriveOutputScript: Unknown script type ${output.script_type}`);
53
54
  };
54
- const verifyTx = async (getHDNode, inputs, outputs, serializedTx, coinInfo) => {
55
+ const verifyTx = async (getHDNode, inputs, outputs, serializedTx, coinInfo, unlockPath) => {
55
56
  const bitcoinTx = utxo_lib_1.Transaction.fromHex(serializedTx, { network: coinInfo.network });
56
57
  if (inputs.length !== bitcoinTx.ins.length) {
57
58
  throw constants_1.ERRORS.TypedError('Runtime', 'verifyTx: Signed transaction inputs invalid length');
@@ -67,7 +68,7 @@ const verifyTx = async (getHDNode, inputs, outputs, serializedTx, coinInfo) => {
67
68
  throw constants_1.ERRORS.TypedError('Runtime', `verifyTx: Wrong output amount at output ${i}. Requested: ${amount}, signed: ${bitcoinTx.outs[i].value}`);
68
69
  }
69
70
  }
70
- const scriptA = await deriveOutputScript(getHDNode, outputs[i], coinInfo);
71
+ const scriptA = await deriveOutputScript(getHDNode, outputs[i], coinInfo, unlockPath);
71
72
  if (scriptA && scriptA.compare(scriptB) !== 0) {
72
73
  throw constants_1.ERRORS.TypedError('Runtime', `verifyTx: Output ${i} scripts differ`);
73
74
  }
@@ -4,6 +4,7 @@ import type { BitcoinNetworkInfo } from '../types';
4
4
  declare type Params = PROTO.GetAddress & {
5
5
  address?: string;
6
6
  coinInfo: BitcoinNetworkInfo;
7
+ unlockPath?: PROTO.UnlockPath;
7
8
  };
8
9
  export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
9
10
  hasBundle?: boolean;
@@ -17,7 +18,7 @@ export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
17
18
  } | undefined;
18
19
  confirmation(): Promise<boolean>;
19
20
  noBackupConfirmation(): Promise<boolean>;
20
- _call({ address_n, show_display, multisig, script_type, coinInfo }: Params): Promise<{
21
+ _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath }: Params): Promise<{
21
22
  path: number[];
22
23
  serializedPath: string;
23
24
  address: string;
@@ -29,7 +29,14 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
29
29
  { name: 'showOnTrezor', type: 'boolean' },
30
30
  { name: 'multisig', type: 'object' },
31
31
  { name: 'scriptType', type: 'string' },
32
+ { name: 'unlockPath', type: 'object' },
32
33
  ]);
34
+ if (batch.unlockPath) {
35
+ (0, paramsValidator_1.validateParams)(batch.unlockPath, [
36
+ { name: 'address_n', required: true, type: 'array' },
37
+ { name: 'mac', required: true, type: 'string' },
38
+ ]);
39
+ }
33
40
  const path = (0, pathUtils_1.validatePath)(batch.path, 1);
34
41
  let coinInfo;
35
42
  if (batch.coin) {
@@ -55,6 +62,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
55
62
  multisig: batch.multisig,
56
63
  script_type: batch.scriptType,
57
64
  coinInfo,
65
+ unlockPath: batch.unlockPath,
58
66
  };
59
67
  });
60
68
  const useEventListener = payload.useEventListener &&
@@ -108,8 +116,11 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
108
116
  const uiResp = await uiPromise.promise;
109
117
  return uiResp.payload;
110
118
  }
111
- _call({ address_n, show_display, multisig, script_type, coinInfo }) {
119
+ async _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath }) {
112
120
  const cmd = this.device.getCommands();
121
+ if (unlockPath) {
122
+ await cmd.unlockPath(unlockPath);
123
+ }
113
124
  return cmd.getAddress({
114
125
  address_n,
115
126
  show_display,
@@ -3,6 +3,7 @@ import type { BitcoinNetworkInfo } from '../types';
3
3
  import type { PROTO } from '../constants';
4
4
  declare type Params = PROTO.GetPublicKey & {
5
5
  coinInfo?: BitcoinNetworkInfo;
6
+ unlockPath?: PROTO.UnlockPath;
6
7
  };
7
8
  export default class GetPublicKey extends AbstractMethod<'getPublicKey', Params[]> {
8
9
  hasBundle?: boolean;
@@ -21,25 +21,40 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
21
21
  { name: 'coin', type: 'string' },
22
22
  { name: 'crossChain', type: 'boolean' },
23
23
  { name: 'showOnTrezor', type: 'boolean' },
24
+ { name: 'scriptType', type: ['string', 'number'] },
25
+ { name: 'ignoreXpubMagic', type: 'boolean' },
26
+ { name: 'ecdsaCurveName', type: 'boolean' },
27
+ { name: 'unlockPath', type: 'object' },
24
28
  ]);
29
+ if (batch.unlockPath) {
30
+ (0, paramsValidator_1.validateParams)(batch.unlockPath, [
31
+ { name: 'address_n', required: true, type: 'array' },
32
+ { name: 'mac', required: true, type: 'string' },
33
+ ]);
34
+ }
25
35
  let coinInfo;
26
36
  if (batch.coin) {
27
37
  coinInfo = (0, coinInfo_1.getBitcoinNetwork)(batch.coin);
28
38
  }
29
- const path = (0, pathUtils_1.validatePath)(batch.path, coinInfo ? 3 : 0);
39
+ const address_n = (0, pathUtils_1.validatePath)(batch.path, coinInfo ? 3 : 0);
30
40
  if (coinInfo && !batch.crossChain) {
31
- (0, paramsValidator_1.validateCoinPath)(path, coinInfo);
41
+ (0, paramsValidator_1.validateCoinPath)(address_n, coinInfo);
32
42
  }
33
43
  else if (!coinInfo) {
34
- coinInfo = (0, coinInfo_1.getBitcoinNetwork)(path);
44
+ coinInfo = (0, coinInfo_1.getBitcoinNetwork)(address_n);
35
45
  }
36
46
  if (coinInfo) {
37
47
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
38
48
  }
39
49
  return {
40
- address_n: path,
50
+ address_n,
51
+ coin_name: coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.name,
52
+ show_display: batch.showOnTrezor,
53
+ script_type: batch.scriptType,
54
+ ignore_xpub_magic: batch.ignoreXpubMagic,
55
+ ecdsa_curve_name: batch.ecdsaCurveName,
41
56
  coinInfo,
42
- show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : false,
57
+ unlockPath: batch.unlockPath,
43
58
  };
44
59
  });
45
60
  }
@@ -67,8 +82,8 @@ class GetPublicKey extends AbstractMethod_1.AbstractMethod {
67
82
  const responses = [];
68
83
  const cmd = this.device.getCommands();
69
84
  for (let i = 0; i < this.params.length; i++) {
70
- const batch = this.params[i];
71
- const response = await cmd.getHDNode(batch.address_n, batch.coinInfo, true, batch.show_display);
85
+ const { coinInfo, unlockPath, ...batch } = this.params[i];
86
+ const response = await cmd.getHDNode(batch, { coinInfo, unlockPath });
72
87
  responses.push(response);
73
88
  if (this.hasBundle) {
74
89
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
@@ -59,6 +59,7 @@ export { default as stellarSignTransaction } from './stellarSignTransaction';
59
59
  export { default as tezosGetAddress } from './tezosGetAddress';
60
60
  export { default as tezosGetPublicKey } from './tezosGetPublicKey';
61
61
  export { default as tezosSignTransaction } from './tezosSignTransaction';
62
+ export { default as unlockPath } from './unlockPath';
62
63
  export { default as verifyMessage } from './verifyMessage';
63
64
  export { default as wipeDevice } from './wipeDevice';
64
65
  export { default as checkFirmwareAuthenticity } from './checkFirmwareAuthenticity';
package/lib/api/index.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.authorizeCoinJoin = exports.applySettings = exports.applyFlags = void 0;
7
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = void 0;
7
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = void 0;
8
8
  var applyFlags_1 = require("./applyFlags");
9
9
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
10
10
  var applySettings_1 = require("./applySettings");
@@ -127,6 +127,8 @@ var tezosGetPublicKey_1 = require("./tezosGetPublicKey");
127
127
  Object.defineProperty(exports, "tezosGetPublicKey", { enumerable: true, get: function () { return __importDefault(tezosGetPublicKey_1).default; } });
128
128
  var tezosSignTransaction_1 = require("./tezosSignTransaction");
129
129
  Object.defineProperty(exports, "tezosSignTransaction", { enumerable: true, get: function () { return __importDefault(tezosSignTransaction_1).default; } });
130
+ var unlockPath_1 = require("./unlockPath");
131
+ Object.defineProperty(exports, "unlockPath", { enumerable: true, get: function () { return __importDefault(unlockPath_1).default; } });
130
132
  var verifyMessage_1 = require("./verifyMessage");
131
133
  Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return __importDefault(verifyMessage_1).default; } });
132
134
  var wipeDevice_1 = require("./wipeDevice");
@@ -12,6 +12,7 @@ declare type Params = {
12
12
  coinInfo: BitcoinNetworkInfo;
13
13
  push: boolean;
14
14
  preauthorized?: boolean;
15
+ unlockPath?: PROTO.UnlockPath;
15
16
  };
16
17
  export default class SignTransaction extends AbstractMethod<'signTransaction', Params> {
17
18
  init(): void;
@@ -32,7 +32,14 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
32
32
  { name: 'push', type: 'boolean' },
33
33
  { name: 'preauthorized', type: 'boolean' },
34
34
  { name: 'amountUnit', type: ['number', 'string'] },
35
+ { name: 'unlockPath', type: 'object' },
35
36
  ]);
37
+ if (payload.unlockPath) {
38
+ (0, paramsValidator_1.validateParams)(payload.unlockPath, [
39
+ { name: 'address_n', required: true, type: 'array' },
40
+ { name: 'mac', required: true, type: 'string' },
41
+ ]);
42
+ }
36
43
  const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(payload.coin);
37
44
  if (!coinInfo) {
38
45
  throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
@@ -70,6 +77,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
70
77
  coinInfo,
71
78
  push: typeof payload.push === 'boolean' ? payload.push : false,
72
79
  preauthorized: payload.preauthorized,
80
+ unlockPath: payload.unlockPath,
73
81
  };
74
82
  this.params.options = (0, bitcoin_1.enhanceSignTx)(this.params.options, coinInfo);
75
83
  }
@@ -95,9 +103,10 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
95
103
  if (!accountPath || !accountPath.address_n) {
96
104
  throw constants_1.ERRORS.TypedError('Runtime', 'Account not found');
97
105
  }
106
+ const address_n = accountPath.address_n.slice(0, 3);
98
107
  const node = await device
99
108
  .getCommands()
100
- .getHDNode(accountPath.address_n.slice(0, 3), params.coinInfo);
109
+ .getHDNode({ address_n }, { coinInfo: params.coinInfo });
101
110
  const account = await blockchain.getAccountInfo({
102
111
  descriptor: node.xpubSegwit || node.xpub,
103
112
  details: 'tokens',
@@ -115,6 +124,9 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
115
124
  if (params.preauthorized) {
116
125
  await device.getCommands().typedCall('DoPreauthorized', 'PreauthorizedRequest', {});
117
126
  }
127
+ else if (params.unlockPath) {
128
+ await device.getCommands().unlockPath(params.unlockPath);
129
+ }
118
130
  const signTxMethod = !useLegacySignProcess ? bitcoin_1.signTx : bitcoin_1.signTxLegacy;
119
131
  const response = await signTxMethod({
120
132
  ...params,
@@ -125,7 +137,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
125
137
  await (0, bitcoin_1.verifyTicketTx)(device.getCommands().getHDNode.bind(device.getCommands()), params.inputs, params.outputs, response.serializedTx, params.coinInfo);
126
138
  }
127
139
  else {
128
- const bitcoinTx = await (0, bitcoin_1.verifyTx)(device.getCommands().getHDNode.bind(device.getCommands()), params.inputs, params.outputs, response.serializedTx, params.coinInfo);
140
+ const bitcoinTx = await (0, bitcoin_1.verifyTx)(device.getCommands().getHDNode.bind(device.getCommands()), params.inputs, params.outputs, response.serializedTx, params.coinInfo, params.unlockPath);
129
141
  if (bitcoinTx.hasWitnesses()) {
130
142
  response.witnesses = bitcoinTx.ins.map((_, i) => { var _a; return (_a = bitcoinTx.getWitness(i)) === null || _a === void 0 ? void 0 : _a.toString('hex'); });
131
143
  }
@@ -0,0 +1,10 @@
1
+ import { AbstractMethod } from '../core/AbstractMethod';
2
+ import { PROTO } from '../constants';
3
+ export default class UnlockPath extends AbstractMethod<'unlockPath', PROTO.UnlockPath> {
4
+ init(): void;
5
+ run(): Promise<{
6
+ address_n: number[];
7
+ mac: string | undefined;
8
+ }>;
9
+ }
10
+ //# sourceMappingURL=unlockPath.d.ts.map
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AbstractMethod_1 = require("../core/AbstractMethod");
4
+ const pathUtils_1 = require("../utils/pathUtils");
5
+ const paramsValidator_1 = require("./common/paramsValidator");
6
+ class UnlockPath extends AbstractMethod_1.AbstractMethod {
7
+ init() {
8
+ this.requiredPermissions = ['read'];
9
+ this.skipFinalReload = true;
10
+ this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
11
+ 1: { min: '0', max: '0' },
12
+ 2: { min: '2.5.3', max: '0' },
13
+ });
14
+ const { payload } = this;
15
+ (0, paramsValidator_1.validateParams)(payload, [
16
+ { name: 'path', required: true },
17
+ { name: 'mac', type: 'string' },
18
+ ]);
19
+ const path = (0, pathUtils_1.validatePath)(payload.path, 1);
20
+ this.params = {
21
+ address_n: path,
22
+ mac: payload.mac,
23
+ };
24
+ }
25
+ async run() {
26
+ const cmd = this.device.getCommands();
27
+ const { message } = await cmd.unlockPath(this.params);
28
+ return {
29
+ address_n: this.params.address_n,
30
+ mac: message.mac,
31
+ };
32
+ }
33
+ }
34
+ exports.default = UnlockPath;
35
+ //# sourceMappingURL=unlockPath.js.map
@@ -7,7 +7,7 @@ export declare const onCall: (message: CoreMessage) => Promise<void>;
7
7
  export declare class Core extends EventEmitter {
8
8
  handleMessage(message: any, isTrustedOrigin: boolean): void;
9
9
  dispose(): void;
10
- getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinJoin | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
10
+ getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinJoin | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").unlockPath | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
11
11
  getTransportInfo(): TransportInfo;
12
12
  }
13
13
  export declare const initCore: () => Core;
@@ -2,5 +2,5 @@ import * as Methods from '../api';
2
2
  import type { IFrameCallMessage } from '../events';
3
3
  export declare const getMethod: (message: IFrameCallMessage & {
4
4
  id?: number;
5
- }) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinJoin | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
5
+ }) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinJoin | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.unlockPath | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
6
6
  //# sourceMappingURL=method.d.ts.map
@@ -186,7 +186,7 @@ exports.config = {
186
186
  {
187
187
  capabilities: ['coinjoin'],
188
188
  methods: ['authorizeCoinJoin', 'getOwnershipId', 'getOwnershipProof'],
189
- min: ['0', '2.4.4'],
189
+ min: ['0', '2.5.3'],
190
190
  },
191
191
  ],
192
192
  };
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "9.0.2";
1
+ export declare const VERSION = "9.0.3";
2
2
  export declare const DEFAULT_DOMAIN: string;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
4
- exports.VERSION = '9.0.2';
4
+ exports.VERSION = '9.0.3';
5
5
  const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
6
6
  exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
7
7
  //# sourceMappingURL=version.js.map
@@ -27,8 +27,13 @@ export declare class DeviceCommands {
27
27
  constructor(device: Device, transport: Transport, sessionId: string);
28
28
  dispose(): void;
29
29
  isDisposed(): boolean;
30
- getPublicKey(address_n: number[], coin_name?: string, script_type?: Messages.InputScriptType, show_display?: boolean): Promise<Messages.PublicKey>;
31
- getHDNode(path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean, showOnTrezor?: boolean): Promise<HDNodeResponse>;
30
+ unlockPath(params?: Messages.UnlockPath): Promise<TypedResponseMessage<"UnlockedPathRequest">>;
31
+ getPublicKey(params: Messages.GetPublicKey, unlockPath?: Messages.UnlockPath): Promise<Messages.PublicKey>;
32
+ getHDNode(params: Messages.GetPublicKey, options?: {
33
+ coinInfo?: BitcoinNetworkInfo;
34
+ validation?: boolean;
35
+ unlockPath?: Messages.UnlockPath;
36
+ }): Promise<HDNodeResponse>;
32
37
  getBitcoinHDNode(path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean): Promise<HDNodeResponse>;
33
38
  getAddress({ address_n, show_display, multisig, script_type }: Messages.GetAddress, coinInfo: BitcoinNetworkInfo): Promise<{
34
39
  path: number[];
@@ -47,45 +47,55 @@ class DeviceCommands {
47
47
  isDisposed() {
48
48
  return this.disposed;
49
49
  }
50
- async getPublicKey(address_n, coin_name = 'Bitcoin', script_type, show_display) {
50
+ unlockPath(params) {
51
+ return this.typedCall('UnlockPath', 'UnlockedPathRequest', params);
52
+ }
53
+ async getPublicKey(params, unlockPath) {
54
+ if (unlockPath) {
55
+ await this.unlockPath(unlockPath);
56
+ }
51
57
  const response = await this.typedCall('GetPublicKey', 'PublicKey', {
52
- address_n,
53
- coin_name,
54
- script_type,
55
- show_display,
58
+ address_n: params.address_n,
59
+ coin_name: params.coin_name || 'Bitcoin',
60
+ script_type: params.script_type,
61
+ show_display: params.show_display,
62
+ ignore_xpub_magic: params.ignore_xpub_magic,
63
+ ecdsa_curve_name: params.ecdsa_curve_name,
56
64
  });
57
65
  return response.message;
58
66
  }
59
- async getHDNode(path, coinInfo, validation = true, showOnTrezor = false) {
67
+ async getHDNode(params, options = {}) {
68
+ const path = params.address_n;
69
+ const { coinInfo, unlockPath } = options;
70
+ const validation = typeof options.validation === 'boolean' ? options.validation : true;
60
71
  if (!this.device.atLeast(['1.7.2', '2.0.10']) || !coinInfo) {
61
72
  return this.getBitcoinHDNode(path, coinInfo);
62
73
  }
63
- let network;
64
- if ((0, pathUtils_1.isMultisigPath)(path)) {
65
- network = coinInfo.network;
74
+ let network = null;
75
+ if (!params.script_type) {
76
+ params.script_type = (0, pathUtils_1.getScriptType)(path);
66
77
  }
67
- else if ((0, pathUtils_1.isSegwitPath)(path)) {
78
+ if (params.script_type === 'SPENDP2SHWITNESS') {
68
79
  network = (0, coinInfo_1.getSegwitNetwork)(coinInfo);
69
80
  }
70
- else if ((0, pathUtils_1.isBech32Path)(path)) {
81
+ else if (params.script_type === 'SPENDWITNESS') {
71
82
  network = (0, coinInfo_1.getBech32Network)(coinInfo);
72
83
  }
73
- let scriptType = (0, pathUtils_1.getScriptType)(path);
74
84
  if (!network) {
75
85
  network = coinInfo.network;
76
- if (scriptType !== 'SPENDADDRESS') {
77
- scriptType = undefined;
78
- }
86
+ }
87
+ if (!params.coin_name) {
88
+ params.coin_name = coinInfo.name;
79
89
  }
80
90
  let publicKey;
81
- if (showOnTrezor || !validation) {
82
- publicKey = await this.getPublicKey(path, coinInfo.name, scriptType, showOnTrezor);
91
+ if (params.show_display || !validation) {
92
+ publicKey = await this.getPublicKey(params, unlockPath);
83
93
  }
84
94
  else {
85
95
  const suffix = 0;
86
96
  const childPath = path.concat([suffix]);
87
- const resKey = await this.getPublicKey(path, coinInfo.name, scriptType);
88
- const childKey = await this.getPublicKey(childPath, coinInfo.name, scriptType);
97
+ const resKey = await this.getPublicKey(params, unlockPath);
98
+ const childKey = await this.getPublicKey({ ...params, address_n: childPath }, unlockPath);
89
99
  publicKey = hdnodeUtils.xpubDerive(resKey, childKey, suffix, network, coinInfo.network);
90
100
  }
91
101
  const response = {
@@ -103,20 +113,22 @@ class DeviceCommands {
103
113
  response.xpub = hdnodeUtils.convertXpub(publicKey.xpub, network, coinInfo.network);
104
114
  }
105
115
  if ((0, pathUtils_1.isTaprootPath)(path)) {
106
- response.xpubSegwit = `tr([5c9e228d/86'/${(0, pathUtils_1.fromHardened)(path[1])}'/${(0, pathUtils_1.fromHardened)(path[2])}']${response.xpub}/<0;1>/*)`;
116
+ const fingerprint = Number(publicKey.root_fingerprint || 0).toString(16);
117
+ const descriptorPath = `${fingerprint}${response.serializedPath.substring(1)}`;
118
+ response.xpubSegwit = `tr([${descriptorPath}]${response.xpub}/<0;1>/*)`;
107
119
  }
108
120
  return response;
109
121
  }
110
122
  async getBitcoinHDNode(path, coinInfo, validation = true) {
111
123
  let publicKey;
112
124
  if (!validation) {
113
- publicKey = await this.getPublicKey(path);
125
+ publicKey = await this.getPublicKey({ address_n: path });
114
126
  }
115
127
  else {
116
128
  const suffix = 0;
117
129
  const childPath = path.concat([suffix]);
118
- const resKey = await this.getPublicKey(path);
119
- const childKey = await this.getPublicKey(childPath);
130
+ const resKey = await this.getPublicKey({ address_n: path });
131
+ const childKey = await this.getPublicKey({ address_n: childPath });
120
132
  publicKey = hdnodeUtils.xpubDerive(resKey, childKey, suffix);
121
133
  }
122
134
  const response = {
@@ -183,7 +195,7 @@ class DeviceCommands {
183
195
  }
184
196
  async ethereumGetPublicKey({ address_n, show_display, }) {
185
197
  if (!this.device.atLeast(['1.8.1', '2.1.0'])) {
186
- return this.getHDNode(address_n);
198
+ return this.getHDNode({ address_n });
187
199
  }
188
200
  const suffix = 0;
189
201
  const childPath = address_n.concat([suffix]);
@@ -403,7 +415,7 @@ class DeviceCommands {
403
415
  ? indexOrPath
404
416
  : (0, accountUtils_1.getAccountAddressN)(coinInfo, indexOrPath);
405
417
  if (coinInfo.type === 'bitcoin') {
406
- const resp = await this.getHDNode(address_n, coinInfo, false);
418
+ const resp = await this.getHDNode({ address_n }, { coinInfo, validation: false });
407
419
  return {
408
420
  descriptor: resp.xpubSegwit || resp.xpub,
409
421
  legacyXpub: resp.xpub,