@trezor/connect 9.1.7 → 9.1.9
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 +14 -0
- package/README.md +1 -1
- package/lib/api/bitcoin/inputs.d.ts +2 -2
- package/lib/api/bitcoin/inputs.js +3 -3
- package/lib/api/bitcoin/refTx.d.ts +7 -7
- package/lib/api/bitcoin/refTx.js +69 -73
- package/lib/api/blockchainGetTransactions.d.ts +1 -1
- package/lib/api/changeWipeCode.d.ts +7 -0
- package/lib/api/changeWipeCode.js +22 -0
- package/lib/api/composeTransaction.js +4 -3
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/signTransaction.js +12 -4
- package/lib/backend/Blockchain.d.ts +2 -1
- package/lib/backend/Blockchain.js +3 -0
- package/lib/core/AbstractMethod.js +1 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/events/index.d.ts +1 -0
- package/lib/events/index.js +1 -0
- package/lib/events/webextension.d.ts +7 -0
- package/lib/events/webextension.js +10 -0
- package/lib/factory.js +1 -0
- package/lib/types/api/blockchainGetTransactions.d.ts +2 -2
- package/lib/types/api/changeWipeCode.d.ts +4 -0
- package/lib/types/api/changeWipeCode.js +3 -0
- package/lib/types/api/index.d.ts +2 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# 9.1.9
|
|
2
|
+
|
|
3
|
+
- fix(connect-popup): webusb pairing in webextensions using manifest version 2 [#10709](https://github.com/trezor/trezor-suite/pull/10709).
|
|
4
|
+
|
|
5
|
+
# 9.1.8
|
|
6
|
+
|
|
7
|
+
- fix(connect-explorer): eth getAccountInfo coin fix (0108b96)
|
|
8
|
+
- fix(connect): do not check firmware range for devices in bootloader (ed53f9f)
|
|
9
|
+
- feat(connect): add changeWipeCode method (b85d957)
|
|
10
|
+
- deps(connect-plugin-ethereum): @metamask/eth-sig-util@^7.0.0->^7.0.1 (e24c80a)
|
|
11
|
+
- chore(connect): improve origTxs and refTxs (ffcb3ee)
|
|
12
|
+
- feat(connect): blockchain-link API adjusted (2df1416)
|
|
13
|
+
- chore(connect-explorer): add ADA params (9969d65)
|
|
14
|
+
|
|
1
15
|
# 9.1.7
|
|
2
16
|
|
|
3
17
|
- 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.
|
|
3
|
+
API version 9.1.9
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
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:
|
|
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 =>
|
|
41
|
-
if (refTx && refTx.
|
|
42
|
-
input.amount = refTx.
|
|
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 {
|
|
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
|
|
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:
|
|
11
|
+
export declare const transformReferencedTransactions: (txs: BitcoinJsTransaction[]) => RefTransaction[];
|
|
12
12
|
export declare const validateReferencedTransactions: ({ transactions, inputs, outputs, addresses, coinInfo, }: {
|
|
13
|
-
transactions?: (
|
|
13
|
+
transactions?: (AccountTransaction | RefTransaction)[] | undefined;
|
|
14
14
|
inputs: PROTO.TxInputType[];
|
|
15
15
|
outputs: PROTO.TxOutputType[];
|
|
16
16
|
addresses?: AccountAddresses | undefined;
|
|
17
|
-
coinInfo:
|
|
17
|
+
coinInfo: BitcoinNetworkInfo;
|
|
18
18
|
}) => RefTransaction[] | undefined;
|
|
19
19
|
//# sourceMappingURL=refTx.d.ts.map
|
package/lib/api/bitcoin/refTx.js
CHANGED
|
@@ -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
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
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:
|
|
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
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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").
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
package/lib/api/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
133
|
+
return (0, bitcoin_1.transformReferencedTransactions)(rawTxs);
|
|
131
134
|
});
|
|
132
135
|
const origTxs = !origTxsIds.length
|
|
133
136
|
? []
|
|
134
|
-
: await blockchain
|
|
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
|
-
|
|
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").
|
|
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') {
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -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.
|
|
4
|
+
exports.VERSION = '9.1.9';
|
|
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/events/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './transport';
|
|
|
8
8
|
export * from './ui-promise';
|
|
9
9
|
export * from './ui-request';
|
|
10
10
|
export * from './ui-response';
|
|
11
|
+
export * from './webextension';
|
|
11
12
|
export declare const UI: {
|
|
12
13
|
readonly RECEIVE_PERMISSION: "ui-receive_permission";
|
|
13
14
|
readonly RECEIVE_CONFIRMATION: "ui-receive_confirmation";
|
package/lib/events/index.js
CHANGED
|
@@ -14,6 +14,7 @@ tslib_1.__exportStar(require("./transport"), exports);
|
|
|
14
14
|
tslib_1.__exportStar(require("./ui-promise"), exports);
|
|
15
15
|
tslib_1.__exportStar(require("./ui-request"), exports);
|
|
16
16
|
tslib_1.__exportStar(require("./ui-response"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./webextension"), exports);
|
|
17
18
|
exports.UI = {
|
|
18
19
|
...ui_request_1.UI_REQUEST,
|
|
19
20
|
...ui_response_1.UI_RESPONSE,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEBEXTENSION = void 0;
|
|
4
|
+
exports.WEBEXTENSION = {
|
|
5
|
+
USB_PERMISSIONS_BROADCAST: 'usb-permissions',
|
|
6
|
+
USB_PERMISSIONS_INIT: 'usb-permissions-init',
|
|
7
|
+
USB_PERMISSIONS_CLOSE: 'usb-permissions-close',
|
|
8
|
+
USB_PERMISSIONS_FINISHED: 'usb-permissions-finished',
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=webextension.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 {
|
|
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<
|
|
6
|
+
export declare function blockchainGetTransactions(params: BlockchainGetTransactions): Response<Transaction[]>;
|
|
7
7
|
//# sourceMappingURL=blockchainGetTransactions.d.ts.map
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "9.1.9",
|
|
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.
|
|
56
|
-
"@trezor/blockchain-link-types": "1.0.
|
|
57
|
-
"@trezor/connect-analytics": "1.0.
|
|
58
|
-
"@trezor/connect-common": "0.0.
|
|
59
|
-
"@trezor/protobuf": "1.0.
|
|
60
|
-
"@trezor/protocol": "1.0.
|
|
61
|
-
"@trezor/transport": "1.1.
|
|
62
|
-
"@trezor/utils": "9.0.
|
|
63
|
-
"@trezor/utxo-lib": "2.0.
|
|
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",
|