@trezor/connect 9.2.1 → 9.2.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 +90 -0
- package/README.md +1 -1
- package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -1
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/bitcoin/Fees.d.ts +2 -2
- package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
- package/lib/api/blockchainDisconnect.d.ts +1 -0
- package/lib/api/blockchainDisconnect.js +3 -4
- package/lib/api/blockchainEstimateFee.d.ts +1 -0
- package/lib/api/blockchainEstimateFee.js +7 -4
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
- package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
- package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
- package/lib/api/blockchainGetTransactions.d.ts +1 -0
- package/lib/api/blockchainGetTransactions.js +3 -1
- package/lib/api/blockchainSetCustomBackend.js +1 -5
- package/lib/api/blockchainSubscribe.d.ts +2 -0
- package/lib/api/blockchainSubscribe.js +13 -2
- package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainSubscribeFiatRates.js +3 -1
- package/lib/api/blockchainUnsubscribe.d.ts +1 -0
- package/lib/api/blockchainUnsubscribe.js +5 -2
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
- package/lib/api/changeLanguage.d.ts +0 -1
- package/lib/api/changeLanguage.js +8 -39
- package/lib/api/composeTransaction.d.ts +2 -0
- package/lib/api/composeTransaction.js +10 -5
- package/lib/api/eos/eosSignTx.d.ts +58 -58
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +6 -6
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/getAccountInfo.js +4 -3
- package/lib/api/getCoinInfo.d.ts +25 -22
- package/lib/api/getFeatures.d.ts +10 -10
- package/lib/api/getPublicKey.d.ts +6 -6
- package/lib/api/nem/nemSignTx.d.ts +13 -13
- package/lib/api/pushTransaction.d.ts +1 -0
- package/lib/api/pushTransaction.js +2 -1
- package/lib/api/resetDevice.d.ts +1 -1
- package/lib/api/resetDevice.js +2 -2
- package/lib/api/signTransaction.d.ts +1 -0
- package/lib/api/signTransaction.js +5 -3
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +18 -18
- package/lib/backend/BackendManager.d.ts +6 -4
- package/lib/backend/BackendManager.js +36 -28
- package/lib/backend/Blockchain.d.ts +15 -4
- package/lib/backend/Blockchain.js +27 -17
- package/lib/backend/BlockchainLink.d.ts +3 -3
- package/lib/backend/BlockchainLink.js +3 -3
- package/lib/core/AbstractMethod.js +1 -0
- package/lib/core/index.js +34 -5
- package/lib/data/DataManager.d.ts +22 -0
- package/lib/data/DataManager.js +7 -3
- package/lib/data/coinInfo.d.ts +131 -117
- package/lib/data/config.d.ts +22 -0
- package/lib/data/config.js +19 -1
- package/lib/data/connectSettings.js +3 -0
- package/lib/data/defaultFeeLevels.js +9 -1
- package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
- package/lib/data/deviceAuthenticityConfig.js +26 -3
- package/lib/data/firmwareInfo.d.ts +1 -1
- package/lib/data/firmwareInfo.js +1 -5
- package/lib/data/getLanguage.d.ts +6 -0
- package/lib/data/getLanguage.js +10 -0
- package/lib/data/models.d.ts +9 -0
- package/lib/data/models.js +9 -0
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +15 -3
- package/lib/device/Device.js +55 -6
- package/lib/device/DeviceCommands.d.ts +8 -8
- package/lib/device/DeviceList.js +4 -6
- package/lib/device/resolveDescriptorForTaproot.js +21 -16
- package/lib/events/blockchain.d.ts +3 -0
- package/lib/events/device.d.ts +1 -0
- package/lib/events/device.js +1 -0
- package/lib/types/api/applySettings.d.ts +6 -6
- package/lib/types/api/authenticateDevice.d.ts +9 -0
- package/lib/types/api/bitcoin/index.d.ts +1 -0
- package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
- package/lib/types/api/blockchainSubscribe.d.ts +1 -0
- package/lib/types/api/composeTransaction.d.ts +2 -0
- package/lib/types/api/getAccountInfo.d.ts +1 -0
- package/lib/types/api/getAddress.d.ts +5 -5
- package/lib/types/api/getCoinInfo.d.ts +4 -2
- package/lib/types/api/getPublicKey.js +4 -1
- package/lib/types/api/nemGetAddress.d.ts +11 -4
- package/lib/types/api/nemGetAddress.js +9 -0
- package/lib/types/api/pushTransaction.d.ts +1 -0
- package/lib/types/api/pushTransaction.js +1 -0
- package/lib/types/api/recoveryDevice.d.ts +1 -1
- package/lib/types/api/resetDevice.d.ts +1 -15
- package/lib/types/api/resetDevice.js +0 -9
- package/lib/types/api/setBusy.d.ts +2 -2
- package/lib/types/coinInfo.d.ts +15 -7
- package/lib/types/coinInfo.js +8 -6
- package/lib/types/firmware.d.ts +5 -15
- package/lib/types/params.d.ts +1 -0
- package/lib/types/params.js +5 -2
- package/lib/types/settings.d.ts +1 -0
- package/lib/utils/assetUtils.js +18 -8
- package/lib/utils/{assets-native.d.ts → assets.native.d.ts} +1 -1
- package/lib/utils/{assets-native.js → assets.native.js} +1 -1
- package/lib/utils/debug.d.ts +5 -31
- package/lib/utils/debug.js +8 -110
- package/lib/utils/hdnodeUtils.d.ts +3 -3
- package/lib/utils/pathUtils.d.ts +3 -3
- package/lib/workers/{workers-react-native.d.ts → workers.native.d.ts} +1 -1
- package/lib/workers/{workers-react-native.js → workers.native.js} +1 -1
- package/package.json +40 -20
package/lib/data/config.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const config: {
|
|
|
52
52
|
T1B1: string;
|
|
53
53
|
T2T1: string;
|
|
54
54
|
T2B1?: undefined;
|
|
55
|
+
T3T1?: undefined;
|
|
55
56
|
};
|
|
56
57
|
max: undefined;
|
|
57
58
|
comment: string[];
|
|
@@ -62,6 +63,7 @@ export declare const config: {
|
|
|
62
63
|
T1B1: string;
|
|
63
64
|
T2T1: string;
|
|
64
65
|
T2B1?: undefined;
|
|
66
|
+
T3T1?: undefined;
|
|
65
67
|
};
|
|
66
68
|
comment: string[];
|
|
67
69
|
methods?: undefined;
|
|
@@ -73,6 +75,7 @@ export declare const config: {
|
|
|
73
75
|
T1B1: string;
|
|
74
76
|
T2T1: string;
|
|
75
77
|
T2B1?: undefined;
|
|
78
|
+
T3T1?: undefined;
|
|
76
79
|
};
|
|
77
80
|
comment: string[];
|
|
78
81
|
coin?: undefined;
|
|
@@ -84,6 +87,7 @@ export declare const config: {
|
|
|
84
87
|
T1B1: string;
|
|
85
88
|
T2T1: string;
|
|
86
89
|
T2B1?: undefined;
|
|
90
|
+
T3T1?: undefined;
|
|
87
91
|
};
|
|
88
92
|
comment: string[];
|
|
89
93
|
coin?: undefined;
|
|
@@ -96,6 +100,7 @@ export declare const config: {
|
|
|
96
100
|
T1B1: string;
|
|
97
101
|
T2T1: string;
|
|
98
102
|
T2B1?: undefined;
|
|
103
|
+
T3T1?: undefined;
|
|
99
104
|
};
|
|
100
105
|
comment: string[];
|
|
101
106
|
max?: undefined;
|
|
@@ -107,6 +112,7 @@ export declare const config: {
|
|
|
107
112
|
T1B1: string;
|
|
108
113
|
T2T1: string;
|
|
109
114
|
T2B1?: undefined;
|
|
115
|
+
T3T1?: undefined;
|
|
110
116
|
};
|
|
111
117
|
coin?: undefined;
|
|
112
118
|
max?: undefined;
|
|
@@ -117,6 +123,7 @@ export declare const config: {
|
|
|
117
123
|
T1B1: string;
|
|
118
124
|
T2T1: string;
|
|
119
125
|
T2B1: string;
|
|
126
|
+
T3T1?: undefined;
|
|
120
127
|
};
|
|
121
128
|
comment: string[];
|
|
122
129
|
coin?: undefined;
|
|
@@ -128,6 +135,7 @@ export declare const config: {
|
|
|
128
135
|
T1B1: string;
|
|
129
136
|
T2T1: string;
|
|
130
137
|
T2B1?: undefined;
|
|
138
|
+
T3T1?: undefined;
|
|
131
139
|
};
|
|
132
140
|
coin?: undefined;
|
|
133
141
|
max?: undefined;
|
|
@@ -139,6 +147,7 @@ export declare const config: {
|
|
|
139
147
|
T1B1: string;
|
|
140
148
|
T2T1: string;
|
|
141
149
|
T2B1: string;
|
|
150
|
+
T3T1?: undefined;
|
|
142
151
|
};
|
|
143
152
|
coin?: undefined;
|
|
144
153
|
max?: undefined;
|
|
@@ -150,11 +159,24 @@ export declare const config: {
|
|
|
150
159
|
T1B1: string;
|
|
151
160
|
T2T1: string;
|
|
152
161
|
T2B1: string;
|
|
162
|
+
T3T1?: undefined;
|
|
153
163
|
};
|
|
154
164
|
comment: string[];
|
|
155
165
|
coin?: undefined;
|
|
156
166
|
methods?: undefined;
|
|
157
167
|
max?: undefined;
|
|
168
|
+
} | {
|
|
169
|
+
methods: string[];
|
|
170
|
+
min: {
|
|
171
|
+
T1B1: string;
|
|
172
|
+
T2T1: string;
|
|
173
|
+
T2B1: string;
|
|
174
|
+
T3T1: string;
|
|
175
|
+
};
|
|
176
|
+
coin?: undefined;
|
|
177
|
+
max?: undefined;
|
|
178
|
+
comment?: undefined;
|
|
179
|
+
capabilities?: undefined;
|
|
158
180
|
})[];
|
|
159
181
|
};
|
|
160
182
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/data/config.js
CHANGED
|
@@ -36,6 +36,16 @@ exports.config = {
|
|
|
36
36
|
label: 'MetaMask',
|
|
37
37
|
icon: '',
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
origin: 'bpcdaglidgnlggelgbjfagekoapjmccp',
|
|
41
|
+
label: 'Rainbow DEV',
|
|
42
|
+
icon: '',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
origin: 'opfgelmcmbiajamepnmloijbpoleiama',
|
|
46
|
+
label: 'Rainbow',
|
|
47
|
+
icon: '',
|
|
48
|
+
},
|
|
39
49
|
{ origin: 'file://', label: ' ', icon: '' },
|
|
40
50
|
],
|
|
41
51
|
onionDomains: {
|
|
@@ -66,6 +76,10 @@ exports.config = {
|
|
|
66
76
|
name: 'firmware-t2b1',
|
|
67
77
|
url: './data/firmware/t2b1/releases.json',
|
|
68
78
|
},
|
|
79
|
+
{
|
|
80
|
+
name: 'firmware-t3t1',
|
|
81
|
+
url: './data/firmware/t3t1/releases.json',
|
|
82
|
+
},
|
|
69
83
|
],
|
|
70
84
|
messages: './data/messages/messages.json',
|
|
71
85
|
supportedBrowsers: {
|
|
@@ -108,7 +122,7 @@ exports.config = {
|
|
|
108
122
|
],
|
|
109
123
|
},
|
|
110
124
|
{
|
|
111
|
-
coin: ['eth', 'tsep', '
|
|
125
|
+
coin: ['eth', 'tsep', 'thol'],
|
|
112
126
|
min: { T1B1: '1.8.0', T2T1: '2.1.0' },
|
|
113
127
|
comment: ['There were protobuf backwards incompatible changes.'],
|
|
114
128
|
},
|
|
@@ -228,6 +242,10 @@ exports.config = {
|
|
|
228
242
|
"Since firmware 2.6.3 there is a new protobuf field 'chunkify' in almost all getAddress and signTx methods",
|
|
229
243
|
],
|
|
230
244
|
},
|
|
245
|
+
{
|
|
246
|
+
methods: ['changeLanguage'],
|
|
247
|
+
min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0', T3T1: '2.7.1' },
|
|
248
|
+
},
|
|
231
249
|
],
|
|
232
250
|
};
|
|
233
251
|
//# sourceMappingURL=config.js.map
|
|
@@ -110,6 +110,9 @@ const parseConnectSettings = (input = {}) => {
|
|
|
110
110
|
if (typeof input.useCoreInPopup === 'boolean') {
|
|
111
111
|
settings.useCoreInPopup = input.useCoreInPopup;
|
|
112
112
|
}
|
|
113
|
+
if (typeof input._extendWebextensionLifetime === 'boolean') {
|
|
114
|
+
settings._extendWebextensionLifetime = input._extendWebextensionLifetime;
|
|
115
|
+
}
|
|
113
116
|
return settings;
|
|
114
117
|
};
|
|
115
118
|
exports.parseConnectSettings = parseConnectSettings;
|
|
@@ -66,7 +66,15 @@ const CARDANO_FEE_INFO = {
|
|
|
66
66
|
};
|
|
67
67
|
const SOLANA_FEE_INFO = {
|
|
68
68
|
blockTime: -1,
|
|
69
|
-
defaultFees: [
|
|
69
|
+
defaultFees: [
|
|
70
|
+
{
|
|
71
|
+
label: 'normal',
|
|
72
|
+
feePerUnit: '100000',
|
|
73
|
+
feeLimit: '200000',
|
|
74
|
+
feePerTx: '25000',
|
|
75
|
+
blocks: -1,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
70
78
|
minFee: -1,
|
|
71
79
|
maxFee: -1,
|
|
72
80
|
dustLimit: -1,
|
|
@@ -10,6 +10,15 @@ export declare const DeviceAuthenticityConfig: import("@sinclair/typebox").TInte
|
|
|
10
10
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
11
|
}>>;
|
|
12
12
|
}>]>;
|
|
13
|
+
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
14
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
15
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
16
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
17
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
18
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
19
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
20
|
+
}>>;
|
|
21
|
+
}>]>;
|
|
13
22
|
}>, import("@sinclair/typebox").TObject<{
|
|
14
23
|
T1B1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
15
24
|
T2T1: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUndefined>;
|
|
@@ -8,13 +8,13 @@ const CertPubKeys = schema_utils_1.Type.Object({
|
|
|
8
8
|
caPubKeys: schema_utils_1.Type.Array(schema_utils_1.Type.String()),
|
|
9
9
|
});
|
|
10
10
|
const ModelPubKeys = schema_utils_1.Type.Intersect([
|
|
11
|
-
schema_utils_1.Type.Record(schema_utils_1.Type.
|
|
11
|
+
schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T1B1'), schema_utils_1.Type.Literal('T2T1')])), schema_utils_1.Type.Intersect([
|
|
12
12
|
CertPubKeys,
|
|
13
13
|
schema_utils_1.Type.Object({
|
|
14
14
|
debug: schema_utils_1.Type.Optional(CertPubKeys),
|
|
15
15
|
}),
|
|
16
16
|
])),
|
|
17
|
-
schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Literal('T2B1')), schema_utils_1.Type.Undefined())),
|
|
17
|
+
schema_utils_1.Type.Partial(schema_utils_1.Type.Record(schema_utils_1.Type.Exclude(schema_utils_1.Type.KeyOfEnum(constants_1.PROTO.DeviceModelInternal), schema_utils_1.Type.Union([schema_utils_1.Type.Literal('T2B1'), schema_utils_1.Type.Literal('T3T1')])), schema_utils_1.Type.Undefined())),
|
|
18
18
|
]);
|
|
19
19
|
exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
20
20
|
ModelPubKeys,
|
|
@@ -25,7 +25,7 @@ exports.DeviceAuthenticityConfig = schema_utils_1.Type.Intersect([
|
|
|
25
25
|
]);
|
|
26
26
|
exports.deviceAuthenticityConfig = {
|
|
27
27
|
version: 1,
|
|
28
|
-
timestamp: '2023-
|
|
28
|
+
timestamp: '2023-04-17T12:00:00+00:00',
|
|
29
29
|
T2B1: {
|
|
30
30
|
rootPubKeys: [
|
|
31
31
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -43,6 +43,9 @@ exports.deviceAuthenticityConfig = {
|
|
|
43
43
|
'04fdbce7dafecc7808c2e047b5ad6b688c9e37529dfefbe96ba8a092895b5e669e93165abac1720f8fd5d607e35f4663cacf9bacd6e90aa97524401af65490f401',
|
|
44
44
|
'04c408e8a873c12256278c360bd7f35533e703b2f65daecf665a4711ebe6297f82ae2bf8ca60ff7261a69939c10a5cf81c17b7c5aac93cbd73136609c00ecd1666',
|
|
45
45
|
'04850fa71163c60bb92b254d9d4a0c664c1ffef9f5d7ea00c4fa4169b0661dc1918bb2d24b2b4d1202701a753552868aaff9514ae81128671e615a96f0ce90a29c',
|
|
46
|
+
'04c99f57eaaca8db0245a46dba5288a4c0b0d6acdd1346feef7770ec6b88d28d6640ee19c3f6d984e8fcfceda11b1e4accefda32b950dcd1785fbd16c2e45493a3',
|
|
47
|
+
'049c288f4de8a239be83955ed260f40c1a4126fb7dc513601dde4cb11f7363d6a259e73cb1bd9283a450ae608d1832c5fd0cbd9526c0285e720fa45494cae981fd',
|
|
48
|
+
'04ac1815177cc1f07700e5f18c05522427413f404bacc987eb1cf9d86f96b9e0cc53ef5941eafd483102eea321205d7dd9271ac2d0fca75a9a43deb824b51f1596',
|
|
46
49
|
],
|
|
47
50
|
debug: {
|
|
48
51
|
rootPubKeys: [
|
|
@@ -53,5 +56,25 @@ exports.deviceAuthenticityConfig = {
|
|
|
53
56
|
],
|
|
54
57
|
},
|
|
55
58
|
},
|
|
59
|
+
T3T1: {
|
|
60
|
+
rootPubKeys: [
|
|
61
|
+
'041854b27fb1d9f65abb66828e78c9dc0ca301e66081ab0c6a4d104f9df1cd0ad5a7c75f77a8c092f55cf825d2abaf734f934c9394d5e75f75a5a06a5ee9be93ae',
|
|
62
|
+
],
|
|
63
|
+
caPubKeys: [
|
|
64
|
+
'045b785b703810363deeadc0faa5a7388d8385f5e4f9170a3c27d3d2506bf9090d5b09044fbad6b906446d8cdb754b65869e8992b26a344e01ecff75844fe5a3d6',
|
|
65
|
+
'046442ece98b1cd13389b6eda3235e2848becc655db564897b2dc0862580f69b29be59dc30f92820f41a7a493b90623e66e1ee8529dbfd60d50aed97b46c4b8f64',
|
|
66
|
+
'0416960078e1d2b44df717ff5445ec76f4247333375982c5ae59b3bc223371f3cf81e7c182fd1ca36c95977070e2ff46f998bff3f00ab0de266edfdd430aea56b8',
|
|
67
|
+
],
|
|
68
|
+
debug: {
|
|
69
|
+
rootPubKeys: [
|
|
70
|
+
'047f77368dea2d4d61e989f474a56723c3212dacf8a808d8795595ef38441427c4389bc454f02089d7f08b873005e4c28d432468997871c0bf286fd3861e21e96a',
|
|
71
|
+
],
|
|
72
|
+
caPubKeys: [
|
|
73
|
+
'04829e8965018feb542e9236c9b2ce08f864a55ed9183d0259564f0e05345b04676a0bef36c59d21d3c24868b5601f0b1193a6bfcf6d814e1cfb79c2256a05e953',
|
|
74
|
+
'046f64eff0dfa3ceeae9708a3881fc09a3dae62198559d022d120e96edc168f3991a9e9b016635a0d43997ee55d8c2b37d969e8abc84e75c791ec911108b52f3c7',
|
|
75
|
+
'041260c3c1fd4ddfc97ba19732d5dcbe6efab61d58af83281b95d6cdb30606bf08f0b817eb6db2825b5ce32d0cc2c275b7eadcedaa1805f00b3f5a11668b6c5cb5',
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
56
79
|
};
|
|
57
80
|
//# sourceMappingURL=deviceAuthenticityConfig.js.map
|
|
@@ -6,7 +6,7 @@ export interface GetInfoProps {
|
|
|
6
6
|
releases: FirmwareRelease[];
|
|
7
7
|
}
|
|
8
8
|
export declare const getInfo: ({ features, releases }: GetInfoProps) => ReleaseInfo | null;
|
|
9
|
-
export declare const getFirmwareStatus: (features: Features) => "
|
|
9
|
+
export declare const getFirmwareStatus: (features: Features) => "custom" | "valid" | "outdated" | "required" | "unknown" | "none";
|
|
10
10
|
export declare const getRelease: (features: Features) => ReleaseInfo | null;
|
|
11
11
|
export declare const getReleases: (deviceModel: DeviceModelInternal) => FirmwareRelease[];
|
|
12
12
|
//# sourceMappingURL=firmwareInfo.d.ts.map
|
package/lib/data/firmwareInfo.js
CHANGED
|
@@ -4,11 +4,7 @@ exports.getReleases = exports.getRelease = exports.getFirmwareStatus = exports.g
|
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
5
|
const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
|
-
const releases = {
|
|
8
|
-
[types_1.DeviceModelInternal.T1B1]: [],
|
|
9
|
-
[types_1.DeviceModelInternal.T2T1]: [],
|
|
10
|
-
[types_1.DeviceModelInternal.T2B1]: [],
|
|
11
|
-
};
|
|
7
|
+
const releases = Object.values(types_1.DeviceModelInternal).reduce((acc, key) => ({ ...acc, [key]: [] }), {});
|
|
12
8
|
const parseFirmware = (json, deviceModel) => {
|
|
13
9
|
Object.keys(json).forEach(key => {
|
|
14
10
|
const release = json[key];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLanguage = void 0;
|
|
4
|
+
const assets_1 = require("../utils/assets");
|
|
5
|
+
const getLanguage = ({ language, version, internal_model, }) => {
|
|
6
|
+
const url = `https://data.trezor.io/firmware/translations/${internal_model.toLowerCase()}/translation-${internal_model.toUpperCase()}-${language}-${version.join('.')}.bin`;
|
|
7
|
+
return (0, assets_1.httpRequest)(url, 'binary');
|
|
8
|
+
};
|
|
9
|
+
exports.getLanguage = getLanguage;
|
|
10
|
+
//# sourceMappingURL=getLanguage.js.map
|
package/lib/data/models.d.ts
CHANGED
package/lib/data/models.js
CHANGED
|
@@ -20,5 +20,14 @@ exports.models = {
|
|
|
20
20
|
'5': 'Bitcoin Orange',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
+
T3T1: {
|
|
24
|
+
name: 'Trezor Safe 5',
|
|
25
|
+
colors: {
|
|
26
|
+
'1': 'Fantastic Ethereum',
|
|
27
|
+
'2': 'Lunatic Dogecoin',
|
|
28
|
+
'3': 'Galactic Litecoin',
|
|
29
|
+
'4': 'Majestic Bitcoin',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
23
32
|
};
|
|
24
33
|
//# sourceMappingURL=models.js.map
|
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.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.2.
|
|
4
|
+
exports.VERSION = '9.2.3';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/lib/device/Device.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TransportProtocol } from '@trezor/protocol';
|
|
|
4
4
|
import { DeviceCommands, PassphrasePromptResponse } from './DeviceCommands';
|
|
5
5
|
import { PROTO, NETWORK } from '../constants';
|
|
6
6
|
import { DEVICE, DeviceButtonRequestPayload } from '../events';
|
|
7
|
-
import type
|
|
7
|
+
import { type Transport, type Descriptor } from '@trezor/transport';
|
|
8
8
|
import { Device as DeviceTyped, DeviceFirmwareStatus, Features, ReleaseInfo, UnavailableCapabilities, FirmwareType } from '../types';
|
|
9
9
|
export type RunOptions = {
|
|
10
10
|
skipFinalReload?: boolean;
|
|
@@ -15,6 +15,7 @@ export type RunOptions = {
|
|
|
15
15
|
useEmptyPassphrase?: boolean;
|
|
16
16
|
useCardanoDerivation?: boolean;
|
|
17
17
|
};
|
|
18
|
+
export declare const GET_FEATURES_TIMEOUT = 3000;
|
|
18
19
|
export interface DeviceEvents {
|
|
19
20
|
[DEVICE.PIN]: (device: Device, b: PROTO.PinMatrixRequestType | undefined, callback: (err: any, pin: string) => void) => void;
|
|
20
21
|
[DEVICE.WORD]: (device: Device, b: PROTO.WordRequestType, callback: (err: any, word: string) => void) => void;
|
|
@@ -22,6 +23,7 @@ export interface DeviceEvents {
|
|
|
22
23
|
[DEVICE.PASSPHRASE_ON_DEVICE]: () => void;
|
|
23
24
|
[DEVICE.BUTTON]: (device: Device, payload: DeviceButtonRequestPayload) => void;
|
|
24
25
|
[DEVICE.ACQUIRED]: () => void;
|
|
26
|
+
[DEVICE.SAVE_STATE]: (state: string) => void;
|
|
25
27
|
}
|
|
26
28
|
export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
27
29
|
transport: Transport;
|
|
@@ -72,6 +74,16 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
72
74
|
useLegacyPassphrase(): boolean;
|
|
73
75
|
initialize(useEmptyPassphrase: boolean, useCardanoDerivation: boolean): Promise<void>;
|
|
74
76
|
getFeatures(): Promise<void>;
|
|
77
|
+
changeLanguage({ language, binary, }: {
|
|
78
|
+
language?: undefined;
|
|
79
|
+
binary: ArrayBuffer;
|
|
80
|
+
} | {
|
|
81
|
+
language: string;
|
|
82
|
+
binary?: undefined;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
private _uploadTranslationData;
|
|
75
87
|
_updateFeatures(feat: Features): void;
|
|
76
88
|
isUnacquired(): boolean;
|
|
77
89
|
disconnect(): void;
|
|
@@ -79,7 +91,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
79
91
|
isInitialized(): boolean;
|
|
80
92
|
isSeedless(): boolean;
|
|
81
93
|
isInconsistent(): boolean;
|
|
82
|
-
getVersion(): [number, number, number]
|
|
94
|
+
getVersion(): never[] | [number, number, number];
|
|
83
95
|
atLeast(versions: string[] | string): boolean;
|
|
84
96
|
isUsed(): boolean;
|
|
85
97
|
isUsedHere(): boolean;
|
|
@@ -90,7 +102,7 @@ export declare class Device extends TypedEmitter<DeviceEvents> {
|
|
|
90
102
|
getDevicePath(): string;
|
|
91
103
|
isT1(): boolean;
|
|
92
104
|
hasUnexpectedMode(allow: string[], require: string[]): "ui-device_bootloader_mode" | "ui-device_not_in_bootloader_mode" | "ui-device_not_initialized" | "ui-device_seedless" | null;
|
|
93
|
-
dispose(): import("@trezor/transport/lib/types").AbortableCall<void, "
|
|
105
|
+
dispose(): import("@trezor/transport/lib/types").AbortableCall<void, "Network request failed" | "Wrong result type." | "device disconnected during action" | "unexpected error" | "Aborted by timeout" | "Aborted by signal" | "This transport can not be used in this environment" | "device not found" | "Unable to open device" | "wrong previous session" | "session not found"> | undefined;
|
|
94
106
|
getMode(): "normal" | "bootloader" | "initialize" | "seedless";
|
|
95
107
|
toMessageObject(): DeviceTyped;
|
|
96
108
|
legacyForceRelease(): Promise<void>;
|
package/lib/device/Device.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Device = void 0;
|
|
3
|
+
exports.Device = exports.GET_FEATURES_TIMEOUT = void 0;
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
5
|
const utils_2 = require("@trezor/utils");
|
|
6
6
|
const utils_3 = require("@trezor/utils");
|
|
@@ -12,9 +12,12 @@ const coinInfo_1 = require("../data/coinInfo");
|
|
|
12
12
|
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
13
13
|
const deviceFeaturesUtils_1 = require("../utils/deviceFeaturesUtils");
|
|
14
14
|
const debug_1 = require("../utils/debug");
|
|
15
|
+
const transport_1 = require("@trezor/transport");
|
|
15
16
|
const types_1 = require("../types");
|
|
16
17
|
const models_1 = require("../data/models");
|
|
18
|
+
const getLanguage_1 = require("../data/getLanguage");
|
|
17
19
|
const _log = (0, debug_1.initLog)('Device');
|
|
20
|
+
exports.GET_FEATURES_TIMEOUT = 3000;
|
|
18
21
|
const parseRunOptions = (options) => {
|
|
19
22
|
if (!options)
|
|
20
23
|
options = {};
|
|
@@ -98,9 +101,6 @@ class Device extends utils_1.TypedEmitter {
|
|
|
98
101
|
await this.commands.callPromise.promise;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
if (this.releasePromise) {
|
|
102
|
-
await this.releasePromise;
|
|
103
|
-
}
|
|
104
104
|
this.releasePromise = this.transport.release({
|
|
105
105
|
session: this.activitySessionID,
|
|
106
106
|
path: this.originalDescriptor.path,
|
|
@@ -177,7 +177,7 @@ class Device extends utils_1.TypedEmitter {
|
|
|
177
177
|
else {
|
|
178
178
|
await Promise.race([
|
|
179
179
|
this.getFeatures(),
|
|
180
|
-
new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')),
|
|
180
|
+
new Promise((_resolve, reject) => setTimeout(() => reject(new Error('GetFeatures timeout')), exports.GET_FEATURES_TIMEOUT)),
|
|
181
181
|
]);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -186,6 +186,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
186
186
|
this.inconsistent = true;
|
|
187
187
|
return this._runInner(() => Promise.resolve({}), options);
|
|
188
188
|
}
|
|
189
|
+
if (transport_1.TRANSPORT_ERROR.ABORTED_BY_TIMEOUT === error.message) {
|
|
190
|
+
this.unreadableError = 'Connection timeout';
|
|
191
|
+
}
|
|
189
192
|
this.inconsistent = true;
|
|
190
193
|
delete this.runPromise;
|
|
191
194
|
return Promise.reject(constants_1.ERRORS.TypedError('Device_InitializeFailed', `Initialize failed: ${error.message} ${error.code ? `, code: ${error.code}` : ''}`));
|
|
@@ -242,8 +245,9 @@ class Device extends utils_1.TypedEmitter {
|
|
|
242
245
|
if (typeof state !== 'string') {
|
|
243
246
|
delete this.internalState[this.instance];
|
|
244
247
|
}
|
|
245
|
-
else {
|
|
248
|
+
else if (state !== this.internalState[this.instance]) {
|
|
246
249
|
this.internalState[this.instance] = state;
|
|
250
|
+
this.emit(events_1.DEVICE.SAVE_STATE, state);
|
|
247
251
|
}
|
|
248
252
|
}
|
|
249
253
|
getInternalState() {
|
|
@@ -309,6 +313,51 @@ class Device extends utils_1.TypedEmitter {
|
|
|
309
313
|
async getFeatures() {
|
|
310
314
|
const { message } = await this.getCommands().typedCall('GetFeatures', 'Features', {});
|
|
311
315
|
this._updateFeatures(message);
|
|
316
|
+
if (!this.features.language_version_matches &&
|
|
317
|
+
this.features.language &&
|
|
318
|
+
this.atLeast('2.7.0')) {
|
|
319
|
+
_log.info('language version mismatch. silently updating...');
|
|
320
|
+
try {
|
|
321
|
+
await this.changeLanguage({ language: this.features.language });
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
_log.error('change language failed silently', err);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async changeLanguage({ language, binary, }) {
|
|
329
|
+
if (language === 'en-US') {
|
|
330
|
+
return this._uploadTranslationData(null);
|
|
331
|
+
}
|
|
332
|
+
if (binary) {
|
|
333
|
+
return this._uploadTranslationData(binary);
|
|
334
|
+
}
|
|
335
|
+
const downloadedBinary = await (0, getLanguage_1.getLanguage)({
|
|
336
|
+
language,
|
|
337
|
+
version: this.getVersion(),
|
|
338
|
+
internal_model: this.features.internal_model,
|
|
339
|
+
});
|
|
340
|
+
return this._uploadTranslationData(downloadedBinary);
|
|
341
|
+
}
|
|
342
|
+
async _uploadTranslationData(payload) {
|
|
343
|
+
if (!this.commands) {
|
|
344
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'uploadTranslationData: device.commands is not set');
|
|
345
|
+
}
|
|
346
|
+
if (payload === null) {
|
|
347
|
+
const response = await this.commands.typedCall('ChangeLanguage', ['Success'], { data_length: 0 });
|
|
348
|
+
return response.message;
|
|
349
|
+
}
|
|
350
|
+
const length = payload.byteLength;
|
|
351
|
+
let response = await this.commands.typedCall('ChangeLanguage', ['TranslationDataRequest', 'Success'], { data_length: length });
|
|
352
|
+
while (response.type !== 'Success') {
|
|
353
|
+
const start = response.message.data_offset;
|
|
354
|
+
const end = response.message.data_offset + response.message.data_length;
|
|
355
|
+
const chunk = payload.slice(start, end);
|
|
356
|
+
response = await this.commands.typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], {
|
|
357
|
+
data_chunk: Buffer.from(chunk).toString('hex'),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return response.message;
|
|
312
361
|
}
|
|
313
362
|
_updateFeatures(feat) {
|
|
314
363
|
var _a, _b, _c, _d;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transport } from '@trezor/transport';
|
|
2
2
|
import { MessagesSchema as Messages } from '@trezor/protobuf';
|
|
3
|
-
import
|
|
3
|
+
import { Device } from './Device';
|
|
4
4
|
import type { CoinInfo, BitcoinNetworkInfo } from '../types';
|
|
5
5
|
import type { HDNodeResponse } from '../types/api/getPublicKey';
|
|
6
6
|
type MessageType = Messages.MessageType;
|
|
@@ -31,8 +31,8 @@ export declare class DeviceCommands {
|
|
|
31
31
|
isDisposed(): boolean;
|
|
32
32
|
unlockPath(params?: Messages.UnlockPath): Promise<TypedResponseMessage<"UnlockedPathRequest">>;
|
|
33
33
|
getPublicKey(params: Messages.GetPublicKey, unlockPath?: Messages.UnlockPath): Promise<{
|
|
34
|
-
root_fingerprint?: number | undefined;
|
|
35
34
|
descriptor?: string | undefined;
|
|
35
|
+
root_fingerprint?: number | undefined;
|
|
36
36
|
node: {
|
|
37
37
|
private_key?: string | undefined;
|
|
38
38
|
public_key: string;
|
|
@@ -51,25 +51,25 @@ export declare class DeviceCommands {
|
|
|
51
51
|
xpubSegwit?: string | undefined;
|
|
52
52
|
descriptorChecksum?: string | undefined;
|
|
53
53
|
path: number[];
|
|
54
|
-
depth: number;
|
|
55
|
-
fingerprint: number;
|
|
56
|
-
xpub: string;
|
|
57
54
|
publicKey: string;
|
|
58
55
|
serializedPath: string;
|
|
56
|
+
depth: number;
|
|
57
|
+
fingerprint: number;
|
|
59
58
|
chainCode: string;
|
|
60
59
|
childNum: number;
|
|
60
|
+
xpub: string;
|
|
61
61
|
}>;
|
|
62
62
|
getBitcoinHDNode(path: number[], coinInfo?: BitcoinNetworkInfo, validation?: boolean): Promise<{
|
|
63
63
|
xpubSegwit?: string | undefined;
|
|
64
64
|
descriptorChecksum?: string | undefined;
|
|
65
65
|
path: number[];
|
|
66
|
-
depth: number;
|
|
67
|
-
fingerprint: number;
|
|
68
|
-
xpub: string;
|
|
69
66
|
publicKey: string;
|
|
70
67
|
serializedPath: string;
|
|
68
|
+
depth: number;
|
|
69
|
+
fingerprint: number;
|
|
71
70
|
chainCode: string;
|
|
72
71
|
childNum: number;
|
|
72
|
+
xpub: string;
|
|
73
73
|
}>;
|
|
74
74
|
getAddress({ address_n, show_display, multisig, script_type, chunkify }: Messages.GetAddress, coinInfo: BitcoinNetworkInfo): Promise<{
|
|
75
75
|
path: number[];
|
package/lib/device/DeviceList.js
CHANGED
|
@@ -324,22 +324,20 @@ class DeviceList extends utils_1.TypedEmitter {
|
|
|
324
324
|
if (error.code === 'Device_NotFound' ||
|
|
325
325
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_NOT_FOUND ||
|
|
326
326
|
error.message === transport_1.TRANSPORT_ERROR.DEVICE_DISCONNECTED_DURING_ACTION ||
|
|
327
|
-
error.message === transport_1.TRANSPORT_ERROR.UNEXPECTED_ERROR
|
|
328
|
-
error.message === transport_1.TRANSPORT_ERROR.INTERFACE_UNABLE_TO_OPEN_DEVICE) {
|
|
327
|
+
error.message === transport_1.TRANSPORT_ERROR.UNEXPECTED_ERROR) {
|
|
329
328
|
delete this.devices[path];
|
|
330
329
|
}
|
|
331
330
|
else if (error.message === transport_1.TRANSPORT_ERROR.SESSION_WRONG_PREVIOUS) {
|
|
332
331
|
this.enumerate();
|
|
333
332
|
this._handleUsedElsewhere(descriptor);
|
|
334
333
|
}
|
|
335
|
-
else if (
|
|
334
|
+
else if (error.message === transport_1.TRANSPORT_ERROR.INTERFACE_UNABLE_TO_OPEN_DEVICE ||
|
|
335
|
+
((_a = error.message) === null || _a === void 0 ? void 0 : _a.indexOf(constants_1.ERRORS.LIBUSB_ERROR_MESSAGE)) >= 0 ||
|
|
336
|
+
error.code === 'Device_InitializeFailed') {
|
|
336
337
|
const device = this._createUnreadableDevice(this.creatingDevicesDescriptors[path], error.message);
|
|
337
338
|
this.devices[path] = device;
|
|
338
339
|
this.emit(events_1.DEVICE.CONNECT_UNACQUIRED, device.toMessageObject());
|
|
339
340
|
}
|
|
340
|
-
else if (error.code === 'Device_InitializeFailed') {
|
|
341
|
-
this._handleUsedElsewhere(descriptor);
|
|
342
|
-
}
|
|
343
341
|
else if (error.code === 'Device_UsedElsewhere') {
|
|
344
342
|
this._handleUsedElsewhere(descriptor);
|
|
345
343
|
}
|
|
@@ -4,23 +4,28 @@ exports.resolveDescriptorForTaproot = void 0;
|
|
|
4
4
|
const resolveDescriptorForTaproot = ({ response, publicKey }) => {
|
|
5
5
|
if (publicKey.descriptor !== null && publicKey.descriptor !== undefined) {
|
|
6
6
|
const [xpub, checksum] = publicKey.descriptor.split('#');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
xpub: `tr([${descriptorPath}]${response.xpub}/<0;1>/*)`,
|
|
21
|
-
checksum: undefined,
|
|
22
|
-
};
|
|
7
|
+
const openingSquareBracketSplit = xpub.split('[');
|
|
8
|
+
if (openingSquareBracketSplit.length === 2) {
|
|
9
|
+
const [beforeOpeningBracket, afterOpeningBracket] = openingSquareBracketSplit;
|
|
10
|
+
const closingSquareBracketSplit = afterOpeningBracket.split(']');
|
|
11
|
+
if (closingSquareBracketSplit.length === 2) {
|
|
12
|
+
const [path, afterClosingBracket] = closingSquareBracketSplit;
|
|
13
|
+
const correctedPath = path.replace(/h/g, "'");
|
|
14
|
+
return {
|
|
15
|
+
xpub: `${beforeOpeningBracket}[${correctedPath}]${afterClosingBracket}`,
|
|
16
|
+
checksum,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
23
20
|
}
|
|
21
|
+
const fingerprint = Number(publicKey.root_fingerprint || 0)
|
|
22
|
+
.toString(16)
|
|
23
|
+
.padStart(8, '0');
|
|
24
|
+
const descriptorPath = `${fingerprint}${response.serializedPath.substring(1)}`;
|
|
25
|
+
return {
|
|
26
|
+
xpub: `tr([${descriptorPath}]${response.xpub}/<0;1>/*)`,
|
|
27
|
+
checksum: undefined,
|
|
28
|
+
};
|
|
24
29
|
};
|
|
25
30
|
exports.resolveDescriptorForTaproot = resolveDescriptorForTaproot;
|
|
26
31
|
//# sourceMappingURL=resolveDescriptorForTaproot.js.map
|
|
@@ -12,16 +12,19 @@ export declare const BLOCKCHAIN: {
|
|
|
12
12
|
};
|
|
13
13
|
export interface BlockchainInfo extends ServerInfo {
|
|
14
14
|
coin: CoinInfo;
|
|
15
|
+
identity?: string;
|
|
15
16
|
misc?: {
|
|
16
17
|
reserve?: string;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export interface BlockchainReconnecting {
|
|
20
21
|
coin: CoinInfo;
|
|
22
|
+
identity?: string;
|
|
21
23
|
time: number;
|
|
22
24
|
}
|
|
23
25
|
export interface BlockchainError {
|
|
24
26
|
coin: CoinInfo;
|
|
27
|
+
identity?: string;
|
|
25
28
|
error: string;
|
|
26
29
|
code?: string;
|
|
27
30
|
}
|