@trezor/connect 9.4.7 → 9.4.8-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 +59 -8
- package/README.md +1 -1
- package/lib/api/applyFlags.d.ts +1 -1
- package/lib/api/applyFlags.js +1 -1
- package/lib/api/applySettings.d.ts +1 -1
- package/lib/api/authenticateDevice.js +1 -1
- package/lib/api/authorizeCoinjoin.d.ts +1 -1
- package/lib/api/authorizeCoinjoin.js +1 -1
- package/lib/api/backupDevice.d.ts +1 -1
- package/lib/api/backupDevice.js +1 -1
- package/lib/api/binance/api/binanceGetAddress.d.ts +1 -1
- package/lib/api/binance/api/binanceGetAddress.js +3 -3
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +1 -1
- package/lib/api/binance/api/binanceGetPublicKey.js +2 -2
- package/lib/api/binance/api/binanceSignTransaction.js +2 -2
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/bitcoin/TransactionComposer.d.ts +1 -1
- package/lib/api/bitcoin/inputs.d.ts +1 -1
- package/lib/api/bitcoin/inputs.js +1 -1
- package/lib/api/bitcoin/outputs.js +2 -2
- package/lib/api/bitcoin/refTx.d.ts +2 -2
- package/lib/api/bitcoin/refTx.js +4 -4
- package/lib/api/bitcoin/signtx.d.ts +2 -2
- package/lib/api/bitcoin/signtxLegacy.d.ts +1 -1
- package/lib/api/bitcoin/signtxVerify.d.ts +1 -1
- package/lib/api/blockchainDisconnect.js +2 -2
- package/lib/api/blockchainEstimateFee.d.ts +1 -1
- package/lib/api/blockchainEstimateFee.js +3 -2
- package/lib/api/blockchainEvmRpcCall.js +2 -2
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
- package/lib/api/blockchainGetAccountBalanceHistory.js +1 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
- package/lib/api/blockchainGetCurrentFiatRates.js +1 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +1 -1
- package/lib/api/blockchainGetInfo.js +1 -1
- package/lib/api/blockchainGetTransactions.js +1 -1
- package/lib/api/blockchainSetCustomBackend.js +1 -1
- package/lib/api/blockchainSubscribe.d.ts +1 -1
- package/lib/api/blockchainSubscribe.js +1 -1
- package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -1
- package/lib/api/blockchainSubscribeFiatRates.js +1 -1
- package/lib/api/blockchainUnsubscribe.d.ts +1 -1
- package/lib/api/blockchainUnsubscribe.js +1 -1
- package/lib/api/blockchainUnsubscribeFiatRates.js +1 -1
- package/lib/api/cancelCoinjoinAuthorization.d.ts +1 -1
- package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +1 -1
- package/lib/api/cardano/api/cardanoComposeTransaction.js +3 -11
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +1 -1
- package/lib/api/cardano/api/cardanoGetAddress.js +4 -4
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +2 -2
- package/lib/api/cardano/api/cardanoGetPublicKey.js +2 -2
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +3 -3
- package/lib/api/cardano/api/cardanoSignTransaction.js +4 -4
- package/lib/api/cardano/cardanoAddressParameters.js +1 -1
- package/lib/api/cardano/cardanoAuxiliaryData.js +1 -1
- package/lib/api/cardano/cardanoCertificate.js +1 -1
- package/lib/api/cardano/cardanoInputs.js +1 -1
- package/lib/api/cardano/cardanoUtils.js +30 -0
- package/lib/api/changePin.d.ts +1 -1
- package/lib/api/changePin.js +1 -1
- package/lib/api/changeWipeCode.d.ts +1 -1
- package/lib/api/cipherKeyValue.d.ts +1 -1
- package/lib/api/cipherKeyValue.js +3 -3
- package/lib/api/common/Discovery.d.ts +2 -2
- package/lib/api/common/paramsValidator.js +1 -1
- package/lib/api/composeTransaction.d.ts +3 -3
- package/lib/api/composeTransaction.js +9 -9
- package/lib/api/eos/api/eosGetPublicKey.d.ts +1 -1
- package/lib/api/eos/api/eosGetPublicKey.js +2 -2
- package/lib/api/eos/api/eosSignTransaction.d.ts +1 -1
- package/lib/api/eos/api/eosSignTransaction.js +2 -2
- package/lib/api/eos/eosSignTx.d.ts +3 -3
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +3 -3
- package/lib/api/ethereum/api/ethereumGetAddress.js +6 -6
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +1 -1
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -3
- package/lib/api/ethereum/api/ethereumSignMessage.d.ts +1 -1
- package/lib/api/ethereum/api/ethereumSignMessage.js +3 -3
- package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +2 -2
- package/lib/api/ethereum/api/ethereumSignTransaction.js +4 -4
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
- package/lib/api/ethereum/api/ethereumSignTypedData.js +6 -6
- package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +1 -1
- package/lib/api/ethereum/api/ethereumVerifyMessage.js +2 -2
- package/lib/api/ethereum/ethereumDefinitions.d.ts +2 -2
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.js +2 -2
- package/lib/api/firmware/parseFirmwareHeaders.d.ts +2 -1
- package/lib/api/firmware/uploadFirmware.d.ts +1 -1
- package/lib/api/firmware/uploadFirmware.js +1 -1
- package/lib/api/firmware/verifyAuthenticityProof.d.ts +1 -1
- package/lib/api/firmware/verifyEntropy.d.ts +19 -0
- package/lib/api/firmware/verifyEntropy.js +112 -0
- package/lib/api/getAccountDescriptor.js +4 -4
- package/lib/api/getAccountInfo.d.ts +21 -1
- package/lib/api/getAccountInfo.js +7 -7
- package/lib/api/getAddress.d.ts +1 -1
- package/lib/api/getAddress.js +3 -3
- package/lib/api/getCoinInfo.d.ts +3 -0
- package/lib/api/getCoinInfo.js +1 -1
- package/lib/api/getDeviceState.js +1 -1
- package/lib/api/getFirmwareHash.d.ts +1 -1
- package/lib/api/getFirmwareHash.js +1 -1
- package/lib/api/getOwnershipId.d.ts +1 -1
- package/lib/api/getOwnershipId.js +2 -2
- package/lib/api/getOwnershipProof.d.ts +1 -1
- package/lib/api/getOwnershipProof.js +2 -2
- package/lib/api/getPublicKey.d.ts +1 -1
- package/lib/api/getPublicKey.js +4 -4
- package/lib/api/loadDevice.d.ts +1 -1
- package/lib/api/loadDevice.js +1 -1
- package/lib/api/nem/api/nemGetAddress.d.ts +1 -1
- package/lib/api/nem/api/nemGetAddress.js +3 -3
- package/lib/api/nem/api/nemSignTransaction.d.ts +1 -1
- package/lib/api/nem/api/nemSignTransaction.js +2 -2
- package/lib/api/pushTransaction.js +2 -2
- package/lib/api/recoveryDevice.d.ts +1 -1
- package/lib/api/requestLogin.d.ts +1 -1
- package/lib/api/requestLogin.js +2 -2
- package/lib/api/resetDevice.d.ts +3 -1
- package/lib/api/resetDevice.js +58 -3
- package/lib/api/ripple/api/rippleGetAddress.d.ts +1 -1
- package/lib/api/ripple/api/rippleGetAddress.js +3 -3
- package/lib/api/ripple/api/rippleSignTransaction.d.ts +1 -1
- package/lib/api/ripple/api/rippleSignTransaction.js +2 -2
- package/lib/api/setBrightness.d.ts +1 -1
- package/lib/api/setBrightness.js +1 -1
- package/lib/api/setBusy.d.ts +1 -1
- package/lib/api/setBusy.js +1 -1
- package/lib/api/setProxy.js +1 -1
- package/lib/api/showDeviceTutorial.d.ts +1 -1
- package/lib/api/showDeviceTutorial.js +1 -1
- package/lib/api/signMessage.d.ts +1 -1
- package/lib/api/signMessage.js +2 -2
- package/lib/api/signTransaction.d.ts +2 -2
- package/lib/api/signTransaction.js +3 -3
- package/lib/api/solana/api/index.d.ts +1 -0
- package/lib/api/solana/api/index.js +3 -1
- package/lib/api/solana/api/solanaComposeTransaction.d.ts +25 -0
- package/lib/api/solana/api/solanaComposeTransaction.js +61 -0
- package/lib/api/solana/api/solanaGetAddress.js +2 -2
- package/lib/api/solana/api/solanaGetPublicKey.js +2 -2
- package/lib/api/solana/api/solanaSignTransaction.d.ts +9 -1
- package/lib/api/solana/api/solanaSignTransaction.js +20 -2
- package/lib/api/solana/solanaUtils.d.ts +48 -0
- package/lib/api/solana/solanaUtils.js +213 -0
- package/lib/api/stellar/api/stellarGetAddress.d.ts +1 -1
- package/lib/api/stellar/api/stellarGetAddress.js +3 -3
- package/lib/api/stellar/api/stellarSignTransaction.js +3 -3
- package/lib/api/tezos/api/tezosGetAddress.d.ts +1 -1
- package/lib/api/tezos/api/tezosGetAddress.js +3 -3
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +1 -1
- package/lib/api/tezos/api/tezosGetPublicKey.js +2 -2
- package/lib/api/tezos/api/tezosSignTransaction.d.ts +1 -1
- package/lib/api/tezos/api/tezosSignTransaction.js +2 -2
- package/lib/api/tezos/tezosSignTx.d.ts +17 -17
- package/lib/api/unlockPath.d.ts +1 -1
- package/lib/api/verifyMessage.d.ts +1 -1
- package/lib/api/verifyMessage.js +3 -3
- package/lib/backend/BackendManager.d.ts +1 -1
- package/lib/backend/BackendManager.js +1 -1
- package/lib/backend/Blockchain.d.ts +2 -2
- package/lib/backend/Blockchain.js +4 -7
- package/lib/constants/errors.d.ts +2 -0
- package/lib/constants/errors.js +4 -0
- package/lib/core/AbstractMethod.d.ts +2 -2
- package/lib/core/AbstractMethod.js +2 -1
- package/lib/core/index.d.ts +3 -3
- package/lib/core/index.js +44 -48
- package/lib/core/onCallFirmwareUpdate.d.ts +3 -8
- package/lib/core/onCallFirmwareUpdate.js +63 -21
- package/lib/data/DataManager.js +1 -5
- package/lib/data/coinInfo.d.ts +15 -131
- package/lib/data/coinInfo.js +8 -8
- package/lib/data/config.d.ts +23 -0
- package/lib/data/config.js +4 -0
- package/lib/data/connectSettings.js +1 -1
- package/lib/data/defaultFeeLevels.d.ts +2 -2
- package/lib/data/defaultFeeLevels.js +34 -14
- package/lib/data/deviceAuthenticityConfigTypes.d.ts +1 -0
- package/lib/data/deviceAuthenticityConfigTypes.js +2 -2
- package/lib/data/firmwareInfo.js +1 -1
- package/lib/data/models.js +5 -1
- package/lib/data/transportInfo.d.ts +0 -1
- package/lib/data/transportInfo.js +41 -28
- package/lib/data/udevInfo.d.ts +0 -1
- package/lib/data/udevInfo.js +2 -5
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +11 -10
- package/lib/device/Device.js +47 -17
- package/lib/device/DeviceCommands.d.ts +2 -2
- package/lib/device/DeviceCommands.js +42 -27
- package/lib/device/DeviceList.d.ts +27 -22
- package/lib/device/DeviceList.js +222 -133
- package/lib/device/StateStorage.js +11 -13
- package/lib/device/prompts.js +28 -36
- package/lib/device/resolveDescriptorForTaproot.d.ts +2 -2
- package/lib/device/resolveDescriptorForTaproot.js +5 -13
- package/lib/events/blockchain.d.ts +1 -1
- package/lib/events/call.d.ts +1 -1
- package/lib/events/core.d.ts +3 -3
- package/lib/events/device.d.ts +11 -1
- package/lib/events/device.js +1 -0
- package/lib/events/popup.d.ts +2 -2
- package/lib/events/transport.d.ts +15 -9
- package/lib/events/transport.js +10 -1
- package/lib/events/ui-promise.d.ts +1 -1
- package/lib/events/ui-request.d.ts +3 -3
- package/lib/factory.d.ts +3 -2
- package/lib/factory.js +3 -1
- package/lib/impl/core-in-module.d.ts +4 -2
- package/lib/impl/core-in-module.js +9 -1
- package/lib/impl/dynamic.d.ts +4 -2
- package/lib/impl/dynamic.js +5 -4
- package/lib/index-browser.js +1 -0
- package/lib/index.js +11 -3
- package/lib/types/account.d.ts +1 -1
- package/lib/types/api/authenticateDevice.d.ts +1 -0
- package/lib/types/api/authorizeCoinjoin.d.ts +1 -1
- package/lib/types/api/authorizeCoinjoin.js +1 -1
- package/lib/types/api/binanceGetAddress.d.ts +1 -1
- package/lib/types/api/binanceGetPublicKey.d.ts +1 -1
- package/lib/types/api/blockchainEstimateFee.d.ts +1 -1
- package/lib/types/api/blockchainSetCustomBackend.d.ts +1 -1
- package/lib/types/api/blockchainSubscribe.d.ts +1 -1
- package/lib/types/api/cardanoComposeTransaction.d.ts +112 -6
- package/lib/types/api/cardanoComposeTransaction.js +77 -0
- package/lib/types/api/cardanoGetAddress.d.ts +1 -1
- package/lib/types/api/cardanoGetPublicKey.d.ts +1 -1
- package/lib/types/api/changeLanguage.d.ts +1 -1
- package/lib/types/api/cipherKeyValue.d.ts +1 -1
- package/lib/types/api/composeTransaction.d.ts +1 -1
- package/lib/types/api/eosGetPublicKey.d.ts +1 -1
- package/lib/types/api/ethereumGetAddress.d.ts +1 -1
- package/lib/types/api/ethereumGetPublicKey.d.ts +1 -1
- package/lib/types/api/ethereumSignTypedData.d.ts +1 -1
- package/lib/types/api/firmwareUpdate.d.ts +11 -2
- package/lib/types/api/getAccountDescriptor.d.ts +1 -1
- package/lib/types/api/getAccountInfo.d.ts +1 -1
- package/lib/types/api/getAddress.d.ts +2 -1
- package/lib/types/api/getCoinInfo.d.ts +1 -1
- package/lib/types/api/getDeviceState.d.ts +1 -1
- package/lib/types/api/getFeatures.d.ts +1 -1
- package/lib/types/api/getOwnershipId.d.ts +2 -1
- package/lib/types/api/getOwnershipProof.d.ts +2 -1
- package/lib/types/api/getPublicKey.d.ts +1 -1
- package/lib/types/api/index.d.ts +7 -3
- package/lib/types/api/nem/index.d.ts +1 -1
- package/lib/types/api/nemGetAddress.d.ts +1 -1
- package/lib/types/api/on.d.ts +1 -1
- package/lib/types/api/recoveryDevice.d.ts +1 -1
- package/lib/types/api/rippleGetAddress.d.ts +1 -1
- package/lib/types/api/setTransports.d.ts +4 -0
- package/lib/types/api/setTransports.js +3 -0
- package/lib/types/api/solana/index.d.ts +41 -0
- package/lib/types/api/solana/index.js +31 -1
- package/lib/types/api/solanaComposeTransaction.d.ts +4 -0
- package/lib/types/api/solanaComposeTransaction.js +3 -0
- package/lib/types/api/solanaGetAddress.d.ts +1 -1
- package/lib/types/api/solanaGetPublicKey.d.ts +1 -1
- package/lib/types/api/stellarGetAddress.d.ts +1 -1
- package/lib/types/api/tezosGetAddress.d.ts +1 -1
- package/lib/types/api/tezosGetPublicKey.d.ts +1 -1
- package/lib/types/api/unlockPath.d.ts +1 -1
- package/lib/types/coinInfo.d.ts +33 -0
- package/lib/types/coinInfo.js +8 -2
- package/lib/types/params.d.ts +1 -1
- package/lib/utils/abortablePromise.d.ts +5 -0
- package/lib/utils/abortablePromise.js +17 -0
- package/lib/utils/accountUtils.d.ts +1 -1
- package/lib/utils/accountUtils.js +1 -1
- package/lib/utils/assetUtils.js +1 -2
- package/lib/utils/assets-browser.d.ts +1 -1
- package/lib/utils/assets.js +1 -1
- package/lib/utils/assets.native.d.ts +1 -1
- package/lib/utils/deviceFeaturesUtils.d.ts +1 -1
- package/lib/utils/deviceFeaturesUtils.js +6 -12
- package/lib/utils/ethereumUtils.d.ts +3 -2
- package/lib/utils/firmwareUtils.d.ts +1 -1
- package/lib/utils/firmwareUtils.js +11 -4
- package/lib/utils/pathUtils.d.ts +1 -1
- package/lib/utils/urlUtils.js +2 -0
- package/lib/workers/workers-browser.d.ts +2 -2
- package/lib/workers/workers-browser.js +2 -2
- package/lib/workers/workers.native.d.ts +1 -1
- package/lib/workers/workers.native.js +2 -2
- package/package.json +22 -12
- package/lib/utils/promiseUtils.d.ts +0 -5
- package/lib/utils/promiseUtils.js +0 -14
package/lib/core/index.js
CHANGED
|
@@ -3,22 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initCoreState = exports.Core = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const events_1 = tslib_1.__importDefault(require("events"));
|
|
6
|
+
const connect_common_1 = require("@trezor/connect-common");
|
|
6
7
|
const transport_1 = require("@trezor/transport");
|
|
7
8
|
const utils_1 = require("@trezor/utils");
|
|
8
|
-
const
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const method_1 = require("./method");
|
|
11
|
+
const onCallFirmwareUpdate_1 = require("./onCallFirmwareUpdate");
|
|
12
|
+
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
9
13
|
const DataManager_1 = require("../data/DataManager");
|
|
10
|
-
const DeviceList_1 = require("../device/DeviceList");
|
|
11
14
|
const analyticsInfo_1 = require("../data/analyticsInfo");
|
|
12
|
-
const
|
|
15
|
+
const DeviceList_1 = require("../device/DeviceList");
|
|
16
|
+
const StateStorage_1 = require("../device/StateStorage");
|
|
13
17
|
const events_2 = require("../events");
|
|
14
|
-
const method_1 = require("./method");
|
|
15
|
-
const uiPromiseManager_1 = require("../utils/uiPromiseManager");
|
|
16
|
-
const popupPromiseManager_1 = require("../utils/popupPromiseManager");
|
|
17
18
|
const debug_1 = require("../utils/debug");
|
|
18
|
-
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
19
19
|
const interactionTimeout_1 = require("../utils/interactionTimeout");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const popupPromiseManager_1 = require("../utils/popupPromiseManager");
|
|
21
|
+
const uiPromiseManager_1 = require("../utils/uiPromiseManager");
|
|
22
22
|
const _log = (0, debug_1.initLog)('Core');
|
|
23
23
|
const waitForPopup = ({ popupPromise, sendCoreMessage }) => {
|
|
24
24
|
sendCoreMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_UI_WINDOW));
|
|
@@ -31,7 +31,7 @@ const initDevice = async (context, methodCallDevice) => {
|
|
|
31
31
|
var _a;
|
|
32
32
|
const { uiPromises, deviceList, sendCoreMessage } = context;
|
|
33
33
|
(0, DeviceList_1.assertDeviceListConnected)(deviceList);
|
|
34
|
-
const isWebUsb = deviceList.
|
|
34
|
+
const isWebUsb = deviceList.getActiveTransports().some(t => t.type === 'WebUsbTransport');
|
|
35
35
|
let device;
|
|
36
36
|
let showDeviceSelection = isWebUsb;
|
|
37
37
|
const isUsingPopup = DataManager_1.DataManager.getSettings('popup');
|
|
@@ -326,9 +326,9 @@ const onCallDevice = async (context, message, method) => {
|
|
|
326
326
|
var _a, _b, _c;
|
|
327
327
|
const { deviceList, callMethods, getOverridePromise, setOverridePromise, sendCoreMessage } = context;
|
|
328
328
|
const responseID = message.id;
|
|
329
|
-
const { origin, env, useCoreInPopup } = DataManager_1.DataManager.getSettings();
|
|
329
|
+
const { origin, env, useCoreInPopup, transports } = DataManager_1.DataManager.getSettings();
|
|
330
330
|
if (!deviceList.isConnected() && !deviceList.pendingConnection()) {
|
|
331
|
-
deviceList.init();
|
|
331
|
+
deviceList.init({ transports });
|
|
332
332
|
}
|
|
333
333
|
await deviceList.pendingConnection();
|
|
334
334
|
const shouldRetry = ['web', 'webextension'].includes(env);
|
|
@@ -397,6 +397,9 @@ const onCallDevice = async (context, message, method) => {
|
|
|
397
397
|
device.on(events_2.DEVICE.PASSPHRASE_ON_DEVICE, () => {
|
|
398
398
|
sendCoreMessage((0, events_2.createUiMessage)(events_2.UI.REQUEST_PASSPHRASE_ON_DEVICE, { device: device.toMessageObject() }));
|
|
399
399
|
});
|
|
400
|
+
device.on(events_2.DEVICE.FIRMWARE_VERSION_CHANGED, payload => {
|
|
401
|
+
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.FIRMWARE_VERSION_CHANGED, payload));
|
|
402
|
+
});
|
|
400
403
|
if (useCoreInPopup && env === 'webextension' && origin) {
|
|
401
404
|
device.initStorage(new StateStorage_1.WebextensionStateStorage(origin));
|
|
402
405
|
}
|
|
@@ -566,7 +569,7 @@ const handleDeviceSelectionChanges = (context, interruptDevice) => {
|
|
|
566
569
|
const promiseExists = uiPromises.exists(events_2.UI.RECEIVE_DEVICE);
|
|
567
570
|
if (promiseExists && deviceList.isConnected()) {
|
|
568
571
|
const onlyDevice = deviceList.getOnlyDevice();
|
|
569
|
-
const isWebUsb = deviceList.
|
|
572
|
+
const isWebUsb = deviceList.getActiveTransports().some(t => t.type === 'WebUsbTransport');
|
|
570
573
|
if (onlyDevice && !isWebUsb) {
|
|
571
574
|
uiPromises.resolve({
|
|
572
575
|
type: events_2.UI.RECEIVE_DEVICE,
|
|
@@ -593,23 +596,23 @@ const initDeviceList = (context) => {
|
|
|
593
596
|
const { deviceList, sendCoreMessage } = context;
|
|
594
597
|
deviceList.on(events_2.DEVICE.CONNECT, device => {
|
|
595
598
|
handleDeviceSelectionChanges(context);
|
|
596
|
-
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CONNECT, device));
|
|
599
|
+
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CONNECT, device.toMessageObject()));
|
|
597
600
|
});
|
|
598
601
|
deviceList.on(events_2.DEVICE.CONNECT_UNACQUIRED, device => {
|
|
599
602
|
handleDeviceSelectionChanges(context);
|
|
600
|
-
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CONNECT_UNACQUIRED, device));
|
|
603
|
+
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CONNECT_UNACQUIRED, device.toMessageObject()));
|
|
601
604
|
});
|
|
602
605
|
deviceList.on(events_2.DEVICE.DISCONNECT, device => {
|
|
603
606
|
handleDeviceSelectionChanges(context);
|
|
604
|
-
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.DISCONNECT, device));
|
|
607
|
+
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.DISCONNECT, device.toMessageObject()));
|
|
605
608
|
});
|
|
606
609
|
deviceList.on(events_2.DEVICE.CHANGED, device => {
|
|
607
|
-
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CHANGED, device));
|
|
610
|
+
sendCoreMessage((0, events_2.createDeviceMessage)(events_2.DEVICE.CHANGED, device.toMessageObject()));
|
|
608
611
|
});
|
|
609
|
-
deviceList.on(transport_1.TRANSPORT.START,
|
|
612
|
+
deviceList.on(transport_1.TRANSPORT.START, transport => sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.START, transport)));
|
|
610
613
|
deviceList.on(transport_1.TRANSPORT.ERROR, error => {
|
|
611
|
-
_log.warn('TRANSPORT.ERROR', error);
|
|
612
|
-
sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR,
|
|
614
|
+
_log.warn('TRANSPORT.ERROR', error.error);
|
|
615
|
+
sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR, error));
|
|
613
616
|
});
|
|
614
617
|
};
|
|
615
618
|
class Core extends events_1.default {
|
|
@@ -657,15 +660,14 @@ class Core extends events_1.default {
|
|
|
657
660
|
resolveWaitForFirstMethod: () => {
|
|
658
661
|
this.waitForFirstMethod.resolve();
|
|
659
662
|
},
|
|
660
|
-
getOverridePromise: () =>
|
|
661
|
-
return this.overridePromise;
|
|
662
|
-
},
|
|
663
|
+
getOverridePromise: () => this.overridePromise,
|
|
663
664
|
setOverridePromise: (promise) => {
|
|
664
665
|
this.overridePromise = promise;
|
|
665
666
|
},
|
|
666
667
|
};
|
|
667
668
|
}
|
|
668
669
|
handleMessage(message) {
|
|
670
|
+
var _a;
|
|
669
671
|
_log.debug('handleMessage', message);
|
|
670
672
|
switch (message.type) {
|
|
671
673
|
case events_2.POPUP.HANDSHAKE:
|
|
@@ -675,8 +677,19 @@ class Core extends events_1.default {
|
|
|
675
677
|
this.popupPromise.clear();
|
|
676
678
|
onPopupClosed(this.getCoreContext(), message.payload ? message.payload.error : null);
|
|
677
679
|
break;
|
|
678
|
-
case transport_1.TRANSPORT.DISABLE_WEBUSB:
|
|
679
|
-
|
|
680
|
+
case transport_1.TRANSPORT.DISABLE_WEBUSB: {
|
|
681
|
+
const settings = DataManager_1.DataManager.getSettings();
|
|
682
|
+
const transports = (_a = settings.transports) === null || _a === void 0 ? void 0 : _a.filter(t => t !== 'WebUsbTransport');
|
|
683
|
+
if (transports && !transports.includes('BridgeTransport')) {
|
|
684
|
+
transports.unshift('BridgeTransport');
|
|
685
|
+
}
|
|
686
|
+
settings.transports = transports;
|
|
687
|
+
resetTransports(this.getCoreContext());
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
case transport_1.TRANSPORT.SET_TRANSPORTS:
|
|
691
|
+
DataManager_1.DataManager.getSettings().transports = message.payload.transports;
|
|
692
|
+
resetTransports(this.getCoreContext());
|
|
680
693
|
break;
|
|
681
694
|
case transport_1.TRANSPORT.REQUEST_DEVICE:
|
|
682
695
|
if (this.deviceList.isConnected()) {
|
|
@@ -684,7 +697,7 @@ class Core extends events_1.default {
|
|
|
684
697
|
}
|
|
685
698
|
break;
|
|
686
699
|
case transport_1.TRANSPORT.GET_INFO:
|
|
687
|
-
this.sendCoreMessage((0, events_2.createResponseMessage)(message.id, true, this.
|
|
700
|
+
this.sendCoreMessage((0, events_2.createResponseMessage)(message.id, true, this.getActiveTransports()));
|
|
688
701
|
break;
|
|
689
702
|
case events_2.UI.RECEIVE_DEVICE:
|
|
690
703
|
case events_2.UI.RECEIVE_CONFIRMATION:
|
|
@@ -736,9 +749,9 @@ class Core extends events_1.default {
|
|
|
736
749
|
await this.waitForFirstMethod.promise;
|
|
737
750
|
return await this.methodSynchronize(() => this.callMethods[0]);
|
|
738
751
|
}
|
|
739
|
-
|
|
752
|
+
getActiveTransports() {
|
|
740
753
|
if (this.deviceList.isConnected()) {
|
|
741
|
-
return this.deviceList.
|
|
754
|
+
return this.deviceList.getActiveTransports();
|
|
742
755
|
}
|
|
743
756
|
}
|
|
744
757
|
enumerate() {
|
|
@@ -776,15 +789,13 @@ class Core extends events_1.default {
|
|
|
776
789
|
}
|
|
777
790
|
const { transports, pendingTransportEvent, transportReconnect, coreMode } = DataManager_1.DataManager.getSettings();
|
|
778
791
|
try {
|
|
779
|
-
this.deviceList.
|
|
792
|
+
this.deviceList.init({ transports, pendingTransportEvent, transportReconnect });
|
|
780
793
|
}
|
|
781
794
|
catch (error) {
|
|
782
|
-
_log.error('setTransports', error);
|
|
783
795
|
this.sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR, { error }));
|
|
784
796
|
throttlePromise.reject(error);
|
|
785
797
|
throw error;
|
|
786
798
|
}
|
|
787
|
-
this.deviceList.init({ pendingTransportEvent, transportReconnect });
|
|
788
799
|
if (!transportReconnect || coreMode === 'auto') {
|
|
789
800
|
await this.deviceList.pendingConnection();
|
|
790
801
|
}
|
|
@@ -794,25 +805,10 @@ class Core extends events_1.default {
|
|
|
794
805
|
}
|
|
795
806
|
}
|
|
796
807
|
exports.Core = Core;
|
|
797
|
-
const
|
|
798
|
-
if (!deviceList.isConnected())
|
|
799
|
-
return;
|
|
800
|
-
if (deviceList.transportType() !== 'WebUsbTransport')
|
|
801
|
-
return;
|
|
808
|
+
const resetTransports = async ({ deviceList, sendCoreMessage }) => {
|
|
802
809
|
const { transports, pendingTransportEvent, transportReconnect } = DataManager_1.DataManager.getSettings();
|
|
803
|
-
if (transports) {
|
|
804
|
-
const transportStr = transports === null || transports === void 0 ? void 0 : transports.filter(transport => typeof transport !== 'object');
|
|
805
|
-
if (transportStr.includes('WebUsbTransport')) {
|
|
806
|
-
transports.splice(transports.indexOf('WebUsbTransport'), 1);
|
|
807
|
-
}
|
|
808
|
-
if (!transportStr.includes('BridgeTransport')) {
|
|
809
|
-
transports.unshift('BridgeTransport');
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
810
|
try {
|
|
813
|
-
deviceList.
|
|
814
|
-
deviceList.setTransports(transports);
|
|
815
|
-
await deviceList.init({ pendingTransportEvent, transportReconnect });
|
|
811
|
+
await deviceList.init({ transports, pendingTransportEvent, transportReconnect });
|
|
816
812
|
}
|
|
817
813
|
catch (error) {
|
|
818
814
|
sendCoreMessage((0, events_2.createTransportMessage)(transport_1.TRANSPORT.ERROR, { error }));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Device } from '../device/Device';
|
|
1
2
|
import { DeviceList } from '../device/DeviceList';
|
|
2
3
|
import { CoreEventMessage } from '../events';
|
|
3
4
|
import { CommonParams, DeviceUniquePath } from '../types';
|
|
5
|
+
import { FirmwareUpdateResponse } from '../types/api/firmwareUpdate';
|
|
4
6
|
import type { Log } from '../utils/debug';
|
|
5
|
-
import type { Device } from '../device/Device';
|
|
6
7
|
type PostMessage = (message: CoreEventMessage) => void;
|
|
7
8
|
export type Params = {
|
|
8
9
|
language?: string;
|
|
@@ -20,12 +21,6 @@ type Context = {
|
|
|
20
21
|
export declare const onCallFirmwareUpdate: ({ params, context: { deviceList, postMessage, initDevice, log, abortSignal }, }: {
|
|
21
22
|
params: Params;
|
|
22
23
|
context: Context;
|
|
23
|
-
}) => Promise<
|
|
24
|
-
check: "other-error";
|
|
25
|
-
checkError: any;
|
|
26
|
-
} | {
|
|
27
|
-
check: string;
|
|
28
|
-
checkError?: undefined;
|
|
29
|
-
}>;
|
|
24
|
+
}) => Promise<FirmwareUpdateResponse>;
|
|
30
25
|
export {};
|
|
31
26
|
//# sourceMappingURL=onCallFirmwareUpdate.d.ts.map
|
|
@@ -4,10 +4,10 @@ exports.onCallFirmwareUpdate = void 0;
|
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const utils_1 = require("@trezor/utils");
|
|
6
6
|
const versionUtils_1 = require("@trezor/utils/lib/versionUtils");
|
|
7
|
-
const events_1 = require("../events");
|
|
8
7
|
const firmware_1 = require("../api/firmware");
|
|
9
|
-
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
10
8
|
const constants_1 = require("../constants");
|
|
9
|
+
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
10
|
+
const events_1 = require("../events");
|
|
11
11
|
const registerEvents = (device, postMessage) => {
|
|
12
12
|
device.on(events_1.DEVICE.BUTTON, (_d, request) => {
|
|
13
13
|
postMessage((0, events_1.createDeviceMessage)(events_1.DEVICE.BUTTON, {
|
|
@@ -48,8 +48,21 @@ const waitForReconnectedDevice = async ({ bootloader, method, intermediary }, {
|
|
|
48
48
|
}
|
|
49
49
|
catch {
|
|
50
50
|
}
|
|
51
|
+
if (reconnectedDevice &&
|
|
52
|
+
!reconnectedDevice.features &&
|
|
53
|
+
reconnectedDevice.handshakeFinished) {
|
|
54
|
+
log.debug('onCallFirmwareUpdate', 'we were unable to read device.features on the first interaction after seeing it, retrying...');
|
|
55
|
+
try {
|
|
56
|
+
await reconnectedDevice.run(undefined, {
|
|
57
|
+
skipFirmwareChecks: true,
|
|
58
|
+
skipLanguageChecks: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
51
64
|
i++;
|
|
52
|
-
log.debug('onCallFirmwareUpdate', 'waiting for device to reconnect', i);
|
|
65
|
+
log.debug('onCallFirmwareUpdate', '...still waiting for device to reconnect', i);
|
|
53
66
|
} while (!abortSignal.aborted &&
|
|
54
67
|
(!(reconnectedDevice === null || reconnectedDevice === void 0 ? void 0 : reconnectedDevice.features) ||
|
|
55
68
|
bootloader === !reconnectedDevice.features.bootloader_mode ||
|
|
@@ -68,7 +81,9 @@ const waitForReconnectedDevice = async ({ bootloader, method, intermediary }, {
|
|
|
68
81
|
}
|
|
69
82
|
registerEvents(reconnectedDevice, postMessage);
|
|
70
83
|
await reconnectedDevice.waitForFirstRun();
|
|
71
|
-
|
|
84
|
+
if (!reconnectedDevice.isUsedHere()) {
|
|
85
|
+
await reconnectedDevice.acquire();
|
|
86
|
+
}
|
|
72
87
|
return reconnectedDevice;
|
|
73
88
|
};
|
|
74
89
|
const getInstallationParams = (device, params) => {
|
|
@@ -107,12 +122,20 @@ const getInstallationParams = (device, params) => {
|
|
|
107
122
|
}
|
|
108
123
|
};
|
|
109
124
|
const getFwHeader = (binary) => Buffer.from(binary.slice(0, 6000)).toString('hex');
|
|
110
|
-
const getBinaryHelper = (device, params, log, postMessage, btcOnly
|
|
125
|
+
const getBinaryHelper = (device, params, log, postMessage, btcOnly) => {
|
|
111
126
|
var _a;
|
|
127
|
+
if (params.binary) {
|
|
128
|
+
return {
|
|
129
|
+
binary: params.binary,
|
|
130
|
+
binaryVersion: (0, firmware_1.parseFirmwareHeaders)(Buffer.from(params.binary)).version,
|
|
131
|
+
releaseVersion: undefined,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
112
134
|
if (!device.firmwareRelease) {
|
|
113
135
|
throw constants_1.ERRORS.TypedError('Runtime', 'device.firmwareRelease is not set');
|
|
114
136
|
}
|
|
115
|
-
|
|
137
|
+
const { intermediaryVersion, release: { version }, } = device.firmwareRelease;
|
|
138
|
+
log.debug('onCallFirmwareUpdate loading binary', 'intermediaryVersion', intermediaryVersion, 'version', version, 'btcOnly', btcOnly);
|
|
116
139
|
postMessage((0, events_1.createUiMessage)(events_1.UI.FIRMWARE_PROGRESS, {
|
|
117
140
|
device: device.toMessageObject(),
|
|
118
141
|
operation: 'downloading',
|
|
@@ -122,7 +145,7 @@ const getBinaryHelper = (device, params, log, postMessage, btcOnly, intermediary
|
|
|
122
145
|
features: device.features,
|
|
123
146
|
releases: (0, firmwareInfo_1.getReleases)((_a = device.features) === null || _a === void 0 ? void 0 : _a.internal_model),
|
|
124
147
|
baseUrl: params.baseUrl || 'https://data.trezor.io',
|
|
125
|
-
version
|
|
148
|
+
version,
|
|
126
149
|
btcOnly,
|
|
127
150
|
intermediaryVersion,
|
|
128
151
|
})
|
|
@@ -138,7 +161,11 @@ const getBinaryHelper = (device, params, log, postMessage, btcOnly, intermediary
|
|
|
138
161
|
operation: 'downloading',
|
|
139
162
|
progress: 100,
|
|
140
163
|
}));
|
|
141
|
-
return
|
|
164
|
+
return {
|
|
165
|
+
binary: res,
|
|
166
|
+
binaryVersion: (0, firmware_1.parseFirmwareHeaders)(Buffer.from(res)).version,
|
|
167
|
+
releaseVersion: version,
|
|
168
|
+
};
|
|
142
169
|
});
|
|
143
170
|
};
|
|
144
171
|
const firmwareCheck = async (reconnectedDevice, device, stripped, postMessage) => {
|
|
@@ -161,12 +188,9 @@ const firmwareCheck = async (reconnectedDevice, device, stripped, postMessage) =
|
|
|
161
188
|
getFirmwareHashResponse.message.hash === hash);
|
|
162
189
|
};
|
|
163
190
|
const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage, initDevice, log, abortSignal }, }) => {
|
|
164
|
-
var _a;
|
|
191
|
+
var _a, _b;
|
|
165
192
|
log.debug('onCallFirmwareUpdate with params: ', params);
|
|
166
193
|
const device = await initDevice((_a = params === null || params === void 0 ? void 0 : params.device) === null || _a === void 0 ? void 0 : _a.path);
|
|
167
|
-
if (!device.firmwareRelease) {
|
|
168
|
-
throw constants_1.ERRORS.TypedError('Runtime', 'device.firmwareRelease is not set');
|
|
169
|
-
}
|
|
170
194
|
if (deviceList.getDeviceCount() > 1) {
|
|
171
195
|
throw constants_1.ERRORS.TypedError('Device_MultipleNotSupported', 'Firmware update allowed with only 1 device connected');
|
|
172
196
|
}
|
|
@@ -179,8 +203,8 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
179
203
|
language,
|
|
180
204
|
btcOnly,
|
|
181
205
|
});
|
|
182
|
-
|
|
183
|
-
|
|
206
|
+
let binaryInfo = await getBinaryHelper(device, params, log, postMessage, btcOnly);
|
|
207
|
+
const { binary } = binaryInfo;
|
|
184
208
|
const deviceInitiallyConnectedInBootloader = device.features.bootloader_mode;
|
|
185
209
|
const deviceInitiallyConnectedWithoutFirmware = device.features.firmware_present === false;
|
|
186
210
|
let reconnectedDevice = device;
|
|
@@ -200,7 +224,7 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
200
224
|
: {};
|
|
201
225
|
await device.acquire();
|
|
202
226
|
const targetLanguage = params.language || device.features.language || 'en-US';
|
|
203
|
-
const languageBlob = language && targetLanguage !== 'en-US'
|
|
227
|
+
const languageBlob = device.firmwareRelease && language && targetLanguage !== 'en-US'
|
|
204
228
|
? await (0, firmware_1.getLanguage)({
|
|
205
229
|
language: targetLanguage,
|
|
206
230
|
version: device.firmwareRelease.release.version,
|
|
@@ -231,14 +255,16 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
231
255
|
}
|
|
232
256
|
reconnectedDevice = await waitForReconnectedDevice({ bootloader: true, method: 'auto' }, { deviceList, device, log, postMessage, abortSignal });
|
|
233
257
|
}
|
|
234
|
-
const intermediary = !params.binary && device.firmwareRelease.intermediaryVersion;
|
|
258
|
+
const intermediary = !params.binary && ((_b = device.firmwareRelease) === null || _b === void 0 ? void 0 : _b.intermediaryVersion);
|
|
259
|
+
const bootloaderVersion = reconnectedDevice.getVersion();
|
|
235
260
|
await reconnectedDevice.initialize(false);
|
|
236
261
|
let stripped = (0, firmware_1.stripFwHeaders)(binary);
|
|
237
262
|
await (0, firmware_1.uploadFirmware)(reconnectedDevice.getCommands().typedCall.bind(reconnectedDevice.getCommands()), postMessage, reconnectedDevice, { payload: !intermediary && (0, firmware_1.shouldStripFwHeaders)(device.features) ? stripped : binary });
|
|
238
263
|
await reconnectedDevice.release();
|
|
239
264
|
if (intermediary) {
|
|
240
265
|
reconnectedDevice = await waitForReconnectedDevice({ bootloader: true, method: 'manual', intermediary: true }, { deviceList, device: reconnectedDevice, log, postMessage, abortSignal });
|
|
241
|
-
|
|
266
|
+
binaryInfo = await getBinaryHelper(reconnectedDevice, params, log, postMessage, btcOnly);
|
|
267
|
+
stripped = (0, firmware_1.stripFwHeaders)(binaryInfo.binary);
|
|
242
268
|
await reconnectedDevice.initialize(false);
|
|
243
269
|
await (0, firmware_1.uploadFirmware)(reconnectedDevice.getCommands().typedCall.bind(reconnectedDevice.getCommands()), postMessage, reconnectedDevice, { payload: stripped });
|
|
244
270
|
await reconnectedDevice.release();
|
|
@@ -256,6 +282,21 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
256
282
|
}
|
|
257
283
|
}
|
|
258
284
|
const checkSupported = reconnectedDevice.atLeast(constants_1.FIRMWARE.FW_HASH_SUPPORTED_VERSIONS) && !params.binary;
|
|
285
|
+
let check;
|
|
286
|
+
const installedVersion = reconnectedDevice.getVersion();
|
|
287
|
+
if (!bootloaderVersion || !installedVersion) {
|
|
288
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'reconnectedDevice.installedVersion is not set');
|
|
289
|
+
}
|
|
290
|
+
const { binaryVersion, releaseVersion } = binaryInfo;
|
|
291
|
+
const assertBinaryVersion = (0, versionUtils_1.isEqual)(installedVersion, binaryVersion);
|
|
292
|
+
const assertReleaseVersion = releaseVersion ? (0, versionUtils_1.isEqual)(installedVersion, releaseVersion) : true;
|
|
293
|
+
const versionDetails = {
|
|
294
|
+
versionCheck: assertBinaryVersion && assertReleaseVersion,
|
|
295
|
+
bootloaderVersion,
|
|
296
|
+
installedVersion,
|
|
297
|
+
binaryVersion,
|
|
298
|
+
releaseVersion,
|
|
299
|
+
};
|
|
259
300
|
if (checkSupported) {
|
|
260
301
|
try {
|
|
261
302
|
log.debug('onCallFirmwareUpdate', 'getFirmwareHash supported, proceed with check', stripped);
|
|
@@ -263,20 +304,21 @@ const onCallFirmwareUpdate = async ({ params, context: { deviceList, postMessage
|
|
|
263
304
|
await reconnectedDevice.release();
|
|
264
305
|
if (isValid) {
|
|
265
306
|
log.debug('onCallFirmwareUpdate', 'installed fw hash and calculated hash match');
|
|
266
|
-
|
|
307
|
+
check = 'valid';
|
|
267
308
|
}
|
|
268
309
|
else {
|
|
269
|
-
|
|
310
|
+
check = 'mismatch';
|
|
270
311
|
}
|
|
271
312
|
}
|
|
272
313
|
catch (err) {
|
|
273
|
-
return { check: 'other-error', checkError: err.message };
|
|
314
|
+
return { check: 'other-error', checkError: err.message, ...versionDetails };
|
|
274
315
|
}
|
|
275
316
|
}
|
|
276
317
|
else {
|
|
277
318
|
await reconnectedDevice.release();
|
|
278
|
-
|
|
319
|
+
check = 'omitted';
|
|
279
320
|
}
|
|
321
|
+
return { check, ...versionDetails };
|
|
280
322
|
};
|
|
281
323
|
exports.onCallFirmwareUpdate = onCallFirmwareUpdate;
|
|
282
324
|
//# sourceMappingURL=onCallFirmwareUpdate.js.map
|
package/lib/data/DataManager.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataManager = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const coins_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins.json"));
|
|
6
5
|
const coins_eth_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins-eth.json"));
|
|
7
|
-
const
|
|
6
|
+
const coins_json_1 = tslib_1.__importDefault(require("@trezor/connect-common/files/coins.json"));
|
|
8
7
|
const messages_json_1 = tslib_1.__importDefault(require("@trezor/protobuf/messages.json"));
|
|
9
8
|
const coinInfo_1 = require("./coinInfo");
|
|
10
9
|
const firmwareInfo_1 = require("./firmwareInfo");
|
|
11
|
-
const transportInfo_1 = require("./transportInfo");
|
|
12
10
|
const types_1 = require("../types");
|
|
13
11
|
const assetUtils_1 = require("../utils/assetUtils");
|
|
14
12
|
class DataManager {
|
|
@@ -19,14 +17,12 @@ class DataManager {
|
|
|
19
17
|
const assetsMap = {
|
|
20
18
|
coins: coins_json_1.default,
|
|
21
19
|
coinsEth: coins_eth_json_1.default,
|
|
22
|
-
bridge: releases_json_1.default,
|
|
23
20
|
...Object.fromEntries(Object.entries(assetUtils_1.firmwareAssets).map(([key, value]) => [
|
|
24
21
|
`firmware-${key.toLowerCase()}`,
|
|
25
22
|
value,
|
|
26
23
|
])),
|
|
27
24
|
};
|
|
28
25
|
Object.assign(this.assets, assetsMap);
|
|
29
|
-
(0, transportInfo_1.parseBridgeJSON)(this.assets.bridge);
|
|
30
26
|
(0, coinInfo_1.parseCoinsJson)({
|
|
31
27
|
...this.assets.coins,
|
|
32
28
|
...this.assets.coinsEth,
|