@trezor/connect 9.6.2-beta.1 → 9.6.2-beta.3
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 +6 -6
- package/README.md +1 -1
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +1 -1
- package/lib/api/ethereum/api/ethereumSignTypedData.js +12 -2
- package/lib/api/firmware/uploadFirmware.js +15 -1
- package/lib/core/onCallFirmwareUpdate.js +1 -3
- package/lib/data/coinInfo.d.ts +0 -64
- package/lib/data/coinInfo.js +1 -40
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.js +2 -2
- package/lib/device/DeviceCurrentSession.js +1 -0
- package/lib/types/device.d.ts +2 -3
- package/lib/utils/assetUtils.js +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
| Package | Stable | Canary |
|
|
2
2
|
| :------------------------------: | :----: | :----------: |
|
|
3
|
-
| npm @trezor/connect | 9.6.1 | 9.6.2-beta.
|
|
4
|
-
| npm @trezor/connect-web | 9.6.1 | 9.6.2-beta.
|
|
5
|
-
| npm @trezor/connect-webextension | 9.6.1 | 9.6.2-beta.
|
|
6
|
-
| npm @trezor/connect-mobile | 9.6.1 | 9.6.2-beta.
|
|
3
|
+
| npm @trezor/connect | 9.6.1 | 9.6.2-beta.3 |
|
|
4
|
+
| npm @trezor/connect-web | 9.6.1 | 9.6.2-beta.3 |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.6.1 | 9.6.2-beta.3 |
|
|
6
|
+
| npm @trezor/connect-mobile | 9.6.1 | 9.6.2-beta.3 |
|
|
7
7
|
|
|
8
8
|
| Deployment | Stable | Canary |
|
|
9
9
|
| :----------------: | :----: | :----------: |
|
|
10
|
-
| connect.trezor.io/ | 9.6.1 | 9.6.2-beta.
|
|
10
|
+
| connect.trezor.io/ | 9.6.1 | 9.6.2-beta.3 |
|
|
11
11
|
|
|
12
12
|
Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
|
|
13
13
|
|
|
14
|
-
# 9.6.2-beta.
|
|
14
|
+
# 9.6.2-beta.3
|
|
15
15
|
|
|
16
16
|
This release is important for smooth support of 2.9.0 trezor firmware, namely commits:
|
|
17
17
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.6.2-beta.
|
|
3
|
+
API version 9.6.2-beta.3
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -99,7 +99,7 @@ export default class EthereumSignTypedData extends AbstractMethod<'ethereumSignT
|
|
|
99
99
|
init(): void;
|
|
100
100
|
initAsync(): Promise<void>;
|
|
101
101
|
get info(): string;
|
|
102
|
-
getButtonRequestData(code: string): {
|
|
102
|
+
getButtonRequestData(code: string, name?: string): {
|
|
103
103
|
type: "message";
|
|
104
104
|
coin: string;
|
|
105
105
|
serializedPath: string;
|
|
@@ -74,8 +74,18 @@ class EthereumSignTypedData extends AbstractMethod_1.AbstractMethod {
|
|
|
74
74
|
get info() {
|
|
75
75
|
return (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK typed data', (0, coinInfo_1.getEthereumNetwork)(this.params.address_n));
|
|
76
76
|
}
|
|
77
|
-
getButtonRequestData(code) {
|
|
78
|
-
if (code === 'ButtonRequest_Other'
|
|
77
|
+
getButtonRequestData(code, name) {
|
|
78
|
+
if ((code === 'ButtonRequest_Other' &&
|
|
79
|
+
name &&
|
|
80
|
+
[
|
|
81
|
+
'should_show_domain',
|
|
82
|
+
'should_show_struct',
|
|
83
|
+
'should_show_array',
|
|
84
|
+
'confirm_typed_value',
|
|
85
|
+
'confirm_empty_typed_message',
|
|
86
|
+
'confirm_typed_data_final',
|
|
87
|
+
].includes(name)) ||
|
|
88
|
+
code === 'ButtonRequest_SignTx') {
|
|
79
89
|
return {
|
|
80
90
|
type: 'message',
|
|
81
91
|
coin: this.params.network?.shortcut ?? 'ETH',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadFirmware = void 0;
|
|
4
|
+
const transport_1 = require("@trezor/transport");
|
|
4
5
|
const constants_1 = require("../../constants");
|
|
5
6
|
const events_1 = require("../../events");
|
|
6
7
|
const postConfirmationMessage = (device) => {
|
|
@@ -41,16 +42,29 @@ const uploadFirmware = async (typedCall, postMessage, device, { payload }) => {
|
|
|
41
42
|
if (device.features.major_version === 2) {
|
|
42
43
|
postConfirmationMessage(device);
|
|
43
44
|
const length = payload.byteLength;
|
|
45
|
+
let progress = 0;
|
|
44
46
|
let response = await typedCall('FirmwareErase', ['FirmwareRequest', 'Success'], { length });
|
|
45
47
|
while (response.type !== 'Success') {
|
|
46
48
|
const start = response.message.offset;
|
|
47
49
|
const end = response.message.offset + response.message.length;
|
|
48
50
|
const chunk = payload.slice(start, end);
|
|
51
|
+
const progressStart = Math.round((start / length) * 100);
|
|
52
|
+
const progressEnd = Math.round((end / length) * 100);
|
|
53
|
+
const progressDiff = progressEnd - progressStart;
|
|
54
|
+
device.transport.on(transport_1.TRANSPORT.SEND_MESSAGE_PROGRESS, p => {
|
|
55
|
+
const newProgress = progressStart + Math.floor(progressDiff * p);
|
|
56
|
+
if (start > 0 && newProgress > progress) {
|
|
57
|
+
progress = newProgress;
|
|
58
|
+
postProgressMessage(device, progress, postMessage);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
49
61
|
if (start > 0) {
|
|
50
|
-
postProgressMessage(device,
|
|
62
|
+
postProgressMessage(device, progressStart, postMessage);
|
|
51
63
|
}
|
|
52
64
|
response = await typedCall('FirmwareUpload', ['FirmwareRequest', 'Success'], {
|
|
53
65
|
payload: chunk,
|
|
66
|
+
}).finally(() => {
|
|
67
|
+
device.transport.removeAllListeners(transport_1.TRANSPORT.SEND_MESSAGE_PROGRESS);
|
|
54
68
|
});
|
|
55
69
|
}
|
|
56
70
|
postProgressMessage(device, 100, postMessage);
|
|
@@ -92,9 +92,7 @@ const getInstallationParams = (device, params) => {
|
|
|
92
92
|
const isUpdatingToEqualFirmwareType = (device.firmwareType === 'bitcoin-only') === btcOnly;
|
|
93
93
|
const upgrade = device.atLeast('2.6.3') && isUpdatingToNewerVersion && isUpdatingToEqualFirmwareType;
|
|
94
94
|
const manual = !device.atLeast(['1.10.0', '2.6.0']) && !upgrade;
|
|
95
|
-
const language =
|
|
96
|
-
device.features.internal_model !== constants_1.PROTO.DeviceModelInternal.T2T1 &&
|
|
97
|
-
device.features.internal_model !== constants_1.PROTO.DeviceModelInternal.T3T1;
|
|
95
|
+
const language = false;
|
|
98
96
|
return {
|
|
99
97
|
manual,
|
|
100
98
|
upgrade,
|
package/lib/data/coinInfo.d.ts
CHANGED
|
@@ -229,70 +229,6 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
|
|
|
229
229
|
};
|
|
230
230
|
isBitcoin: boolean;
|
|
231
231
|
};
|
|
232
|
-
export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
|
|
233
|
-
blockchainLink?: {
|
|
234
|
-
type: string;
|
|
235
|
-
url: string[];
|
|
236
|
-
} | undefined;
|
|
237
|
-
label: string;
|
|
238
|
-
blockTime: number;
|
|
239
|
-
minFee: number;
|
|
240
|
-
maxFee: number;
|
|
241
|
-
minPriorityFee: number;
|
|
242
|
-
name: string;
|
|
243
|
-
shortcut: string;
|
|
244
|
-
slip44: number;
|
|
245
|
-
support: {
|
|
246
|
-
T1B1: string | false;
|
|
247
|
-
T2T1: string | false;
|
|
248
|
-
T2B1: string | false;
|
|
249
|
-
T3B1: string | false;
|
|
250
|
-
T3T1: string | false;
|
|
251
|
-
T3W1: string | false;
|
|
252
|
-
UNKNOWN: string | false;
|
|
253
|
-
connect: boolean;
|
|
254
|
-
};
|
|
255
|
-
decimals: number;
|
|
256
|
-
defaultFees: {
|
|
257
|
-
feePerTx?: string | undefined;
|
|
258
|
-
feeLimit?: string | undefined;
|
|
259
|
-
baseFeePerGas?: string | undefined;
|
|
260
|
-
maxFeePerGas?: string | undefined;
|
|
261
|
-
maxPriorityFeePerGas?: string | undefined;
|
|
262
|
-
label: "normal" | "custom" | "high" | "economy" | "low";
|
|
263
|
-
blocks: number;
|
|
264
|
-
feePerUnit: string;
|
|
265
|
-
}[];
|
|
266
|
-
} & {
|
|
267
|
-
cashAddrPrefix?: string | undefined;
|
|
268
|
-
xPubMagicSegwitNative?: number | undefined;
|
|
269
|
-
xPubMagicSegwit?: number | undefined;
|
|
270
|
-
taproot?: boolean | undefined;
|
|
271
|
-
type: "bitcoin";
|
|
272
|
-
dustLimit: number;
|
|
273
|
-
curveName: string;
|
|
274
|
-
forceBip143: boolean;
|
|
275
|
-
hashGenesisBlock: string;
|
|
276
|
-
maxAddressLength: number;
|
|
277
|
-
maxFeeSatoshiKb: number;
|
|
278
|
-
minAddressLength: number;
|
|
279
|
-
minFeeSatoshiKb: number;
|
|
280
|
-
segwit: boolean;
|
|
281
|
-
xPubMagic: number;
|
|
282
|
-
network: {
|
|
283
|
-
forkId?: number | undefined;
|
|
284
|
-
messagePrefix: string;
|
|
285
|
-
bech32: string;
|
|
286
|
-
bip32: {
|
|
287
|
-
public: number;
|
|
288
|
-
private: number;
|
|
289
|
-
};
|
|
290
|
-
pubKeyHash: number;
|
|
291
|
-
scriptHash: number;
|
|
292
|
-
wif: number;
|
|
293
|
-
};
|
|
294
|
-
isBitcoin: boolean;
|
|
295
|
-
};
|
|
296
232
|
export declare const getCoinInfo: (currency: string) => ({
|
|
297
233
|
blockchainLink?: {
|
|
298
234
|
type: string;
|
package/lib/data/coinInfo.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllNetworks = exports.getUniqueNetworks = exports.parseCoinsJson = exports.ethereumNetworkInfoBase = exports.getCoinName = exports.getCoinInfo = exports.
|
|
3
|
+
exports.getAllNetworks = exports.getUniqueNetworks = exports.parseCoinsJson = exports.ethereumNetworkInfoBase = exports.getCoinName = exports.getCoinInfo = exports.fixCoinInfoNetwork = exports.getBech32Network = exports.getSegwitNetwork = exports.getMiscNetwork = exports.getEthereumNetwork = exports.getBitcoinNetwork = void 0;
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
5
|
const defaultFeeLevels_1 = require("./defaultFeeLevels");
|
|
6
|
-
const constants_1 = require("../constants");
|
|
7
6
|
const pathUtils_1 = require("../utils/pathUtils");
|
|
8
7
|
const bitcoinNetworks = [];
|
|
9
8
|
const ethereumNetworks = [];
|
|
@@ -86,44 +85,6 @@ const fixCoinInfoNetwork = (ci, path) => {
|
|
|
86
85
|
return coinInfo;
|
|
87
86
|
};
|
|
88
87
|
exports.fixCoinInfoNetwork = fixCoinInfoNetwork;
|
|
89
|
-
const detectBtcVersion = (data) => {
|
|
90
|
-
if (data.subversion == null) {
|
|
91
|
-
return 'btc';
|
|
92
|
-
}
|
|
93
|
-
if (data.subversion.startsWith('/Bitcoin ABC')) {
|
|
94
|
-
return 'bch';
|
|
95
|
-
}
|
|
96
|
-
if (data.subversion.startsWith('/Bitcoin Cash')) {
|
|
97
|
-
return 'bch';
|
|
98
|
-
}
|
|
99
|
-
if (data.subversion.startsWith('/Bitcoin Gold')) {
|
|
100
|
-
return 'btg';
|
|
101
|
-
}
|
|
102
|
-
return 'btc';
|
|
103
|
-
};
|
|
104
|
-
const getCoinInfoByHash = (hash, networkInfo) => {
|
|
105
|
-
const networks = (0, utils_1.cloneObject)(bitcoinNetworks);
|
|
106
|
-
const result = networks.find(info => hash.toLowerCase() === info.hashGenesisBlock.toLowerCase());
|
|
107
|
-
if (!result) {
|
|
108
|
-
throw constants_1.ERRORS.TypedError('Method_UnknownCoin', `Coin info not found for hash: ${hash} ${networkInfo.hashGenesisBlock}`);
|
|
109
|
-
}
|
|
110
|
-
if (result.isBitcoin) {
|
|
111
|
-
const btcVersion = detectBtcVersion(networkInfo);
|
|
112
|
-
let fork;
|
|
113
|
-
if (btcVersion === 'bch') {
|
|
114
|
-
fork = networks.find(info => info.name === 'Bcash');
|
|
115
|
-
}
|
|
116
|
-
else if (btcVersion === 'btg') {
|
|
117
|
-
fork = networks.find(info => info.name === 'Bgold');
|
|
118
|
-
}
|
|
119
|
-
if (fork) {
|
|
120
|
-
return fork;
|
|
121
|
-
}
|
|
122
|
-
throw constants_1.ERRORS.TypedError('Method_UnknownCoin', `Coin info not found for hash: ${hash} ${networkInfo.hashGenesisBlock} BTC version:${btcVersion}`);
|
|
123
|
-
}
|
|
124
|
-
return result;
|
|
125
|
-
};
|
|
126
|
-
exports.getCoinInfoByHash = getCoinInfoByHash;
|
|
127
88
|
const getCoinInfo = (currency) => (0, exports.getBitcoinNetwork)(currency) || (0, exports.getEthereumNetwork)(currency) || (0, exports.getMiscNetwork)(currency);
|
|
128
89
|
exports.getCoinInfo = getCoinInfo;
|
|
129
90
|
const getCoinName = (path) => {
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEEPLINK_VERSION = exports.CONTENT_SCRIPT_VERSION = exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.6.2-beta.
|
|
4
|
+
exports.VERSION = '9.6.2-beta.3';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
const isBeta = exports.VERSION.includes('beta');
|
|
7
7
|
exports.DEFAULT_DOMAIN = isBeta
|
package/lib/device/Device.js
CHANGED
|
@@ -572,7 +572,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
572
572
|
this._firmwareType = types_1.FirmwareType.BitcoinOnly;
|
|
573
573
|
}
|
|
574
574
|
else if (feat.fw_vendor === 'Trezor') {
|
|
575
|
-
this._firmwareType = types_1.FirmwareType.
|
|
575
|
+
this._firmwareType = types_1.FirmwareType.Universal;
|
|
576
576
|
}
|
|
577
577
|
else if (this.getMode() !== 'bootloader') {
|
|
578
578
|
this._firmwareType =
|
|
@@ -580,7 +580,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
580
580
|
feat.capabilities.length > 0 &&
|
|
581
581
|
!feat.capabilities.includes('Capability_Bitcoin_like')
|
|
582
582
|
? types_1.FirmwareType.BitcoinOnly
|
|
583
|
-
: types_1.FirmwareType.
|
|
583
|
+
: types_1.FirmwareType.Universal;
|
|
584
584
|
}
|
|
585
585
|
const deviceInfo = device_utils_1.models[feat.internal_model] ?? {
|
|
586
586
|
name: `Unknown ${feat.internal_model}`,
|
package/lib/types/device.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FeaturesNarrowing, FirmwareType } from '@trezor/device-utils';
|
|
2
2
|
import type { ThpStateSerialized } from '@trezor/protocol';
|
|
3
|
+
import { Branded } from '@trezor/type-utils';
|
|
3
4
|
import type { PROTO } from '../constants';
|
|
4
5
|
import type { ReleaseInfo } from './firmware';
|
|
5
6
|
export type DeviceStatus = 'available' | 'occupied' | 'used';
|
|
@@ -34,9 +35,7 @@ export type FirmwareHashCheckResult = {
|
|
|
34
35
|
attemptCount?: number;
|
|
35
36
|
errorPayload?: unknown;
|
|
36
37
|
};
|
|
37
|
-
export type DeviceUniquePath = string &
|
|
38
|
-
__type: 'DeviceUniquePath';
|
|
39
|
-
};
|
|
38
|
+
export type DeviceUniquePath = string & Branded<'DeviceUniquePath'>;
|
|
40
39
|
export declare const DeviceUniquePath: (id: string) => DeviceUniquePath;
|
|
41
40
|
type BaseDevice = {
|
|
42
41
|
path: DeviceUniquePath;
|
package/lib/utils/assetUtils.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.firmwareAssets = {
|
|
|
13
13
|
[device_utils_1.DeviceModelInternal.T3T1]: require('@trezor/connect-common/files/firmware/t3t1/releases.json'),
|
|
14
14
|
[device_utils_1.DeviceModelInternal.T3W1]: require('@trezor/connect-common/files/firmware/t3w1/releases.json'),
|
|
15
15
|
};
|
|
16
|
-
exports.firmwareReleaseConfigAssets = require('@trezor/connect-common/files/firmware/release/releases.v1.
|
|
16
|
+
exports.firmwareReleaseConfigAssets = require('@trezor/connect-common/files/firmware/release/releases.v1.json');
|
|
17
17
|
const tryLocalAssetRequire = (url) => {
|
|
18
18
|
const fileUrl = url.split('?')[0];
|
|
19
19
|
switch (fileUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.6.2-beta.
|
|
3
|
+
"version": "9.6.2-beta.3",
|
|
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.",
|
|
@@ -79,21 +79,21 @@
|
|
|
79
79
|
"@solana-program/token": "^0.5.1",
|
|
80
80
|
"@solana-program/token-2022": "^0.4.2",
|
|
81
81
|
"@solana/kit": "^2.1.1",
|
|
82
|
-
"@trezor/blockchain-link": "2.5.2-beta.
|
|
83
|
-
"@trezor/blockchain-link-types": "1.4.2-beta.
|
|
84
|
-
"@trezor/blockchain-link-utils": "1.4.2-beta.
|
|
85
|
-
"@trezor/connect-analytics": "1.3.
|
|
86
|
-
"@trezor/connect-common": "0.4.2-beta.
|
|
82
|
+
"@trezor/blockchain-link": "2.5.2-beta.2",
|
|
83
|
+
"@trezor/blockchain-link-types": "1.4.2-beta.3",
|
|
84
|
+
"@trezor/blockchain-link-utils": "1.4.2-beta.2",
|
|
85
|
+
"@trezor/connect-analytics": "1.3.5-beta.1",
|
|
86
|
+
"@trezor/connect-common": "0.4.2-beta.3",
|
|
87
87
|
"@trezor/crypto-utils": "1.1.4-beta.1",
|
|
88
88
|
"@trezor/device-utils": "1.1.2-beta.1",
|
|
89
89
|
"@trezor/env-utils": "^1.4.2-beta.1",
|
|
90
90
|
"@trezor/protobuf": "1.4.2-beta.1",
|
|
91
91
|
"@trezor/protocol": "1.2.8-beta.1",
|
|
92
92
|
"@trezor/schema-utils": "1.3.4-beta.1",
|
|
93
|
-
"@trezor/transport": "1.5.2-beta.
|
|
94
|
-
"@trezor/type-utils": "1.1.8-beta.
|
|
95
|
-
"@trezor/utils": "9.4.2-beta.
|
|
96
|
-
"@trezor/utxo-lib": "2.4.2-beta.
|
|
93
|
+
"@trezor/transport": "1.5.2-beta.2",
|
|
94
|
+
"@trezor/type-utils": "1.1.8-beta.2",
|
|
95
|
+
"@trezor/utils": "9.4.2-beta.2",
|
|
96
|
+
"@trezor/utxo-lib": "2.4.2-beta.2",
|
|
97
97
|
"blakejs": "^1.2.1",
|
|
98
98
|
"bs58": "^6.0.0",
|
|
99
99
|
"bs58check": "^4.0.0",
|