@trezor/connect 9.1.10 → 9.1.12
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 +32 -0
- package/README.md +1 -1
- package/lib/api/binance/api/binanceSignTransaction.js +1 -1
- package/lib/api/cardano/api/cardanoSignTransaction.js +1 -1
- package/lib/api/eos/api/eosSignTransaction.js +1 -1
- package/lib/api/eos/eosSignTx.d.ts +3 -3
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -2
- package/lib/api/firmware/uploadFirmware.d.ts +2 -2
- package/lib/api/getAddress.js +6 -0
- package/lib/api/getCoinInfo.d.ts +3 -3
- package/lib/api/nem/api/nemSignTransaction.js +5 -1
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/ripple/api/rippleSignTransaction.js +1 -1
- package/lib/api/solana/api/solanaSignTransaction.js +1 -1
- package/lib/api/stellar/api/stellarSignTransaction.js +1 -1
- package/lib/api/tezos/api/tezosSignTransaction.js +1 -1
- package/lib/backend/Blockchain.d.ts +2 -2
- package/lib/core/AbstractMethod.d.ts +3 -3
- package/lib/core/AbstractMethod.js +20 -18
- package/lib/core/index.d.ts +3 -6
- package/lib/core/index.js +57 -48
- package/lib/core/method.d.ts +1 -3
- package/lib/core/method.native.d.ts +1 -3
- package/lib/data/analyticsInfo.d.ts +2 -2
- package/lib/data/coinInfo.d.ts +14 -14
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +2 -2
- package/lib/events/call.d.ts +1 -1
- package/lib/events/core.d.ts +8 -10
- package/lib/events/iframe.d.ts +1 -1
- package/lib/events/popup.d.ts +1 -1
- package/lib/events/ui-request.d.ts +1 -2
- package/lib/index.d.ts +0 -4
- package/lib/index.js +23 -40
- package/lib/types/api/ethereum/index.d.ts +4 -4
- package/lib/types/api/ethereum/index.js +1 -1
- package/lib/types/api/nem/index.d.ts +46 -46
- package/lib/types/api/nem/index.js +1 -1
- package/lib/utils/promiseUtils.d.ts +0 -1
- package/package.json +12 -12
package/lib/core/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initCore = exports.Core = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const events_1 = tslib_1.__importDefault(require("events"));
|
|
6
6
|
const transport_1 = require("@trezor/transport");
|
|
7
7
|
const createDeferred_1 = require("@trezor/utils/lib/createDeferred");
|
|
8
|
+
const getSynchronize_1 = require("@trezor/utils/lib/getSynchronize");
|
|
9
|
+
const connect_common_1 = require("@trezor/connect-common");
|
|
8
10
|
const DataManager_1 = require("../data/DataManager");
|
|
9
11
|
const DeviceList_1 = require("../device/DeviceList");
|
|
10
12
|
const analyticsInfo_1 = require("../data/analyticsInfo");
|
|
@@ -19,12 +21,11 @@ let _core;
|
|
|
19
21
|
let _deviceList;
|
|
20
22
|
let _popupPromise;
|
|
21
23
|
const _uiPromises = [];
|
|
22
|
-
let _preferredDevice;
|
|
23
24
|
const _callMethods = [];
|
|
24
25
|
let _interactionTimeout;
|
|
25
26
|
let _deviceListInitTimeout;
|
|
26
27
|
let _overridePromise;
|
|
27
|
-
|
|
28
|
+
const methodSynchronize = (0, getSynchronize_1.getSynchronize)();
|
|
28
29
|
const _log = (0, debug_1.initLog)('Core');
|
|
29
30
|
const postMessage = (message) => {
|
|
30
31
|
if (message.event === events_2.RESPONSE_EVENT) {
|
|
@@ -93,13 +94,12 @@ const handleMessage = (message) => {
|
|
|
93
94
|
break;
|
|
94
95
|
}
|
|
95
96
|
case events_2.IFRAME.CALL:
|
|
96
|
-
|
|
97
|
+
onCall(message).catch(error => {
|
|
97
98
|
_log.error('onCall', error);
|
|
98
99
|
});
|
|
99
100
|
break;
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
exports.handleMessage = handleMessage;
|
|
103
103
|
const initDevice = async (method) => {
|
|
104
104
|
if (!_deviceList) {
|
|
105
105
|
throw constants_1.ERRORS.TypedError('Transport_Missing');
|
|
@@ -108,9 +108,18 @@ const initDevice = async (method) => {
|
|
|
108
108
|
const isWebUsb = _deviceList.transportType() === 'WebUsbTransport';
|
|
109
109
|
let device;
|
|
110
110
|
let showDeviceSelection = isWebUsb;
|
|
111
|
+
const origin = DataManager_1.DataManager.getSettings('origin');
|
|
112
|
+
const { preferredDevice } = connect_common_1.storage.load().origin[origin] || {};
|
|
113
|
+
const preferredDeviceInList = preferredDevice && _deviceList.getDevice(preferredDevice.path);
|
|
114
|
+
if (preferredDevice && !preferredDeviceInList) {
|
|
115
|
+
connect_common_1.storage.save(store => {
|
|
116
|
+
store.origin[origin] = { ...store.origin[origin], preferredDevice: undefined };
|
|
117
|
+
return store;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
111
120
|
if (method.devicePath) {
|
|
112
121
|
device = _deviceList.getDevice(method.devicePath);
|
|
113
|
-
showDeviceSelection = !!(device === null || device === void 0 ? void 0 : device.unreadableError);
|
|
122
|
+
showDeviceSelection = !device || !!(device === null || device === void 0 ? void 0 : device.unreadableError);
|
|
114
123
|
}
|
|
115
124
|
else {
|
|
116
125
|
const devices = _deviceList.asArray();
|
|
@@ -141,7 +150,14 @@ const initDevice = async (method) => {
|
|
|
141
150
|
if (uiPromise) {
|
|
142
151
|
const { payload } = await uiPromise.promise;
|
|
143
152
|
if (payload.remember) {
|
|
144
|
-
|
|
153
|
+
const { path, state } = payload.device;
|
|
154
|
+
connect_common_1.storage.save(store => {
|
|
155
|
+
store.origin[origin] = {
|
|
156
|
+
...store.origin[origin],
|
|
157
|
+
preferredDevice: { path, state },
|
|
158
|
+
};
|
|
159
|
+
return store;
|
|
160
|
+
});
|
|
145
161
|
}
|
|
146
162
|
device = _deviceList.getDevice(payload.device.path);
|
|
147
163
|
}
|
|
@@ -160,25 +176,27 @@ const onCall = async (message) => {
|
|
|
160
176
|
const responseID = message.id;
|
|
161
177
|
const trustedHost = DataManager_1.DataManager.getSettings('trustedHost');
|
|
162
178
|
const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
|
|
163
|
-
|
|
164
|
-
|
|
179
|
+
const origin = DataManager_1.DataManager.getSettings('origin');
|
|
180
|
+
const { preferredDevice } = connect_common_1.storage.loadForOrigin(origin) || {};
|
|
181
|
+
if (preferredDevice && !message.payload.device) {
|
|
182
|
+
message.payload.device = preferredDevice;
|
|
165
183
|
}
|
|
166
184
|
let method;
|
|
167
185
|
let messageResponse;
|
|
168
186
|
try {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
187
|
+
method = await methodSynchronize(async () => {
|
|
188
|
+
var _a;
|
|
189
|
+
_log.debug('loading method...');
|
|
190
|
+
const method = await (0, method_1.getMethod)(message);
|
|
191
|
+
_log.debug('method selected', method.name);
|
|
192
|
+
method.postMessage = postMessage;
|
|
193
|
+
method.getPopupPromise = getPopupPromise;
|
|
194
|
+
method.createUiPromise = createUiPromise;
|
|
195
|
+
method.init();
|
|
196
|
+
await ((_a = method.initAsync) === null || _a === void 0 ? void 0 : _a.call(method));
|
|
197
|
+
return method;
|
|
198
|
+
});
|
|
177
199
|
_callMethods.push(method);
|
|
178
|
-
if (method.initAsync) {
|
|
179
|
-
method.initAsyncPromise = method.initAsync();
|
|
180
|
-
await method.initAsyncPromise;
|
|
181
|
-
}
|
|
182
200
|
}
|
|
183
201
|
catch (error) {
|
|
184
202
|
postMessage((0, events_2.createPopupMessage)(events_2.POPUP.CANCEL_POPUP_REQUEST));
|
|
@@ -203,7 +221,7 @@ const onCall = async (message) => {
|
|
|
203
221
|
return Promise.resolve();
|
|
204
222
|
}
|
|
205
223
|
if (!_deviceList && !DataManager_1.DataManager.getSettings('transportReconnect')) {
|
|
206
|
-
await (
|
|
224
|
+
await initDeviceList(false);
|
|
207
225
|
}
|
|
208
226
|
if (method.isManagementRestricted()) {
|
|
209
227
|
postMessage((0, events_2.createPopupMessage)(events_2.POPUP.CANCEL_POPUP_REQUEST));
|
|
@@ -396,7 +414,7 @@ const onCall = async (message) => {
|
|
|
396
414
|
}
|
|
397
415
|
const response = messageResponse;
|
|
398
416
|
if (response) {
|
|
399
|
-
if (method.name === 'rebootToBootloader' && response.success) {
|
|
417
|
+
if (method.device.isT1() && method.name === 'rebootToBootloader' && response.success) {
|
|
400
418
|
await (0, promiseUtils_1.resolveAfter)(1000).promise;
|
|
401
419
|
try {
|
|
402
420
|
await device.run(() => Promise.resolve(), { skipFinalReload: true });
|
|
@@ -419,7 +437,6 @@ const onCall = async (message) => {
|
|
|
419
437
|
}
|
|
420
438
|
}
|
|
421
439
|
};
|
|
422
|
-
exports.onCall = onCall;
|
|
423
440
|
const cleanup = () => {
|
|
424
441
|
_popupPromise = undefined;
|
|
425
442
|
_uiPromises.splice(0);
|
|
@@ -549,16 +566,13 @@ const handleDeviceSelectionChanges = (interruptDevice) => {
|
|
|
549
566
|
shouldClosePopup = true;
|
|
550
567
|
}
|
|
551
568
|
});
|
|
552
|
-
if (_preferredDevice && _preferredDevice.path === path) {
|
|
553
|
-
_preferredDevice = undefined;
|
|
554
|
-
}
|
|
555
569
|
if (shouldClosePopup) {
|
|
556
570
|
closePopup();
|
|
557
571
|
cleanup();
|
|
558
572
|
}
|
|
559
573
|
}
|
|
560
574
|
};
|
|
561
|
-
const initDeviceList = async (
|
|
575
|
+
const initDeviceList = async (transportReconnect) => {
|
|
562
576
|
try {
|
|
563
577
|
_deviceList = new DeviceList_1.DeviceList();
|
|
564
578
|
_deviceList.on(events_2.DEVICE.CONNECT, device => {
|
|
@@ -584,11 +598,11 @@ const initDeviceList = async (settings) => {
|
|
|
584
598
|
}
|
|
585
599
|
_deviceList = undefined;
|
|
586
600
|
postMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR, { error }));
|
|
587
|
-
if (
|
|
601
|
+
if (transportReconnect) {
|
|
588
602
|
const { promise, timeout } = (0, promiseUtils_1.resolveAfter)(1000, null);
|
|
589
603
|
_deviceListInitTimeout = timeout;
|
|
590
604
|
promise.then(() => {
|
|
591
|
-
initDeviceList(
|
|
605
|
+
initDeviceList(transportReconnect);
|
|
592
606
|
});
|
|
593
607
|
}
|
|
594
608
|
});
|
|
@@ -601,20 +615,20 @@ const initDeviceList = async (settings) => {
|
|
|
601
615
|
catch (error) {
|
|
602
616
|
_deviceList = undefined;
|
|
603
617
|
postMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR, { error }));
|
|
604
|
-
if (!
|
|
618
|
+
if (!transportReconnect) {
|
|
605
619
|
throw error;
|
|
606
620
|
}
|
|
607
621
|
else {
|
|
608
622
|
const { promise, timeout } = (0, promiseUtils_1.resolveAfter)(3000, null);
|
|
609
623
|
_deviceListInitTimeout = timeout;
|
|
610
624
|
await promise;
|
|
611
|
-
await initDeviceList(
|
|
625
|
+
await initDeviceList(transportReconnect);
|
|
612
626
|
}
|
|
613
627
|
}
|
|
614
628
|
};
|
|
615
629
|
class Core extends events_1.default {
|
|
616
630
|
handleMessage(message) {
|
|
617
|
-
|
|
631
|
+
handleMessage(message);
|
|
618
632
|
}
|
|
619
633
|
async dispose() {
|
|
620
634
|
(0, BlockchainLink_1.dispose)();
|
|
@@ -626,11 +640,8 @@ class Core extends events_1.default {
|
|
|
626
640
|
await _deviceList.dispose();
|
|
627
641
|
}
|
|
628
642
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
await _getMethodPromise;
|
|
632
|
-
}
|
|
633
|
-
return _callMethods[0];
|
|
643
|
+
getCurrentMethod() {
|
|
644
|
+
return methodSynchronize(() => _callMethods[0]);
|
|
634
645
|
}
|
|
635
646
|
getTransportInfo() {
|
|
636
647
|
if (!_deviceList) {
|
|
@@ -646,7 +657,7 @@ class Core extends events_1.default {
|
|
|
646
657
|
}
|
|
647
658
|
}
|
|
648
659
|
exports.Core = Core;
|
|
649
|
-
const initCore = async (settings, logWriterFactory) => {
|
|
660
|
+
const initCore = async (settings, onCoreEvent, logWriterFactory) => {
|
|
650
661
|
if (logWriterFactory) {
|
|
651
662
|
(0, debug_1.setLogWriter)(logWriterFactory);
|
|
652
663
|
}
|
|
@@ -655,29 +666,27 @@ const initCore = async (settings, logWriterFactory) => {
|
|
|
655
666
|
(0, debug_1.enableLog)(DataManager_1.DataManager.getSettings('debug'));
|
|
656
667
|
_core = new Core();
|
|
657
668
|
_interactionTimeout = new interactionTimeout_1.InteractionTimeout(settings.popup ? settings.interactionTimeout : 0);
|
|
658
|
-
|
|
669
|
+
_core.on(events_2.CORE_EVENT, onCoreEvent);
|
|
659
670
|
}
|
|
660
671
|
catch (error) {
|
|
661
672
|
_log.error('init', error);
|
|
662
673
|
throw error;
|
|
663
674
|
}
|
|
664
|
-
};
|
|
665
|
-
exports.initCore = initCore;
|
|
666
|
-
const initTransport = async (settings) => {
|
|
667
675
|
try {
|
|
668
|
-
if (!
|
|
669
|
-
await initDeviceList(
|
|
676
|
+
if (!DataManager_1.DataManager.getSettings('transportReconnect')) {
|
|
677
|
+
await initDeviceList(false);
|
|
670
678
|
}
|
|
671
679
|
else {
|
|
672
|
-
initDeviceList(
|
|
680
|
+
initDeviceList(true);
|
|
673
681
|
}
|
|
674
682
|
}
|
|
675
683
|
catch (error) {
|
|
676
684
|
_log.error('initTransport', error);
|
|
677
685
|
throw error;
|
|
678
686
|
}
|
|
687
|
+
return _core;
|
|
679
688
|
};
|
|
680
|
-
exports.
|
|
689
|
+
exports.initCore = initCore;
|
|
681
690
|
const disableWebUSBTransport = async () => {
|
|
682
691
|
var _a;
|
|
683
692
|
if (!_deviceList)
|
|
@@ -696,7 +705,7 @@ const disableWebUSBTransport = async () => {
|
|
|
696
705
|
}
|
|
697
706
|
try {
|
|
698
707
|
await _deviceList.dispose();
|
|
699
|
-
await initDeviceList(settings);
|
|
708
|
+
await initDeviceList(settings.transportReconnect);
|
|
700
709
|
}
|
|
701
710
|
catch (error) {
|
|
702
711
|
}
|
package/lib/core/method.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { IFrameCallMessage } from '../events';
|
|
2
2
|
import type { AbstractMethod } from './AbstractMethod';
|
|
3
|
-
export declare const getMethod: (message: IFrameCallMessage
|
|
4
|
-
id?: number;
|
|
5
|
-
}) => Promise<AbstractMethod<any>>;
|
|
3
|
+
export declare const getMethod: (message: IFrameCallMessage) => Promise<AbstractMethod<any>>;
|
|
6
4
|
//# sourceMappingURL=method.d.ts.map
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { IFrameCallMessage } from '../events';
|
|
2
|
-
export declare const getMethod: (message: IFrameCallMessage
|
|
3
|
-
id?: number;
|
|
4
|
-
}) => Promise<any>;
|
|
2
|
+
export declare const getMethod: (message: IFrameCallMessage) => Promise<any>;
|
|
5
3
|
//# sourceMappingURL=method.native.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreEventMessage } from '../events';
|
|
2
2
|
import type { Device } from '../types';
|
|
3
|
-
export declare const enhancePostMessageWithAnalytics: (callback:
|
|
3
|
+
export declare const enhancePostMessageWithAnalytics: (callback: (message: CoreEventMessage) => void, message: CoreEventMessage, data: {
|
|
4
4
|
device?: Device;
|
|
5
5
|
}) => void;
|
|
6
6
|
//# sourceMappingURL=analyticsInfo.d.ts.map
|
package/lib/data/coinInfo.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export declare const getBitcoinNetwork: (pathOrName: DerivationPath) => ({
|
|
|
4
4
|
type: string;
|
|
5
5
|
url: string[];
|
|
6
6
|
} | undefined;
|
|
7
|
-
name: string;
|
|
8
7
|
label: string;
|
|
9
8
|
blockTime: number;
|
|
10
9
|
minFee: number;
|
|
11
10
|
maxFee: number;
|
|
11
|
+
name: string;
|
|
12
12
|
shortcut: string;
|
|
13
13
|
slip44: number;
|
|
14
14
|
support: {
|
|
@@ -60,11 +60,11 @@ export declare const getEthereumNetwork: (pathOrName: DerivationPath) => ({
|
|
|
60
60
|
type: string;
|
|
61
61
|
url: string[];
|
|
62
62
|
} | undefined;
|
|
63
|
-
name: string;
|
|
64
63
|
label: string;
|
|
65
64
|
blockTime: number;
|
|
66
65
|
minFee: number;
|
|
67
66
|
maxFee: number;
|
|
67
|
+
name: string;
|
|
68
68
|
shortcut: string;
|
|
69
69
|
slip44: number;
|
|
70
70
|
support: {
|
|
@@ -91,11 +91,11 @@ export declare const getMiscNetwork: (pathOrName: DerivationPath) => ({
|
|
|
91
91
|
type: string;
|
|
92
92
|
url: string[];
|
|
93
93
|
} | undefined;
|
|
94
|
-
name: string;
|
|
95
94
|
label: string;
|
|
96
95
|
blockTime: number;
|
|
97
96
|
minFee: number;
|
|
98
97
|
maxFee: number;
|
|
98
|
+
name: string;
|
|
99
99
|
shortcut: string;
|
|
100
100
|
slip44: number;
|
|
101
101
|
support: {
|
|
@@ -146,11 +146,11 @@ export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]
|
|
|
146
146
|
type: string;
|
|
147
147
|
url: string[];
|
|
148
148
|
} | undefined;
|
|
149
|
-
name: string;
|
|
150
149
|
label: string;
|
|
151
150
|
blockTime: number;
|
|
152
151
|
minFee: number;
|
|
153
152
|
maxFee: number;
|
|
153
|
+
name: string;
|
|
154
154
|
shortcut: string;
|
|
155
155
|
slip44: number;
|
|
156
156
|
support: {
|
|
@@ -202,11 +202,11 @@ export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => {
|
|
|
202
202
|
type: string;
|
|
203
203
|
url: string[];
|
|
204
204
|
} | undefined;
|
|
205
|
-
name: string;
|
|
206
205
|
label: string;
|
|
207
206
|
blockTime: number;
|
|
208
207
|
minFee: number;
|
|
209
208
|
maxFee: number;
|
|
209
|
+
name: string;
|
|
210
210
|
shortcut: string;
|
|
211
211
|
slip44: number;
|
|
212
212
|
support: {
|
|
@@ -258,11 +258,11 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
258
258
|
type: string;
|
|
259
259
|
url: string[];
|
|
260
260
|
} | undefined;
|
|
261
|
-
name: string;
|
|
262
261
|
label: string;
|
|
263
262
|
blockTime: number;
|
|
264
263
|
minFee: number;
|
|
265
264
|
maxFee: number;
|
|
265
|
+
name: string;
|
|
266
266
|
shortcut: string;
|
|
267
267
|
slip44: number;
|
|
268
268
|
support: {
|
|
@@ -313,11 +313,11 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
313
313
|
type: string;
|
|
314
314
|
url: string[];
|
|
315
315
|
} | undefined;
|
|
316
|
-
name: string;
|
|
317
316
|
label: string;
|
|
318
317
|
blockTime: number;
|
|
319
318
|
minFee: number;
|
|
320
319
|
maxFee: number;
|
|
320
|
+
name: string;
|
|
321
321
|
shortcut: string;
|
|
322
322
|
slip44: number;
|
|
323
323
|
support: {
|
|
@@ -343,11 +343,11 @@ export declare const getCoinInfo: (currency: string) => ({
|
|
|
343
343
|
type: string;
|
|
344
344
|
url: string[];
|
|
345
345
|
} | undefined;
|
|
346
|
-
name: string;
|
|
347
346
|
label: string;
|
|
348
347
|
blockTime: number;
|
|
349
348
|
minFee: number;
|
|
350
349
|
maxFee: number;
|
|
350
|
+
name: string;
|
|
351
351
|
shortcut: string;
|
|
352
352
|
slip44: number;
|
|
353
353
|
support: {
|
|
@@ -391,11 +391,11 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
391
391
|
type: string;
|
|
392
392
|
url: string[];
|
|
393
393
|
} | undefined;
|
|
394
|
-
name: string;
|
|
395
394
|
label: string;
|
|
396
395
|
blockTime: number;
|
|
397
396
|
minFee: number;
|
|
398
397
|
maxFee: number;
|
|
398
|
+
name: string;
|
|
399
399
|
shortcut: string;
|
|
400
400
|
slip44: number;
|
|
401
401
|
support: {
|
|
@@ -446,11 +446,11 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
446
446
|
type: string;
|
|
447
447
|
url: string[];
|
|
448
448
|
} | undefined;
|
|
449
|
-
name: string;
|
|
450
449
|
label: string;
|
|
451
450
|
blockTime: number;
|
|
452
451
|
minFee: number;
|
|
453
452
|
maxFee: number;
|
|
453
|
+
name: string;
|
|
454
454
|
shortcut: string;
|
|
455
455
|
slip44: number;
|
|
456
456
|
support: {
|
|
@@ -476,11 +476,11 @@ export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) =>
|
|
|
476
476
|
type: string;
|
|
477
477
|
url: string[];
|
|
478
478
|
} | undefined;
|
|
479
|
-
name: string;
|
|
480
479
|
label: string;
|
|
481
480
|
blockTime: number;
|
|
482
481
|
minFee: number;
|
|
483
482
|
maxFee: number;
|
|
483
|
+
name: string;
|
|
484
484
|
shortcut: string;
|
|
485
485
|
slip44: number;
|
|
486
486
|
support: {
|
|
@@ -507,11 +507,11 @@ export declare const getAllNetworks: () => (({
|
|
|
507
507
|
type: string;
|
|
508
508
|
url: string[];
|
|
509
509
|
} | undefined;
|
|
510
|
-
name: string;
|
|
511
510
|
label: string;
|
|
512
511
|
blockTime: number;
|
|
513
512
|
minFee: number;
|
|
514
513
|
maxFee: number;
|
|
514
|
+
name: string;
|
|
515
515
|
shortcut: string;
|
|
516
516
|
slip44: number;
|
|
517
517
|
support: {
|
|
@@ -562,11 +562,11 @@ export declare const getAllNetworks: () => (({
|
|
|
562
562
|
type: string;
|
|
563
563
|
url: string[];
|
|
564
564
|
} | undefined;
|
|
565
|
-
name: string;
|
|
566
565
|
label: string;
|
|
567
566
|
blockTime: number;
|
|
568
567
|
minFee: number;
|
|
569
568
|
maxFee: number;
|
|
569
|
+
name: string;
|
|
570
570
|
shortcut: string;
|
|
571
571
|
slip44: number;
|
|
572
572
|
support: {
|
|
@@ -592,11 +592,11 @@ export declare const getAllNetworks: () => (({
|
|
|
592
592
|
type: string;
|
|
593
593
|
url: string[];
|
|
594
594
|
} | undefined;
|
|
595
|
-
name: string;
|
|
596
595
|
label: string;
|
|
597
596
|
blockTime: number;
|
|
598
597
|
minFee: number;
|
|
599
598
|
maxFee: number;
|
|
599
|
+
name: string;
|
|
600
600
|
shortcut: string;
|
|
601
601
|
slip44: number;
|
|
602
602
|
support: {
|
|
@@ -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-02-08T12:00:00+00:00',
|
|
29
29
|
T2B1: {
|
|
30
30
|
rootPubKeys: [
|
|
31
31
|
'04ca97480ac0d7b1e6efafe518cd433cec2bf8ab9822d76eafd34363b55d63e60380bff20acc75cde03cffcb50ab6f8ce70c878e37ebc58ff7cca0a83b16b15fa5',
|
|
@@ -37,6 +37,9 @@ exports.deviceAuthenticityConfig = {
|
|
|
37
37
|
'0454d310d88d55d3044d80fcdbce9a63bf3118545fae71f6eca303272dcc4d25cf775ae3c18ae9f41b2cf29377bc4696fc79c8824a6fd6b9ca5fb6805ed6557aab',
|
|
38
38
|
'04e94bf05586a8e7a3e9aba32662a439be5f378da372219c8ee7cf8b4684dbfbd7ba88ed920c06f9f26deab9077654647738df8cf70898fea1c3aaf2ef086fc578',
|
|
39
39
|
'048c6c104bd7cc59cd5c5717533786a72ab59685bd13937f5542820e90f6ac6945e520e19d1d627a8e81ef5a94ef87de7a6a0d778e7dc9d389db877a5f9b629dd8',
|
|
40
|
+
'0467f8860c56b35985b0f53eb04e9187ccf216e1c08327d71231f5dafe92df5c0f1b4dc8ebdcd2f42d0e20c61c493ba2a67d2c354cb57255b0b7dcf7c2196b8277',
|
|
41
|
+
'049faf57b307013e9fed7564956d4a10938326df2e5d3df0456a0525af5f74ddfb88ba7a37c4c04435ffdca33b4fdf2626afbe65fe5c8fc0c6737de3313b85f229',
|
|
42
|
+
'04e3f9053b38000ef590f9cfb48337ef6ea7b387e00f514481f75ac8870b794e81808ea7e12cf86a7b756acb82148f2373541d21b443b6ba389e02f15348bbabf6',
|
|
40
43
|
],
|
|
41
44
|
debug: {
|
|
42
45
|
rootPubKeys: [
|
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.1.
|
|
4
|
+
exports.VERSION = '9.1.12';
|
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedEmitter } from '@trezor/utils/lib/typedEventEmitter';
|
|
2
2
|
import { Deferred } from '@trezor/utils/lib/createDeferred';
|
|
3
3
|
import { TransportProtocol } from '@trezor/protocol';
|
|
4
|
-
import { DeviceCommands } from './DeviceCommands';
|
|
4
|
+
import { DeviceCommands, PassphrasePromptResponse } from './DeviceCommands';
|
|
5
5
|
import { PROTO, NETWORK } from '../constants';
|
|
6
6
|
import { DEVICE, DeviceButtonRequestPayload } from '../events';
|
|
7
7
|
import type { Transport, Descriptor } from '@trezor/transport';
|
|
@@ -18,7 +18,7 @@ export type RunOptions = {
|
|
|
18
18
|
export interface DeviceEvents {
|
|
19
19
|
[DEVICE.PIN]: (device: Device, b: PROTO.PinMatrixRequestType | undefined, callback: (err: any, pin: string) => void) => void;
|
|
20
20
|
[DEVICE.WORD]: (device: Device, b: PROTO.WordRequestType, callback: (err: any, word: string) => void) => void;
|
|
21
|
-
[DEVICE.PASSPHRASE]: (device: Device, callback: (response:
|
|
21
|
+
[DEVICE.PASSPHRASE]: (device: Device, callback: (response: PassphrasePromptResponse) => void) => void;
|
|
22
22
|
[DEVICE.PASSPHRASE_ON_DEVICE]: () => void;
|
|
23
23
|
[DEVICE.BUTTON]: (device: Device, payload: DeviceButtonRequestPayload) => void;
|
|
24
24
|
[DEVICE.ACQUIRED]: () => void;
|
package/lib/events/call.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type CallMethodResponse<M extends keyof CallApi> = UnwrappedResponse<Retu
|
|
|
24
24
|
export type CallMethodAnyResponse = ReturnType<CallMethodUnion>;
|
|
25
25
|
export type CallMethod = (params: CallMethodPayload) => Promise<any>;
|
|
26
26
|
export interface IFrameCallMessage {
|
|
27
|
-
|
|
27
|
+
id: number;
|
|
28
28
|
type: typeof IFRAME.CALL;
|
|
29
29
|
payload: CallMethodPayload;
|
|
30
30
|
}
|
package/lib/events/core.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import type { BlockchainEventMessage } from './blockchain';
|
|
2
2
|
import type { IFrameCallMessage, MethodResponseMessage } from './call';
|
|
3
3
|
import type { DeviceEventMessage } from './device';
|
|
4
|
-
import type { IFrameEventMessage } from './iframe';
|
|
5
|
-
import type { PopupEventMessage } from './popup';
|
|
6
|
-
import type { TransportEventMessage } from './transport';
|
|
4
|
+
import type { IFrameEventMessage, IFrameInit, IFrameLogRequest } from './iframe';
|
|
5
|
+
import type { PopupAnalyticsResponse, PopupClosedMessage, PopupEventMessage } from './popup';
|
|
6
|
+
import type { TransportEventMessage, TransportDisableWebUSB, TransportRequestWebUSBDevice } from './transport';
|
|
7
7
|
import type { UiEventMessage } from './ui-request';
|
|
8
|
-
import type {
|
|
8
|
+
import type { UiResponseEvent } from './ui-response';
|
|
9
9
|
import type { Unsuccessful } from '../types/params';
|
|
10
10
|
export declare const CORE_EVENT = "CORE_EVENT";
|
|
11
|
-
export type
|
|
12
|
-
|
|
11
|
+
export type CoreRequestMessage = PopupClosedMessage | PopupAnalyticsResponse | TransportDisableWebUSB | TransportRequestWebUSBDevice | UiResponseEvent | IFrameInit | IFrameCallMessage | IFrameLogRequest;
|
|
12
|
+
export type CoreEventMessage = {
|
|
13
13
|
success?: boolean;
|
|
14
|
-
} & (BlockchainEventMessage | DeviceEventMessage | TransportEventMessage | UiEventMessage |
|
|
15
|
-
export
|
|
16
|
-
export type PostMessage = (message: CoreMessage) => void;
|
|
17
|
-
export declare const parseMessage: (messageData: any) => CoreMessage;
|
|
14
|
+
} & (BlockchainEventMessage | DeviceEventMessage | TransportEventMessage | UiEventMessage | MethodResponseMessage | IFrameEventMessage | PopupEventMessage);
|
|
15
|
+
export declare const parseMessage: <T extends CoreRequestMessage | CoreEventMessage = never>(messageData: any) => T;
|
|
18
16
|
export declare const createErrorMessage: (error: Error & {
|
|
19
17
|
code?: string;
|
|
20
18
|
}) => Unsuccessful;
|
package/lib/events/iframe.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface IFrameLogRequest {
|
|
|
38
38
|
export type IFrameEvent = {
|
|
39
39
|
type: typeof IFRAME.BOOTSTRAP;
|
|
40
40
|
payload?: typeof undefined;
|
|
41
|
-
} | IFrameLoaded |
|
|
41
|
+
} | IFrameLoaded | IFrameError;
|
|
42
42
|
export type IFrameEventMessage = IFrameEvent & {
|
|
43
43
|
event: typeof UI_EVENT;
|
|
44
44
|
};
|
package/lib/events/popup.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface PopupContentScriptLoaded {
|
|
|
67
67
|
export type PopupEvent = {
|
|
68
68
|
type: typeof POPUP.LOADED | typeof POPUP.CORE_LOADED | typeof POPUP.CANCEL_POPUP_REQUEST;
|
|
69
69
|
payload?: typeof undefined;
|
|
70
|
-
} | PopupInit | PopupHandshake | PopupError |
|
|
70
|
+
} | PopupInit | PopupHandshake | PopupError | PopupContentScriptLoaded | PopupMethodInfo;
|
|
71
71
|
export type PopupEventMessage = PopupEvent & {
|
|
72
72
|
event: typeof UI_EVENT;
|
|
73
73
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EventTypeDeviceSelected } from '@trezor/connect-analytics';
|
|
2
2
|
import type { PROTO } from '../constants';
|
|
3
|
-
import type { TransportDisableWebUSB, TransportRequestWebUSBDevice } from './transport';
|
|
4
3
|
import type { Device, CoinInfo, BitcoinNetworkInfo, SelectFeeLevel } from '../types';
|
|
5
4
|
import type { DiscoveryAccountType, DiscoveryAccount } from '../types/account';
|
|
6
5
|
import type { MessageFactoryFn } from '../types/utils';
|
|
@@ -200,7 +199,7 @@ export interface FirmwareProgress {
|
|
|
200
199
|
progress: number;
|
|
201
200
|
};
|
|
202
201
|
}
|
|
203
|
-
export type UiEvent = UiRequestWithoutPayload | UiRequestDeviceAction | UiRequestButton | UiRequestPermission | UiRequestConfirmation | UiRequestSelectDevice | UiRequestUnexpectedDeviceMode | UiRequestSelectAccount | UiRequestSelectFee | UpdateCustomFee | BundleProgress<any> | FirmwareProgress | FirmwareException | UiRequestAddressValidation | UiRequestSetOperation
|
|
202
|
+
export type UiEvent = UiRequestWithoutPayload | UiRequestDeviceAction | UiRequestButton | UiRequestPermission | UiRequestConfirmation | UiRequestSelectDevice | UiRequestUnexpectedDeviceMode | UiRequestSelectAccount | UiRequestSelectFee | UpdateCustomFee | BundleProgress<any> | FirmwareProgress | FirmwareException | UiRequestAddressValidation | UiRequestSetOperation;
|
|
204
203
|
export type UiEventMessage = UiEvent & {
|
|
205
204
|
event: typeof UI_EVENT;
|
|
206
205
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
import { Deferred } from '@trezor/utils/lib/createDeferred';
|
|
4
3
|
export declare const eventEmitter: EventEmitter;
|
|
5
|
-
export declare const messagePromises: {
|
|
6
|
-
[key: number]: Deferred<any>;
|
|
7
|
-
};
|
|
8
4
|
declare const TrezorConnect: import("./types").TrezorConnect;
|
|
9
5
|
export default TrezorConnect;
|
|
10
6
|
export * from './exports';
|