
    E#iK                     	   S SK r S SKrS SKrS SKJrJrJrJr  SSKJr  SSK	J
r
JrJrJr  SSKJr  SSKJrJrJr  \\R&                  \\R&                  /\4   4   r\\/\4   r\\
R0                  /\4   r\\\\R4                     4   r\\\\
R8                     4   r " S	 S
\ R<                  5      r " S S\5      r  " S S5      r! " S S\!5      r" " S S\!5      r#S r$S r%S r&S r' " S S5      r( " S S\\(5      r)\)" 5       r*\*RW                  \#" S5      \RX                  \
RZ                  SS9  \*RW                  \#" S5      \R\                  \
R^                  SS9  \*RW                  \#" S5      \R`                  \
Rb                  SS9  \*RW                  \#" S5      \Rd                  \
Rf                  SS9  \*RW                  \#" S 5      \Rh                  \
Rj                  S S9  \*RW                  \#" S!5      \Rl                  \
Rn                  S!S9  \*RW                  \#" S"S#S$9\Rp                  \
Rr                  S%S9  \*RW                  \#" S"S&S$9\Rt                  \
Rv                  S"S9  \*RW                  \#" S'5      \Rp                  \
Rr                  S'S9  \*RW                  \#" S(5      \Rx                  \
Rz                  S(S9  \*RW                  \$\R|                  \
R~                  S)S9  \*RW                  \%\R                  \
R                  S*S9  \)" 5       rB\BR                  \#" S5      \R                  SS9  \BR                  \#" S5      \R                  SS9  \BR                  \#" S5      \R                  SS9  \BR                  \#" S5      \R                  SS9  \BR                  \#" S 5      \R                  S S9  \BR                  \#" S!5      \R                  S!S9  \BR                  \#" S"S#S$9\R                  S%S9  \BR                  \#" S"S&S$9\R                  S"S9  \BR                  \#" S'5      \R                  S'S9  \BR                  \#" S(5      \R                  S(S9  \BR                  \$\R                  S)S9  \BR                  \%\R                  S*S9  g)+    N)AnyCallableTypeUnion   )abi   )decodingencoding
exceptionsgrammar)	BaseCoder)ABITypeErrorMultipleEntriesFoundNoEntriesFoundc                   D    \ rS rSr\R
                  S 5       rS rS rSr	g)Copyable'   c                     g N selfs    h/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/ethereum/abi/registry.pycopyCopyable.copy(   s        c                 "    U R                  5       $ r   r   r   s    r   __copy__Copyable.__copy__,       yy{r   c                 "    U R                  5       $ r   r   )r   argss     r   __deepcopy__Copyable.__deepcopy__/   r"   r   r   N)
__name__
__module____qualname____firstlineno__abcabstractmethodr   r    r%   __static_attributes__r   r   r   r   r   '   s$     r   r   c                   L    \ rS rSrSrS rSS jrS rS rS r	S	 r
S
 rS rSrg)PredicateMapping3   z
Acts as a mapping from predicate functions to values.  Values are retrieved
when their corresponding predicate matches a given input.  Predicates can
also be labeled to facilitate removal from the mapping.
c                 ,    Xl         0 U l        0 U l        g r   )_name_values_labeled_predicates)r   names     r   __init__PredicateMapping.__init__:   s    
#% r   Nc                 8   XR                   ;   a.  [        SR                  [        U5      U R                  5      5      eUbL  X0R
                  ;   a/  [        SR                  [        U5      UU R                  5      5      eXR
                  U'   X R                   U'   g )NzMatcher {} already exists in {}z/Matcher {} with label '{}' already exists in {})r3   
ValueErrorformatreprr2   r4   )r   	predicatevaluelabels       r   addPredicateMapping.add?   s    $188OJJ  000 ELLY

  /8$$U+"'Yr   c           	        ^ [        U4S jU R                  R                  5        5       5      n[        U5      S:X  a%  [	        SR                  TU R                  5      5      e[        [        U6 5      u  p4[        U5      S:  a>  SR                  [        [        U5      5      n[        ST SU R                   SU S	35      eUS   $ )
