
    ei"                         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dS )    N)AnyAnyStr   )HexStr   )	is_stringis_textz(0[xX])?[0-9a-fA-F]*valuereturnc                     t          |           st          d          t          t          |                     }|                    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      q/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/static_dependencies/ethereum/utils/hexadecimal.py
decode_hexr      sV    5>> <:;;;#F5MM22L##G,,Ii(((    c                 ,   t          |           st          d          t          | t          t          f          r| }n|                     d          }t          j        |          }t          t          |
                    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!      s    U ,EFFF	EE9-	.	. ,ll7++!+..J
 1 1' : :;;<<<r   c                     t          |           st          dt          |                      |                     d          S )Nz3is_0x_prefixed requires text typed arguments. Got: )0x0X)r	   r   repr
startswithr
   s    r   is_0x_prefixedr(   +   sI    5>> 
O$u++OO
 
 	
 L)))r   c                 R    t          |           rt          | dd                    S | S )Nr   r(   r   r'   s    r   r   r   3   s-    e !eABBi   Lr   c                 H    t          |           r| S t          d| z             S )Nr#   r*   r'   s    r   r   r   9   s)    e $,r   c                 `    t          |           r| sdS t                              |           d uS )NF)r	   _HEX_REGEXP	fullmatchr'   s    r   	is_hexstrr/   ?   s5    5>>  u  ''t33r   c                     t          |           st          dt          |                      | sdS t                              |           d uS )Nz+is_hex requires text typed arguments. Got: F)r	   r   r%   r-   r.   r'   s    r   is_hexr1   E   sT    5>> USd5kkSSTTT u  ''t33r   )r   retypingr   r   r   typesr   r	   compiler-   strr   r   r!   boolr(   r   r   r/   r1    r   r   <module>r9      s    				       
            
 bj/00)c )e ) ) ) )	=f 	= 	= 	= 	= 	=*# *$ * * * *F v       F        4S 4T 4 4 4 44# 4$ 4 4 4 4 4 4r   