
    afE                         d dl mZ ddlmZmZmZmZmZmZm	Z	m
Z
 dededededed	ed
edee         defdZdedededededed	ed
edee         defdZdededededed	ed
edee         dedefdZdS )    )Optional   )signrecover
is_address
is_bytes16is_block_numberis_chain_idis_eth_privkeyis_signaturechainIdverifyingContractmember	published	catalogIdapiIdschemametareturnc                    t          |           sJ t          |          sJ t          |          sJ t          |          sJ t          |          sJ t          |          sJ t	          |          t
          k    sJ t	          |          t
          k    sJ ddddddgddddddd	ddd
ddddddddddddddgddddd| |||||||pddd}|S )z

    :param chainId:
    :param verifyingContract:
    :param member:
    :param published:
    :param catalogId:
    :param apiId:
    :param schema:
    :param meta:
    :return:
    namestring)r   typeversionr   uint256r   addressr   r   r   bytes16r   r   r   )EIP712DomainEIP712ApiPublishr   XBR1)r   r    )r   r   r   r   r   r   r   r   )typesprimaryTypedomainmessage)r
   r   r	   r   r   str)	r   r   r   r   r   r   r   r   datas	            R/var/www/html/env/lib/python3.11/site-packages/autobahn/xbr/_eip712_api_publish.py_create_eip712_api_publishr*       s    w'(((((f9%%%%%i     e<<3:: #$ 
 &$ 	 &% 
 0% 
 %% 
 (% 
 (% 
 $% 
 %$ 
 #$ ;!!-
 -
\ *
 

 !2""JB	
 	
i> >D@ K    eth_privkeyc	           
      p    t          |           sJ t          ||||||||          }	t          | |	          S )z

    :param eth_privkey: Ethereum address of buyer (a raw 20 bytes Ethereum address).
    :type eth_privkey: bytes

    :return: The signature according to EIP712 (32+32+1 raw bytes).
    :rtype: bytes
    )r   r*   r   )
r,   r   r   r   r   r   r   r   r   r(   s
             r)   sign_eip712_api_publishr.   z   sL     +&&&&&%g/@&)U^`egm&*, ,DT"""r+   	signaturec	           
      p    t          |          sJ t          | |||||||          }	t          |	|          S )z
    Recover the signer address the given EIP712 signature was signed with.

    :return: The (computed) signer address the signature was signed with.
    :rtype: bytes
    )r   r*   r   )
r   r   r   r   r   r   r   r   r/   r(   s
             r)   recover_eip712_api_publishr1      sL     	"""""%g/@&)U^`egm&*, ,D4###r+   N)typingr   _eip712_baser   r   r   r   r	   r
   r   r   intbytesr'   dictr*   r.   r1    r+   r)   <module>r8      s  6      . . . . . . . . . . . . . . . . . . . .W W Wu Wad W*/W8=WGJWRZ[^R_WdhW W W Wt# # #QV #`e #'*#7<#EJ#TW#_ghk_l#qv# # # #"$ $ $u $ad $*/$8=$GJ$RZ[^R_$*/$49$ $ $ $ $ $r+   