
    E#i$                         % S r SSKJr  SSKJrJrJrJrJr  SSK	J
r
JrJr  \R                  r\\S'   SSKJrJr  SSKJr  SS	KJr  SS
KJr   " S S5      r " S S\
5      rg)zm
Module for BIP44 keys derivation.
Reference: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
    )Union   )Bip32KeyDataBip32KeyIndexBip32KeyNetVersions
Bip32ConstBip32Slip10Secp256k1)	Bip44BaseBip44ChangesBip44Levels_BIP44_BTC_KEY_NET_VER_MAIN)BipCoinsBipCoinConf)	CoinsConf)Slip44)DER_PATH_NON_HARDENED_FULLc                   V    \ rS rSr% SrSr\\S'   \R                  " S5      r
\\S'   Srg)	
Bip44Const+   z$Class container for BIP44 constants.zBIP-0044	SPEC_NAME,   PURPOSE N)__name__
__module____qualname____firstlineno____doc__r   str__annotations__r   HardenIndexr   int__static_attributes__r       b/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/bip/bip44/bip44.pyr   r   +   s&    .  Is ,,R0GS0r$   r   c                       \ rS rSrSr\S\S\4S j5       r\S\	S\4S j5       r
S\4S jrS\4S	 jrS
\S\4S jrS\S\4S jrS\S\4S jr\S\	4S j5       rSrg)Bip444   ze
BIP44 class.
It allows master key generation and children keys derivation in according to BIP-0044.

seed_bytesreturnc                     [        [        R                  R                  5       [        R
                  S[        [        S[        S[        R                  R                  S5      0S9nU R                  UU5      $ )a  
Create a Bip44Base object from the specified seed (e.g. BIP39 seed).

Args:
    seed_bytes (bytes)  : Seed bytes
    coin_type (BipCoins): Coin type, shall be a Bip44Coins enum

Returns:
    Bip44Base object: Bip44Base object

Raises:
    TypeError: If coin type is not a Bip44Coins enum
    ValueError: If the seed is too short
    Bip32KeyError: If the seed is not suitable for master key generation
FNhrpaddr_hrp)
coin_namescoin_idx
is_testnetdef_pathkey_net_verwif_net_ver	bip32_clsaddr_params)r   r   Cosmos	CoinNamesr   ATOMr   r   r	   
ParamByKey	_FromSeed)clsr)   confs      r%   FromSeedBip44.FromSeed>   sk    (  ''113[[/3* y''22:>
 }}Z!# 	#r$   
ex_key_strc                 T    U R                  U[        R                  [        5      5      $ )aT  
Create a Bip44Base object from the specified extended key.

Args:
    ex_key_str (str)    : Extended key string
    coin_type (BipCoins): Coin type, shall be a Bip44Coins enum

Returns:
    Bip44Base object: Bip44Base object

Raises:
    TypeError: If coin type is not a Bip44Coins enum
    Bip32KeyError: If the extended key is not valid
)_FromExtendedKeyBip44ConfGetter	GetConfig	coin_type)r;   r?   s     r%   FromExtendedKeyBip44.FromExtendedKeyb   s"    & ##J0I0I)0TUUr$   c                 @    U R                  [        R                  5      $ )a	  
Derive a child key from the purpose and return a new Bip44Base object.

Returns:
    Bip44Base object: Bip44Base object

Raises:
    Bip44DepthError: If current depth is not suitable for deriving keys
    Bip32KeyError: If the derivation results in an invalid key
)_PurposeGenericr   r   selfs    r%   PurposeBip44.Purpose   s     ##J$6$677r$   c                 "    U R                  5       $ )a%  
Derive a child key from the coin type specified at construction and return a new Bip44Base object.

Returns:
    Bip44Base object: Bip44Base object

Raises:
    Bip44DepthError: If current depth is not suitable for deriving keys
    Bip32KeyError: If the derivation results in an invalid key
)_CoinGenericrI   s    r%   Coin
Bip44.Coin   s       ""r$   acc_idxc                 $    U R                  U5      $ )aA  
Derive a child key from the specified account index and return a new Bip44Base object.

Args:
    acc_idx (int): Account index

Returns:
    Bip44Base object: Bip44Base object

Raises:
    Bip44DepthError: If current depth is not suitable for deriving keys
    Bip32KeyError: If the derivation results in an invalid key
)_AccountGeneric)rJ   rQ   s     r%   AccountBip44.Account   s     ##G,,r$   change_typec                 $    U R                  U5      $ )a  
Derive a child key from the specified change type and return a new Bip44Base object.

Args:
    change_type (Bip44Changes): Change type, must a Bip44Changes enum

Returns:
    Bip44Base object: Bip44Base object

Raises:
    TypeError: If change type is not a Bip44Changes enum
    Bip44DepthError: If current depth is not suitable for deriving keys
    Bip32KeyError: If the derivation results in an invalid key
)_ChangeGeneric)rJ   rV   s     r%   ChangeBip44.Change   s      "";//r$   addr_idxc                 $    U R                  U5      $ )aB  
Derive a child key from the specified address index and return a new Bip44Base object.

Args:
    addr_idx (int): Address index

Returns:
    Bip44Base object: Bip44Base object

Raises:
    Bip44DepthError: If current depth is not suitable for deriving keys
    Bip32KeyError: If the derivation results in an invalid key
)_AddressIndexGeneric)rJ   r[   s     r%   AddressIndexBip44.AddressIndex   s     ((22r$   c                  "    [         R                  $ )z?
Get specification name.

Returns:
    str: Specification name
)r   r   r   r$   r%   SpecNameBip44.SpecName  s     ###r$   r   N)r   r   r   r   r   classmethodbytesr
   r=   r   rE   rK   rO   r"   rT   r   rY   r^   staticmethodra   r#   r   r$   r%   r'   r'   4   s     !#"!#'0!# !#F V$'V,5V V`8 8#i #--!*-"0(0-60$3"3'03" $c $ $r$   r'   N)r   typingr   bip32r   r   r   r   r	   
bip44_baser
   r   r   MAIN_NET_KEY_NET_VERSIONSr   r    conf.commonr   r   	coin_confr   slip.slip44r   r   r   r'   r   r$   r%   <module>rm      sS   *  f f = =3=3W3W 0 W 0 !   41 1U$I U$r$   