Derivations

class index.DERIVATIONS()

A registry for all derivation classes. Provides methods to access, validate, and retrieve derivation class definitions.

exported from derivations.index

index.DERIVATIONS.dictionary

type: Record<string, typeof Derivation>

A dictionary mapping derivation names to their corresponding classes.

static index.DERIVATIONS.getClasses()

Returns all available derivation classes.

Returns:

typeof Derivation[] – List of derivation class constructors.

static index.DERIVATIONS.getDerivationClass(name)

Retrieves a derivation class by name.

Arguments:
  • name (string) – The derivation name.

Returns:

any – The derivation class corresponding to the given name.

static index.DERIVATIONS.getNames()

Returns all available derivation names.

Returns:

string[] – List of derivation names.

static index.DERIVATIONS.isDerivation(name)

Checks if a derivation name exists in the dictionary.

Arguments:
  • name (string) – The derivation name to check.

Returns:

boolean – True if the derivation name exists, false otherwise.

class derivation.Derivation(options={})

Base abstract class for all hierarchical deterministic derivations.

Provides common functionality such as normalization, path management, and standard interface definitions for BIP-based and custom derivations.

Subclasses (like BIP44Derivation, CIP1852Derivation, etc.) must override abstract methods like getName(), clean(), getPurpose(), getCoinType(), etc.

exported from derivations.derivation

Creates a new derivation instance.

Arguments:
  • options (DerivationOptionsInterface) – Optional derivation configuration.

derivation.Derivation.derivations

type: DerivationsType[]

derivation.Derivation.indexes

type: number[]

derivation.Derivation.path

type: string

derivation.Derivation.purpose

type: DerivationType

derivation.Derivation.clean()

Resets the derivation to its default clean state. Must be implemented by subclasses.

Returns:

this

derivation.Derivation.getAccount()

Returns the account index. Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getAddress()

Returns the address index. Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getChange(...args)

Returns the change chain identifier. Must be implemented by subclasses.

Arguments:
  • args (any[]) – Optional arguments for change formatting.

Returns:

string | number

derivation.Derivation.getCoinType()

Returns the coin type (e.g., 0 for Bitcoin). Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getDepth()

Returns the depth (number of derivation levels).

Returns:

number – The depth of the derivation path.

derivation.Derivation.getDerivations()

Returns the structured derivations array.

Returns:

DerivationsType[] – Array of derivation tuples.

derivation.Derivation.getIndexes()

Returns the list of indexes in the derivation path.

Returns:

number[] – Array of index numbers.

derivation.Derivation.getMajor()

Returns the major index (if applicable in hierarchical standards). Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getMinor()

Returns the minor index (if applicable in hierarchical standards). Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getName()

Returns the derivation standard name for the current instance.

Returns:

string – The derivation standard name.

derivation.Derivation.getPath()

Returns the full derivation path.

Returns:

