@trezor/connect 9.6.0 → 9.6.1-beta.2
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 +37 -8
- package/README.md +1 -1
- package/lib/api/blockchainEstimateFee.js +1 -0
- package/lib/api/discoverAccounts.js +10 -2
- package/lib/api/eos/eosSignTx.d.ts +3 -3
- package/lib/api/ethereum/api/ethereumSignMessage.js +1 -1
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +1 -1
- package/lib/api/firmware/getBinary.js +2 -2
- package/lib/api/getAddress.d.ts +1 -0
- package/lib/api/getAddress.js +1 -0
- package/lib/api/getCoinInfo.d.ts +3 -3
- package/lib/api/getNonce.d.ts +9 -0
- package/lib/api/getNonce.js +15 -0
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +4 -2
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/resetDevice.d.ts +2 -3
- package/lib/api/resetDevice.js +47 -49
- package/lib/api/signMessage.js +1 -1
- package/lib/api/signTransaction.js +6 -1
- package/lib/backend/Blockchain.d.ts +1 -0
- package/lib/backend/fees/BitcoinFeeLevels.d.ts +2 -4
- package/lib/backend/fees/BitcoinFeeLevels.js +11 -73
- package/lib/backend/fees/EthereumFeeLevels.d.ts +1 -3
- package/lib/backend/fees/EthereumFeeLevels.js +8 -5
- package/lib/backend/fees/MiscFeeLevels.d.ts +0 -3
- package/lib/backend/fees/MiscFeeLevels.js +2 -2
- package/lib/constants/errors.d.ts +1 -0
- package/lib/constants/errors.js +1 -0
- package/lib/core/AbstractMethod.d.ts +1 -1
- package/lib/core/index.js +43 -53
- package/lib/core/onCallFirmwareUpdate.js +2 -2
- package/lib/data/coinInfo.d.ts +11 -11
- package/lib/data/coinInfo.js +1 -1
- package/lib/data/connectSettings.js +0 -3
- package/lib/data/defaultFeeLevels.d.ts +3 -1
- package/lib/data/defaultFeeLevels.js +22 -12
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/firmwareInfo.d.ts +1 -0
- package/lib/data/firmwareInfo.js +14 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +20 -21
- package/lib/device/Device.js +78 -123
- package/lib/device/DeviceCurrentSession.d.ts +441 -4027
- package/lib/device/DeviceCurrentSession.js +75 -44
- package/lib/device/DeviceList.d.ts +3 -8
- package/lib/device/DeviceList.js +21 -77
- package/lib/device/TransportManager.d.ts +2 -6
- package/lib/device/TransportManager.js +11 -7
- package/lib/device/checkFirmwareRevision.js +2 -2
- package/lib/device/workflow/index.d.ts +2 -0
- package/lib/device/workflow/index.js +6 -0
- package/lib/device/workflow/validateState.d.ts +3 -0
- package/lib/device/workflow/validateState.js +97 -0
- package/lib/events/device.d.ts +19 -1
- package/lib/events/device.js +2 -0
- package/lib/events/index.d.ts +4 -0
- package/lib/events/ui-request.d.ts +24 -3
- package/lib/events/ui-request.js +3 -0
- package/lib/events/ui-response.d.ts +11 -1
- package/lib/events/ui-response.js +1 -0
- package/lib/factory.js +1 -0
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/applySettings.d.ts +1 -0
- package/lib/types/api/discoverAccounts.d.ts +17 -4
- package/lib/types/api/discoverAccounts.js +2 -0
- package/lib/types/api/getNonce.d.ts +4 -0
- package/lib/types/api/getNonce.js +3 -0
- package/lib/types/api/index.d.ts +2 -0
- package/lib/types/coinInfo.d.ts +6 -6
- package/lib/types/coinInfo.js +2 -0
- package/lib/types/device.d.ts +3 -4
- package/lib/types/fees.d.ts +1 -1
- package/lib/types/fees.js +1 -1
- package/lib/types/params.d.ts +1 -0
- package/lib/types/settings.d.ts +0 -1
- package/lib/types/workflow.d.ts +8 -0
- package/lib/types/workflow.js +3 -0
- package/lib/utils/formatUtils.d.ts +1 -0
- package/lib/utils/formatUtils.js +9 -1
- package/lib/utils/uiPromiseManager.d.ts +2 -0
- package/package.json +17 -17
- package/lib/data/downloadReleasesMetadata.d.ts +0 -7
- package/lib/data/downloadReleasesMetadata.js +0 -18
- package/lib/data/models.d.ts +0 -8
- package/lib/data/models.js +0 -49
|
@@ -6,6 +6,7 @@ export declare const hasHexPrefix: (str: string) => boolean;
|
|
|
6
6
|
export declare const stripHexPrefix: (str: string) => string;
|
|
7
7
|
export declare const addHexPrefix: (str: string) => `0x${string}`;
|
|
8
8
|
export declare const messageToHex: (message: string) => string;
|
|
9
|
+
export declare const hexToText: (hex: string) => string;
|
|
9
10
|
export declare const deepTransform: <V>(transform: (str: string) => V) => <T>(value: T) => DeepTransformed<T, V>;
|
|
10
11
|
type DeepTransformed<T, V> = T extends string ? V : T extends (infer U)[] ? DeepTransformed<U, V>[] : T extends object ? {
|
|
11
12
|
[K in keyof T]: DeepTransformed<T[K], V>;
|
package/lib/utils/formatUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deepTransform = exports.messageToHex = exports.addHexPrefix = exports.stripHexPrefix = exports.hasHexPrefix = exports.btckb2satoshib = exports.formatTime = exports.formatAmount = void 0;
|
|
3
|
+
exports.deepTransform = exports.hexToText = exports.messageToHex = exports.addHexPrefix = exports.stripHexPrefix = exports.hasHexPrefix = exports.btckb2satoshib = exports.formatTime = exports.formatAmount = void 0;
|
|
4
4
|
const bigNumber_1 = require("@trezor/utils/lib/bigNumber");
|
|
5
5
|
const formatAmount = (n, coinInfo) => `${new bigNumber_1.BigNumber(n).div(10 ** coinInfo.decimals).toString(10)} ${coinInfo.shortcut}`;
|
|
6
6
|
exports.formatAmount = formatAmount;
|
|
@@ -55,6 +55,14 @@ const messageToHex = (message) => {
|
|
|
55
55
|
return buffer.toString('hex');
|
|
56
56
|
};
|
|
57
57
|
exports.messageToHex = messageToHex;
|
|
58
|
+
const hexToText = (hex) => {
|
|
59
|
+
const clean = (0, exports.messageToHex)(hex);
|
|
60
|
+
const text = Buffer.from(clean, 'hex').toString('utf8');
|
|
61
|
+
if (/[\uFFFD]/.test(text))
|
|
62
|
+
return hex;
|
|
63
|
+
return text;
|
|
64
|
+
};
|
|
65
|
+
exports.hexToText = hexToText;
|
|
58
66
|
const deepTransform = (transform) => {
|
|
59
67
|
const recursion = (value) => {
|
|
60
68
|
if (typeof value === 'string') {
|
|
@@ -22,6 +22,8 @@ export declare const createUiPromiseManager: (interactionTimeout: () => void) =>
|
|
|
22
22
|
type: T;
|
|
23
23
|
}> | Extract<import("../events").UiResponsePassphrase, {
|
|
24
24
|
type: T;
|
|
25
|
+
}> | Extract<import("../events").UiResponseThpPairingTag, {
|
|
26
|
+
type: T;
|
|
25
27
|
}> | Extract<import("../events").UiResponsePassphraseAction, {
|
|
26
28
|
type: T;
|
|
27
29
|
}> | Extract<import("../events").UiResponseAccount, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.1-beta.2",
|
|
4
4
|
"author": "Trezor <info@trezor.io>",
|
|
5
5
|
"homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
|
|
6
6
|
"description": "High-level javascript interface for Trezor hardware wallet.",
|
|
@@ -74,25 +74,25 @@
|
|
|
74
74
|
"@mobily/ts-belt": "^3.13.1",
|
|
75
75
|
"@noble/hashes": "^1.6.1",
|
|
76
76
|
"@scure/bip39": "^1.5.1",
|
|
77
|
-
"@solana-program/compute-budget": "^0.
|
|
77
|
+
"@solana-program/compute-budget": "^0.8.0",
|
|
78
78
|
"@solana-program/system": "^0.7.0",
|
|
79
79
|
"@solana-program/token": "^0.5.1",
|
|
80
|
-
"@solana-program/token-2022": "^0.4.
|
|
80
|
+
"@solana-program/token-2022": "^0.4.2",
|
|
81
81
|
"@solana/kit": "^2.1.1",
|
|
82
|
-
"@trezor/blockchain-link": "2.5.
|
|
83
|
-
"@trezor/blockchain-link-types": "1.4.
|
|
84
|
-
"@trezor/blockchain-link-utils": "1.4.
|
|
85
|
-
"@trezor/connect-analytics": "1.3.
|
|
86
|
-
"@trezor/connect-common": "0.4.
|
|
82
|
+
"@trezor/blockchain-link": "2.5.1-beta.1",
|
|
83
|
+
"@trezor/blockchain-link-types": "1.4.1-beta.1",
|
|
84
|
+
"@trezor/blockchain-link-utils": "1.4.1-beta.1",
|
|
85
|
+
"@trezor/connect-analytics": "1.3.4-beta.1",
|
|
86
|
+
"@trezor/connect-common": "0.4.1-beta.1",
|
|
87
87
|
"@trezor/crypto-utils": "1.1.3",
|
|
88
|
-
"@trezor/device-utils": "1.1.
|
|
89
|
-
"@trezor/protobuf": "1.4.
|
|
90
|
-
"@trezor/protocol": "1.2.
|
|
88
|
+
"@trezor/device-utils": "1.1.1-beta.2",
|
|
89
|
+
"@trezor/protobuf": "1.4.1-beta.1",
|
|
90
|
+
"@trezor/protocol": "1.2.7-beta.1",
|
|
91
91
|
"@trezor/schema-utils": "1.3.3",
|
|
92
|
-
"@trezor/transport": "1.5.
|
|
93
|
-
"@trezor/type-utils": "1.1.
|
|
94
|
-
"@trezor/utils": "9.4.
|
|
95
|
-
"@trezor/utxo-lib": "2.4.
|
|
92
|
+
"@trezor/transport": "1.5.1-beta.1",
|
|
93
|
+
"@trezor/type-utils": "1.1.7-beta.1",
|
|
94
|
+
"@trezor/utils": "9.4.1-beta.2",
|
|
95
|
+
"@trezor/utxo-lib": "2.4.1-beta.1",
|
|
96
96
|
"blakejs": "^1.2.1",
|
|
97
97
|
"bs58": "^6.0.0",
|
|
98
98
|
"bs58check": "^4.0.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@trezor/trezor-user-env-link": "1.0.2",
|
|
105
105
|
"@types/karma": "^6.3.9",
|
|
106
106
|
"babel-loader": "^10.0.0",
|
|
107
|
-
"jest": "
|
|
107
|
+
"jest": "30.0.0",
|
|
108
108
|
"karma": "^6.4.4",
|
|
109
109
|
"karma-babel-preprocessor": "^8.0.2",
|
|
110
110
|
"karma-chrome-launcher": "^3.2.0",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"ts-node": "^10.9.2",
|
|
118
118
|
"tsx": "^4.19.3",
|
|
119
119
|
"web3-utils": "^4.3.2",
|
|
120
|
-
"webpack": "5.
|
|
120
|
+
"webpack": "5.99.9",
|
|
121
121
|
"ws": "^8.18.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FirmwareRelease } from '@trezor/device-utils';
|
|
2
|
-
type DownloadReleasesMetadataParams = {
|
|
3
|
-
internal_model: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const downloadReleasesMetadata: ({ internal_model, }: DownloadReleasesMetadataParams) => Promise<FirmwareRelease[]>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=downloadReleasesMetadata.d.ts.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.downloadReleasesMetadata = void 0;
|
|
4
|
-
const assets_1 = require("../utils/assets");
|
|
5
|
-
const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
6
|
-
const downloadReleasesMetadata = async ({ internal_model, }) => {
|
|
7
|
-
const url = `https://data.trezor.io/firmware/${internal_model.toLowerCase()}/releases.json`;
|
|
8
|
-
const response = await (0, assets_1.httpRequest)(url, 'json', {
|
|
9
|
-
signal: AbortSignal.timeout(10000),
|
|
10
|
-
skipLocalForceDownload: true,
|
|
11
|
-
});
|
|
12
|
-
if ((0, firmwareUtils_1.isValidReleases)(response)) {
|
|
13
|
-
return response;
|
|
14
|
-
}
|
|
15
|
-
return [];
|
|
16
|
-
};
|
|
17
|
-
exports.downloadReleasesMetadata = downloadReleasesMetadata;
|
|
18
|
-
//# sourceMappingURL=downloadReleasesMetadata.js.map
|
package/lib/data/models.d.ts
DELETED
package/lib/data/models.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.models = void 0;
|
|
4
|
-
const safe3Model = {
|
|
5
|
-
name: 'Trezor Safe 3',
|
|
6
|
-
colors: {
|
|
7
|
-
'1': 'Cosmic Black',
|
|
8
|
-
'2': 'Stellar Silver',
|
|
9
|
-
'3': 'Solar Gold',
|
|
10
|
-
'4': 'Galactic Rose',
|
|
11
|
-
'5': 'Bitcoin Orange',
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
exports.models = {
|
|
15
|
-
UNKNOWN: {
|
|
16
|
-
name: 'Unknown',
|
|
17
|
-
colors: safe3Model.colors,
|
|
18
|
-
},
|
|
19
|
-
T1B1: {
|
|
20
|
-
name: 'Trezor Model One',
|
|
21
|
-
colors: {},
|
|
22
|
-
},
|
|
23
|
-
T2T1: {
|
|
24
|
-
name: 'Trezor Model T',
|
|
25
|
-
colors: {},
|
|
26
|
-
},
|
|
27
|
-
T2B1: safe3Model,
|
|
28
|
-
T3B1: safe3Model,
|
|
29
|
-
T3T1: {
|
|
30
|
-
name: 'Trezor Safe 5',
|
|
31
|
-
colors: {
|
|
32
|
-
'1': 'Black Graphite',
|
|
33
|
-
'2': 'Violet Ore',
|
|
34
|
-
'3': 'Green Beryl',
|
|
35
|
-
'4': 'Bitcoin Orange',
|
|
36
|
-
'5': 'Freedom Edition',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
T3W1: {
|
|
40
|
-
name: 'Trezor Safe 7',
|
|
41
|
-
colors: {
|
|
42
|
-
'1': 'Fantastic Ethereum',
|
|
43
|
-
'2': 'Lunatic Dogecoin',
|
|
44
|
-
'3': 'Galactic Litecoin',
|
|
45
|
-
'4': 'Majestic Bitcoin',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=models.js.map
|