mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-10 09:18:15 +01:00
feat(device-utils): internal_model, display name utility in device-utils
This commit is contained in:
@@ -22,6 +22,7 @@ export const getDeviceFeatures = (feat?: Partial<Features>): Features => ({
|
||||
needs_backup: false,
|
||||
flags: 0,
|
||||
model: 'T',
|
||||
internal_model: 'T2T1',
|
||||
fw_major: null,
|
||||
fw_minor: null,
|
||||
fw_patch: null,
|
||||
|
||||
@@ -7,6 +7,27 @@ export enum DeviceModel {
|
||||
UNKNOWN = '',
|
||||
}
|
||||
|
||||
export enum DeviceInternalModel {
|
||||
T1 = 'T1B1',
|
||||
TT = 'T2T1',
|
||||
T2B1 = 'T2B1',
|
||||
UNKNOWN = '',
|
||||
}
|
||||
|
||||
export const getDeviceDisplayName = (deviceModel: DeviceModel) => {
|
||||
switch (deviceModel) {
|
||||
case DeviceModel.T1:
|
||||
return 'Trezor Model One';
|
||||
case DeviceModel.TT:
|
||||
return 'Trezor Model T';
|
||||
case DeviceModel.T2B1:
|
||||
return 'Trezor Model R';
|
||||
default:
|
||||
console.error('Unknown Trezor device');
|
||||
return 'Trezor';
|
||||
}
|
||||
};
|
||||
|
||||
export const getDeviceModel = (device?: PartialDevice): DeviceModel => {
|
||||
const deviceModel = device?.features?.model;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ export type PartialDevice = Partial<{
|
||||
initialized: boolean | null;
|
||||
no_backup: boolean | null;
|
||||
model: string | null;
|
||||
internal_model: string | null;
|
||||
};
|
||||
firmwareType: string | null;
|
||||
}>;
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
BlockchainNetworks,
|
||||
} from '@suite-common/wallet-types';
|
||||
import { networksCompatibility } from '@suite-common/wallet-config';
|
||||
import { DeviceModel } from '@trezor/device-utils';
|
||||
import { DeviceModel, DeviceInternalModel } from '@trezor/device-utils';
|
||||
|
||||
// in-memory implementation of indexedDB
|
||||
import 'fake-indexeddb/auto';
|
||||
@@ -111,6 +111,7 @@ const getDeviceFeatures = (feat?: Partial<Features>): Features => ({
|
||||
needs_backup: false,
|
||||
flags: 0,
|
||||
model: DeviceModel.TT,
|
||||
internal_model: DeviceInternalModel.TT,
|
||||
fw_major: null,
|
||||
fw_minor: null,
|
||||
fw_patch: null,
|
||||
|
||||
@@ -34,7 +34,9 @@ export const hiddenDevice: TrezorDevice = {
|
||||
firmware_present: null,
|
||||
needs_backup: false,
|
||||
flags: 0,
|
||||
// TODO: use DeviceModel, DeviceInternalModel enums
|
||||
model: 'T',
|
||||
internal_model: 'T2T1',
|
||||
fw_major: null,
|
||||
fw_minor: null,
|
||||
fw_patch: null,
|
||||
|
||||
Reference in New Issue
Block a user