@trezor/connect 9.1.7 → 9.1.8

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 9.1.8
2
+
3
+ - fix(connect-explorer): eth getAccountInfo coin fix (0108b96)
4
+ - fix(connect): do not check firmware range for devices in bootloader (ed53f9f)
5
+ - feat(connect): add changeWipeCode method (b85d957)
6
+ - deps(connect-plugin-ethereum): @metamask/eth-sig-util@^7.0.0->^7.0.1 (e24c80a)
7
+ - chore(connect): improve origTxs and refTxs (ffcb3ee)
8
+ - feat(connect): blockchain-link API adjusted (2df1416)
9
+ - chore(connect-explorer): add ADA params (9969d65)
10
+
1
11
  # 9.1.7
2
12
 
3
13
  - fix(connect): correct UiRequestConfirmation type in solanaGetPublicKey (a93ea1890)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.1.7
3
+ API version 9.1.8
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,8 +1,8 @@
1
- import type { TypedRawTransaction } from '@trezor/blockchain-link';
1
+ import { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib';
2
2
  import type { BitcoinNetworkInfo, ProtoWithDerivationPath } from '../../types';
3
3
  import type { ComposeUtxo } from '../../types/api/composeTransaction';
4
4
  import type { PROTO } from '../../constants';
5
5
  export declare const validateTrezorInputs: (inputs: ProtoWithDerivationPath<PROTO.TxInputType>[], coinInfo: BitcoinNetworkInfo) => PROTO.TxInputType[];
6
- export declare const enhanceTrezorInputs: (inputs: PROTO.TxInputType[], rawTxs: TypedRawTransaction[]) => void;
6
+ export declare const enhanceTrezorInputs: (inputs: PROTO.TxInputType[], rawTxs: BitcoinJsTransaction[]) => void;
7
7
  export declare const inputToTrezor: (input: ComposeUtxo, sequence?: number) => PROTO.TxInputType;
8
8
  //# sourceMappingURL=inputs.d.ts.map
@@ -37,9 +37,9 @@ const enhanceTrezorInputs = (inputs, rawTxs) => {
37
37
  inputs.forEach(input => {
38
38
  if (!input.amount) {
39
39
  console.warn('TrezorConnect.singTransaction deprecation: missing input amount.');
40
- const refTx = rawTxs.find(t => 'txid' in t.tx && t.tx.txid === input.prev_hash);
41
- if (refTx && refTx.type === 'blockbook' && refTx.tx.vout[input.prev_index]) {
42
- input.amount = refTx.tx.vout[input.prev_index].value;
40
+ const refTx = rawTxs.find(t => t.getId() === input.prev_hash);
41
+ if (refTx && refTx.outs[input.prev_index]) {
42
+ input.amount = refTx.outs[input.prev_index].value;
43
43
  }
44
44
  }
45
45
  });
@@ -1,19 +1,19 @@
1
- import { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib';
2
- import type { TypedRawTransaction } from '@trezor/blockchain-link';
3
- import type { CoinInfo, AccountAddresses, AccountTransaction } from '../../types';
1
+ import { Transaction as BitcoinJsTransaction, Network } from '@trezor/utxo-lib';
2
+ import type { CoinInfo, AccountAddresses, AccountTransaction, BitcoinNetworkInfo } from '../../types';
4
3
  import type { RefTransaction, TransactionOptions } from '../../types/api/bitcoin';
5
4
  import type { PROTO } from '../../constants';
6
5
  export declare const requireReferencedTransactions: (inputs: PROTO.TxInputType[], options?: TransactionOptions, coinInfo?: CoinInfo) => boolean;
7
6
  export declare const getReferencedTransactions: (inputs: PROTO.TxInputType[]) => string[];
8
7
  export declare const getOrigTransactions: (inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[]) => string[];
9
- export declare const transformOrigTransactions: (txs: TypedRawTransaction[], coinInfo: CoinInfo, addresses?: AccountAddresses) => RefTransaction[];
8
+ export declare const parseTransactionHexes: (network?: Network) => (hexes: string[]) => (import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<undefined> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("packages/utxo-lib/lib/transaction/dash").DashSpecific> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("packages/utxo-lib/lib/transaction/zcash").ZcashSpecific>)[];
9
+ export declare const transformOrigTransactions: (txs: BitcoinJsTransaction[], coinInfo: BitcoinNetworkInfo, currentInputs: PROTO.TxInputType[], addresses: AccountAddresses) => RefTransaction[];
10
10
  export declare const transformReferencedTransaction: (tx: BitcoinJsTransaction) => RefTransaction;
11
- export declare const transformReferencedTransactions: (txs: TypedRawTransaction[], coinInfo: CoinInfo) => RefTransaction[];
11
+ export declare const transformReferencedTransactions: (txs: BitcoinJsTransaction[]) => RefTransaction[];
12
12
  export declare const validateReferencedTransactions: ({ transactions, inputs, outputs, addresses, coinInfo, }: {
13
- transactions?: (RefTransaction | AccountTransaction)[] | undefined;
13
+ transactions?: (AccountTransaction | RefTransaction)[] | undefined;
14
14
  inputs: PROTO.TxInputType[];
15
15
  outputs: PROTO.TxOutputType[];
16
16
  addresses?: AccountAddresses | undefined;
17
- coinInfo: CoinInfo;
17
+ coinInfo: BitcoinNetworkInfo;
18
18
  }) => RefTransaction[] | undefined;
19
19
  //# sourceMappingURL=refTx.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateReferencedTransactions = exports.transformReferencedTransactions = exports.transformReferencedTransaction = exports.transformOrigTransactions = exports.getOrigTransactions = exports.getReferencedTransactions = exports.requireReferencedTransactions = void 0;
3
+ exports.validateReferencedTransactions = exports.transformReferencedTransactions = exports.transformReferencedTransaction = exports.transformOrigTransactions = exports.parseTransactionHexes = exports.getOrigTransactions = exports.getReferencedTransactions = exports.requireReferencedTransactions = void 0;
4
4
  const utxo_lib_1 = require("@trezor/utxo-lib");
5
5
  const utils_1 = require("@trezor/utils");
6
6
  const pathUtils_1 = require("../../utils/pathUtils");
@@ -39,6 +39,8 @@ const getOrigTransactions = (inputs, outputs) => {
39
39
  return result;
40
40
  };
41
41
  exports.getOrigTransactions = getOrigTransactions;
42
+ const parseTransactionHexes = (network) => (hexes) => hexes.map(hex => utxo_lib_1.Transaction.fromHex(hex, { network }));
43
+ exports.parseTransactionHexes = parseTransactionHexes;
42
44
  const enhanceTransaction = (refTx, srcTx) => {
43
45
  const extraData = srcTx.getExtraData();
44
46
  if (extraData) {
@@ -55,27 +57,38 @@ const enhanceTransaction = (refTx, srcTx) => {
55
57
  }
56
58
  return refTx;
57
59
  };
58
- const transformOrigTransaction = (origTx, tx, addresses) => {
59
- const { vin, vout, txid } = origTx;
60
- const inputAddresses = addresses.used.concat(addresses.change).concat(addresses.unused);
60
+ const parseOutputScript = (output, network) => {
61
+ try {
62
+ const address = utxo_lib_1.address.fromOutputScript(output, network);
63
+ return { type: 'address', address };
64
+ }
65
+ catch {
66
+ try {
67
+ const { data } = utxo_lib_1.payments.embed({ output }, { validate: true });
68
+ return { type: 'data', data };
69
+ }
70
+ catch {
71
+ return { type: 'unknown' };
72
+ }
73
+ }
74
+ };
75
+ const transformOrigTransaction = (tx, coinInfo, currentInputs, addresses) => {
61
76
  const inputsMap = (input, i) => {
62
77
  var _a;
63
- const rawInput = vin[i];
64
- if (!(rawInput === null || rawInput === void 0 ? void 0 : rawInput.value) || !(rawInput === null || rawInput === void 0 ? void 0 : rawInput.addresses) || rawInput.addresses.length !== 1) {
65
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid input at ${txid} [${i}]`);
78
+ const prev_hash = utils_1.bufferUtils.reverseBuffer(input.hash).toString('hex');
79
+ const currentInput = currentInputs.find(inp => inp.prev_hash === prev_hash && inp.prev_index === input.index);
80
+ if (!(currentInput === null || currentInput === void 0 ? void 0 : currentInput.address_n)) {
81
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid input at ${tx.getId()} [${i}]`);
66
82
  }
67
- const [address] = rawInput.addresses;
68
- const inputAddress = inputAddresses.find(addr => addr.address === address);
69
- const address_n = (0, pathUtils_1.getHDPath)((inputAddress === null || inputAddress === void 0 ? void 0 : inputAddress.path) || '');
70
83
  return {
71
- address_n,
72
- prev_hash: utils_1.bufferUtils.reverseBuffer(input.hash).toString('hex'),
84
+ address_n: currentInput.address_n,
85
+ prev_hash,
73
86
  prev_index: input.index,
74
87
  script_sig: input.script.toString('hex'),
75
88
  sequence: input.sequence,
76
- script_type: (0, pathUtils_1.getScriptType)(address_n),
89
+ script_type: (0, pathUtils_1.getScriptType)(currentInput.address_n),
77
90
  multisig: undefined,
78
- amount: rawInput.value,
91
+ amount: currentInput.amount,
79
92
  decred_tree: undefined,
80
93
  witness: (_a = tx.getWitness(i)) === null || _a === void 0 ? void 0 : _a.toString('hex'),
81
94
  ownership_proof: undefined,
@@ -83,38 +96,41 @@ const transformOrigTransaction = (origTx, tx, addresses) => {
83
96
  };
84
97
  };
85
98
  const outputsMap = (output, i) => {
86
- var _a;
87
- const rawOutput = vout[i];
88
- if (!rawOutput.isAddress) {
89
- const { data } = utxo_lib_1.payments.embed({ output: output.script });
90
- const op_return_data = (_a = data === null || data === void 0 ? void 0 : data.shift()) === null || _a === void 0 ? void 0 : _a.toString('hex');
91
- if (typeof op_return_data !== 'string') {
92
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid op_return_data at ${txid} [${i}]`);
99
+ var _a, _b;
100
+ const parsed = parseOutputScript(output.script, coinInfo.network);
101
+ switch (parsed.type) {
102
+ case 'data': {
103
+ 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');
104
+ if (typeof op_return_data !== 'string') {
105
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid op_return_data at ${tx.getId()} [${i}]`);
106
+ }
107
+ return {
108
+ script_type: 'PAYTOOPRETURN',
109
+ amount: '0',
110
+ op_return_data,
111
+ };
93
112
  }
94
- return {
95
- script_type: 'PAYTOOPRETURN',
96
- amount: '0',
97
- op_return_data,
98
- };
99
- }
100
- if (!rawOutput.addresses || rawOutput.addresses.length !== 1) {
101
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid output at ${txid} [${i}]`);
102
- }
103
- const [address] = rawOutput.addresses;
104
- const changeAddress = addresses.change.find(addr => addr.address === address);
105
- const address_n = changeAddress && (0, pathUtils_1.getHDPath)(changeAddress.path);
106
- const amount = output.value.toString();
107
- return address_n
108
- ? {
109
- address_n,
110
- amount,
111
- script_type: (0, pathUtils_1.getOutputScriptType)(address_n),
113
+ case 'address': {
114
+ const { address } = parsed;
115
+ const changeAddress = addresses.change.find(addr => addr.address === address);
116
+ const address_n = changeAddress && (0, pathUtils_1.getHDPath)(changeAddress.path);
117
+ const amount = output.value.toString();
118
+ return address_n
119
+ ? {
120
+ address_n,
121
+ amount,
122
+ script_type: (0, pathUtils_1.getOutputScriptType)(address_n),
123
+ }
124
+ : {
125
+ address,
126
+ amount,
127
+ script_type: 'PAYTOADDRESS',
128
+ };
112
129
  }
113
- : {
114
- address,
115
- amount,
116
- script_type: 'PAYTOADDRESS',
117
- };
130
+ case 'unknown':
131
+ default:
132
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid output at ${tx.getId()} [${i}]`);
133
+ }
118
134
  };
119
135
  const refTx = {
120
136
  version: tx.version,
@@ -127,13 +143,7 @@ const transformOrigTransaction = (origTx, tx, addresses) => {
127
143
  };
128
144
  return enhanceTransaction(refTx, tx);
129
145
  };
130
- const isTransactionWithHex = (tx) => tx.type === 'blockbook' && !!tx.tx.hex;
131
- const transformOrigTransactions = (txs, coinInfo, addresses) => coinInfo.type !== 'bitcoin' || !addresses
132
- ? []
133
- : txs.filter(isTransactionWithHex).map(raw => {
134
- const tx = utxo_lib_1.Transaction.fromHex(raw.tx.hex, { network: coinInfo.network });
135
- return transformOrigTransaction(raw.tx, tx, addresses);
136
- });
146
+ const transformOrigTransactions = (txs, coinInfo, currentInputs, addresses) => txs.map(tx => transformOrigTransaction(tx, coinInfo, currentInputs, addresses));
137
147
  exports.transformOrigTransactions = transformOrigTransactions;
138
148
  const transformReferencedTransaction = (tx) => {
139
149
  const inputsMap = (input) => ({
@@ -158,27 +168,8 @@ const transformReferencedTransaction = (tx) => {
158
168
  return enhanceTransaction(refTx, tx);
159
169
  };
160
170
  exports.transformReferencedTransaction = transformReferencedTransaction;
161
- const transformReferencedTransactions = (txs, coinInfo) => coinInfo.type !== 'bitcoin'
162
- ? []
163
- : txs.filter(isTransactionWithHex).map(raw => {
164
- const tx = utxo_lib_1.Transaction.fromHex(raw.tx.hex, { network: coinInfo.network });
165
- return (0, exports.transformReferencedTransaction)(tx);
166
- });
171
+ const transformReferencedTransactions = (txs) => txs.map(exports.transformReferencedTransaction);
167
172
  exports.transformReferencedTransactions = transformReferencedTransactions;
168
- const transformAccountToOrigTransaction = ({ tx, addresses, coinInfo, }) => {
169
- if (!tx.hex)
170
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `refTx: hex for ${tx.txid} not provided`);
171
- if (!addresses)
172
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `refTx: addresses for ${tx.txid} not provided`);
173
- const srcTx = utxo_lib_1.Transaction.fromHex(tx.hex, { network: coinInfo.network });
174
- return transformOrigTransaction({ ...tx.details, txid: tx.txid }, srcTx, addresses);
175
- };
176
- const transformAccountToReferencedTransaction = ({ tx, coinInfo, }) => {
177
- if (!tx.hex)
178
- throw (0, errors_1.TypedError)('Method_InvalidParameter', `refTx: hex for ${tx.txid} not provided`);
179
- const srcTx = utxo_lib_1.Transaction.fromHex(tx.hex, { network: coinInfo.network });
180
- return (0, exports.transformReferencedTransaction)(srcTx);
181
- };
182
173
  const validateReferencedTransactions = ({ transactions, inputs, outputs, addresses, coinInfo, }) => {
183
174
  if (!Array.isArray(transactions) || transactions.length === 0)
184
175
  return;
@@ -186,10 +177,15 @@ const validateReferencedTransactions = ({ transactions, inputs, outputs, address
186
177
  const origTxs = (0, exports.getOrigTransactions)(inputs, outputs);
187
178
  const transformedTxs = transactions.map(tx => {
188
179
  if ('details' in tx) {
180
+ if (!tx.hex)
181
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `refTx: hex for ${tx.txid} not provided`);
182
+ const srcTx = utxo_lib_1.Transaction.fromHex(tx.hex, { network: coinInfo.network });
189
183
  if (origTxs.includes(tx.txid)) {
190
- return transformAccountToOrigTransaction({ tx, addresses, coinInfo });
184
+ if (!addresses)
185
+ throw (0, errors_1.TypedError)('Method_InvalidParameter', `refTx: addresses for ${tx.txid} not provided`);
186
+ return transformOrigTransaction(srcTx, coinInfo, inputs, addresses);
191
187
  }
192
- return transformAccountToReferencedTransaction({ tx, coinInfo });
188
+ return (0, exports.transformReferencedTransaction)(srcTx);
193
189
  }
194
190
  (0, paramsValidator_1.validateParams)(tx, [
195
191
  { name: 'hash', type: 'string', required: true },
@@ -6,7 +6,7 @@ type Params = {
6
6
  };
7
7
  export default class BlockchainGetTransactions extends AbstractMethod<'blockchainGetTransactions', Params> {
8
8
  init(): void;
9
- run(): Promise<import("packages/blockchain-link-types/lib").TypedRawTransaction[]>;
9
+ run(): Promise<import("packages/blockchain-link-types/lib/common").Transaction[]>;
10
10
  }
11
11
  export {};
12
12
  //# sourceMappingURL=blockchainGetTransactions.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { AbstractMethod } from '../core/AbstractMethod';
2
+ import type { PROTO } from '../constants';
3
+ export default class ChangeWipeCode extends AbstractMethod<'changeWipeCode', PROTO.ChangeWipeCode> {
4
+ init(): void;
5
+ run(): Promise<PROTO.Success>;
6
+ }
7
+ //# sourceMappingURL=changeWipeCode.d.ts.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AbstractMethod_1 = require("../core/AbstractMethod");
4
+ const paramsValidator_1 = require("./common/paramsValidator");
5
+ class ChangeWipeCode extends AbstractMethod_1.AbstractMethod {
6
+ init() {
7
+ this.requiredPermissions = ['management'];
8
+ this.useDeviceState = false;
9
+ const { payload } = this;
10
+ (0, paramsValidator_1.validateParams)(payload, [{ name: 'remove', type: 'boolean' }]);
11
+ this.params = {
12
+ remove: payload.remove,
13
+ };
14
+ }
15
+ async run() {
16
+ const cmd = this.device.getCommands();
17
+ const response = await cmd.typedCall('ChangeWipeCode', 'Success', this.params);
18
+ return response.message;
19
+ }
20
+ }
21
+ exports.default = ChangeWipeCode;
22
+ //# sourceMappingURL=changeWipeCode.js.map
@@ -228,9 +228,10 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
228
228
  const requiredRefTxs = (0, bitcoin_1.requireReferencedTransactions)(inputs, options, coinInfo);
229
229
  const refTxsIds = (0, bitcoin_1.getReferencedTransactions)(inputs);
230
230
  if (requiredRefTxs && refTxsIds.length > 0) {
231
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
232
- const rawTxs = await blockchain.getTransactions(refTxsIds);
233
- refTxs = (0, bitcoin_1.transformReferencedTransactions)(rawTxs, coinInfo);
231
+ refTxs = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage)
232
+ .then(blockchain => blockchain.getTransactionHexes(refTxsIds))
233
+ .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
234
+ .then(bitcoin_1.transformReferencedTransactions);
234
235
  }
235
236
  const signTxMethod = !this.device.unavailableCapabilities.replaceTransaction
236
237
  ? bitcoin_1.signTx
@@ -17,6 +17,7 @@ export { default as blockchainSubscribeFiatRates } from './blockchainSubscribeFi
17
17
  export { default as blockchainUnsubscribe } from './blockchainUnsubscribe';
18
18
  export { default as blockchainUnsubscribeFiatRates } from './blockchainUnsubscribeFiatRates';
19
19
  export { default as changePin } from './changePin';
20
+ export { default as changeWipeCode } from './changeWipeCode';
20
21
  export { default as cipherKeyValue } from './cipherKeyValue';
21
22
  export { default as composeTransaction } from './composeTransaction';
22
23
  export { default as firmwareUpdate } from './firmwareUpdate';
package/lib/api/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.firmwareUpdate = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
6
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.firmwareUpdate = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
7
7
  var applyFlags_1 = require("./applyFlags");
8
8
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
9
9
  var applySettings_1 = require("./applySettings");
@@ -42,6 +42,8 @@ var blockchainUnsubscribeFiatRates_1 = require("./blockchainUnsubscribeFiatRates
42
42
  Object.defineProperty(exports, "blockchainUnsubscribeFiatRates", { enumerable: true, get: function () { return __importDefault(blockchainUnsubscribeFiatRates_1).default; } });
43
43
  var changePin_1 = require("./changePin");
44
44
  Object.defineProperty(exports, "changePin", { enumerable: true, get: function () { return __importDefault(changePin_1).default; } });
45
+ var changeWipeCode_1 = require("./changeWipeCode");
46
+ Object.defineProperty(exports, "changeWipeCode", { enumerable: true, get: function () { return __importDefault(changeWipeCode_1).default; } });
45
47
  var cipherKeyValue_1 = require("./cipherKeyValue");
46
48
  Object.defineProperty(exports, "cipherKeyValue", { enumerable: true, get: function () { return __importDefault(cipherKeyValue_1).default; } });
47
49
  var composeTransaction_1 = require("./composeTransaction");
@@ -125,15 +125,23 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
125
125
  const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
126
126
  const refTxs = !refTxsIds.length
127
127
  ? []
128
- : await blockchain.getTransactions(refTxsIds).then(rawTxs => {
128
+ : await blockchain
129
+ .getTransactionHexes(refTxsIds)
130
+ .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
131
+ .then(rawTxs => {
129
132
  (0, bitcoin_1.enhanceTrezorInputs)(this.params.inputs, rawTxs);
130
- return (0, bitcoin_1.transformReferencedTransactions)(rawTxs, coinInfo);
133
+ return (0, bitcoin_1.transformReferencedTransactions)(rawTxs);
131
134
  });
132
135
  const origTxs = !origTxsIds.length
133
136
  ? []
134
- : await blockchain.getTransactions(origTxsIds).then(async (rawOrigTxs) => {
137
+ : await blockchain
138
+ .getTransactionHexes(origTxsIds)
139
+ .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
140
+ .then(async (rawOrigTxs) => {
135
141
  const accountAddresses = addresses !== null && addresses !== void 0 ? addresses : (await this.fetchAddresses(blockchain));
136
- return (0, bitcoin_1.transformOrigTransactions)(rawOrigTxs, coinInfo, accountAddresses);
142
+ if (!accountAddresses)
143
+ return [];
144
+ return (0, bitcoin_1.transformOrigTransactions)(rawOrigTxs, coinInfo, inputs, accountAddresses);
137
145
  });
138
146
  return refTxs.concat(origTxs);
139
147
  }
@@ -22,7 +22,8 @@ export declare class Blockchain {
22
22
  constructor(options: BlockchainOptions);
23
23
  onError(error: ERRORS.TrezorError): void;
24
24
  init(): Promise<void>;
25
- getTransactions(txs: string[]): Promise<import("@trezor/blockchain-link").TypedRawTransaction[]>;
25
+ getTransactions(txs: string[]): Promise<import("@trezor/blockchain-link").Transaction[]>;
26
+ getTransactionHexes(txids: string[]): Promise<string[]>;
26
27
  getCurrentFiatRates(params: {
27
28
  currencies?: string[];
28
29
  token?: string;
@@ -91,6 +91,9 @@ class Blockchain {
91
91
  getTransactions(txs) {
92
92
  return Promise.all(txs.map(id => this.link.getTransaction(id)));
93
93
  }
94
+ getTransactionHexes(txids) {
95
+ return Promise.all(txids.map(id => this.link.getTransactionHex(id)));
96
+ }
94
97
  getCurrentFiatRates(params) {
95
98
  return this.link.getCurrentFiatRates(params);
96
99
  }
@@ -130,7 +130,7 @@ class AbstractMethod {
130
130
  return;
131
131
  }
132
132
  const { device } = this;
133
- if (!device.features)
133
+ if (!device.features || device.isBootloader())
134
134
  return;
135
135
  const range = this.firmwareRange[device.features.internal_model];
136
136
  if (device.firmwareStatus === 'none') {
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "9.1.7";
1
+ export declare const VERSION = "9.1.8";
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.1.7';
4
+ exports.VERSION = '9.1.8';
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
package/lib/factory.js CHANGED
@@ -121,6 +121,7 @@ const factory = ({ eventEmitter, manifest, init, call, requestLogin, uiResponse,
121
121
  showDeviceTutorial: params => call({ ...params, method: 'showDeviceTutorial' }),
122
122
  backupDevice: params => call({ ...params, method: 'backupDevice' }),
123
123
  changePin: params => call({ ...params, method: 'changePin' }),
124
+ changeWipeCode: params => call({ ...params, method: 'changeWipeCode' }),
124
125
  firmwareUpdate: params => call({ ...params, method: 'firmwareUpdate' }),
125
126
  recoveryDevice: params => call({ ...params, method: 'recoveryDevice' }),
126
127
  getCoinInfo: params => call({ ...params, method: 'getCoinInfo' }),
@@ -1,7 +1,7 @@
1
- import type { TypedRawTransaction } from '@trezor/blockchain-link';
1
+ import type { Transaction } from '@trezor/blockchain-link';
2
2
  import type { CommonParamsWithCoin, Response } from '../params';
3
3
  export type BlockchainGetTransactions = CommonParamsWithCoin & {
4
4
  txs: string[];
5
5
  };
6
- export declare function blockchainGetTransactions(params: BlockchainGetTransactions): Response<TypedRawTransaction[]>;
6
+ export declare function blockchainGetTransactions(params: BlockchainGetTransactions): Response<Transaction[]>;
7
7
  //# sourceMappingURL=blockchainGetTransactions.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { PROTO } from '../../constants';
2
+ import type { Params, Response } from '../params';
3
+ export declare function changeWipeCode(params: Params<PROTO.ChangeWipeCode>): Response<PROTO.Success>;
4
+ //# sourceMappingURL=changeWipeCode.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=changeWipeCode.js.map
@@ -24,6 +24,7 @@ import { cardanoGetPublicKey } from './cardanoGetPublicKey';
24
24
  import { cardanoSignTransaction } from './cardanoSignTransaction';
25
25
  import { cardanoComposeTransaction } from './cardanoComposeTransaction';
26
26
  import { changePin } from './changePin';
27
+ import { changeWipeCode } from './changeWipeCode';
27
28
  import { cipherKeyValue } from './cipherKeyValue';
28
29
  import { composeTransaction } from './composeTransaction';
29
30
  import { disableWebUSB } from './disableWebUSB';
@@ -112,6 +113,7 @@ export interface TrezorConnect {
112
113
  cardanoSignTransaction: typeof cardanoSignTransaction;
113
114
  cardanoComposeTransaction: typeof cardanoComposeTransaction;
114
115
  changePin: typeof changePin;
116
+ changeWipeCode: typeof changeWipeCode;
115
117
  cipherKeyValue: typeof cipherKeyValue;
116
118
  composeTransaction: typeof composeTransaction;
117
119
  disableWebUSB: typeof disableWebUSB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trezor/connect",
3
- "version": "9.1.7",
3
+ "version": "9.1.8",
4
4
  "author": "Trezor <info@trezor.io>",
5
5
  "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
6
6
  "description": "High-level javascript interface for Trezor hardware wallet.",
@@ -52,15 +52,15 @@
52
52
  "@ethereumjs/common": "^4.1.0",
53
53
  "@ethereumjs/tx": "^5.1.0",
54
54
  "@fivebinaries/coin-selection": "2.2.1",
55
- "@trezor/blockchain-link": "2.1.20",
56
- "@trezor/blockchain-link-types": "1.0.9",
57
- "@trezor/connect-analytics": "1.0.10",
58
- "@trezor/connect-common": "0.0.24",
59
- "@trezor/protobuf": "1.0.4",
60
- "@trezor/protocol": "1.0.4",
61
- "@trezor/transport": "1.1.19",
62
- "@trezor/utils": "9.0.16",
63
- "@trezor/utxo-lib": "2.0.2",
55
+ "@trezor/blockchain-link": "2.1.21",
56
+ "@trezor/blockchain-link-types": "1.0.10",
57
+ "@trezor/connect-analytics": "1.0.11",
58
+ "@trezor/connect-common": "0.0.25",
59
+ "@trezor/protobuf": "1.0.5",
60
+ "@trezor/protocol": "1.0.5",
61
+ "@trezor/transport": "1.1.20",
62
+ "@trezor/utils": "9.0.17",
63
+ "@trezor/utxo-lib": "2.0.3",
64
64
  "bignumber.js": "^9.1.1",
65
65
  "blakejs": "^1.2.1",
66
66
  "bs58": "^5.0.0",