@trezor/connect 9.1.6 → 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 +43 -0
- package/README.md +1 -1
- package/lib/api/binance/api/binanceGetAddress.d.ts +1 -1
- package/lib/api/binance/api/binanceGetAddress.js +4 -1
- package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -0
- package/lib/api/binance/api/binanceSignTransaction.js +3 -1
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/binance/binanceSignTx.js +2 -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/cardano/api/cardanoGetAddress.d.ts +1 -1
- package/lib/api/cardano/api/cardanoGetAddress.js +4 -1
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +1 -0
- package/lib/api/cardano/api/cardanoSignTransaction.js +3 -0
- package/lib/api/changeWipeCode.d.ts +7 -0
- package/lib/api/changeWipeCode.js +22 -0
- package/lib/api/common/paramsValidator.js +5 -3
- package/lib/api/composeTransaction.js +4 -3
- package/lib/api/eos/api/eosGetPublicKey.js +2 -0
- package/lib/api/eos/api/eosSignTransaction.d.ts +1 -0
- package/lib/api/eos/api/eosSignTransaction.js +3 -1
- package/lib/api/eos/eosSignTx.d.ts +1 -1
- package/lib/api/eos/eosSignTx.js +2 -1
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +1 -1
- package/lib/api/ethereum/api/ethereumGetAddress.js +4 -1
- package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +1 -0
- package/lib/api/ethereum/api/ethereumSignTransaction.js +7 -5
- package/lib/api/ethereum/ethereumSignTx.d.ts +4 -4
- package/lib/api/ethereum/ethereumSignTx.js +4 -2
- package/lib/api/getAddress.d.ts +1 -1
- package/lib/api/getAddress.js +4 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +3 -1
- package/lib/api/nem/api/nemGetAddress.d.ts +1 -1
- package/lib/api/nem/api/nemGetAddress.js +4 -1
- package/lib/api/nem/api/nemSignTransaction.js +2 -1
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/nem/nemSignTx.js +2 -1
- package/lib/api/ripple/api/rippleGetAddress.d.ts +1 -1
- package/lib/api/ripple/api/rippleGetAddress.js +4 -1
- package/lib/api/ripple/api/rippleSignTransaction.js +3 -1
- package/lib/api/signTransaction.js +14 -4
- package/lib/api/solana/additionalInfo.d.ts +10 -0
- package/lib/api/solana/additionalInfo.js +33 -0
- package/lib/api/solana/api/solanaGetAddress.d.ts +1 -1
- package/lib/api/solana/api/solanaGetAddress.js +4 -2
- package/lib/api/solana/api/solanaGetPublicKey.js +1 -2
- package/lib/api/solana/api/solanaSignTransaction.js +2 -1
- package/lib/api/stellar/api/stellarGetAddress.d.ts +1 -1
- package/lib/api/stellar/api/stellarGetAddress.js +4 -1
- package/lib/api/tezos/api/tezosGetAddress.d.ts +1 -1
- package/lib/api/tezos/api/tezosGetAddress.js +4 -1
- package/lib/api/tezos/api/tezosGetPublicKey.js +2 -0
- package/lib/api/tezos/tezosSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.js +2 -1
- package/lib/backend/Blockchain.d.ts +2 -1
- package/lib/backend/Blockchain.js +4 -0
- package/lib/core/AbstractMethod.js +4 -1
- package/lib/data/DataManager.d.ts +11 -0
- package/lib/data/config.d.ts +11 -0
- package/lib/data/config.js +9 -2
- package/lib/data/defaultFeeLevels.js +1 -0
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/firmwareInfo.d.ts +1 -1
- package/lib/data/firmwareInfo.js +4 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +2 -0
- package/lib/device/Device.js +12 -2
- package/lib/device/DeviceCommands.d.ts +2 -2
- package/lib/device/DeviceCommands.js +10 -3
- package/lib/events/ui-request.d.ts +1 -1
- package/lib/factory.js +1 -0
- package/lib/types/api/binance/index.d.ts +1 -0
- package/lib/types/api/bitcoin/index.d.ts +2 -0
- package/lib/types/api/blockchainGetTransactions.d.ts +2 -2
- package/lib/types/api/cardano/index.d.ts +2 -0
- package/lib/types/api/changeWipeCode.d.ts +4 -0
- package/lib/types/api/changeWipeCode.js +3 -0
- package/lib/types/api/eos/index.d.ts +1 -0
- package/lib/types/api/ethereum/index.d.ts +1 -0
- package/lib/types/api/index.d.ts +2 -0
- package/lib/types/api/nem/index.d.ts +1 -0
- package/lib/types/api/ripple/index.d.ts +1 -0
- package/lib/types/api/solana/index.d.ts +10 -0
- package/lib/types/api/tezos/index.d.ts +1 -0
- package/lib/types/coinInfo.d.ts +3 -3
- package/lib/types/device.d.ts +1 -1
- package/lib/types/params.d.ts +3 -0
- package/lib/utils/debug.d.ts +5 -1
- package/lib/utils/debug.js +7 -6
- package/lib/utils/deviceFeaturesUtils.js +6 -5
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
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
|
+
|
|
11
|
+
# 9.1.7
|
|
12
|
+
|
|
13
|
+
- fix(connect): correct UiRequestConfirmation type in solanaGetPublicKey (a93ea1890)
|
|
14
|
+
- chore(connect): stricter UiRequestConfirmation types (f35bd28bf)
|
|
15
|
+
- feat(connect-common): add more backend urls for solana (29f042470)
|
|
16
|
+
- chore: Throttler throttling instead of debouncing in `@trezor/blockchain-link` (#10288) (f7ff0cf9f)
|
|
17
|
+
- feat(transport): accept encoding protocols as parameter of send, receive and call methods (b64af958e)
|
|
18
|
+
- fix(connect-explorer): fs, path, fallbacks in webpack (4f5a15e32)
|
|
19
|
+
- chore(connect-common): update fw binaries to 2.6.4 (398509788)
|
|
20
|
+
- docs(connect): update index page (8cb5262f6)
|
|
21
|
+
- feat(connect-explorer): update SVG in Header component (e8d9beace)
|
|
22
|
+
- feat(connect-explorer): update favicon image (a8d660dd2)
|
|
23
|
+
- feat(connect-explorer): add Solana (799bf63f5)
|
|
24
|
+
- chore(connect): update downgraded @ethereumjs libs (9ac430c42)
|
|
25
|
+
- chore(connect): add option for chunkify solana `getAddress` method (98d234f31)
|
|
26
|
+
- fix(connect-explorer-webextension): add commitHash to webpack (6b6b77d9d)
|
|
27
|
+
- feat(suite): add Solana support (f2a89b34f)
|
|
28
|
+
- chore: add Holesky (175707861,8776bb79c)
|
|
29
|
+
- feat(connect-explorer): version docs (6ea9ef1f2)
|
|
30
|
+
- fix(connect-popup): when connect-src not same as host popup display unknown origin (1bc6f2da1)
|
|
31
|
+
- feat(connect-explorer, connect): add `chunkify` paramater to getAddress and signTx methods (7e01923f0,2926b2bdb)
|
|
32
|
+
- fix(connect-popup): handle METHOD_INFO (e6d11072b)
|
|
33
|
+
- fix(connect): support unknown (custom) internal_models (0915d8893)
|
|
34
|
+
- fix(cardano): fee estimate for set-max output (c50a8f2c7)
|
|
35
|
+
- chore(connect): use `tslib` as dependency in all public libs (606ecc63b)
|
|
36
|
+
- chore: update `jest` and related dependency (b8a321c83)
|
|
37
|
+
- chore(connect-examples): cleanup unused lines in script (b509d24d5)
|
|
38
|
+
- chore(connect-webextension): postMessage useQueue param (4e626e758)
|
|
39
|
+
- chore(repo): update tsx (53de3e3a8)
|
|
40
|
+
- chore(connect): remove Solana beta console logs (3ea8343ee)
|
|
41
|
+
- chore(docs): add link to internal description of device authenticity config update (ee9ad470a)
|
|
42
|
+
- chore(connect): add new CA pubkeys and update timestamp (b64c3f411)
|
|
43
|
+
|
|
1
44
|
# 9.1.6
|
|
2
45
|
|
|
3
46
|
- chore(connect): remove web3-utils (2f683f6)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.1.
|
|
3
|
+
API version 9.1.8
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -16,7 +16,7 @@ export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress
|
|
|
16
16
|
} | undefined;
|
|
17
17
|
confirmation(): Promise<boolean>;
|
|
18
18
|
noBackupConfirmation(): Promise<boolean>;
|
|
19
|
-
_call({ address_n, show_display }: Params): Promise<PROTO.BinanceAddress>;
|
|
19
|
+
_call({ address_n, show_display, chunkify }: Params): Promise<PROTO.BinanceAddress>;
|
|
20
20
|
run(): Promise<import("../../..").Address | import("../../..").Address[]>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -27,12 +27,14 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
27
27
|
{ name: 'path', required: true },
|
|
28
28
|
{ name: 'address', type: 'string' },
|
|
29
29
|
{ name: 'showOnTrezor', type: 'boolean' },
|
|
30
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
30
31
|
]);
|
|
31
32
|
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
32
33
|
return {
|
|
33
34
|
address_n: path,
|
|
34
35
|
address: batch.address,
|
|
35
36
|
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
37
|
+
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
36
38
|
};
|
|
37
39
|
});
|
|
38
40
|
const useEventListener = payload.useEventListener &&
|
|
@@ -79,11 +81,12 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
79
81
|
const uiResp = await uiPromise.promise;
|
|
80
82
|
return uiResp.payload;
|
|
81
83
|
}
|
|
82
|
-
async _call({ address_n, show_display }) {
|
|
84
|
+
async _call({ address_n, show_display, chunkify }) {
|
|
83
85
|
const cmd = this.device.getCommands();
|
|
84
86
|
const response = await cmd.typedCall('BinanceGetAddress', 'BinanceAddress', {
|
|
85
87
|
address_n,
|
|
86
88
|
show_display,
|
|
89
|
+
chunkify,
|
|
87
90
|
});
|
|
88
91
|
return response.message;
|
|
89
92
|
}
|
|
@@ -3,6 +3,7 @@ import type { BinancePreparedTransaction } from '../../../types/api/binance';
|
|
|
3
3
|
type Params = {
|
|
4
4
|
path: number[];
|
|
5
5
|
transaction: BinancePreparedTransaction;
|
|
6
|
+
chunkify?: boolean;
|
|
6
7
|
};
|
|
7
8
|
export default class BinanceSignTransaction extends AbstractMethod<'binanceSignTransaction', Params> {
|
|
8
9
|
init(): void;
|
|
@@ -14,19 +14,21 @@ class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
14
14
|
(0, paramsValidator_1.validateParams)(payload, [
|
|
15
15
|
{ name: 'path', type: 'string', required: true },
|
|
16
16
|
{ name: 'transaction', required: true },
|
|
17
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
17
18
|
]);
|
|
18
19
|
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
19
20
|
const transaction = helper.validate(payload.transaction);
|
|
20
21
|
this.params = {
|
|
21
22
|
path,
|
|
22
23
|
transaction,
|
|
24
|
+
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
get info() {
|
|
26
28
|
return 'Sign Binance transaction';
|
|
27
29
|
}
|
|
28
30
|
run() {
|
|
29
|
-
return helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.transaction);
|
|
31
|
+
return helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.transaction, this.params.chunkify);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
exports.default = BinanceSignTransaction;
|
|
@@ -2,5 +2,5 @@ import { PROTO } from '../../constants';
|
|
|
2
2
|
import type { BinanceSDKTransaction, BinancePreparedTransaction } from '../../types/api/binance';
|
|
3
3
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
4
4
|
export declare const validate: (tx: BinanceSDKTransaction) => BinancePreparedTransaction;
|
|
5
|
-
export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction) => Promise<PROTO.BinanceSignedTx>;
|
|
5
|
+
export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction, chunkify?: boolean) => Promise<PROTO.BinanceSignedTx>;
|
|
6
6
|
//# sourceMappingURL=binanceSignTx.d.ts.map
|
|
@@ -73,7 +73,7 @@ const validate = (tx) => {
|
|
|
73
73
|
return preparedTx;
|
|
74
74
|
};
|
|
75
75
|
exports.validate = validate;
|
|
76
|
-
const signTx = async (typedCall, address_n, tx) => {
|
|
76
|
+
const signTx = async (typedCall, address_n, tx, chunkify) => {
|
|
77
77
|
const { account_number, chain_id, memo, sequence, source, messages } = tx;
|
|
78
78
|
const msg_count = messages.length;
|
|
79
79
|
await typedCall('BinanceSignTx', 'BinanceTxRequest', {
|
|
@@ -84,6 +84,7 @@ const signTx = async (typedCall, address_n, tx) => {
|
|
|
84
84
|
memo,
|
|
85
85
|
sequence,
|
|
86
86
|
source,
|
|
87
|
+
chunkify,
|
|
87
88
|
});
|
|
88
89
|
return processTxRequest(typedCall, messages, 0);
|
|
89
90
|
};
|
|
@@ -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
|
|
@@ -16,7 +16,7 @@ export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress
|
|
|
16
16
|
} | undefined;
|
|
17
17
|
confirmation(): Promise<boolean>;
|
|
18
18
|
noBackupConfirmation(): Promise<boolean>;
|
|
19
|
-
_call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, }: Params): Promise<PROTO.CardanoAddress>;
|
|
19
|
+
_call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<PROTO.CardanoAddress>;
|
|
20
20
|
_ensureFirmwareSupportsBatch(batch: Params): void;
|
|
21
21
|
run(): Promise<import("../../..").CardanoAddress | import("../../..").CardanoAddress[]>;
|
|
22
22
|
}
|
|
@@ -31,6 +31,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
31
31
|
{ name: 'derivationType', type: 'number' },
|
|
32
32
|
{ name: 'address', type: 'string' },
|
|
33
33
|
{ name: 'showOnTrezor', type: 'boolean' },
|
|
34
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
34
35
|
]);
|
|
35
36
|
(0, cardanoAddressParameters_1.validateAddressParameters)(batch.addressParameters);
|
|
36
37
|
return {
|
|
@@ -42,6 +43,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
42
43
|
? batch.derivationType
|
|
43
44
|
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
44
45
|
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
46
|
+
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
45
47
|
};
|
|
46
48
|
});
|
|
47
49
|
const useEventListener = payload.useEventListener &&
|
|
@@ -88,7 +90,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
88
90
|
const uiResp = await uiPromise.promise;
|
|
89
91
|
return uiResp.payload;
|
|
90
92
|
}
|
|
91
|
-
async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, }) {
|
|
93
|
+
async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }) {
|
|
92
94
|
const cmd = this.device.getCommands();
|
|
93
95
|
const response = await cmd.typedCall('CardanoGetAddress', 'CardanoAddress', {
|
|
94
96
|
address_parameters,
|
|
@@ -96,6 +98,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
96
98
|
network_id,
|
|
97
99
|
derivation_type,
|
|
98
100
|
show_display,
|
|
101
|
+
chunkify,
|
|
99
102
|
});
|
|
100
103
|
return response.message;
|
|
101
104
|
}
|
|
@@ -46,6 +46,7 @@ export type CardanoSignTransactionParams = {
|
|
|
46
46
|
hash: string;
|
|
47
47
|
};
|
|
48
48
|
testnet?: boolean;
|
|
49
|
+
chunkify?: boolean;
|
|
49
50
|
};
|
|
50
51
|
export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignTransaction', CardanoSignTransactionParams> {
|
|
51
52
|
init(): void;
|
|
@@ -68,6 +68,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
68
68
|
{ name: 'includeNetworkId', type: 'boolean' },
|
|
69
69
|
{ name: 'unsignedTx', type: 'object' },
|
|
70
70
|
{ name: 'testnet', type: 'boolean' },
|
|
71
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
71
72
|
]);
|
|
72
73
|
const inputsWithPath = payload.inputs.map(cardanoInputs_1.transformInput);
|
|
73
74
|
const outputsWithData = payload.outputs.map(cardanoOutputs_1.transformOutput);
|
|
@@ -153,6 +154,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
153
154
|
includeNetworkId: payload.includeNetworkId,
|
|
154
155
|
unsignedTx: 'unsignedTx' in payload ? payload.unsignedTx : undefined,
|
|
155
156
|
testnet: 'testnet' in payload ? payload.testnet : undefined,
|
|
157
|
+
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
160
|
get info() {
|
|
@@ -254,6 +256,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
254
256
|
reference_inputs_count: this.params.referenceInputs.length,
|
|
255
257
|
derivation_type: this.params.derivationType,
|
|
256
258
|
include_network_id: this.params.includeNetworkId,
|
|
259
|
+
chunkify: this.params.chunkify,
|
|
257
260
|
};
|
|
258
261
|
await typedCall('CardanoSignTxInit', 'CardanoTxItemAck', signTxInitMessage);
|
|
259
262
|
for (const { input } of this.params.inputsWithPath) {
|
|
@@ -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
|
|
@@ -72,12 +72,14 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
|
|
|
72
72
|
const models = Object.keys(range);
|
|
73
73
|
if (coinInfo) {
|
|
74
74
|
models.forEach(model => {
|
|
75
|
-
|
|
75
|
+
const supportVersion = coinInfo.support ? coinInfo.support[model] : false;
|
|
76
|
+
if (supportVersion === false) {
|
|
76
77
|
range[model].min = '0';
|
|
77
78
|
}
|
|
78
79
|
else if (range[model].min !== '0' &&
|
|
79
|
-
|
|
80
|
-
range[model].min
|
|
80
|
+
typeof supportVersion === 'string' &&
|
|
81
|
+
utils_1.versionUtils.isNewer(supportVersion, range[model].min)) {
|
|
82
|
+
range[model].min = supportVersion;
|
|
81
83
|
}
|
|
82
84
|
});
|
|
83
85
|
}
|
|
@@ -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
|
|
@@ -18,11 +18,13 @@ class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
18
18
|
(0, paramsValidator_1.validateParams)(batch, [
|
|
19
19
|
{ name: 'path', required: true },
|
|
20
20
|
{ name: 'showOnTrezor', type: 'boolean' },
|
|
21
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
21
22
|
]);
|
|
22
23
|
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
23
24
|
return {
|
|
24
25
|
address_n: path,
|
|
25
26
|
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : false,
|
|
27
|
+
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
26
28
|
};
|
|
27
29
|
});
|
|
28
30
|
}
|
|
@@ -14,6 +14,7 @@ class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
14
14
|
(0, paramsValidator_1.validateParams)(payload, [
|
|
15
15
|
{ name: 'path', required: true },
|
|
16
16
|
{ name: 'transaction', required: true },
|
|
17
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
17
18
|
]);
|
|
18
19
|
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
19
20
|
const { chain_id, header, ack } = helper.validate(payload.transaction);
|
|
@@ -22,13 +23,14 @@ class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
22
23
|
chain_id,
|
|
23
24
|
header,
|
|
24
25
|
ack,
|
|
26
|
+
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
get info() {
|
|
28
30
|
return 'Sign EOS transaction';
|
|
29
31
|
}
|
|
30
32
|
async run() {
|
|
31
|
-
const response = await helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.chain_id, this.params.header, this.params.ack);
|
|
33
|
+
const response = await helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.chain_id, this.params.header, this.params.ack, this.params.chunkify);
|
|
32
34
|
return {
|
|
33
35
|
signature: response.signature,
|
|
34
36
|
};
|
|
@@ -13,5 +13,5 @@ export declare const validate: (tx: EosSDKTransaction) => {
|
|
|
13
13
|
};
|
|
14
14
|
ack: PROTO.EosTxActionAck[];
|
|
15
15
|
};
|
|
16
|
-
export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[]) => Promise<PROTO.EosSignedTx>;
|
|
16
|
+
export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[], chunkify: boolean) => Promise<PROTO.EosSignedTx>;
|
|
17
17
|
//# sourceMappingURL=eosSignTx.d.ts.map
|