Skip to content

Commit

Permalink
chore(trezor-user-link): stop sending specific version, backend shoul…
Browse files Browse the repository at this point in the history
…d have the right fallback
  • Loading branch information
mroz22 authored and HajekOndrej committed Feb 13, 2025
1 parent 47dc3f8 commit af1af48
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions packages/trezor-user-env-link/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable no-console */

import semverRSort from 'semver/functions/rsort';
import semverValid from 'semver/functions/valid';

import { TypedEmitter } from '@trezor/utils';

import { Firmwares, Model } from './types';
Expand Down Expand Up @@ -95,7 +92,6 @@ export const DEFAULT_BRIDGE_VERSION = '2.0.33';
export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents> {
private client: WebsocketClient;
public firmwares?: Firmwares;
private defaultFirmware: Record<string, string> = {};
public defaultModel: Model = 'T2T1';

public currentEmulatorSetup?: Partial<SetupEmu> = {};
Expand All @@ -108,18 +104,6 @@ export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents>
super();
this.client = new WebsocketClient();

this.client.on('firmwares', (firmwares: Firmwares) => {
this.firmwares = firmwares;
// select the highest version from the list of available firmwares.
// this is the version that is likely to be the newest production.

Object.keys(firmwares).forEach(model => {
this.defaultFirmware![model as Model] = semverRSort(
firmwares![model as Model].filter(fw => semverValid(fw)),
)[0];
});
});

this.client.on('disconnected', () => this.emit('disconnected'));

// todo: legacy api, should be removed
Expand Down Expand Up @@ -205,9 +189,7 @@ export class TrezorUserEnvLinkClass extends TypedEmitter<WebsocketClientEvents>
const params = {
type: 'emulator-start',
model: this.defaultModel,
version: arg?.model
? this.defaultFirmware![arg.model]
: this.defaultFirmware![this.defaultModel] || '2-main',
version: arg?.model === 'T1B1' ? '1-latest' : '2-latest',
...arg,
};

Expand Down

0 comments on commit af1af48

Please sign in to comment.