
    E#i"                         S SK r S SKrS SKJrJr  SSKJr  SSKJrJr  \R                  " S5      r
S\S	\4S
 jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrg)    N)AnyAnyStr   )HexStr   )	is_stringis_textz(0[xX])?[0-9a-fA-F]*valuereturnc                     [        U 5      (       d  [        S5      e[        [        U 5      5      nUR	                  S5      n[
        R                  " U5      $ )Nz Value must be an instance of strascii)r	   	TypeErrorremove_0x_prefixr   encodebinascii	unhexlify)r
   non_prefixed	ascii_hexs      m/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/ethereum/utils/hexadecimal.py
decode_hexr      sF    5>>:;;#F5M2L##G,Ii((    c                    [        U 5      (       d  [        S5      e[        U [        [        45      (       a  U nOU R                  S5      n[        R                  " U5      n[        [        UR                  S5      5      5      $ )Nz+Value must be an instance of str or unicoder   )r   r   
isinstancebytes	bytearrayr   r   hexlifyadd_0x_prefixr   decode)r
   ascii_bytes
binary_hexs      r   
encode_hexr!      si    UEFF	EE9-	.	.ll7+!!+.J
 1 1' :;<<r   c                 r    [        U 5      (       d  [        S[        U 5       35      eU R                  S5      $ )Nz3is_0x_prefixed requires text typed arguments. Got: )0x0X)r	   r   repr
startswithr
   s    r   is_0x_prefixedr(   +   s9    5>>A$u+O
 	
 L))r   c                 B    [        U 5      (       a  [        U SS  5      $ U $ )Nr   r(   r   r'   s    r   r   r   3   s#    eeABi  Lr   c                 B    [        U 5      (       a  U $ [        SU -   5      $ )Nr#   r*   r'   s    r   r   r   9   s!    e$,r   c                 `    [        U 5      (       a  U (       d  g[        R                  U 5      S L$ )NF)r	   _HEX_REGEXP	fullmatchr'   s    r   	is_hexstrr/   ?   s&    5>>  't33r   c                     [        U 5      (       d  [        S[        U 5       35      eU (       d  g[        R	                  U 5      S L$ )Nz+is_hex requires text typed arguments. Got: F)r	   r   r%   r-   r.   r'   s    r   is_hexr1   E   s>    5>>Ed5k]STT  't33r   )r   retypingr   r   r   typesr   r	   compiler-   strr   r   r!   boolr(   r   r   r/   r1    r   r   <module>r9      s     	

 jj/0)c )e )	=f 	= 	=*# *$ *F v    F  4S 4T 44# 4$ 4r   