Nc              3   L   >#    U  H  u  pU" T5      (       d  M  X4v   M     g 7fr   r   ).0r<   r=   type_strs      r   	<genexpr>(PredicateMapping.find.<locals>.<genexpr>W   s(      
$8 	" Y$8s   $
$r   z"No matching entries for '{}' in {}r	   z, zMultiple matching entries for 'z' in z: z. This occurs when two registrations match the same type string. You may need to delete one of the registrations or modify its matching behavior to ensure it doesn't collide with other registrations. See the "Registry" documentation for more information.)tupler3   itemslenr   r:   r2   zipjoinmapr;   r   )r   rD   results
predicatesvaluespredicate_reprss    `    r   findPredicateMapping.findV   s     
$(LL$6$6$8
 
 w<1 4;;JJ  #3=1
w<!"iiD*(=>O&1(5B"# $66  ayr   c                      U R                   U	  U R                  U5      nU R                  U	 g ! [         a/    [        SR                  [        U5      U R                  5      5      ef = f! [         a     g f = f)NzMatcher {} not found in {})r3   KeyErrorr:   r;   r2   _label_for_predicater4   r9   )r   r<   r>   s      r   remove_by_equality#PredicateMapping.remove_by_equalityt   s    	Y'	0--i8E ((/  	,33OJJ 	  		s   / A+ 9A(+
A87A8c                     U R                   R                  5        H  u  p#X1L d  M  Us  $    [        SR                  [	        U5      U R
                  5      5      e)Nz-Matcher {} not referred to by any label in {})r4   rH   r9   r:   r;   r2   )r   r<   keyr=   s       r   rU   %PredicateMapping._label_for_predicate   sU     2288:JC!
 ; ;BBY


 	
r   c                      U R                   U   nU R                   U	 U R                  U	 g ! [         a%    [        SR                  XR                  5      5      ef = f)NzLabel '{}' not found in {})r4   rT   r:   r2   r3   )r   r>   r<   s      r   remove_by_label PredicateMapping.remove_by_label   sb    	S007I $$U+LL#	  	S7>>ujjQRR	Ss	   , /Ac                     [        U5      (       a  U R                  U5        g [        U[        5      (       a  U R	                  U5        g [        SR                  [        U5      5      5      e)Nz4Key to be removed must be callable or string: got {})callablerV   
isinstancestrr\   	TypeErrorr:   type)r   predicate_or_labels     r   removePredicateMapping.remove   s^    &''##$67*C00  !34FMM+, r   c                     [        U 5      " U R                  5      n[        R                  " U R                  5      Ul        [        R                  " U R                  5      Ul        U$ r   )rc   r2   r   r3   r4   r   cpys     r   r   PredicateMapping.copy   sD    4j$ii-"&))D,D,D"E
r   )r4   r2   r3   r   )r'   r(   r)   r*   __doc__r6   r?   rQ   rV   rU   r\   re   r   r-   r   r   r   r/   r/   3   s/    &
(.<0(
$
r   r/   c                   J    \ rS rSrSr\" 5       rS rS rS r	S r
S rS rS	rg
)	Predicate   zR
Represents a predicate function to be used for type matching in
``ABIRegistry``.
c                     [        S5      e)NzMust implement `__call__`NotImplementedError)r   r$   kwargss      r   __call__Predicate.__call__   s    !"=>>r   c                     [        S5      e)NzMust implement `__str__`rp   r   s    r   __str__Predicate.__str__   s    !"<==r   c                 L    SR                  [        U 5      R                  U 5      $ )Nz<{} {}>)r:   rc   r'   r   s    r   __repr__Predicate.__repr__   s    T
 3 3T::r   c              #   L   #    U R                    H  n[        X5      v   M     g 7fr   )	__slots__getattr)r   attrs     r   __iter__Predicate.__iter__   s     NND$%% #s   "$c                 *    [        [        U 5      5      $ r   )hashrG   r   s    r   __hash__Predicate.__hash__   s    E$K  r   c                 j    [        U 5      [        U5      L =(       a    [        U 5      [        U5      :H  $ r   )rc   rG   r   others     r   __eq__Predicate.__eq__   s'    DzT%[(HU4[E%L-HHr   r   N)r'   r(   r)   r*   rk   rG   r|   rs   rv   ry   r   r   r   r-   r   r   r   rm   rm      s/    
 I?>;&!Ir   rm   c                   .    \ rS rSrSrSrS rS rS rSr	g)Equals   z6
A predicate that matches any input equal to `value`.
r=   c                     Xl         g r   r   )r   r=   s     r   r6   Equals.__init__   s    
r   c                      U R                   U:H  $ r   r   r   s     r   rs   Equals.__call__   s    zzU""r   c                 J    SR                  [        U R                  5      5      $ )Nz(== {}))r:   r;   r=   r   s    r   rv   Equals.__str__   s    TZZ 011r   N
r'   r(   r)   r*   rk   r|   r6   rs   rv   r-   r   r   r   r   r      s     I#2r   r   c                   6    \ rS rSrSrSrSS.S jrS rS rSr	g)	
BaseEquals   aT  
A predicate that matches a basic type string with a base component equal to
`value` and no array component.  If `with_sub` is `True`, the type string
must have a sub component to match.  If `with_sub` is `False`, the type
string must *not* have a sub component to match.  If `with_sub` is None,
the type string's sub component is ignored.
basewith_subNr   c                    Xl         X l        g r   r   )r   r   r   s      r   r6   BaseEquals.__init__   s    	 r   c                     [         R                  " U5      n[	        U[         R
                  5      (       ar  UR                  b  gU R                  b>  U R                  (       a  UR                  c  gU R                  (       d  UR                  b  gUR                  U R                  :H  $ g! [        R                   a     gf = f)NF)
r   parser   
ParseErrorr`   	BasicTypearrlistr   subr   )r   rD   abi_types      r   rs   BaseEquals.__call__   s    	}}X.H h 1 122+}}(==X\\%9 }})A ==DII-- # $$ 		s   B* *C Cc                     SR                  [        U R                  5      U R                  c  S5      $ U R                  (       a  S5      $ S5      $ )Nz(base == {}{}) z and sub is not Nonez and sub is None)r:   r;   r   r   r   s    r   rv   BaseEquals.__str__  sV    &&O}}$ 
 	
 -1MM(	
 	
 @R	
 	
r   r   r   r   r   r   r      s      %I)- !,
r   r   c                      [         R                  " U 5      nUR                  SL$ ! [        R                   a     gf = f)zF
A predicate that matches a type string with an array dimension list.
FN)r   r   r   r   r   rD   r   s     r   has_arrlistr     sB    ==* 4''    s   & ==c                      [         R                  " U 5      n[	        U[         R
                  5      =(       a    UR                  SL $ ! [        R                   a     gf = f)zE
A predicate that matches a tuple type with no array dimension list.
FN)r   r   r   r   r`   	TupleTyper   r   s     r   is_base_tupler     sT    ==* h 1 12Ox7G7G47OO    s   A AAc                 F   ^  [         R                  " T 5      U 4S j5       nU$ )Nc                 P   > U R                   R                  5         T" U /UQ70 UD6$ r   )get_encodercache_clearr   r$   rr   
old_methods      r   
new_method(_clear_encoder_cache.<locals>.new_method(  *    $$&$0000r   	functoolswrapsr   r   s   ` r   _clear_encoder_cacher   '  &    __Z 1 !1 r   c                 F   ^  [         R                  " T 5      U 4S j5       nU$ )Nc                 P   > U R                   R                  5         T" U /UQ70 UD6$ r   )get_decoderr   r   s      r   r   (_clear_decoder_cache.<locals>.new_method1  r   r   r   r   s   ` r   _clear_decoder_cacher   0  r   r   c                   H    \ rS rSr\SS j5       r\S 5       r\S 5       rSrg)BaseRegistryi9  Nc                     [        U5      (       a  U R                  XU5        g [        U[        5      (       a  U R                  [	        U5      X!5        g [        SR                  [        U5      5      5      e)Nz:Lookup must be a callable or a value of type `str`: got {})r_   r?   r`   ra   r   rb   r:   r;   )mappinglookupr=   r>   s       r   	_registerBaseRegistry._register:  sb    FKKu-fc""KKv6HOOV
 	
r   c                     [        U5      (       a  U R                  U5        g [        U[        5      (       a  U R	                  U5        g [        SR                  [        U5      5      5      e)Nz@Lookup/label must be a callable or a value of type `str`: got {})r_   rV   r`   ra   r\   rb   r:   r;   )r   lookup_or_labels     r   _unregisterBaseRegistry._unregisterJ  s_    O$$&&7os++##O4NUU_%
 	
r   c                      U R                  U5      nU$ ! [         a/  nSUR                  S   ;   a  [        R                  " U5        e S nAff = f)NzNo matchingr   )rQ   r9   r$   r   r   )r   rD   r=   es       r   _get_registrationBaseRegistry._get_registrationZ  sO    	LL*E   	q	) h'	s    
A*A		Ar   r   )	r'   r(   r)   r*   staticmethodr   r   r   r-   r   r   r   r   r   9  s<    
 
 
 
  r   r   c                   t  ^  \ rS rSrS rU 4S jr\ SS\S\S\	SS4S	 jj5       r
\S
\SS4S j5       r\ SS\S\S\	SS4S jj5       r\S
\SS4S j5       r SS\S\S\S\	SS4
S jjrS\	SS4S jr\R&                  " SS9S 5       rS\R,                  S\4S jr\R&                  " SS9S 5       rS rSrU =r$ )ABIRegistryii  c                 D    [        S5      U l        [        S5      U l        g )Nzencoder registryzdecoder registry)r/   	_encoders	_decodersr   s    r   r6   ABIRegistry.__init__j  s    )*<=)*<=r   c                    > [         TU ]  X5      n[        U[        5      (       a&  [	        U[
        5      (       a  UR                  X 5      $ U$ r   )superr   r`   rc   
issubclassr   from_type_str)r   r   rD   coder	__class__s       r   r   ABIRegistry._get_registrationn  sA    )'<eT""z%'C'C&&x66r   Nr   encoderr>   returnc                 :    U R                  U R                  XUS9  g)z
Registers the given ``encoder`` under the given ``lookup``.  A unique
string label may be optionally provided that can be used to refer to
the registration by name.  For more information about arguments, refer
to :any:`register`.
r>   N)r   r   )r   r   r   r>   s       r   register_encoderABIRegistry.register_encoderv       	t~~veDr   r   c                 <    U R                  U R                  U5        g)a  
Unregisters an encoder in the registry with the given lookup or label.
If ``lookup_or_label`` is a string, the encoder with the label
``lookup_or_label`` will be unregistered.  If it is an function, the
encoder with the lookup function ``lookup_or_label`` will be
unregistered.
N)r   r   r   r   s     r   unregister_encoderABIRegistry.unregister_encoder       	9r   decoderc                 :    U R                  U R                  XUS9  g)z
Registers the given ``decoder`` under the given ``lookup``.  A unique
string label may be optionally provided that can be used to refer to
the registration by name.  For more information about arguments, refer
to :any:`register`.
r   N)r   r   )r   r   r   r>   s       r   register_decoderABIRegistry.register_decoder  r   r   c                 <    U R                  U R                  U5        g)a  
Unregisters a decoder in the registry with the given lookup or label.
If ``lookup_or_label`` is a string, the decoder with the label
``lookup_or_label`` will be unregistered.  If it is an function, the
decoder with the lookup function ``lookup_or_label`` will be
unregistered.
N)r   r   r   s     r   unregister_decoderABIRegistry.unregister_decoder  r   r   c                 D    U R                  XUS9  U R                  XUS9  g)a  
Registers the given ``encoder`` and ``decoder`` under the given
``lookup``.  A unique string label may be optionally provided that can
be used to refer to the registration by name.

