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