@trezor/connect 9.3.0 → 9.3.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 +121 -8
- package/README.md +1 -1
- package/lib/api/checkFirmwareAuthenticity.d.ts +2 -1
- package/lib/api/checkFirmwareAuthenticity.js +34 -26
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +1 -0
- package/lib/api/ethereum/api/ethereumSignTypedData.js +3 -1
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/firmware/getBinary.d.ts +4 -4
- package/lib/api/firmware/getBinary.js +4 -15
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.d.ts +11 -0
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.js +32 -0
- package/lib/api/firmware/index.d.ts +1 -0
- package/lib/api/firmware/index.js +3 -1
- package/lib/api/firmware/verifyAuthenticityProof.d.ts +1 -1
- package/lib/api/firmware/verifyAuthenticityProof.js +37 -2
- package/lib/api/firmware/x509certificate.d.ts +20 -6
- package/lib/api/firmware/x509certificate.js +82 -13
- package/lib/api/getCoinInfo.d.ts +3 -0
- package/lib/api/getFeatures.d.ts +1 -0
- package/lib/backend/Blockchain.js +10 -1
- package/lib/core/AbstractMethod.js +1 -0
- package/lib/core/index.d.ts +3 -3
- package/lib/core/index.js +93 -111
- package/lib/core/onCallFirmwareUpdate.js +25 -14
- package/lib/data/DataManager.d.ts +11 -0
- package/lib/data/DataManager.js +1 -1
- package/lib/data/coinInfo.d.ts +14 -0
- package/lib/data/config.d.ts +11 -0
- package/lib/data/config.js +17 -1
- package/lib/data/connectSettings.js +3 -2
- package/lib/data/deviceAuthenticityConfig.d.ts +1 -28
- package/lib/data/deviceAuthenticityConfig.js +25 -24
- package/lib/data/deviceAuthenticityConfigTypes.d.ts +38 -0
- package/lib/data/deviceAuthenticityConfigTypes.js +28 -0
- package/lib/data/models.d.ts +10 -0
- package/lib/data/models.js +12 -10
- package/lib/data/version.d.ts +2 -1
- package/lib/data/version.js +3 -2
- package/lib/device/Device.d.ts +2 -3
- package/lib/device/Device.js +15 -24
- package/lib/device/DeviceCommands.js +2 -27
- package/lib/device/DeviceList.d.ts +42 -27
- package/lib/device/DeviceList.js +249 -233
- package/lib/events/core.d.ts +2 -2
- package/lib/events/popup.d.ts +1 -0
- package/lib/events/transport.d.ts +5 -0
- package/lib/index.js +20 -20
- package/lib/types/api/authenticateDevice.d.ts +9 -0
- package/lib/types/api/authenticateDevice.js +2 -2
- package/lib/types/api/checkFirmwareAuthenticity.d.ts +4 -1
- package/lib/types/api/init.d.ts +2 -2
- package/lib/types/coinInfo.d.ts +7 -0
- package/lib/types/firmware.d.ts +2 -2
- package/lib/types/settings.d.ts +7 -3
- package/lib/utils/assetUtils.js +1 -0
- package/lib/utils/promiseUtils.d.ts +3 -3
- package/lib/utils/promiseUtils.js +7 -5
- package/package.json +16 -17
- package/lib/core/coreManager.d.ts +0 -16
- package/lib/core/coreManager.js +0 -55
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const onCoreEvent = (message) => {
|
|
|
30
30
|
var _a;
|
|
31
31
|
const { event, type, payload } = message;
|
|
32
32
|
if (type === events_2.UI.REQUEST_UI_WINDOW) {
|
|
33
|
-
(_a = coreManager.
|
|
33
|
+
(_a = coreManager.get()) === null || _a === void 0 ? void 0 : _a.handleMessage({ type: events_2.POPUP.HANDSHAKE });
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
if (type === events_2.POPUP.CANCEL_POPUP_REQUEST)
|
|
@@ -64,11 +64,8 @@ const onCoreEvent = (message) => {
|
|
|
64
64
|
_log.warn('Undefined message', event, message);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const initSettings = (settings = {}) => {
|
|
68
68
|
var _a;
|
|
69
|
-
if (coreManager.getCore() || coreManager.getInitPromise()) {
|
|
70
|
-
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
71
|
-
}
|
|
72
69
|
_settings = (0, connectSettings_1.parseConnectSettings)({ ..._settings, ...settings, popup: false });
|
|
73
70
|
if (!_settings.manifest) {
|
|
74
71
|
throw constants_1.ERRORS.TypedError('Init_ManifestMissing');
|
|
@@ -76,19 +73,25 @@ const init = async (settings = {}) => {
|
|
|
76
73
|
if (!((_a = _settings.transports) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
77
74
|
_settings.transports = ['BridgeTransport'];
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
};
|
|
77
|
+
const init = async (settings = {}) => {
|
|
78
|
+
if (coreManager.get() || coreManager.getPending()) {
|
|
79
|
+
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
80
|
+
}
|
|
81
|
+
initSettings(settings);
|
|
82
|
+
if (!_settings.lazyLoad) {
|
|
83
|
+
await coreManager.getOrInit(_settings, onCoreEvent);
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
};
|
|
86
|
+
const initCore = () => {
|
|
87
|
+
initSettings({ lazyLoad: false });
|
|
88
|
+
return coreManager.getOrInit(_settings, onCoreEvent);
|
|
84
89
|
};
|
|
85
90
|
const call = async (params) => {
|
|
91
|
+
var _a, _b;
|
|
86
92
|
let core;
|
|
87
93
|
try {
|
|
88
|
-
|
|
89
|
-
await init();
|
|
90
|
-
}
|
|
91
|
-
core = await coreManager.getOrInitCore(_settings, onCoreEvent);
|
|
94
|
+
core = (_b = (_a = coreManager.get()) !== null && _a !== void 0 ? _a : (await coreManager.getPending())) !== null && _b !== void 0 ? _b : (await initCore());
|
|
92
95
|
}
|
|
93
96
|
catch (error) {
|
|
94
97
|
return (0, events_2.createErrorMessage)(error);
|
|
@@ -101,10 +104,7 @@ const call = async (params) => {
|
|
|
101
104
|
id: promiseId,
|
|
102
105
|
});
|
|
103
106
|
const response = await promise;
|
|
104
|
-
|
|
105
|
-
return response;
|
|
106
|
-
}
|
|
107
|
-
return (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_NoResponse'));
|
|
107
|
+
return response !== null && response !== void 0 ? response : (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_NoResponse'));
|
|
108
108
|
}
|
|
109
109
|
catch (error) {
|
|
110
110
|
_log.error('call', error);
|
|
@@ -112,7 +112,7 @@ const call = async (params) => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
const uiResponse = (response) => {
|
|
115
|
-
const core = coreManager.
|
|
115
|
+
const core = coreManager.get();
|
|
116
116
|
if (!core) {
|
|
117
117
|
throw constants_1.ERRORS.TypedError('Init_NotInitialized');
|
|
118
118
|
}
|
|
@@ -121,7 +121,7 @@ const uiResponse = (response) => {
|
|
|
121
121
|
const requestLogin = async (params) => {
|
|
122
122
|
if (typeof params.callback === 'function') {
|
|
123
123
|
const { callback } = params;
|
|
124
|
-
const core = coreManager.
|
|
124
|
+
const core = coreManager.get();
|
|
125
125
|
const loginChallengeListener = async (event) => {
|
|
126
126
|
const { data } = event;
|
|
127
127
|
if (data && data.type === events_2.UI.LOGIN_CHALLENGE_REQUEST) {
|
|
@@ -153,7 +153,7 @@ const requestLogin = async (params) => {
|
|
|
153
153
|
return call({ method: 'requestLogin', ...params });
|
|
154
154
|
};
|
|
155
155
|
const cancel = (error) => {
|
|
156
|
-
const core = coreManager.
|
|
156
|
+
const core = coreManager.get();
|
|
157
157
|
if (!core) {
|
|
158
158
|
throw constants_1.ERRORS.TypedError('Runtime', 'postMessage: _core not found');
|
|
159
159
|
}
|
|
@@ -12,6 +12,15 @@ export declare const AuthenticateDeviceParams: import("@sinclair/typebox").TObje
|
|
|
12
12
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
13
13
|
}>>;
|
|
14
14
|
}>]>;
|
|
15
|
+
T3B1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
16
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
17
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
18
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
19
|
+
debug: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
20
|
+
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
21
|
+
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>]>;
|
|
15
24
|
T3T1: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{
|
|
16
25
|
rootPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
17
26
|
caPubKeys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthenticateDeviceParams = void 0;
|
|
4
4
|
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
-
const
|
|
5
|
+
const deviceAuthenticityConfigTypes_1 = require("../../data/deviceAuthenticityConfigTypes");
|
|
6
6
|
exports.AuthenticateDeviceParams = schema_utils_1.Type.Object({
|
|
7
|
-
config: schema_utils_1.Type.Optional(
|
|
7
|
+
config: schema_utils_1.Type.Optional(deviceAuthenticityConfigTypes_1.DeviceAuthenticityConfig),
|
|
8
8
|
allowDebugKeys: schema_utils_1.Type.Optional(schema_utils_1.Type.Boolean()),
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=authenticateDevice.js.map
|
|
@@ -4,5 +4,8 @@ export interface CheckFirmwareAuthenticityResponse {
|
|
|
4
4
|
actualFirmwareHash: string;
|
|
5
5
|
valid: boolean;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type CheckFirmwareAuthenticityParams = CommonParams & {
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function checkFirmwareAuthenticity(params: CheckFirmwareAuthenticityParams): Response<CheckFirmwareAuthenticityResponse>;
|
|
8
11
|
//# sourceMappingURL=checkFirmwareAuthenticity.d.ts.map
|
package/lib/types/api/init.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConnectSettingsPublic, Manifest } from '../settings';
|
|
2
2
|
export declare function init(settings: {
|
|
3
3
|
manifest: Manifest;
|
|
4
|
-
} & Partial<
|
|
4
|
+
} & Partial<ConnectSettingsPublic>): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=init.d.ts.map
|
package/lib/types/coinInfo.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const CoinSupport: import("@sinclair/typebox").TObject<{
|
|
|
27
27
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
28
28
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
29
29
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
30
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
30
31
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
31
32
|
connect: import("@sinclair/typebox").TBoolean;
|
|
32
33
|
}>;
|
|
@@ -45,6 +46,7 @@ export declare const BitcoinNetworkInfo: import("@sinclair/typebox").TIntersect<
|
|
|
45
46
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
46
47
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
47
48
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
49
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
48
50
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
49
51
|
connect: import("@sinclair/typebox").TBoolean;
|
|
50
52
|
}>;
|
|
@@ -103,6 +105,7 @@ export declare const EthereumNetworkInfo: import("@sinclair/typebox").TIntersect
|
|
|
103
105
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
104
106
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
105
107
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
108
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
106
109
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
107
110
|
connect: import("@sinclair/typebox").TBoolean;
|
|
108
111
|
}>;
|
|
@@ -136,6 +139,7 @@ export declare const MiscNetworkInfo: import("@sinclair/typebox").TIntersect<[im
|
|
|
136
139
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
137
140
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
138
141
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
142
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
139
143
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
140
144
|
connect: import("@sinclair/typebox").TBoolean;
|
|
141
145
|
}>;
|
|
@@ -169,6 +173,7 @@ export declare const CoinInfo: import("@sinclair/typebox").TUnion<[import("@sinc
|
|
|
169
173
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
170
174
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
171
175
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
176
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
172
177
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
173
178
|
connect: import("@sinclair/typebox").TBoolean;
|
|
174
179
|
}>;
|
|
@@ -225,6 +230,7 @@ export declare const CoinInfo: import("@sinclair/typebox").TUnion<[import("@sinc
|
|
|
225
230
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
226
231
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
227
232
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
233
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
228
234
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
229
235
|
connect: import("@sinclair/typebox").TBoolean;
|
|
230
236
|
}>;
|
|
@@ -256,6 +262,7 @@ export declare const CoinInfo: import("@sinclair/typebox").TUnion<[import("@sinc
|
|
|
256
262
|
T1B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
257
263
|
T2T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
258
264
|
T2B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
265
|
+
T3B1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
259
266
|
T3T1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TLiteral<false>]>;
|
|
260
267
|
connect: import("@sinclair/typebox").TBoolean;
|
|
261
268
|
}>;
|
package/lib/types/firmware.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export type FirmwareRelease = {
|
|
|
8
8
|
required: boolean;
|
|
9
9
|
url: string;
|
|
10
10
|
fingerprint: string;
|
|
11
|
-
changelog: string;
|
|
11
|
+
changelog: string | string[];
|
|
12
|
+
changelog_bitcoinonly?: string | string[];
|
|
12
13
|
version: VersionArray;
|
|
13
14
|
min_firmware_version: VersionArray;
|
|
14
15
|
min_bootloader_version: VersionArray;
|
|
15
16
|
bootloader_version?: VersionArray;
|
|
16
17
|
url_bitcoinonly?: string;
|
|
17
18
|
fingerprint_bitcoinonly?: string;
|
|
18
|
-
notes?: string;
|
|
19
19
|
channel?: string;
|
|
20
20
|
translations?: string[];
|
|
21
21
|
};
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Manifest {
|
|
|
6
6
|
email: string;
|
|
7
7
|
}
|
|
8
8
|
export type Proxy = BlockchainSettings['proxy'];
|
|
9
|
-
export interface
|
|
9
|
+
export interface ConnectSettingsPublic {
|
|
10
10
|
manifest?: Manifest;
|
|
11
11
|
connectSrc?: string;
|
|
12
12
|
debug?: boolean;
|
|
@@ -19,6 +19,11 @@ export interface ConnectSettings {
|
|
|
19
19
|
pendingTransportEvent?: boolean;
|
|
20
20
|
lazyLoad?: boolean;
|
|
21
21
|
interactionTimeout?: number;
|
|
22
|
+
trustedHost: boolean;
|
|
23
|
+
coreMode?: 'auto' | 'popup' | 'iframe';
|
|
24
|
+
_extendWebextensionLifetime?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ConnectSettingsInternal {
|
|
22
27
|
origin?: string;
|
|
23
28
|
configSrc: string;
|
|
24
29
|
iframeSrc: string;
|
|
@@ -26,13 +31,12 @@ export interface ConnectSettings {
|
|
|
26
31
|
webusbSrc: string;
|
|
27
32
|
version: string;
|
|
28
33
|
priority: number;
|
|
29
|
-
trustedHost: boolean;
|
|
30
34
|
extension?: string;
|
|
31
35
|
env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native';
|
|
32
36
|
timestamp: number;
|
|
33
37
|
proxy?: Proxy;
|
|
34
38
|
sharedLogger?: boolean;
|
|
35
39
|
useCoreInPopup?: boolean;
|
|
36
|
-
_extendWebextensionLifetime?: boolean;
|
|
37
40
|
}
|
|
41
|
+
export type ConnectSettings = ConnectSettingsPublic & ConnectSettingsInternal;
|
|
38
42
|
//# sourceMappingURL=settings.d.ts.map
|
package/lib/utils/assetUtils.js
CHANGED
|
@@ -9,6 +9,7 @@ const firmwareAssets = {
|
|
|
9
9
|
[types_1.DeviceModelInternal.T1B1]: require('@trezor/connect-common/files/firmware/t1b1/releases.json'),
|
|
10
10
|
[types_1.DeviceModelInternal.T2T1]: require('@trezor/connect-common/files/firmware/t2t1/releases.json'),
|
|
11
11
|
[types_1.DeviceModelInternal.T2B1]: require('@trezor/connect-common/files/firmware/t2b1/releases.json'),
|
|
12
|
+
[types_1.DeviceModelInternal.T3B1]: require('@trezor/connect-common/files/firmware/t2b1/releases.json'),
|
|
12
13
|
[types_1.DeviceModelInternal.T3T1]: require('@trezor/connect-common/files/firmware/t3t1/releases.json'),
|
|
13
14
|
};
|
|
14
15
|
const getAssetByUrl = (url) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const resolveAfter: (msec: number, value?:
|
|
2
|
-
promise: Promise<
|
|
3
|
-
|
|
1
|
+
export declare const resolveAfter: <T = void>(msec: number, value?: T | undefined) => {
|
|
2
|
+
promise: Promise<T>;
|
|
3
|
+
reject: (e: Error) => void;
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=promiseUtils.d.ts.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveAfter = void 0;
|
|
4
|
+
const utils_1 = require("@trezor/utils");
|
|
4
5
|
const resolveAfter = (msec, value) => {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const { promise, reject, resolve } = (0, utils_1.createDeferred)();
|
|
7
|
+
const timeout = setTimeout(resolve, msec, value);
|
|
8
|
+
return {
|
|
9
|
+
promise: promise.finally(() => clearTimeout(timeout)),
|
|
10
|
+
reject,
|
|
11
|
+
};
|
|
10
12
|
};
|
|
11
13
|
exports.resolveAfter = resolveAfter;
|
|
12
14
|
//# sourceMappingURL=promiseUtils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.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.",
|
|
@@ -67,20 +67,20 @@
|
|
|
67
67
|
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@babel/preset-typescript": "^7.
|
|
71
|
-
"@ethereumjs/common": "^4.
|
|
72
|
-
"@ethereumjs/tx": "^5.
|
|
70
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
71
|
+
"@ethereumjs/common": "^4.3.0",
|
|
72
|
+
"@ethereumjs/tx": "^5.3.0",
|
|
73
73
|
"@fivebinaries/coin-selection": "2.2.1",
|
|
74
|
-
"@trezor/blockchain-link": "2.2.
|
|
75
|
-
"@trezor/blockchain-link-types": "1.1.
|
|
74
|
+
"@trezor/blockchain-link": "2.2.1-beta.2",
|
|
75
|
+
"@trezor/blockchain-link-types": "1.1.1-beta.2",
|
|
76
76
|
"@trezor/connect-analytics": "1.1.0",
|
|
77
|
-
"@trezor/connect-common": "0.1.
|
|
78
|
-
"@trezor/protobuf": "1.1.
|
|
79
|
-
"@trezor/protocol": "1.1.
|
|
80
|
-
"@trezor/schema-utils": "1.1.
|
|
81
|
-
"@trezor/transport": "1.2.
|
|
82
|
-
"@trezor/utils": "9.1.
|
|
83
|
-
"@trezor/utxo-lib": "2.1.
|
|
77
|
+
"@trezor/connect-common": "0.1.1-beta.2",
|
|
78
|
+
"@trezor/protobuf": "1.1.1-beta.2",
|
|
79
|
+
"@trezor/protocol": "1.1.1-beta.1",
|
|
80
|
+
"@trezor/schema-utils": "1.1.1-beta.1",
|
|
81
|
+
"@trezor/transport": "1.2.1-beta.2",
|
|
82
|
+
"@trezor/utils": "9.1.1-beta.2",
|
|
83
|
+
"@trezor/utxo-lib": "2.1.1-beta.1",
|
|
84
84
|
"blakejs": "^1.2.1",
|
|
85
85
|
"bs58": "^5.0.0",
|
|
86
86
|
"bs58check": "^3.0.1",
|
|
@@ -90,7 +90,6 @@
|
|
|
90
90
|
"@trezor/trezor-user-env-link": "1.0.2",
|
|
91
91
|
"@types/karma": "^6.3.8",
|
|
92
92
|
"babel-loader": "^9.1.3",
|
|
93
|
-
"ethereum-cryptography": "^2.1.3",
|
|
94
93
|
"jest": "29.7.0",
|
|
95
94
|
"karma": "^6.4.2",
|
|
96
95
|
"karma-babel-preprocessor": "^8.0.2",
|
|
@@ -101,9 +100,9 @@
|
|
|
101
100
|
"karma-webpack": "^5.0.1",
|
|
102
101
|
"node-libs-browser": "^2.2.1",
|
|
103
102
|
"ts-node": "^10.9.1",
|
|
104
|
-
"tsx": "^4.
|
|
105
|
-
"webpack": "^5.
|
|
106
|
-
"ws": "^8.
|
|
103
|
+
"tsx": "^4.16.3",
|
|
104
|
+
"webpack": "^5.93.0",
|
|
105
|
+
"ws": "^8.18.0"
|
|
107
106
|
},
|
|
108
107
|
"peerDependencies": {
|
|
109
108
|
"tslib": "^2.6.2"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import { CoreEventMessage } from '../events';
|
|
4
|
-
import { ConnectSettings } from '../types';
|
|
5
|
-
type CoreInstance = EventEmitter & {
|
|
6
|
-
init: (settings: ConnectSettings, onCoreEvent: (message: CoreEventMessage) => void, ...rest: any[]) => Promise<void>;
|
|
7
|
-
dispose: () => any;
|
|
8
|
-
};
|
|
9
|
-
export declare const initCoreManager: <Core extends CoreInstance>(core: Core) => {
|
|
10
|
-
getOrInitCore: (...[settings, onCoreEvent, ...rest]: Parameters<Core["init"]>) => Promise<Core>;
|
|
11
|
-
getCore: () => Core | undefined;
|
|
12
|
-
getInitPromise: () => Promise<Core> | undefined;
|
|
13
|
-
dispose: () => void;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=coreManager.d.ts.map
|
package/lib/core/coreManager.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initCoreManager = void 0;
|
|
4
|
-
const utils_1 = require("@trezor/utils");
|
|
5
|
-
const events_1 = require("../events");
|
|
6
|
-
const initCoreManager = (core) => {
|
|
7
|
-
const state = {};
|
|
8
|
-
let initDfd;
|
|
9
|
-
const getOrInitCore = (...[settings, onCoreEvent, ...rest]) => {
|
|
10
|
-
if (state.core)
|
|
11
|
-
return Promise.resolve(state.core);
|
|
12
|
-
if (state.initPromise)
|
|
13
|
-
return state.initPromise;
|
|
14
|
-
const eventThrottle = async (...args) => {
|
|
15
|
-
if (state.initPromise) {
|
|
16
|
-
const core = await state.initPromise.catch(() => { });
|
|
17
|
-
if (!core)
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
onCoreEvent(...args);
|
|
21
|
-
};
|
|
22
|
-
const dfd = (0, utils_1.createDeferred)();
|
|
23
|
-
initDfd = dfd;
|
|
24
|
-
state.initPromise = dfd.promise;
|
|
25
|
-
core.init(settings, eventThrottle, ...rest)
|
|
26
|
-
.then(() => {
|
|
27
|
-
core.on(events_1.CORE_EVENT, onCoreEvent);
|
|
28
|
-
core.off(events_1.CORE_EVENT, eventThrottle);
|
|
29
|
-
state.core = core;
|
|
30
|
-
dfd.resolve(core);
|
|
31
|
-
})
|
|
32
|
-
.catch(dfd.reject)
|
|
33
|
-
.finally(() => {
|
|
34
|
-
initDfd = undefined;
|
|
35
|
-
delete state.initPromise;
|
|
36
|
-
});
|
|
37
|
-
return dfd.promise;
|
|
38
|
-
};
|
|
39
|
-
const dispose = () => {
|
|
40
|
-
var _a;
|
|
41
|
-
initDfd === null || initDfd === void 0 ? void 0 : initDfd.reject(new Error('Core disposed'));
|
|
42
|
-
initDfd = undefined;
|
|
43
|
-
(_a = state.core) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
44
|
-
delete state.initPromise;
|
|
45
|
-
delete state.core;
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
getOrInitCore,
|
|
49
|
-
getCore: () => state.core,
|
|
50
|
-
getInitPromise: () => state.initPromise,
|
|
51
|
-
dispose,
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
exports.initCoreManager = initCoreManager;
|
|
55
|
-
//# sourceMappingURL=coreManager.js.map
|