:param lookup: A type string or type string matcher function
    (predicate).  When the registry is queried with a type string
    ``query`` to determine which encoder or decoder to use, ``query``
    will be checked against every registration in the registry.  If a
    registration was created with a type string for ``lookup``, it will
    be considered a match if ``lookup == query``.  If a registration
    was created with a matcher function for ``lookup``, it will be
    considered a match if ``lookup(query) is True``.  If more than one
    registration is found to be a match, then an exception is raised.

:param encoder: An encoder callable or class to use if ``lookup``
    matches a query.  If ``encoder`` is a callable, it must accept a
    python value and return a ``bytes`` value.  If ``encoder`` is a
    class, it must be a valid subclass of :any:`encoding.BaseEncoder`
    and must also implement the :any:`from_type_str` method on
    :any:`base.BaseCoder`.

:param decoder: A decoder callable or class to use if ``lookup``
    matches a query.  If ``decoder`` is a callable, it must accept a
    stream-like object of bytes and return a python value.  If
    ``decoder`` is a class, it must be a valid subclass of
    :any:`decoding.BaseDecoder` and must also implement the
    :any:`from_type_str` method on :any:`base.BaseCoder`.

:param label: An optional label that can be used to refer to this
    registration by name.  This label can be used to unregister an
    entry in the registry via the :any:`unregister` method and its
    variants.
