mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-09 08:48:15 +01:00
chore(connect): change FirmwareType from type to enum
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# unreleased
|
||||
|
||||
- change: FirmwareType changed from type to enum
|
||||
|
||||
# 9.1.1
|
||||
|
||||
- feat(connect-popup): added device model_internal in features
|
||||
|
||||
@@ -4,6 +4,7 @@ import { stripFwHeaders, calculateFirmwareHash } from './firmware';
|
||||
import { getReleases } from '../data/firmwareInfo';
|
||||
import { ERRORS } from '../constants';
|
||||
import { httpRequest } from '../utils/assets';
|
||||
import { FirmwareType } from '../types';
|
||||
|
||||
export default class CheckFirmwareAuthenticity extends AbstractMethod<'checkFirmwareAuthenticity'> {
|
||||
init() {
|
||||
@@ -31,7 +32,7 @@ export default class CheckFirmwareAuthenticity extends AbstractMethod<'checkFirm
|
||||
|
||||
const baseUrl = `https://data.trezor.io/firmware/${device.features.major_version}`;
|
||||
const fwUrl = `${baseUrl}/trezor-${deviceVersion}${
|
||||
device.firmwareType === 'bitcoin-only' ? '-bitcoinonly.bin' : '.bin'
|
||||
device.firmwareType === FirmwareType.BitcoinOnly ? '-bitcoinonly.bin' : '.bin'
|
||||
}`;
|
||||
|
||||
const fw = await httpRequest(fwUrl, 'binary');
|
||||
|
||||
@@ -16,13 +16,14 @@ import { versionCompare } from '../utils/versionUtils';
|
||||
import { create as createDeferred, Deferred } from '../utils/deferred';
|
||||
import { initLog } from '../utils/debug';
|
||||
import type { Transport, Descriptor } from '@trezor/transport';
|
||||
import type {
|
||||
import {
|
||||
Device as DeviceTyped,
|
||||
DeviceFirmwareStatus,
|
||||
DeviceStatus,
|
||||
Features,
|
||||
ReleaseInfo,
|
||||
UnavailableCapabilities,
|
||||
FirmwareType,
|
||||
} from '../types';
|
||||
|
||||
// custom log
|
||||
@@ -119,7 +120,7 @@ export class Device extends TypedEmitter<DeviceEvents> {
|
||||
|
||||
networkTypeState: NETWORK.NetworkType[] = [];
|
||||
|
||||
firmwareType: 'regular' | 'bitcoin-only' = 'regular';
|
||||
firmwareType: FirmwareType = FirmwareType.Regular;
|
||||
|
||||
constructor(transport: Transport, descriptor: Descriptor) {
|
||||
super();
|
||||
@@ -539,8 +540,8 @@ export class Device extends TypedEmitter<DeviceEvents> {
|
||||
feat.capabilities &&
|
||||
feat.capabilities.length > 0 &&
|
||||
!feat.capabilities.includes('Capability_Bitcoin_like')
|
||||
? 'bitcoin-only'
|
||||
: 'regular';
|
||||
? FirmwareType.BitcoinOnly
|
||||
: FirmwareType.Regular;
|
||||
}
|
||||
|
||||
isUnacquired() {
|
||||
|
||||
@@ -13,7 +13,10 @@ export type UnavailableCapability =
|
||||
| 'update-required'
|
||||
| 'trezor-connect-outdated';
|
||||
|
||||
export type FirmwareType = 'bitcoin-only' | 'regular';
|
||||
export enum FirmwareType {
|
||||
BitcoinOnly = 'bitcoin-only',
|
||||
Regular = 'regular',
|
||||
}
|
||||
|
||||
// NOTE: unavailableCapabilities is an object with information what is NOT supported by this device.
|
||||
// in ideal/expected setup this object should be empty but given setup might have exceptions.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { FirmwareType } from '@trezor/connect';
|
||||
|
||||
import { PartialDevice } from './types';
|
||||
import { isDeviceInBootloaderMode } from './modeUtils';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user