hd_wallet_bip_factory

Module for creating BIP wallet factories.

class HdWalletBipFactoryConst

Bases: object

Class container for HD wallet BIP factory constants.

BIP_COIN_TO_CLASS: Dict[Type[BipCoins], Type[Bip44Base]] = {<enum 'Bip44Coins'>: <class 'bip_utils.bip.bip44.bip44.Bip44'>, <enum 'Bip49Coins'>: <class 'bip_utils.bip.bip49.bip49.Bip49'>, <enum 'Bip84Coins'>: <class 'bip_utils.bip.bip84.bip84.Bip84'>, <enum 'Bip86Coins'>: <class 'bip_utils.bip.bip86.bip86.Bip86'>}
class HdWalletBipFactory(coin_type: BipCoins)

Bases: object

HD wallet BIP factory class. It allows a HdWalletBip to be created in different ways.

m_bip_cls: Type[Bip44Base]
m_bip_coin: BipCoins
CreateRandom(wallet_name: str, words_num: Bip39WordsNum = Bip39WordsNum.WORDS_NUM_24, lang: Bip39Languages = Bip39Languages.ENGLISH) HdWalletBase

Create wallet randomly.

Parameters:
  • wallet_name (str) – Wallet name

  • words_num (HdWalletBipWordsNum, optional) – Words number (default: 24)

  • lang (HdWalletBipLanguages, optional) – Language (default: English)

Returns:

HdWalletBase object

Return type:

HdWalletBase object

Raises:

TypeError – If words number is not a HdWalletBipWordsNum enum or language is not a HdWalletBipLanguages enum

CreateFromMnemonic(wallet_name: str, mnemonic: str, passphrase: str = '') HdWalletBase

Create wallet from mnemonic.

Parameters:
  • wallet_name (str) – Wallet name

  • mnemonic (str) – Mnemonic

  • passphrase (str, optional) – Passphrase for protecting mnemonic, empty if not specified

Returns:

HdWalletBase object

Return type:

HdWalletBase object

Raises:

ValueError – If the mnemonic is not valid

CreateFromSeed(wallet_name: str, seed_bytes: bytes) HdWalletBase

Create wallet from seed.

Parameters:
  • wallet_name (str) – Wallet name

  • seed_bytes (bytes) – Seed bytes

Returns:

HdWalletBase object

Return type:

HdWalletBase object

Raises:

ValueError – If the seed is not valid

CreateFromExtendedKey(wallet_name: str, ex_key_str: str) HdWalletBase

Create wallet from extended key.

Parameters:
  • wallet_name (str) – Wallet name

  • ex_key_str (str) – Extended key string

Returns:

HdWalletBase object

Return type:

HdWalletBase object

Raises:

ValueError – If the extended key is not valid