r   N)r   r   )r   r   r   r   r>   s        r   registerABIRegistry.register  s+    J 	fU;fU;r   c                 H    U R                  U5        U R                  U5        g)z_
Unregisters the entries in the encoder and decoder registries which
have the label ``label``.
N)r   r   )r   r>   s     r   
unregisterABIRegistry.unregister  s     
 	&&r   )maxsizec                 :    U R                  U R                  U5      $ r   )r   r   r   rD   s     r   r   ABIRegistry.get_encoder      %%dnnh??r   rD   c                 T     U R                  U5        g! [        [        4 a     gf = f)z
Returns ``True`` if an encoder is found for the given type string
``type_str``.  Otherwise, returns ``False``.  Raises
:class:`~eth_abi.exceptions.MultipleEntriesFound` if multiple encoders
are found.
TF)r   r   r   r   s     r   has_encoderABIRegistry.has_encoder  s3    	X&  n- 		s    ''c                 :    U R                  U R                  U5      $ r   )r   r   r   s     r   r   ABIRegistry.get_decoder  r   r   c                     [        U 5      " 5       n[        R                  " U R                  5      Ul        [        R                  " U R                  5      Ul        U$ )a  
Copies a registry such that new registrations can be made or existing
registrations can be unregistered without affecting any instance from
which a copy was obtained.  This is useful if an existing registry
fulfills most of a user's needs but requires one or two modifications.
In that case, a copy of that registry can be obtained and the necessary
changes made without affecting the original registry.
)rc   r   r   r   rh   s     r   r   ABIRegistry.copy  s<     4jl		$..1		$..1
r   )r   r   r   )r'   r(   r)   r*   r6   r   r   LookupEncoderra   r   r   r   Decoderr   r   r   r   r   	lru_cacher   r   TypeStrboolr   r   r   r-   __classcell__)r   s   @r   r   r   i  sv   > =A	E	E'.	E7:	E		E 	E :& :T : : =A	E	E'.	E7:	E		E 	E :& :T : : PT&<&<'.&<9@&<IL&<	&<P' ' ' &@ '@CKK D  &@ '@ r   r   uintr   intaddressr
  ufixedfixedbytesTr   zbytes<M>Ffunctionstringr   r   )Nr+   r   r   typingr   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r	  r
  r  r  EncoderCallableContextFramesBytesIODecoderCallableBaseEncoderr  BaseDecoderr  ABCr   r/   rm   r   r   r   r   r   r   r   r   registryr   UnsignedIntegerEncoderUnsignedIntegerDecoderSignedIntegerEncoderSignedIntegerDecoderAddressEncoderAddressDecoderBooleanEncoderBooleanDecoderUnsignedFixedEncoderUnsignedFixedDecoderSignedFixedEncoderSignedFixedDecoderBytesEncoderBytesDecoderByteStringEncoderByteStringDecoderTextStringEncoderStringDecoderBaseArrayEncoderBaseArrayDecoderTupleEncoderTupleDecoderregistry_packedr   PackedUnsignedIntegerEncoderPackedSignedIntegerEncoderPackedAddressEncoderPackedBooleanEncoderPackedUnsignedFixedEncoderPackedSignedFixedEncoderPackedBytesEncoderPackedByteStringEncoderPackedTextStringEncoderPackedArrayEncoderr   r   r   <module>r=     sr   
      
s{{Hckk]D%899	:C5%<(H99:C?@
h&:&:!;;
<
h&:&:!;;
<	sww 	~x ~BI I82Y 2"+
 +
\	(	P- -`O(L Od =   v####
	   	  u!!!!
	   	  y
	   	  v
	   	  x!!!!
	   	  w
	   	  w&
	   	  w'
	   	  z
	   	  x
	   	  
	   	  
	   -     v))
 ! 
     u''
 ! 
     y!!
 ! 
     v!!
 ! 
     x''
 ! 
     w%%
 ! 
     w&
 ! 
     w'$$
 ! 
     z
 ! 
     x$$
 ! 
     
 ! 
     
 ! r   