HDWallet¶
- class hdwallet.HDWallet(cryptocurrency, options={})¶
HDWallet class for managing hierarchical deterministic wallets.
exported from
hdwalletCreates an HDWallet instance.
- Arguments:
cryptocurrency (typeof Cryptocurrency) – The cryptocurrency class to use.
options (HDWalletOptionsInterface) – Optional wallet settings.
- hdwallet.HDWallet.derivation?¶
type: Derivation
- hdwallet.HDWallet.cleanDerivation()¶
Clears the derivation.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromDerivation(derivation)¶
Initialize wallet from a derivation.
- Arguments:
derivation (Derivation) – The derivation instance.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromEntropy(entropy)¶
Initialize wallet from entropy.
- Arguments:
entropy (Entropy) – The entropy instance.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromMnemonic(mnemonic)¶
Initialize wallet from a mnemonic.
- Arguments:
mnemonic (Mnemonic) – The mnemonic instance.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromPrivateKey(privateKey)¶
Initialize wallet from a private key.
- Arguments:
privateKey (string) – The private key string.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromPublicKey(publicKey)¶
Initialize wallet from a public key.
- Arguments:
publicKey (string) – The public key string.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromSeed(seed)¶
Initialize wallet from a seed.
- Arguments:
seed (Seed) – The seed instance.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromSpendPrivateKey(spendPrivateKey)¶
Initialize wallet from Monero spend private key.
- Arguments:
spendPrivateKey (string) – The spend private key string.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromWIF(wif)¶
Initialize wallet from a WIF key.
- Arguments:
wif (string) – The WIF string.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromWatchOnly(viewPrivateKey, spendPublicKey)¶
Initialize wallet from Monero watch-only keys.
- Arguments:
viewPrivateKey (string) – The view private key string.
spendPublicKey (string) – The spend public key string.
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromXPrivateKey(xprivateKey, encoded=true, strict=false)¶
Initialize wallet from an extended private key.
- Arguments:
xprivateKey (string) – The extended private key string.
encoded (boolean) – Whether the key is encoded (default: true).
strict (boolean) – Whether to use strict mode (default: false).
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.fromXPublicKey(xpublicKey, encoded=true, strict=false)¶
Initialize wallet from an extended public key.
- Arguments:
xpublicKey (string) – The extended public key string.
encoded (boolean) – Whether the key is encoded (default: true).
strict (boolean) – Whether to use strict mode (default: false).
- Returns:
HDWallet – The current HDWallet instance.
- hdwallet.HDWallet.getAddress(options={})¶
Get wallet address.
- Arguments:
options (HDWalletAddressOptionsInterface) – Optional address settings.
- Returns:
string | null – Address string or null.
- hdwallet.HDWallet.getCardanoType()¶
Get Cardano type.
- Returns:
string | null – Cardano type string or null.
- hdwallet.HDWallet.getChainCode()¶
Get the chain code.
- Returns:
string | null – Chain code string.
- hdwallet.HDWallet.getCoinType()¶
Get the coin type.
- Returns:
number – Coin type number.
- hdwallet.HDWallet.getCompressed()¶
Get the compressed public key.
- Returns:
string – Compressed public key string.
- hdwallet.HDWallet.getCryptocurrency()¶
Get the cryptocurrency name.
- Returns:
string – Cryptocurrency name string.
- hdwallet.HDWallet.getDepth()¶
Get key depth.
- Returns:
number – Depth number.
- hdwallet.HDWallet.getDump(exclude=[])¶
Get full dump of wallet data.
- Arguments:
exclude (string[]) – List of keys to exclude.
- Returns:
Record<string, any> – Object containing wallet data.
- hdwallet.HDWallet.getDumps(exclude=[])¶
Get dumps for derivation ranges.
- Arguments:
exclude (string[]) – List of keys to exclude.
- Returns:
any – Array of wallet data objects or null.
- hdwallet.HDWallet.getECC()¶
Get the ECC algorithm name.
- Returns:
string – ECC algorithm string.
- hdwallet.HDWallet.getEntropy()¶
Get entropy value.
- Returns:
string | null – Entropy as a string or null.
- hdwallet.HDWallet.getFingerprint()¶
Get key fingerprint.
- Returns:
string – Fingerprint string.
- hdwallet.HDWallet.getHD()¶
Get HD type name.
- Returns:
string – HD type string.
- hdwallet.HDWallet.getHash()¶
Get key hash.
- Returns:
string – Key hash string.
- hdwallet.HDWallet.getIndex()¶
Get last index in derivation path.
- Returns:
number – Index number.
- hdwallet.HDWallet.getIndexes()¶
Get all indexes in derivation path.
- Returns:
number[] – Array of index numbers.
- hdwallet.HDWallet.getIntegratedAddress(paymentID)¶
Get Monero integrated address.
- Arguments:
paymentID (string) – Optional payment ID.
- Returns:
string | null – Integrated address string or null.
- hdwallet.HDWallet.getLanguage()¶
Get language of mnemonic.
- Returns:
string | null – Language string or null.
- hdwallet.HDWallet.getMasterChainCode()¶
Get the master chain code.
- Returns:
string | null – Master chain code string.
- hdwallet.HDWallet.getMasterPrivateKey()¶
Get the master private key.
- Returns:
string | null – Master private key string or null.
- hdwallet.HDWallet.getMasterPublicKey(publicKeyType)¶
Get the master public key.
- Arguments:
publicKeyType (string) – Optional public key type.
- Returns:
string | null – Master public key string.
- hdwallet.HDWallet.getMasterWIF(wifType)¶
Get the master WIF key.
- Arguments:
wifType (string) – Optional WIF type.
- Returns:
string | null – Master WIF string or null.
- hdwallet.HDWallet.getMasterXPrivateKey(semantic, encoded=true)¶
Alias for getRootXPrivateKey.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return the encoded key (default: true).
- Returns:
string | null – Master xprv string or null.
- hdwallet.HDWallet.getMasterXPublicKey(semantic, encoded=true)¶
Alias for getRootXPublicKey.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return the encoded key (default: true).
- Returns:
string | null – Master xpub string or null.
- hdwallet.HDWallet.getMnemonic()¶
Get the mnemonic string.
- Returns:
string | null – Mnemonic string or null.
- hdwallet.HDWallet.getMnemonicType()¶
Get mnemonic type.
- Returns:
string | null – Mnemonic type string or null.
- hdwallet.HDWallet.getMode()¶
Get mode (Electrum-V2 only).
- Returns:
string – Mode string.
- hdwallet.HDWallet.getNetwork()¶
Get network name.
- Returns:
string – Network name string.
- hdwallet.HDWallet.getParentFingerprint()¶
Get parent fingerprint.
- Returns:
string – Parent fingerprint string.
- hdwallet.HDWallet.getPassphrase()¶
Get wallet passphrase.
- Returns:
string | null – Passphrase string or null.
- hdwallet.HDWallet.getPath()¶
Get derivation path.
- Returns:
string – Path string.
- hdwallet.HDWallet.getPathKey()¶
Get path key.
- Returns:
string | null – Path key string or null.
- hdwallet.HDWallet.getPrimaryAddress()¶
Get the Monero primary address.
- Returns:
string | null – Address string or null.
- hdwallet.HDWallet.getPrivateKey()¶
Get the standard private key.
- Returns:
string | null – Private key string or null.
- hdwallet.HDWallet.getPublicKey(publicKeyType)¶
Get the standard public key.
- Arguments:
publicKeyType (string) – Optional public key type.
- Returns:
string – Public key string.
- hdwallet.HDWallet.getPublicKeyType()¶
Get the public key type.
- Returns:
string – Public key type string.
- hdwallet.HDWallet.getRootChainCode()¶
Get the root chain code.
- Returns:
string | null – Root chain code string.
- hdwallet.HDWallet.getRootPrivateKey()¶
Get the root private key.
- Returns:
string | null – Root private key string or null.
- hdwallet.HDWallet.getRootPublicKey(publicKeyType)¶
Get the root public key.
- Arguments:
publicKeyType (string) – Optional public key type.
- Returns:
string | null – Root public key string.
- hdwallet.HDWallet.getRootWIF(wifType)¶
Get the root WIF (Wallet Import Format) key.
- Arguments:
wifType (string) – Optional WIF type.
- Returns:
string | null – WIF string or null if unsupported.
- hdwallet.HDWallet.getRootXPrivateKey(semantic, encoded=true)¶
Get the root extended private key (xprv) for the wallet.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return the encoded key (default: true).
- Returns:
string | null – Root xprv string or null if unsupported.
- hdwallet.HDWallet.getRootXPublicKey(semantic, encoded=true)¶
Get the root extended public key (xpub) for the wallet.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return the encoded key (default: true).
- Returns:
string | null – Root xpub string or null if unsupported.
- hdwallet.HDWallet.getSeed()¶
Get wallet seed.
- Returns:
string | null – Seed string or null.
- hdwallet.HDWallet.getSemantic()¶
Get semantic type.
- Returns:
string | null – Semantic string or null.
- hdwallet.HDWallet.getSpendPrivateKey()¶
Get the Monero spend private key.
- Returns:
string | null – Monero spend private key string.
- hdwallet.HDWallet.getSpendPublicKey()¶
Get the Monero spend public key.
- Returns:
string – Monero spend public key string.
- hdwallet.HDWallet.getStrength()¶
Get entropy strength.
- Returns:
number | null – Entropy strength in bits or null.
- hdwallet.HDWallet.getStrict()¶
Get strict derivation setting.
- Returns:
boolean | null – Boolean or null if unsupported.
- hdwallet.HDWallet.getSubAddress(minor, major)¶
Get Monero subaddress.
- Arguments:
minor (number) – Optional minor index.
major (number) – Optional major index.
- Returns:
string | null – Subaddress string or null.
- hdwallet.HDWallet.getSymbol()¶
Get the cryptocurrency symbol.
- Returns:
string – Cryptocurrency symbol string.
- hdwallet.HDWallet.getUncompressed()¶
Get the uncompressed public key.
- Returns:
string – Uncompressed public key string.
- hdwallet.HDWallet.getViewPrivateKey()¶
Get the Monero view private key.
- Returns:
string – Monero view private key string.
- hdwallet.HDWallet.getViewPublicKey()¶
Get the Monero view public key.
- Returns:
string – Monero view public key string.
- hdwallet.HDWallet.getWIF(wifType)¶
Get the standard WIF key.
- Arguments:
wifType (string) – Optional WIF type.
- Returns:
string | null – WIF string or null.
- hdwallet.HDWallet.getWIFType()¶
Get the WIF type.
- Returns:
string | null – WIF type string or null.
- hdwallet.HDWallet.getWords()¶
Get number of words in mnemonic.
- Returns:
number | null – Word count or null.
- hdwallet.HDWallet.getXPrivateKey(semantic, encoded=true)¶
Get coin-specific extended private key.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return encoded key (default: true).
- Returns:
string | null – Extended private key string or null.
- hdwallet.HDWallet.getXPublicKey(semantic, encoded=true)¶
Get coin-specific extended public key.
- Arguments:
semantic (string) – Optional semantic version.
encoded (boolean) – Whether to return encoded key (default: true).
- Returns:
string | null – Extended public key string or null.
- hdwallet.HDWallet.updateDerivation(derivation)¶
Update the wallet’s derivation.
- Arguments:
derivation (Derivation) – The derivation instance.
- Returns:
HDWallet – The current HDWallet instance.
Examples for fromEntropy()
Examples for fromMnemonic()
Examples for fromSeed()
Examples for fromXPublicKey()
Examples for fromXPrivateKey()
Client |
Example |
|---|---|
Algorand |
|
BIP’s |
https://github.com/hdwallet-io/hdwallet.js/blob/master/examples/hdwallet/bips/from-xprivate-key.ts |
Cardano |
Examples for fromPublicKey()
Examples for fromPrivateKey()
Examples for fromWIF()
Examples for fromWatchOnly()
Client |
Example |
|---|---|
Monero |
https://github.com/hdwallet-io/hdwallet.js/blob/master/examples/hdwallet/monero/from-watch-only.ts |
Examples for fromSpendPrivateKey()