string – The derivation path (e.g., 'm/44'/0'/0'/0/0').

derivation.Derivation.getPurpose()

Returns the derivation purpose (e.g., 44 for BIP44). Must be implemented by subclasses.

Returns:

number

derivation.Derivation.getRole(...args)

Returns the role name in role-based derivations (e.g., 'external', 'staking'). Must be implemented by subclasses.

Arguments:
  • args (any[]) – Optional arguments for role formatting.

Returns:

string

static derivation.Derivation.getName()

Returns the name of the derivation standard (e.g., 'BIP44'). Must be overridden in subclasses.

Returns:

string

class bip44.BIP44Derivation(options=...)

Implements the BIP44 hierarchical deterministic derivation standard.

BIP44 defines a path structure: m / purpose’ / coin_type’ / account’ / change / address_index

exported from derivations.bip44

Extends:
  • Derivation

Creates a new BIP44 derivation path.

Arguments:
  • options (DerivationOptionsInterface) – Derivation configuration.

bip44.BIP44Derivation.account

type: DerivationsType

bip44.BIP44Derivation.address

type: DerivationsType

bip44.BIP44Derivation.change

type: DerivationsType

bip44.BIP44Derivation.coinType

type: DerivationsType

bip44.BIP44Derivation.purpose

type: DerivationType

bip44.BIP44Derivation.clean()

Resets the derivation to account 0, change 'external-chain', and address 0.

Returns:

this – Current instance for chaining.

bip44.BIP44Derivation.fromAccount(account)

Updates the account index and regenerates the derivation path.

Arguments:
  • account (IndexType) – Account index.

Returns:

this – Current instance for chaining.

bip44.BIP44Derivation.fromAddress(address)

Updates the address index and regenerates the derivation path.

Arguments:
  • address (IndexType) – Address index.

Returns:

this – Current instance for chaining.

bip44.BIP44Derivation.fromChange(change)

Updates the change type and regenerates the derivation path.

Arguments:
  • change (string | number) – Change type or index.

Returns:

this – Current instance for chaining.

bip44.BIP44Derivation.fromCoinType(coinType)

Updates the coin type and regenerates the derivation path.

Arguments:
  • coinType (string | number) – Coin type index (e.g., 0 for Bitcoin).

Returns:

this – Current instance for chaining.

bip44.BIP44Derivation.getAccount()

Gets the current account index.

Returns:

number – Account index.

bip44.BIP44Derivation.getAddress()

Gets the address index.

Returns:

number – Address index.

bip44.BIP44Derivation.getChange(nameOnly=true)

Gets the change name or index value.

Arguments:
  • nameOnly (boolean) – Whether to return 'external-chain' or 'internal-chain' instead of 0 or 1.

Returns:

string – The change name if nameOnly=true; otherwise the index.

bip44.BIP44Derivation.getChangeValue(change, nameOnly=false)

Maps the given change value to its numeric or name form.

Arguments:
  • change (IndexType) – Change value (0, 1, 'external-chain', or 'internal-chain').

  • nameOnly (boolean) – If true, returns string name; otherwise numeric index.

Returns:

any – Mapped change value.

bip44.BIP44Derivation.getCoinType()

Gets the current coin type index.

Returns:

number – Coin type index.

bip44.BIP44Derivation.getPurpose()

Gets the BIP purpose (always 44).

Returns:

number – The BIP purpose index.

bip44.BIP44Derivation.updateDerivation()

Updates internal path, derivations, and indexes based on current parameters.

static bip44.BIP44Derivation.getName()

Returns the derivation standard name.

Returns:

string‘BIP44’

const { DERIVATIONS, BIP44Derivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', ... ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], [class BIP49Derivation], [class BIP84Derivation], ... ]
DERIVATIONS.getDerivationClass("BIP44")
console.log(DERIVATIONS.getDerivationClass("BIP44"));
// Output: [class BIP44Derivation]
DERIVATIONS.getDerivationClass("BIP44") === BIP44Derivation
console.log(DERIVATIONS.getDerivationClass("BIP44") === BIP44Derivation);
// Output: true
DERIVATIONS.isDerivation("BIP44")
console.log(DERIVATIONS.isDerivation("BIP44"));
// Output: true
BIP44Derivation.getName()
console.log(BIP44Derivation.getName());
// Output: 'BIP44'
const derivation = new BIP44Derivation({
...   coinType: 0,  // Bitcoin
...   account: 0,
...   change: 'external-chain',
...   address: 0
... });
console.log('\n>>> new BIP44Derivation(...)');
console.log(derivation);
// Output: BIP44 derivation path: m/44'/0'/0'/0/0
derivation.fromAccount(1).fromChange('internal-chain').fromAddress(5);
console.log('derivation.fromAccount(1).fromChange("internal-chain").fromAddress(5)');
console.log(derivation);
// Output: m/44'/0'/1'/1/5
derivation.clean();
console.log('derivation.clean()');
console.log(derivation);
// Output: m/44'/0'/0'/0/0
console.log(derivation.getPurpose());
// Output: 44
console.log(derivation.getCoinType());
// Output: 0
console.log(derivation.getChange());
// Output: 'external-chain'
class bip49.BIP49Derivation(options=...)

Represents the BIP49 derivation standard.

BIP49 defines the derivation scheme for hierarchical deterministic (HD) wallets using P2WPKH-nested-in-P2SH addresses (i.e., SegWit wrapped in P2SH). It extends BIP44 derivation and changes the purpose field to 49'.

exported from derivations.bip49

Extends:
  • BIP44Derivation

Creates a new instance of the BIP49 derivation class.

Arguments:
  • options (DerivationOptionsInterface) – Optional configuration object.

bip49.BIP49Derivation.purpose

type: DerivationType

static bip49.BIP49Derivation.getName()

Retrieves the derivation name identifier.

Returns:

string – Returns the name "BIP49".

const { DERIVATIONS, BIP49Derivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log('DERIVATIONS.getNames()');
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', ... ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], [class BIP49Derivation], [class BIP84Derivation], ... ]
DERIVATIONS.getDerivationClass("BIP49")
console.log(DERIVATIONS.getDerivationClass("BIP49"));
// Output: [class BIP49Derivation]
DERIVATIONS.getDerivationClass("BIP49") === BIP49Derivation
console.log(DERIVATIONS.getDerivationClass("BIP49") === BIP49Derivation);
// Output: true
DERIVATIONS.isDerivation("BIP49")
console.log(DERIVATIONS.isDerivation("BIP49"));
// Output: true
BIP49Derivation.getName()
console.log(BIP49Derivation.getName());
// Output: 'BIP49'
const derivation = new BIP49Derivation({
...   coinType: 0,  // Bitcoin
...   account: 0,
...   change: 'external-chain',
...   address: 0
... });
console.log(derivation);
// Output: BIP49 derivation path: m/49'/0'/0'/0/0
derivation.fromAccount(1).fromChange('internal-chain').fromAddress(5);
console.log(derivation);
// Output: m/49'/0'/1'/1/5
derivation.clean();
console.log('\n>>> derivation.clean()');
console.log(derivation);
// Output: m/49'/0'/0'/0/0
console.log(derivation.getPurpose());
// Output: 49
console.log(derivation.getCoinType());
// Output: 0
console.log(derivation.getChange());
// Output: 'external-chain'
class bip84.BIP84Derivation(options=...)

Implements the BIP84 hierarchical deterministic derivation standard.

BIP84 defines a path structure: m / purpose’ / coin_type’ / account’ / change / address_index

This class extends BIP44Derivation but uses purpose 84 (native SegWit addresses).

exported from derivations.bip84

Extends:
  • BIP44Derivation

Creates a new BIP84 derivation path.

Arguments:
  • options (DerivationOptionsInterface) – Derivation configuration.

bip84.BIP84Derivation.purpose

type: DerivationType

static bip84.BIP84Derivation.getName()

Returns the derivation standard name.

Returns:

string‘BIP84’

const { DERIVATIONS, BIP84Derivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', ... ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], [class BIP49Derivation], [class BIP84Derivation], ... ]
DERIVATIONS.getDerivationClass("BIP84")
console.log(DERIVATIONS.getDerivationClass("BIP84"));
// Output: [class BIP84Derivation]
DERIVATIONS.getDerivationClass("BIP84") === BIP84Derivation
console.log(DERIVATIONS.getDerivationClass("BIP84") === BIP84Derivation);
// Output: true
DERIVATIONS.isDerivation("BIP84")
console.log(DERIVATIONS.isDerivation("BIP84"));
// Output: true
BIP84Derivation.getName()
console.log(BIP84Derivation.getName());
// Output: 'BIP84'
const derivation = new BIP84Derivation({
...   coinType: 0,  // Bitcoin
...   account: 0,
...   change: 'external-chain',
...   address: 0
... });
console.log('\n>>> new BIP84Derivation(...)');
console.log(derivation);
// Output: BIP84 derivation path: m/84'/0'/0'/0/0
derivation.fromAccount(2).fromChange('internal-chain').fromAddress(7);
console.log(derivation);
// Output: m/84'/0'/2'/1/7
derivation.clean();
console.log(derivation);
// Output: m/84'/0'/0'/0/0
console.log(derivation.getPurpose());
// Output: 84
console.log(derivation.getCoinType());
// Output: 0
console.log(derivation.getChange());
// Output: 'external-chain'
class bip86.BIP86Derivation(options=...)

Implements the BIP86 hierarchical deterministic derivation standard.

BIP86 defines a path structure: m / purpose’ / coin_type’ / account’ / change / address_index where purpose is 86.

Extends BIP44Derivation.

exported from derivations.bip86

Extends:
  • BIP44Derivation

Creates a new BIP86 derivation path.

Arguments:
  • options (DerivationOptionsInterface) – Derivation configuration.

bip86.BIP86Derivation.purpose

type: DerivationType

static bip86.BIP86Derivation.getName()

Returns the derivation standard name.

Returns:

string‘BIP86’

const { DERIVATIONS, BIP86Derivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', ... ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], [class BIP49Derivation], [class BIP84Derivation], [class BIP86Derivation], ... ]
DERIVATIONS.getDerivationClass("BIP86")
console.log(DERIVATIONS.getDerivationClass("BIP86"));
// Output: [class BIP86Derivation]
DERIVATIONS.getDerivationClass("BIP86") === BIP86Derivation
console.log(DERIVATIONS.getDerivationClass("BIP86") === BIP86Derivation);
// Output: true
DERIVATIONS.isDerivation("BIP86")
console.log(DERIVATIONS.isDerivation("BIP86"));
// Output: true
BIP86Derivation.getName()
console.log(BIP86Derivation.getName());
// Output: 'BIP86'
const derivation = new BIP86Derivation({
...   coinType: 0,  // Bitcoin
...   account: 0,
...   change: 'external-chain',
...   address: 0
... });
console.log(derivation);
// Output: BIP86 derivation path: m/86'/0'/0'/0/0
derivation.fromAccount(1).fromChange('internal-chain').fromAddress(5);
console.log('derivation.fromAccount(1).fromChange("internal-chain").fromAddress(5)');
console.log(derivation);
// Output: m/86'/0'/1'/1/5
derivation.clean();
console.log(derivation);
// Output: m/86'/0'/0'/0/0
console.log(derivation.getPurpose());
// Output: 86
console.log(derivation.getCoinType());
// Output: 0
console.log(derivation.getChange());
// Output: 'external-chain'
class cip1852.CIP1852Derivation(options=...)

Implements the CIP-1852 hierarchical deterministic derivation standard for Cardano.

The derivation path structure is: m / purpose’ / coin_type’ / account’ / role / address_index

exported from derivations.cip1852

Extends:
  • Derivation

Creates a new CIP1852 derivation path.

Arguments:
  • options (DerivationOptionsInterface) – Derivation configuration.

cip1852.CIP1852Derivation.purpose

type: DerivationType

cip1852.CIP1852Derivation.clean()

Resets derivation to default Cardano parameters.

Returns:

this – Current instance for chaining.

cip1852.CIP1852Derivation.fromAccount(account)

Sets the account index and updates the derivation.

Arguments:
  • account (IndexType)

Returns:

this – Current instance for chaining.

cip1852.CIP1852Derivation.fromAddress(address)

Sets the address index and updates the derivation.

Arguments:
  • address (IndexType)

Returns:

this – Current instance for chaining.

cip1852.CIP1852Derivation.fromCoinType(coinType)

Sets the coin type and updates the derivation.

Arguments:
  • coinType (string | number)

Returns:

this – Current instance for chaining.

cip1852.CIP1852Derivation.fromRole(role)

Sets the role and updates the derivation.

Arguments:
  • role (string | number)

Returns:

this – Current instance for chaining.

cip1852.CIP1852Derivation.getAccount()

Returns the account index.

Returns:

number

cip1852.CIP1852Derivation.getAddress()

Returns the address index.

Returns:

number

cip1852.CIP1852Derivation.getCoinType()

Returns the coin type index.

Returns:

number

cip1852.CIP1852Derivation.getPurpose()

Returns the purpose index (always 1852).

Returns:

number

cip1852.CIP1852Derivation.getRole(nameOnly=true)

Returns the role name or index.

Arguments:
  • nameOnly (boolean) – If true, returns role name; otherwise numeric index.

Returns:

string

cip1852.CIP1852Derivation.getRoleValue(role, nameOnly=false)

Maps the given role value to its numeric or name form.

Arguments:
  • role (IndexType) – Role value (0, 1, 2, or corresponding role name).

  • nameOnly (boolean) – If true, returns string name; otherwise numeric index.

Returns:

any – Mapped role value.

static cip1852.CIP1852Derivation.getName()

Returns the derivation standard name.

Returns:

string‘CIP1852’

const { DERIVATIONS, CIP1852Derivation, ROLES } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', 'CIP1852', ... ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], ..., [class CIP1852Derivation], ... ]
DERIVATIONS.getDerivationClass("CIP1852")
console.log(DERIVATIONS.getDerivationClass("CIP1852"));
// Output: [class CIP1852Derivation]
DERIVATIONS.getDerivationClass("CIP1852") === CIP1852Derivation
console.log(DERIVATIONS.getDerivationClass("CIP1852") === CIP1852Derivation);
// Output: true
DERIVATIONS.isDerivation("CIP1852")
console.log(DERIVATIONS.isDerivation("CIP1852"));
// Output: true
CIP1852Derivation.getName()
console.log(CIP1852Derivation.getName());
// Output: 'CIP1852'
const derivation = new CIP1852Derivation({
...   coinType: 0,  // Cardano
...   account: 0,
...   role: ROLES.EXTERNAL_CHAIN,
...   address: 0
... });
console.log(derivation);
// Output: CIP1852 derivation path: m/1852'/0'/0'/0/0
derivation.fromAccount(1).fromRole(ROLES.STAKING_KEY).fromAddress(5);
console.log(derivation);
// Output: m/1852'/0'/1'/2/5
derivation.clean();
console.log(derivation);
// Output: m/1852'/0'/0'/0/0
console.log(derivation.getPurpose());
// Output: 1852
console.log(derivation.getCoinType());
// Output: 0
console.log(derivation.getRole());
// Output: 'external-chain'
class custom.CustomDerivation()

Represents a custom derivation path that does not conform to a specific standard (like BIP44).

This class allows flexible derivation path construction based on either: - a direct string path (e.g. "m/44'/0'/0'/0/0") - a list of indexes (e.g. [44, 0, 0, 0, 0])

exported from derivations.custom

Extends:
  • Derivation

custom.CustomDerivation.clean()

Resets the derivation to its default (empty) state.

Returns:

this – The current instance for chaining.

custom.CustomDerivation.fromIndex(index, hardened=false)

Extends the current derivation path by appending an index.

Optionally marks the index as hardened using the ' suffix.

Arguments:
  • index (number) – The index to append.

  • hardened (boolean) – Whether the index is hardened.

Returns:

this – The current instance for chaining.

custom.CustomDerivation.fromIndexes(indexes)

Derives from an array of indexes.

Automatically generates a valid derivation path from the given index sequence.

Arguments:
  • indexes (number[]) – The list of indexes (e.g. [44, 0, 0, 0, 0]).

Returns:

this – The current instance for chaining.

custom.CustomDerivation.fromPath(path)

Derives from a given string path.

The path must start with "m/", e.g. "m/44'/0'/0'/0/0".

Arguments:
  • path (string) – The derivation path string.

Returns:

this – The current instance for chaining.

static custom.CustomDerivation.getName()

Returns the derivation name.

Returns:

string – The string 'Custom'.

const { DERIVATIONS, CustomDerivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'Custom', 'BIP44', 'BIP49', 'BIP84', 'BIP86', 'CIP1852', 'Electrum', 'Monero', 'HDW' ]
DERIVATIONS.getDerivationClass("Custom")
console.log(DERIVATIONS.getDerivationClass("Custom"));
// Output: [class CustomDerivation]
DERIVATIONS.getDerivationClass("Custom") === CustomDerivation
console.log(DERIVATIONS.getDerivationClass("Custom") === CustomDerivation);
// Output: true
CustomDerivation.getName()
console.log(CustomDerivation.getName());
// Output: 'Custom'
const derivation = new CustomDerivation();
console.log(derivation);
// Output: Custom derivation with default empty path: m/
derivation.fromPath("m/44'/0'/0'/0/0");
console.log(derivation);
// Output: Custom derivation path: m/44'/0'/0'/0/0
derivation.fromIndexes([44, 0, 0, 0, 1]);
console.log(derivation);
// Output: Custom derivation path: m/44/0/0/0/1
derivation.fromIndex(5, true);
console.log(derivation);
// Output: Custom derivation path: m/44/0/0/0/1/5'
derivation.clean();
console.log(derivation);
// Output: Custom derivation path: m/
class electrum.ElectrumDerivation(options=...)

Implements Electrum-style derivation for hierarchical deterministic wallets.

Electrum derivation paths are simplified as: m / change / address_index

exported from derivations.electrum

Extends:
  • Derivation

Creates a new Electrum derivation path.

Arguments:
  • options (DerivationOptionsInterface) – Configuration options.

electrum.ElectrumDerivation.clean()

Resets the derivation to change 0 and address 0.

Returns:

this – Current instance for chaining.

electrum.ElectrumDerivation.fromAddress(address)

Updates the address index and regenerates the derivation path.

Arguments:
  • address (IndexType) – Address index.

Returns:

this – Current instance for chaining.

electrum.ElectrumDerivation.fromChange(change)

Updates the change index and regenerates the derivation path.

Arguments:
  • change (IndexType) – Change index.

Returns:

this – Current instance for chaining.

electrum.ElectrumDerivation.getAddress()

Gets the current address index.

Returns:

number – Address index.

electrum.ElectrumDerivation.getChange()

Gets the current change index.

Returns:

number – Change index.

static electrum.ElectrumDerivation.getName()

Returns the derivation standard name.

Returns:

string‘Electrum’

const { DERIVATIONS, ElectrumDerivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', 'CIP1852', 'Electrum', 'Monero', 'HDW' ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], [class BIP49Derivation], ... [class ElectrumDerivation], ... ]
DERIVATIONS.getDerivationClass("Electrum")
console.log(DERIVATIONS.getDerivationClass("Electrum"));
// Output: [class ElectrumDerivation]
DERIVATIONS.getDerivationClass("Electrum") === ElectrumDerivation
console.log(DERIVATIONS.getDerivationClass("Electrum") === ElectrumDerivation);
// Output: true
DERIVATIONS.isDerivation("Electrum")
console.log(DERIVATIONS.isDerivation("Electrum"));
// Output: true
ElectrumDerivation.getName()
console.log(ElectrumDerivation.getName());
// Output: 'Electrum'
const derivation = new ElectrumDerivation({ change: 0, address: 0 });
console.log(derivation);
// Output: Electrum derivation path: m/0/0
derivation.fromChange(1).fromAddress(5);
console.log(derivation);
// Output: m/1/5
derivation.clean();
console.log(derivation);
// Output: m/0/0
console.log(derivation.getChange());
// Output: 0
console.log(derivation.getAddress());
// Output: 0
class hdw.HDWDerivation(options=...)

HDWDerivation implements a generic hierarchical deterministic wallet derivation supporting multiple elliptic curves.

exported from derivations.hdw

Extends:
  • Derivation

Constructor to initialize the HDW derivation.

Arguments:
  • options (DerivationOptionsInterface) – Options including account, ECC type, and address.

hdw.HDWDerivation.clean()

Reset the derivation to default values.

Returns:

this – - Returns the derivation instance for chaining.

hdw.HDWDerivation.fromAccount(account)

Set a new account index.

Arguments:
  • account (IndexType) – The new account index.

Returns:

this – - Returns the derivation instance for chaining.

hdw.HDWDerivation.fromAddress(address)

Set a new address index.

Arguments:
  • address (IndexType) – The new address index.

Returns:

this – - Returns the derivation instance for chaining.

hdw.HDWDerivation.fromECC(ecc)

Set a new ECC type.

Arguments:
  • ecc (string | number | EllipticCurveCryptography) – ECC name, index, or EllipticCurveCryptography instance.

Returns:

this – - Returns the derivation instance for chaining.

hdw.HDWDerivation.getAccount()

Get the account index.

Returns:

number – - The account index.

hdw.HDWDerivation.getAddress()

Get the address index.

Returns:

number – - The address index.

hdw.HDWDerivation.getECC(nameOnly=true)

Get the ECC type used.

Arguments:
  • nameOnly (boolean) – If true, returns the ECC name; otherwise returns numeric index.

Returns:

string – - ECC name or numeric index.

hdw.HDWDerivation.getECCValue(ecc, nameOnly=false)

Converts an ECC input to a valid internal representation.

Arguments:
  • ecc (EllipticCurveCryptography | IndexType) – ECC name, index, or EllipticCurveCryptography instance.

  • nameOnly (boolean) – If true, returns the ECC name instead of numeric index.

Returns:

any – - Numeric index or ECC name.

static hdw.HDWDerivation.getName()

Returns the name of this derivation class.

Returns:

string – - ‘HDW’

const { DERIVATIONS, HDWDerivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', 'CIP1852', 'Electrum', 'Monero', 'HDW' ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], ... , [class HDWDerivation] ]
DERIVATIONS.getDerivationClass("HDW")
console.log(DERIVATIONS.getDerivationClass("HDW"));
// Output: [class HDWDerivation]
DERIVATIONS.getDerivationClass("HDW") === HDWDerivation
console.log(DERIVATIONS.getDerivationClass("HDW") === HDWDerivation);
// Output: true
DERIVATIONS.isDerivation("HDW")
console.log(DERIVATIONS.isDerivation("HDW"));
// Output: true
HDWDerivation.getName()
console.log(HDWDerivation.getName());
// Output: 'HDW'
const derivation = new HDWDerivation({ account: 0, ecc: 'SLIP10Secp256k1ECC', address: 0 });
console.log(derivation);
// Output: HDW derivation path: m/0/0/0
derivation.fromAccount(1).fromECC('SLIP10Ed25519ECC').fromAddress(5);
console.log(derivation);
// Output: m/1/1/5
derivation.clean();
console.log(derivation);
// Output: m/0/0/0
console.log(derivation.getAccount());
// Output: 0
console.log(derivation.getECC());
// Output: 'SLIP10Secp256k1ECC'
console.log(derivation.getAddress());
// Output: 0
class monero.MoneroDerivation(options=...)

MoneroDerivation implements a hierarchical derivation path for Monero wallets.

exported from derivations.monero

Extends:
  • Derivation

Constructor to initialize Monero derivation.

Arguments:
  • options (DerivationOptionsInterface) – Options including minor and major indices.

monero.MoneroDerivation.clean()

Reset the derivation to default values.

Returns:

this – - Returns the derivation instance for chaining.

monero.MoneroDerivation.fromMajor(major)

Set a new major index.

Arguments:
  • major (IndexType) – The major index.

Returns:

this – - Returns the derivation instance for chaining.

monero.MoneroDerivation.fromMinor(minor)

Set a new minor index.

Arguments:
  • minor (IndexType) – The minor index.

Returns:

this – - Returns the derivation instance for chaining.

monero.MoneroDerivation.getMajor()

Get the major index.

Returns:

number – - The major index.

monero.MoneroDerivation.getMinor()

Get the minor index.

Returns:

number – - The minor index.

static monero.MoneroDerivation.getName()

Returns the name of this derivation class.

Returns:

string – - ‘Monero’

const { DERIVATIONS, MoneroDerivation } = await import('./src/derivations/index.js');
DERIVATIONS.getNames()
console.log(DERIVATIONS.getNames());
// Output: [ 'BIP32', 'BIP44', 'BIP49', 'BIP84', 'BIP86', 'CIP1852', 'Electrum', 'Monero', 'HDW' ]
DERIVATIONS.getClasses()
console.log(DERIVATIONS.getClasses());
// Output: [ [class BIP32Derivation], [class BIP44Derivation], ..., [class MoneroDerivation], [class HDWDerivation] ]
DERIVATIONS.getDerivationClass("Monero")
console.log(DERIVATIONS.getDerivationClass("Monero"));
// Output: [class MoneroDerivation]
DERIVATIONS.getDerivationClass("Monero") === MoneroDerivation
console.log(DERIVATIONS.getDerivationClass("Monero") === MoneroDerivation);
// Output: true
DERIVATIONS.isDerivation("Monero")
console.log(DERIVATIONS.isDerivation("Monero"));
// Output: true
MoneroDerivation.getName()
console.log(MoneroDerivation.getName());
// Output: 'Monero'
const derivation = new MoneroDerivation({ minor: 1, major: 0 });
console.log(derivation);
// Output: Monero derivation path: m/1/0
derivation.fromMinor(2).fromMajor(1);
console.log(derivation);
// Output: m/2/1
derivation.clean();
console.log(derivation);
// Output: m/1/0
console.log(derivation.getMinor());
// Output: 1
console.log(derivation.getMajor());
// Output: 0