import type { KeyPath } from "../types"; import type { AccountType, KeySpace } from "./enums"; export function keyPathToString(account: AccountType, type: KeySpace, index: number): string { return `${account}'/${type}/${index}`; } export function stringToKeyPath(path: string): KeyPath { const parts = path.split('/'); return { account: parseInt(parts[0].replace("'", "")) as AccountType, type: parseInt(parts[1]) as KeySpace, index: parseInt(parts[2]) }; }