Skip to content

Commit

Permalink
refactor(llc): SeedPhraseType in types/manager
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandremgo committed Jun 9, 2022
1 parent 569a2a1 commit 9296d68
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
8 changes: 2 additions & 6 deletions libs/ledger-live-common/src/hw/extractOnboardingState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { DeviceExtractOnboardingStateError } from "@ledgerhq/errors";
import { SeedPhraseType } from "../types/manager";

const onboardingFlagsBytesLength = 4;

const onboardedMask = 0x04;
Expand All @@ -7,12 +9,6 @@ const seedPhraseTypeMask = 0x60;
const seedPhraseTypeFlagOffset = 5;
const currentSeedWordIndexMask = 0x1f;

export enum SeedPhraseType {
Twelve = "12-words",
Eighteen = "18-words",
TwentyFour = "24-words",
}

const fromBitsToSeedPhraseType = new Map<number, SeedPhraseType>([
[0, SeedPhraseType.TwentyFour],
[1, SeedPhraseType.Eighteen],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as rxjsOperators from "rxjs/operators";
import { DeviceModelId } from "@ledgerhq/devices";
import Transport from "@ledgerhq/hw-transport";
import {
DeviceOnboardingStatePollingError,
DeviceExtractOnboardingStateError,
DisconnectedDevice,
} from "@ledgerhq/errors";
Expand All @@ -13,9 +12,9 @@ import getVersion from "./getVersion";
import {
extractOnboardingState,
OnboardingState,
SeedPhraseType,
OnboardingStep,
} from "./extractOnboardingState";
import { SeedPhraseType } from "../types/manager";

jest.mock("./deviceAccess");
jest.mock("./getVersion");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import { timer, of } from "rxjs";
import { map, delayWhen } from "rxjs/operators";
import { renderHook, act } from "@testing-library/react-hooks";
import { DeviceModelId } from "@ledgerhq/devices";
import { DisconnectedDevice } from "@ledgerhq/errors";
import { useOnboardingStatePolling } from "./useOnboardingStatePolling";
import {
extractOnboardingState,
OnboardingState,
SeedPhraseType,
OnboardingStep,
} from "../../hw/extractOnboardingState";
import { DisconnectedDevice } from "@ledgerhq/errors";
import { SeedPhraseType } from "../../types/manager";
import { getOnboardingStatePolling } from "../../hw/getOnboardingStatePolling";

jest.mock("../../hw/getOnboardingStatePolling");
Expand Down
5 changes: 5 additions & 0 deletions libs/ledger-live-common/src/types/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export type McuVersion = {
date_creation: string;
date_last_modified: string;
};
export enum SeedPhraseType {
Twelve = "12-words",
Eighteen = "18-words",
TwentyFour = "24-words",
}
export type FirmwareInfo = {
isBootloader: boolean;
rawVersion: string; // if SE seVersion, if BL blVersion
Expand Down

0 comments on commit 9296d68

Please sign in to comment.