feat(connect): basic T3T1 support in types

This commit is contained in:
Martin Varmuza
2024-04-11 12:05:32 +02:00
committed by Tomáš Klíma
parent 68be4d2bd9
commit 1bc4569136
9 changed files with 39 additions and 16 deletions

View File

@@ -172,10 +172,11 @@ const DEFAULT_RANGE = {
T1B1: { min: '1.0.0', max: '0' },
T2T1: { min: '2.0.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
};
const DEFAULT_COIN_INFO = {
support: { T1B1: '1.6.2', T2T1: '2.1.0', T2B1: '2.6.1' },
support: { T1B1: '1.6.2', T2T1: '2.1.0', T2B1: '2.6.1', T3T1: '2.7.1' },
shortcut: 'btc',
type: 'bitcoin',
};
@@ -199,6 +200,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.6.2', max: '0' },
T2T1: { min: '2.1.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -209,6 +211,7 @@ export const getFirmwareRange = [
T1B1: { min: '0', max: '0' },
T2T1: { min: '0', max: '0' },
T2B1: { min: '0', max: '0' },
T3T1: { min: '0', max: '0' },
},
},
{
@@ -217,7 +220,7 @@ export const getFirmwareRange = [
params: [
'signTransaction',
{
support: { T1B1: false, T2T1: '2.1.0', T2B1: '2.6.1' },
support: { T1B1: false, T2T1: '2.1.0', T2B1: '2.6.1', T3T1: '2.7.1' },
shortcut: 'btc',
type: 'bitcoin',
},
@@ -227,6 +230,7 @@ export const getFirmwareRange = [
T1B1: { min: '0', max: '0' },
T2T1: { min: '2.1.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -235,7 +239,7 @@ export const getFirmwareRange = [
params: [
'signTransaction',
{
support: { T1B1: '1.6.2', T2T1: false, T2B1: false },
support: { T1B1: '1.6.2', T2T1: false, T2B1: false, T3T1: false },
shortcut: 'btc',
type: 'bitcoin',
},
@@ -245,6 +249,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.6.2', max: '0' },
T2T1: { min: '0', max: '0' },
T2B1: { min: '0', max: '0' },
T3T1: { min: '0', max: '0' },
},
},
{
@@ -280,6 +285,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.11.0', max: '0' },
T2T1: { min: '2.5.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -296,6 +302,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.0', max: '0' },
T2T1: { min: '2.4.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -312,6 +319,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.0', max: '0' },
T2T1: { min: '2.4.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -342,6 +350,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.0', max: '0' },
T2T1: { min: '2.4.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -372,6 +381,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.0', max: '0' },
T2T1: { min: '2.4.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -394,6 +404,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.0', max: '0' },
T2T1: { min: '2.4.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -408,6 +419,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.6.2', max: '1.10.0' },
T2T1: { min: '2.1.0', max: '2.4.0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -443,6 +455,7 @@ export const getFirmwareRange = [
T1B1: { min: '0', max: '0' },
T2T1: { min: '2.1.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -465,6 +478,7 @@ export const getFirmwareRange = [
T1B1: { min: '1.10.4', max: '0' },
T2T1: { min: '2.4.2', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
{
@@ -474,6 +488,7 @@ export const getFirmwareRange = [
T1B1: { min: '0', max: '0' },
T2T1: { min: '0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
},
},
];

View File

@@ -153,6 +153,7 @@ export const ethereumNetworkInfoFromDefinition = (
T1B1: '1.6.2',
T2T1: '2.0.7',
T2B1: '2.6.1',
T3T1: '2.7.1',
},
blockchainLink: undefined,
});

View File

@@ -25,6 +25,7 @@ export const DEFAULT_FIRMWARE_RANGE: FirmwareRange = {
T1B1: { min: '1.0.0', max: '0' },
T2T1: { min: '2.0.0', max: '0' },
T2B1: { min: '2.6.1', max: '0' },
T3T1: { min: '2.7.1', max: '0' },
};
export abstract class AbstractMethod<Name extends CallMethodPayload['method'], Params = undefined> {

View File

@@ -240,7 +240,7 @@ export const config = {
},
{
methods: ['changeLanguage'],
min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0' },
min: { T1B1: '0', T2T1: '2.7.0', T2B1: '2.7.0', T3T1: '2.7.1' },
},
],
};

View File

@@ -21,6 +21,7 @@ const releases: Record<keyof typeof DeviceModelInternal, FirmwareRelease[]> = {
[DeviceModelInternal.T1B1]: [],
[DeviceModelInternal.T2T1]: [],
[DeviceModelInternal.T2B1]: [],
[DeviceModelInternal.T3T1]: [],
};
export const parseFirmware = (json: any, deviceModel: DeviceModelInternal) => {

View File

@@ -17,4 +17,13 @@ export const models = {
'5': 'Bitcoin Orange',
},
},
T3T1: {
name: 'Trezor Safe 5',
colors: {
'1': 'Fantastic Ethereum',
'2': 'Lunatic Dogecoin',
'3': 'Galactic Litecoin',
'4': 'Majestic Bitcoin',
},
},
};

View File

@@ -32,6 +32,7 @@ export const CoinSupport = Type.Object({
T1B1: Type.Union([Type.String(), Type.Literal(false)]),
T2T1: Type.Union([Type.String(), Type.Literal(false)]),
T2B1: Type.Union([Type.String(), Type.Literal(false)]),
T3T1: Type.Union([Type.String(), Type.Literal(false)]),
});
export type BlockchainLink = Static<typeof BlockchainLink>;

View File

@@ -1,19 +1,13 @@
import { DeviceModelInternal } from '@trezor/protobuf';
import { Type } from '@trezor/schema-utils';
export interface FirmwareRange {
T1B1: {
export type FirmwareRange = Record<
DeviceModelInternal,
{
min: string;
max: string;
};
T2T1: {
min: string;
max: string;
};
T2B1: {
min: string;
max: string;
};
}
}
>;
export type VersionArray = [number, number, number];

View File

@@ -7,6 +7,7 @@ export const pickByDeviceModel = <Type>(
[DeviceModelInternal.T1B1]?: Type;
[DeviceModelInternal.T2T1]?: Type;
[DeviceModelInternal.T2B1]?: Type;
[DeviceModelInternal.T3T1]?: Type;
},
): Type => {
if (!deviceModelInternal || typeof options[deviceModelInternal] === 'undefined') {