@trezor/connect 9.0.6 → 9.0.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 +22 -2
- package/README.md +1 -1
- package/lib/api/authorizeCoinjoin.d.ts +7 -0
- package/lib/api/{authorizeCoinJoin.js → authorizeCoinjoin.js} +3 -3
- package/lib/api/bitcoin/createPendingTx.d.ts +35 -0
- package/lib/api/bitcoin/createPendingTx.js +60 -0
- package/lib/api/bitcoin/index.d.ts +1 -0
- package/lib/api/bitcoin/index.js +1 -0
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +2 -1
- package/lib/api/blockchainGetCurrentFiatRates.js +6 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +3 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +9 -1
- package/lib/api/blockchainGetTransactions.d.ts +1 -1
- package/lib/api/cardano/cardanoAuxiliaryData.js +43 -23
- package/lib/api/cardanoSignTransaction.d.ts +2 -1
- package/lib/api/cardanoSignTransaction.js +21 -11
- package/lib/api/composeTransaction.js +2 -2
- package/lib/api/ethereum/ethereumDefinitions.d.ts +7 -0
- package/lib/api/ethereum/ethereumDefinitions.js +43 -0
- package/lib/api/ethereum/ethereumSignTx.d.ts +3 -2
- package/lib/api/ethereum/ethereumSignTx.js +4 -2
- package/lib/api/ethereumGetAddress.d.ts +2 -1
- package/lib/api/ethereumGetAddress.js +19 -2
- package/lib/api/ethereumSignMessage.js +13 -0
- package/lib/api/ethereumSignTransaction.js +10 -3
- package/lib/api/ethereumSignTypedData.js +13 -0
- package/lib/api/firmware/getBinary.d.ts +3 -12
- package/lib/api/firmware/getBinary.js +5 -9
- package/lib/api/firmwareUpdate.d.ts +3 -2
- package/lib/api/firmwareUpdate.js +4 -5
- package/lib/api/getAccountInfo.d.ts +8 -8
- package/lib/api/getAccountInfo.js +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.js +3 -3
- package/lib/api/setBusy.js +1 -4
- package/lib/api/setProxy.js +1 -1
- package/lib/api/signTransaction.d.ts +2 -1
- package/lib/api/signTransaction.js +12 -2
- package/lib/api/unlockPath.js +1 -4
- package/lib/backend/Blockchain.d.ts +3 -0
- package/lib/core/AbstractMethod.d.ts +1 -0
- package/lib/core/AbstractMethod.js +9 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +24 -11
- package/lib/core/method.d.ts +1 -1
- package/lib/data/DataManager.d.ts +92 -15
- package/lib/data/DataManager.js +3 -53
- package/lib/data/config.js +9 -3
- package/lib/data/connectSettings.d.ts +0 -1
- package/lib/data/connectSettings.js +14 -58
- package/lib/data/firmwareInfo.js +48 -46
- package/lib/data/transportInfo.d.ts +1 -0
- package/lib/data/transportInfo.js +14 -1
- package/lib/data/udevInfo.d.ts +1 -0
- package/lib/data/udevInfo.js +14 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/DescriptorStream.js +1 -1
- package/lib/device/Device.js +1 -2
- package/lib/device/DeviceCommands.d.ts +1 -1
- package/lib/device/DeviceCommands.js +6 -7
- package/lib/device/DeviceList.d.ts +1 -2
- package/lib/device/DeviceList.js +27 -19
- package/lib/events/iframe.d.ts +2 -1
- package/lib/events/popup.d.ts +2 -1
- package/lib/events/transport.d.ts +2 -1
- package/lib/factory.js +1 -1
- package/lib/index.js +5 -4
- package/lib/types/api/{authorizeCoinJoin.d.ts → authorizeCoinjoin.d.ts} +3 -3
- package/lib/types/api/{authorizeCoinJoin.js → authorizeCoinjoin.js} +1 -1
- package/lib/types/api/bitcoin/index.d.ts +4 -0
- package/lib/types/api/cardano/index.d.ts +10 -9
- package/lib/types/api/firmwareUpdate.d.ts +2 -1
- package/lib/types/api/index.d.ts +2 -2
- package/lib/types/firmware.d.ts +2 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/params.d.ts +1 -0
- package/lib/types/settings.d.ts +12 -1
- package/lib/utils/firmwareUtils.d.ts +0 -1
- package/lib/utils/firmwareUtils.js +1 -9
- package/lib/utils/pathUtils.d.ts +1 -0
- package/lib/utils/pathUtils.js +3 -1
- package/lib/utils/promiseUtils.d.ts +5 -1
- package/lib/utils/promiseUtils.js +7 -3
- package/lib/utils/urlUtils.d.ts +2 -1
- package/lib/utils/urlUtils.js +18 -3
- package/lib/utils/versionUtils.d.ts +3 -1
- package/lib/utils/versionUtils.js +5 -2
- package/package.json +16 -16
- package/lib/api/authorizeCoinJoin.d.ts +0 -7
- package/lib/device/AbortController.d.ts +0 -21
- package/lib/device/AbortController.js +0 -40
- package/lib/utils/browserUtils.d.ts +0 -21
- package/lib/utils/browserUtils.js +0 -100
- package/lib/utils/windowsUtils.d.ts +0 -2
- package/lib/utils/windowsUtils.js +0 -6
|
@@ -8,6 +8,7 @@ const coinInfo_1 = require("../data/coinInfo");
|
|
|
8
8
|
const formatUtils_1 = require("../utils/formatUtils");
|
|
9
9
|
const constants_1 = require("../constants");
|
|
10
10
|
const events_1 = require("../events");
|
|
11
|
+
const ethereumDefinitions_1 = require("./ethereum/ethereumDefinitions");
|
|
11
12
|
class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
@@ -90,20 +91,33 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
90
91
|
const uiResp = await uiPromise.promise;
|
|
91
92
|
return uiResp.payload;
|
|
92
93
|
}
|
|
93
|
-
_call({ address_n, show_display }) {
|
|
94
|
+
_call({ address_n, show_display, encoded_network }) {
|
|
94
95
|
const cmd = this.device.getCommands();
|
|
95
96
|
return cmd.ethereumGetAddress({
|
|
96
97
|
address_n,
|
|
97
98
|
show_display,
|
|
99
|
+
encoded_network,
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
102
|
async run() {
|
|
103
|
+
var _a;
|
|
101
104
|
const responses = [];
|
|
102
105
|
for (let i = 0; i < this.params.length; i++) {
|
|
103
106
|
const batch = this.params[i];
|
|
107
|
+
const slip44 = (0, pathUtils_1.getSlip44ByPath)(batch.address_n);
|
|
108
|
+
const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
|
|
109
|
+
chainId: (_a = batch === null || batch === void 0 ? void 0 : batch.network) === null || _a === void 0 ? void 0 : _a.chainId,
|
|
110
|
+
slip44,
|
|
111
|
+
});
|
|
112
|
+
const definitionParams = {
|
|
113
|
+
...(definitions.encoded_network && {
|
|
114
|
+
encoded_network: definitions.encoded_network,
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
104
117
|
if (batch.show_display) {
|
|
105
118
|
const silent = await this._call({
|
|
106
119
|
...batch,
|
|
120
|
+
...definitionParams,
|
|
107
121
|
show_display: false,
|
|
108
122
|
});
|
|
109
123
|
if (typeof batch.address === 'string') {
|
|
@@ -116,7 +130,10 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
116
130
|
batch.address = silent.address;
|
|
117
131
|
}
|
|
118
132
|
}
|
|
119
|
-
const response = await this._call(
|
|
133
|
+
const response = await this._call({
|
|
134
|
+
...batch,
|
|
135
|
+
...definitionParams,
|
|
136
|
+
});
|
|
120
137
|
responses.push(response);
|
|
121
138
|
if (this.hasBundle) {
|
|
122
139
|
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
@@ -6,6 +6,7 @@ const pathUtils_1 = require("../utils/pathUtils");
|
|
|
6
6
|
const coinInfo_1 = require("../data/coinInfo");
|
|
7
7
|
const ethereumUtils_1 = require("../utils/ethereumUtils");
|
|
8
8
|
const formatUtils_1 = require("../utils/formatUtils");
|
|
9
|
+
const ethereumDefinitions_1 = require("./ethereum/ethereumDefinitions");
|
|
9
10
|
class EthereumSignMessage extends AbstractMethod_1.AbstractMethod {
|
|
10
11
|
init() {
|
|
11
12
|
this.requiredPermissions = ['read', 'write'];
|
|
@@ -30,7 +31,19 @@ class EthereumSignMessage extends AbstractMethod_1.AbstractMethod {
|
|
|
30
31
|
async run() {
|
|
31
32
|
const cmd = this.device.getCommands();
|
|
32
33
|
const { address_n, message } = this.params;
|
|
34
|
+
const network = (0, coinInfo_1.getEthereumNetwork)(address_n);
|
|
35
|
+
const slip44 = (0, pathUtils_1.getSlip44ByPath)(address_n);
|
|
36
|
+
const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
|
|
37
|
+
chainId: network === null || network === void 0 ? void 0 : network.chainId,
|
|
38
|
+
slip44,
|
|
39
|
+
});
|
|
40
|
+
const definitionParams = {
|
|
41
|
+
...(definitions.encoded_network && {
|
|
42
|
+
encoded_network: definitions.encoded_network,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
33
45
|
const response = await cmd.typedCall('EthereumSignMessage', 'EthereumMessageSignature', {
|
|
46
|
+
...definitionParams,
|
|
34
47
|
address_n,
|
|
35
48
|
message,
|
|
36
49
|
});
|
|
@@ -8,6 +8,7 @@ const coinInfo_1 = require("../data/coinInfo");
|
|
|
8
8
|
const ethereumUtils_1 = require("../utils/ethereumUtils");
|
|
9
9
|
const formatUtils_1 = require("../utils/formatUtils");
|
|
10
10
|
const helper = tslib_1.__importStar(require("./ethereum/ethereumSignTx"));
|
|
11
|
+
const ethereumDefinitions_1 = require("./ethereum/ethereumDefinitions");
|
|
11
12
|
const strip = value => {
|
|
12
13
|
if (typeof value === 'string') {
|
|
13
14
|
let stripped = (0, formatUtils_1.stripHexPrefix)(value);
|
|
@@ -71,11 +72,17 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
71
72
|
},
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
|
-
run() {
|
|
75
|
+
async run() {
|
|
75
76
|
const { tx } = this.params;
|
|
77
|
+
const slip44 = (0, pathUtils_1.getSlip44ByPath)(this.params.path);
|
|
78
|
+
const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
|
|
79
|
+
chainId: tx.chainId,
|
|
80
|
+
slip44,
|
|
81
|
+
contractAddress: tx.data ? tx.to : undefined,
|
|
82
|
+
});
|
|
76
83
|
return tx.type === 'eip1559'
|
|
77
|
-
? helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, tx.data, tx.accessList)
|
|
78
|
-
: helper.ethereumSignTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, tx.data, tx.txType);
|
|
84
|
+
? helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, tx.data, tx.accessList, definitions)
|
|
85
|
+
: helper.ethereumSignTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, tx.data, tx.txType, definitions);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
exports.default = EthereumSignTransaction;
|
|
@@ -8,6 +8,7 @@ const ethereumUtils_1 = require("../utils/ethereumUtils");
|
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const ethereumSignTypedData_1 = require("./ethereum/ethereumSignTypedData");
|
|
10
10
|
const formatUtils_1 = require("../utils/formatUtils");
|
|
11
|
+
const ethereumDefinitions_1 = require("./ethereum/ethereumDefinitions");
|
|
11
12
|
class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
|
|
12
13
|
init() {
|
|
13
14
|
this.requiredPermissions = ['read', 'write'];
|
|
@@ -59,10 +60,22 @@ class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
|
|
|
59
60
|
{ name: 'message_hash', type: 'string' },
|
|
60
61
|
]);
|
|
61
62
|
const { domain_separator_hash, message_hash } = this.params;
|
|
63
|
+
const network = (0, coinInfo_1.getEthereumNetwork)(address_n);
|
|
64
|
+
const slip44 = (0, pathUtils_1.getSlip44ByPath)(address_n);
|
|
65
|
+
const definitions = await (0, ethereumDefinitions_1.getEthereumDefinitions)({
|
|
66
|
+
chainId: network === null || network === void 0 ? void 0 : network.chainId,
|
|
67
|
+
slip44,
|
|
68
|
+
});
|
|
69
|
+
const definitionParams = {
|
|
70
|
+
...(definitions.encoded_network && {
|
|
71
|
+
encoded_network: definitions.encoded_network,
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
62
74
|
const response = await cmd.typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', {
|
|
63
75
|
address_n,
|
|
64
76
|
domain_separator_hash: domain_separator_hash,
|
|
65
77
|
message_hash,
|
|
78
|
+
...definitionParams,
|
|
66
79
|
});
|
|
67
80
|
const { address, signature } = response.message;
|
|
68
81
|
return {
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { GetInfoProps } from '../../data/firmwareInfo';
|
|
2
|
+
import { IntermediaryVersion } from '../../types';
|
|
2
3
|
interface GetBinaryProps extends GetInfoProps {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
btcOnly?: boolean;
|
|
5
6
|
version?: number[];
|
|
6
|
-
|
|
7
|
+
intermediaryVersion?: IntermediaryVersion;
|
|
7
8
|
}
|
|
8
|
-
export declare const getBinary: ({ features, releases, baseUrl, version, btcOnly,
|
|
9
|
-
binary: any;
|
|
10
|
-
} | {
|
|
11
|
-
binary: any;
|
|
12
|
-
changelog: import("../..").FirmwareRelease[] | null;
|
|
13
|
-
release: import("../..").FirmwareRelease;
|
|
14
|
-
isLatest: boolean;
|
|
15
|
-
latest: import("../..").FirmwareRelease;
|
|
16
|
-
isRequired: boolean | null;
|
|
17
|
-
isNewer: boolean | null;
|
|
18
|
-
}>;
|
|
9
|
+
export declare const getBinary: ({ features, releases, baseUrl, version, btcOnly, intermediaryVersion, }: GetBinaryProps) => any;
|
|
19
10
|
export {};
|
|
20
11
|
//# sourceMappingURL=getBinary.d.ts.map
|
|
@@ -5,13 +5,12 @@ const utils_1 = require("@trezor/utils");
|
|
|
5
5
|
const assets_1 = require("../../utils/assets");
|
|
6
6
|
const firmwareUtils_1 = require("../../utils/firmwareUtils");
|
|
7
7
|
const firmwareInfo_1 = require("../../data/firmwareInfo");
|
|
8
|
-
const getBinary =
|
|
8
|
+
const getBinary = ({ features, releases, baseUrl, version, btcOnly, intermediaryVersion, }) => {
|
|
9
9
|
if (!(0, firmwareUtils_1.isStrictFeatures)(features)) {
|
|
10
10
|
throw new Error('Features of unexpected shape provided');
|
|
11
11
|
}
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
return { binary: fw };
|
|
12
|
+
if (intermediaryVersion) {
|
|
13
|
+
return (0, assets_1.httpRequest)(`${baseUrl}/firmware/1/trezor-inter-v${intermediaryVersion}.bin`, 'binary');
|
|
15
14
|
}
|
|
16
15
|
const infoByBootloader = (0, firmwareInfo_1.getInfo)({ features, releases });
|
|
17
16
|
const releaseByFirmware = releases.find(r => version &&
|
|
@@ -26,11 +25,8 @@ const getBinary = async ({ features, releases, baseUrl, version, btcOnly, interm
|
|
|
26
25
|
if (!utils_1.versionUtils.isEqual(releaseByFirmware.version, infoByBootloader.release.version)) {
|
|
27
26
|
throw new Error('version provided as param does not match firmware version found by features in bootloader');
|
|
28
27
|
}
|
|
29
|
-
const
|
|
30
|
-
return {
|
|
31
|
-
...infoByBootloader,
|
|
32
|
-
binary: fw,
|
|
33
|
-
};
|
|
28
|
+
const fwUrl = releaseByFirmware[btcOnly ? 'url_bitcoinonly' : 'url'];
|
|
29
|
+
return (0, assets_1.httpRequest)(`${baseUrl}/${fwUrl}`, 'binary');
|
|
34
30
|
};
|
|
35
31
|
exports.getBinary = getBinary;
|
|
36
32
|
//# sourceMappingURL=getBinary.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { IntermediaryVersion } from '../types';
|
|
2
3
|
type Params = {
|
|
3
4
|
binary?: ArrayBuffer;
|
|
4
5
|
version?: number[];
|
|
5
6
|
btcOnly?: boolean;
|
|
6
|
-
baseUrl
|
|
7
|
-
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
intermediaryVersion?: IntermediaryVersion;
|
|
8
9
|
};
|
|
9
10
|
export default class FirmwareUpdate extends AbstractMethod<'firmwareUpdate', Params> {
|
|
10
11
|
init(): void;
|
|
@@ -22,14 +22,14 @@ class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
|
22
22
|
{ name: 'btcOnly', type: 'boolean' },
|
|
23
23
|
{ name: 'baseUrl', type: 'string' },
|
|
24
24
|
{ name: 'binary', type: 'array-buffer' },
|
|
25
|
-
{ name: '
|
|
25
|
+
{ name: 'intermediaryVersion', type: 'number' },
|
|
26
26
|
]);
|
|
27
27
|
if ('version' in payload) {
|
|
28
28
|
this.params = {
|
|
29
29
|
version: payload.version,
|
|
30
30
|
btcOnly: payload.btcOnly,
|
|
31
31
|
baseUrl: payload.baseUrl || 'https://data.trezor.io',
|
|
32
|
-
|
|
32
|
+
intermediaryVersion: payload.intermediaryVersion,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
if ('binary' in payload) {
|
|
@@ -61,15 +61,14 @@ class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
|
61
61
|
binary = params.binary;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
|
|
64
|
+
binary = await (0, firmware_1.getBinary)({
|
|
65
65
|
features: device.features,
|
|
66
66
|
releases: (0, firmwareInfo_1.getReleases)(device.features.major_version),
|
|
67
67
|
version: params.version,
|
|
68
68
|
btcOnly: params.btcOnly,
|
|
69
69
|
baseUrl: params.baseUrl,
|
|
70
|
-
|
|
70
|
+
intermediaryVersion: params.intermediaryVersion,
|
|
71
71
|
});
|
|
72
|
-
binary = firmware.binary;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
catch (err) {
|
|
@@ -20,18 +20,18 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
20
20
|
balance: string;
|
|
21
21
|
availableBalance: string;
|
|
22
22
|
empty: boolean;
|
|
23
|
-
tokens?: import("packages/blockchain-link/lib/
|
|
24
|
-
addresses?: import("packages/blockchain-link/lib/
|
|
23
|
+
tokens?: import("packages/blockchain-link-types/lib/common").TokenInfo[] | undefined;
|
|
24
|
+
addresses?: import("packages/blockchain-link-types/lib/common").AccountAddresses | undefined;
|
|
25
25
|
history: {
|
|
26
26
|
total: number;
|
|
27
27
|
tokens?: number | undefined;
|
|
28
28
|
unconfirmed: number;
|
|
29
|
-
transactions?: import("packages/blockchain-link/lib/
|
|
29
|
+
transactions?: import("packages/blockchain-link-types/lib/common").Transaction[] | undefined;
|
|
30
30
|
txids?: string[] | undefined;
|
|
31
31
|
};
|
|
32
32
|
misc?: {
|
|
33
33
|
nonce?: string | undefined;
|
|
34
|
-
erc20Contract?: import("packages/blockchain-link/lib/
|
|
34
|
+
erc20Contract?: import("packages/blockchain-link-types/lib/common").TokenInfo | undefined;
|
|
35
35
|
sequence?: number | undefined;
|
|
36
36
|
reserve?: string | undefined;
|
|
37
37
|
rewards?: string | undefined;
|
|
@@ -59,18 +59,18 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
59
59
|
balance: string;
|
|
60
60
|
availableBalance: string;
|
|
61
61
|
empty: boolean;
|
|
62
|
-
tokens?: import("packages/blockchain-link/lib/
|
|
63
|
-
addresses?: import("packages/blockchain-link/lib/
|
|
62
|
+
tokens?: import("packages/blockchain-link-types/lib/common").TokenInfo[] | undefined;
|
|
63
|
+
addresses?: import("packages/blockchain-link-types/lib/common").AccountAddresses | undefined;
|
|
64
64
|
history: {
|
|
65
65
|
total: number;
|
|
66
66
|
tokens?: number | undefined;
|
|
67
67
|
unconfirmed: number;
|
|
68
|
-
transactions?: import("packages/blockchain-link/lib/
|
|
68
|
+
transactions?: import("packages/blockchain-link-types/lib/common").Transaction[] | undefined;
|
|
69
69
|
txids?: string[] | undefined;
|
|
70
70
|
};
|
|
71
71
|
misc?: {
|
|
72
72
|
nonce?: string | undefined;
|
|
73
|
-
erc20Contract?: import("packages/blockchain-link/lib/
|
|
73
|
+
erc20Contract?: import("packages/blockchain-link-types/lib/common").TokenInfo | undefined;
|
|
74
74
|
sequence?: number | undefined;
|
|
75
75
|
reserve?: string | undefined;
|
|
76
76
|
rewards?: string | undefined;
|
|
@@ -287,7 +287,7 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
|
287
287
|
discovery.stop();
|
|
288
288
|
const account = discovery.accounts[uiResp.payload];
|
|
289
289
|
if (!discovery.completed) {
|
|
290
|
-
await (0, promiseUtils_1.resolveAfter)(501);
|
|
290
|
+
await (0, promiseUtils_1.resolveAfter)(501).promise;
|
|
291
291
|
}
|
|
292
292
|
const info = await blockchain.getAccountInfo({
|
|
293
293
|
descriptor: account.descriptor,
|
package/lib/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as applyFlags } from './applyFlags';
|
|
2
2
|
export { default as applySettings } from './applySettings';
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as authorizeCoinjoin } from './authorizeCoinjoin';
|
|
4
4
|
export { default as backupDevice } from './backupDevice';
|
|
5
5
|
export { default as binanceGetAddress } from './binanceGetAddress';
|
|
6
6
|
export { default as binanceGetPublicKey } from './binanceGetPublicKey';
|
package/lib/api/index.js
CHANGED
|
@@ -3,14 +3,14 @@ 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.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.
|
|
6
|
+
exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.authorizeCoinjoin = exports.applySettings = exports.applyFlags = void 0;
|
|
7
7
|
exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = void 0;
|
|
8
8
|
var applyFlags_1 = require("./applyFlags");
|
|
9
9
|
Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
|
|
10
10
|
var applySettings_1 = require("./applySettings");
|
|
11
11
|
Object.defineProperty(exports, "applySettings", { enumerable: true, get: function () { return __importDefault(applySettings_1).default; } });
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "
|
|
12
|
+
var authorizeCoinjoin_1 = require("./authorizeCoinjoin");
|
|
13
|
+
Object.defineProperty(exports, "authorizeCoinjoin", { enumerable: true, get: function () { return __importDefault(authorizeCoinjoin_1).default; } });
|
|
14
14
|
var backupDevice_1 = require("./backupDevice");
|
|
15
15
|
Object.defineProperty(exports, "backupDevice", { enumerable: true, get: function () { return __importDefault(backupDevice_1).default; } });
|
|
16
16
|
var binanceGetAddress_1 = require("./binanceGetAddress");
|
package/lib/api/setBusy.js
CHANGED
|
@@ -9,10 +9,7 @@ class SetBusy extends AbstractMethod_1.AbstractMethod {
|
|
|
9
9
|
this.requiredPermissions = ['management'];
|
|
10
10
|
const { payload } = this;
|
|
11
11
|
(0, paramsValidator_1.validateParams)(payload, [{ name: 'expiry_ms', type: 'number' }]);
|
|
12
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name,
|
|
13
|
-
1: { min: '0', max: '0' },
|
|
14
|
-
2: { min: '2.5.3', max: '0' },
|
|
15
|
-
});
|
|
12
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, undefined, this.firmwareRange);
|
|
16
13
|
this.params = {
|
|
17
14
|
expiry_ms: payload.expiry_ms,
|
|
18
15
|
};
|
package/lib/api/setProxy.js
CHANGED
|
@@ -15,7 +15,7 @@ class SetProxy extends AbstractMethod_1.AbstractMethod {
|
|
|
15
15
|
const { proxy } = DataManager_1.DataManager.getSettings();
|
|
16
16
|
const isChanged = proxy !== this.payload.proxy;
|
|
17
17
|
if (isChanged) {
|
|
18
|
-
DataManager_1.DataManager.
|
|
18
|
+
DataManager_1.DataManager.getSettings().proxy = this.payload.proxy;
|
|
19
19
|
await (0, BlockchainLink_1.reconnectAllBackends)();
|
|
20
20
|
}
|
|
21
21
|
return { message: 'Success' };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
|
-
import type { BitcoinNetworkInfo, AccountAddresses } from '../types';
|
|
3
|
+
import type { BitcoinNetworkInfo, AccountAddresses, AccountUtxo } from '../types';
|
|
4
4
|
import type { RefTransaction, TransactionOptions } from '../types/api/bitcoin';
|
|
5
5
|
type Params = {
|
|
6
6
|
inputs: PROTO.TxInputType[];
|
|
@@ -9,6 +9,7 @@ type Params = {
|
|
|
9
9
|
coinjoinRequest?: PROTO.CoinJoinRequest;
|
|
10
10
|
refTxs?: RefTransaction[];
|
|
11
11
|
addresses?: AccountAddresses;
|
|
12
|
+
utxo?: AccountUtxo[];
|
|
12
13
|
options: TransactionOptions;
|
|
13
14
|
coinInfo: BitcoinNetworkInfo;
|
|
14
15
|
push: boolean;
|
|
@@ -66,6 +66,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
66
66
|
paymentRequests: payload.paymentRequests || [],
|
|
67
67
|
refTxs,
|
|
68
68
|
addresses: payload.account ? payload.account.addresses : undefined,
|
|
69
|
+
utxo: payload.account ? payload.account.utxo : undefined,
|
|
69
70
|
options: {
|
|
70
71
|
lock_time: payload.locktime,
|
|
71
72
|
timestamp: payload.timestamp,
|
|
@@ -143,15 +144,24 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
143
144
|
if (!response.serializedTx) {
|
|
144
145
|
return response;
|
|
145
146
|
}
|
|
147
|
+
let bitcoinTx;
|
|
146
148
|
if (params.options.decred_staking_ticket) {
|
|
147
149
|
await (0, bitcoin_1.verifyTicketTx)(device.getCommands().getHDNode.bind(device.getCommands()), params.inputs, params.outputs, response.serializedTx, params.coinInfo);
|
|
148
150
|
}
|
|
149
151
|
else {
|
|
150
|
-
|
|
152
|
+
bitcoinTx = await (0, bitcoin_1.verifyTx)(device.getCommands().getHDNode.bind(device.getCommands()), params.inputs, params.outputs, response.serializedTx, params.coinInfo, params.unlockPath);
|
|
151
153
|
if (bitcoinTx.hasWitnesses()) {
|
|
152
|
-
response.witnesses = bitcoinTx.ins.map((_, i) => { var _a; return (_a = bitcoinTx.getWitness(i)) === null || _a === void 0 ? void 0 : _a.toString('hex'); });
|
|
154
|
+
response.witnesses = bitcoinTx.ins.map((_, i) => { var _a; return (_a = bitcoinTx === null || bitcoinTx === void 0 ? void 0 : bitcoinTx.getWitness(i)) === null || _a === void 0 ? void 0 : _a.toString('hex'); });
|
|
153
155
|
}
|
|
154
156
|
}
|
|
157
|
+
if (bitcoinTx && params.addresses && params.utxo) {
|
|
158
|
+
response.signedTransaction = (0, bitcoin_1.createPendingTransaction)(bitcoinTx, {
|
|
159
|
+
utxo: params.utxo,
|
|
160
|
+
addresses: params.addresses,
|
|
161
|
+
inputs: params.inputs,
|
|
162
|
+
outputs: params.outputs,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
155
165
|
if (params.push) {
|
|
156
166
|
(0, BlockchainLink_1.isBackendSupported)(params.coinInfo);
|
|
157
167
|
const blockchain = await (0, BlockchainLink_1.initBlockchain)(params.coinInfo, this.postMessage);
|
package/lib/api/unlockPath.js
CHANGED
|
@@ -7,10 +7,7 @@ class UnlockPath extends AbstractMethod_1.AbstractMethod {
|
|
|
7
7
|
init() {
|
|
8
8
|
this.requiredPermissions = ['read'];
|
|
9
9
|
this.skipFinalReload = true;
|
|
10
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name,
|
|
11
|
-
1: { min: '0', max: '0' },
|
|
12
|
-
2: { min: '2.5.3', max: '0' },
|
|
13
|
-
});
|
|
10
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, undefined, this.firmwareRange);
|
|
14
11
|
const { payload } = this;
|
|
15
12
|
(0, paramsValidator_1.validateParams)(payload, [
|
|
16
13
|
{ name: 'path', required: true },
|
|
@@ -25,12 +25,15 @@ export declare class Blockchain {
|
|
|
25
25
|
getTransactions(txs: string[]): Promise<import("@trezor/blockchain-link").TypedRawTransaction[]>;
|
|
26
26
|
getCurrentFiatRates(params: {
|
|
27
27
|
currencies?: string[];
|
|
28
|
+
token?: string;
|
|
28
29
|
}): Promise<{
|
|
29
30
|
ts: number;
|
|
30
31
|
rates: import("@trezor/blockchain-link").FiatRates;
|
|
31
32
|
}>;
|
|
32
33
|
getFiatRatesForTimestamps(params: {
|
|
34
|
+
currencies?: string[];
|
|
33
35
|
timestamps: number[];
|
|
36
|
+
token?: string;
|
|
34
37
|
}): Promise<{
|
|
35
38
|
tickers: {
|
|
36
39
|
ts: number;
|
|
@@ -52,6 +52,7 @@ export declare abstract class AbstractMethod<Name extends CallMethodPayload['met
|
|
|
52
52
|
checkPermissions(): void;
|
|
53
53
|
savePermissions(temporary?: boolean): void;
|
|
54
54
|
checkFirmwareRange(isUsingPopup?: boolean): Promise<"ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined>;
|
|
55
|
+
isManagementRestricted(): boolean | undefined;
|
|
55
56
|
abstract init(): void;
|
|
56
57
|
abstract run(): Promise<MethodReturnType<Name>>;
|
|
57
58
|
dispose(): void;
|
|
@@ -6,6 +6,7 @@ const DataManager_1 = require("../data/DataManager");
|
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const events_1 = require("../events");
|
|
8
8
|
const versionUtils_1 = require("../utils/versionUtils");
|
|
9
|
+
const urlUtils_1 = require("../utils/urlUtils");
|
|
9
10
|
class AbstractMethod {
|
|
10
11
|
constructor(message) {
|
|
11
12
|
var _a, _b;
|
|
@@ -154,6 +155,14 @@ class AbstractMethod {
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
}
|
|
158
|
+
isManagementRestricted() {
|
|
159
|
+
const { popup, origin } = DataManager_1.DataManager.getSettings();
|
|
160
|
+
if (popup && this.requiredPermissions.includes('management')) {
|
|
161
|
+
const host = (0, urlUtils_1.getHost)(origin);
|
|
162
|
+
const allowed = DataManager_1.DataManager.getConfig().management.find(item => item.origin === host || item.origin === origin);
|
|
163
|
+
return !allowed;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
157
166
|
dispose() { }
|
|
158
167
|
}
|
|
159
168
|
exports.AbstractMethod = AbstractMethod;
|
package/lib/core/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const onCall: (message: CoreMessage) => Promise<void>;
|
|
|
7
7
|
export declare class Core extends EventEmitter {
|
|
8
8
|
handleMessage(message: any, isTrustedOrigin: boolean): void;
|
|
9
9
|
dispose(): Promise<void>;
|
|
10
|
-
getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").
|
|
10
|
+
getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinjoin | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setBusy | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").unlockPath | import("../api").verifyMessage | import("../api").wipeDevice | import("../api").checkFirmwareAuthenticity)[];
|
|
11
11
|
getTransportInfo(): TransportInfo;
|
|
12
12
|
}
|
|
13
13
|
export declare const initCore: () => Core;
|
package/lib/core/index.js
CHANGED
|
@@ -21,6 +21,7 @@ let _uiPromises = [];
|
|
|
21
21
|
const _callMethods = [];
|
|
22
22
|
let _preferredDevice;
|
|
23
23
|
let _interactionTimeout;
|
|
24
|
+
let _deviceListInitTimeout;
|
|
24
25
|
const _log = (0, debug_1.initLog)('Core');
|
|
25
26
|
const postMessage = (message) => {
|
|
26
27
|
if (message.event === events_2.RESPONSE_EVENT) {
|
|
@@ -75,6 +76,7 @@ const handleMessage = (message, isTrustedOrigin = false) => {
|
|
|
75
76
|
disableWebUSBTransport();
|
|
76
77
|
break;
|
|
77
78
|
case events_2.TRANSPORT.REQUEST_DEVICE:
|
|
79
|
+
_deviceList === null || _deviceList === void 0 ? void 0 : _deviceList.enumerate();
|
|
78
80
|
break;
|
|
79
81
|
case events_2.UI.RECEIVE_DEVICE:
|
|
80
82
|
case events_2.UI.RECEIVE_CONFIRMATION:
|
|
@@ -105,7 +107,7 @@ const initDevice = async (method) => {
|
|
|
105
107
|
if (!_deviceList) {
|
|
106
108
|
throw constants_1.ERRORS.TypedError('Transport_Missing');
|
|
107
109
|
}
|
|
108
|
-
const isWebUsb = _deviceList.transportType() === '
|
|
110
|
+
const isWebUsb = _deviceList.transportType() === 'WebUsbTransport';
|
|
109
111
|
let device;
|
|
110
112
|
let showDeviceSelection = isWebUsb;
|
|
111
113
|
if (method.devicePath) {
|
|
@@ -195,9 +197,7 @@ const onCall = async (message) => {
|
|
|
195
197
|
if (!_deviceList && !DataManager_1.DataManager.getSettings('transportReconnect')) {
|
|
196
198
|
await (0, exports.initTransport)(DataManager_1.DataManager.getSettings());
|
|
197
199
|
}
|
|
198
|
-
if (
|
|
199
|
-
method.requiredPermissions.includes('management') &&
|
|
200
|
-
!DataManager_1.DataManager.isManagementAllowed()) {
|
|
200
|
+
if (method.isManagementRestricted()) {
|
|
201
201
|
postMessage((0, events_2.createPopupMessage)(events_2.POPUP.CANCEL_POPUP_REQUEST));
|
|
202
202
|
postMessage((0, events_2.createResponseMessage)(responseID, false, {
|
|
203
203
|
error: constants_1.ERRORS.TypedError('Method_NotAllowed'),
|
|
@@ -379,7 +379,7 @@ const onCall = async (message) => {
|
|
|
379
379
|
const response = messageResponse;
|
|
380
380
|
if (response) {
|
|
381
381
|
if (method.name === 'rebootToBootloader' && response.success) {
|
|
382
|
-
await (0, promiseUtils_1.resolveAfter)(1000);
|
|
382
|
+
await (0, promiseUtils_1.resolveAfter)(1000).promise;
|
|
383
383
|
await device.run(() => Promise.resolve(), { skipFinalReload: true });
|
|
384
384
|
}
|
|
385
385
|
await device.cleanup();
|
|
@@ -501,7 +501,7 @@ const handleDeviceSelectionChanges = (interruptDevice) => {
|
|
|
501
501
|
const uiPromise = findUiPromise(events_2.UI.RECEIVE_DEVICE);
|
|
502
502
|
if (uiPromise && _deviceList) {
|
|
503
503
|
const list = _deviceList.asArray();
|
|
504
|
-
const isWebUsb = _deviceList.transportType()
|
|
504
|
+
const isWebUsb = _deviceList.transportType() === 'WebUsbTransport';
|
|
505
505
|
if (list.length === 1 && !isWebUsb) {
|
|
506
506
|
uiPromise.resolve({
|
|
507
507
|
type: events_2.UI.RECEIVE_DEVICE,
|
|
@@ -563,8 +563,10 @@ const initDeviceList = async (settings) => {
|
|
|
563
563
|
_deviceList = undefined;
|
|
564
564
|
postMessage((0, events_2.createTransportMessage)(events_2.TRANSPORT.ERROR, { error }));
|
|
565
565
|
if (settings.transportReconnect) {
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
const { promise, timeout } = (0, promiseUtils_1.resolveAfter)(1000, null);
|
|
567
|
+
_deviceListInitTimeout = timeout;
|
|
568
|
+
await promise;
|
|
569
|
+
initDeviceList(settings);
|
|
568
570
|
}
|
|
569
571
|
});
|
|
570
572
|
_deviceList.on(events_2.TRANSPORT.START, transportType => postMessage((0, events_2.createTransportMessage)(events_2.TRANSPORT.START, transportType)));
|
|
@@ -580,7 +582,9 @@ const initDeviceList = async (settings) => {
|
|
|
580
582
|
throw error;
|
|
581
583
|
}
|
|
582
584
|
else {
|
|
583
|
-
|
|
585
|
+
const { promise, timeout } = (0, promiseUtils_1.resolveAfter)(3000, null);
|
|
586
|
+
_deviceListInitTimeout = timeout;
|
|
587
|
+
await promise;
|
|
584
588
|
await initDeviceList(settings);
|
|
585
589
|
}
|
|
586
590
|
}
|
|
@@ -591,6 +595,9 @@ class Core extends events_1.default {
|
|
|
591
595
|
}
|
|
592
596
|
async dispose() {
|
|
593
597
|
(0, BlockchainLink_1.dispose)();
|
|
598
|
+
if (_deviceListInitTimeout) {
|
|
599
|
+
clearTimeout(_deviceListInitTimeout);
|
|
600
|
+
}
|
|
594
601
|
this.removeAllListeners();
|
|
595
602
|
if (_deviceList) {
|
|
596
603
|
await _deviceList.dispose();
|
|
@@ -646,12 +653,18 @@ const initTransport = async (settings) => {
|
|
|
646
653
|
};
|
|
647
654
|
exports.initTransport = initTransport;
|
|
648
655
|
const disableWebUSBTransport = async () => {
|
|
656
|
+
var _a, _b;
|
|
649
657
|
if (!_deviceList)
|
|
650
658
|
return;
|
|
651
|
-
if (_deviceList.transportType() !== '
|
|
659
|
+
if (_deviceList.transportType() !== 'WebUsbTransport')
|
|
652
660
|
return;
|
|
653
661
|
const settings = DataManager_1.DataManager.getSettings();
|
|
654
|
-
settings.
|
|
662
|
+
if ((_a = settings.transports) === null || _a === void 0 ? void 0 : _a.includes('WebUsbTransport')) {
|
|
663
|
+
settings.transports.splice(settings.transports.indexOf('WebUsbTransport'));
|
|
664
|
+
}
|
|
665
|
+
if (!((_b = settings.transports) === null || _b === void 0 ? void 0 : _b.includes('BridgeTransport'))) {
|
|
666
|
+
settings.transports.unshift('BridgeTransport');
|
|
667
|
+
}
|
|
655
668
|
try {
|
|
656
669
|
await _deviceList.dispose();
|
|
657
670
|
await initDeviceList(settings);
|
package/lib/core/method.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import * as Methods from '../api';
|
|
|
2
2
|
import type { IFrameCallMessage } from '../events';
|
|
3
3
|
export declare const getMethod: (message: IFrameCallMessage & {
|
|
4
4
|
id?: number;
|
|
5
|
-
}) => Methods.applyFlags | Methods.applySettings | Methods.
|
|
5
|
+
}) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinjoin | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setBusy | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.unlockPath | Methods.verifyMessage | Methods.wipeDevice | Methods.checkFirmwareAuthenticity;
|
|
6
6
|
//# sourceMappingURL=method.d.ts.map
|