Skip to content

Commit

Permalink
chore(tranport): all bridge versions except 2.0.27, 2.0.33 and 3+ are…
Browse files Browse the repository at this point in the history
… now considered outdated
  • Loading branch information
mroz22 committed Feb 28, 2025
1 parent 7363725 commit 26ddbf8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/transport/src/transports/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
bridge as protocolBridge,
v1 as protocolV1,
} from '@trezor/protocol';
import { resolveAfter, versionUtils } from '@trezor/utils';
import { resolveAfter } from '@trezor/utils';

import {
AbstractTransport,
Expand Down Expand Up @@ -63,14 +63,9 @@ type IncompleteRequestOptions = {
type BridgeConstructorParameters = AbstractTransportParams & {
// bridge url
url?: string;
latestVersion?: string;
};

export class BridgeTransport extends AbstractTransport {
/**
* information about the latest version of trezord.
*/
private latestVersion?: string;
private useProtocolMessages: boolean = false;
/**
* url of trezord server.
Expand All @@ -81,10 +76,9 @@ export class BridgeTransport extends AbstractTransport {
public apiType = 'usb' as const;

constructor(params: BridgeConstructorParameters) {
const { url = DEFAULT_URL, latestVersion, ...rest } = params || {};
const { url = DEFAULT_URL, ...rest } = params || {};
super(rest);
this.url = url;
this.latestVersion = latestVersion;
}

ping({ signal }: AbstractTransportMethodParams<'ping'> = {}) {
Expand All @@ -106,9 +100,14 @@ export class BridgeTransport extends AbstractTransport {

this.version = response.payload.version;

if (this.latestVersion) {
this.isOutdated = versionUtils.isNewer(this.latestVersion, this.version);
if (this.version.startsWith('3')) {
this.isOutdated = false;
} else {
this.isOutdated =
// as for trezord-go only 2.0.27 (standalone) and 2.0.33 (suite-desktop bundled) are supported
!['2.0.27', '2.0.33'].includes(this.version);
}

this.useProtocolMessages = !!response.payload.protocolMessages;

this.stopped = false;
Expand Down

0 comments on commit 26ddbf8

Please sign in to comment.