WizardConnect/packages/wallet/src/derivation-path.ts

34 lines
907 B
TypeScript
Raw Normal View History

2026-02-26 11:19:47 +01:00
// Copyright (C) 2026 Whiterun LLC,
// This software is licensed under the GNU Lesser General Public License (LGPL), version 3.0 or later.
// A copy of the license can be found in the LICENSE file or at https://www.gnu.org/licenses/lgpl-3.0.html
/**
* BCH HD wallet derivation paths.
* child_index values as used in hdwalletv1 protocol:
* 0 = Receive (m/44'/145'/0'/0)
* 1 = Change (m/44'/145'/0'/1)
* 7 = Cauldron (m/44'/145'/0'/7)
*/
export enum DerivationPath {
Receive = 0,
Change = 1,
Cauldron = 7,
}
export function childIndexOfPath(path: DerivationPath): number {
return path as number;
}
export function pathOfChildIndex(child: number): DerivationPath | undefined {
switch (child) {
case 0:
return DerivationPath.Receive;
case 1:
return DerivationPath.Change;
case 7:
return DerivationPath.Cauldron;
default:
return undefined;
}
}