
    ":h"                         d dl Z d dlZd dlmZmZ ddlmZ ddlmZmZ  ej                  d      Z
ded	efd
Zded	efdZded	efdZded	efdZded	efdZded	efdZded	efdZy)    N)AnyAnyStr   )HexStr   )	is_stringis_textz(0[xX])?[0-9a-fA-F]*valuereturnc                     t        |       st        d      t        t        |             }|j	                  d      }t        j                  |      S )Nz Value must be an instance of strascii)r	   	TypeErrorremove_0x_prefixr   encodebinascii	unhexlify)r
   non_prefixed	ascii_hexs      m/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/static_dependencies/ethereum/utils/hexadecimal.py
decode_hexr      sD    5>:;;#F5M2L##G,Ii((    c                     t        |       st        d      t        | t        t        f      r| }n| j                  d      }t        j                  |      }t        t        |j                  d                  S )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!      sc    UEFF	EE9-	.ll7+!!+.J
 1 1' :;<<r   c                 h    t        |       st        dt        |              | j                  d      S )Nz3is_0x_prefixed requires text typed arguments. Got: )0x0X)r	   r   repr
startswithr
   s    r   is_0x_prefixedr(   +   s7    5>A$u+O
 	
 L))r   c                 8    t        |       rt        | dd        S | S )Nr   r(   r   r'   s    r   r   r   3   s     eeABi  Lr   c                 8    t        |       r| S t        d| z         S )Nr#   r*   r'   s    r   r   r   9   s    e$,r   c                 L    t        |       r| syt        j                  |       d uS )NF)r	   _HEX_REGEXP	fullmatchr'   s    r   	is_hexstrr/   ?   s$    5>  't33r   c                 z    t        |       st        dt        |              | syt        j	                  |       d uS )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     	

 bjj/0)c )e )	=f 	= 	=*# *$ *F v    F  4S 4T 44# 4$ 4r   