o
    >h]                     @   s   z
d dl mZ dZW n   dZY erod dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
mZmZ dd ZG d	d
 d
ejZG dd dejZG dd dejZG dd dejZe
e e	e ee ee dS dS )    )xbrTFN)hl)	IProviderISeller	IConsumerIBuyerc                  O   s   t  jd g| R i |S N)asyncioget_running_looprun_in_executor)argskwargs r   }/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/autobahn/asyncio/xbr/__init__.pyr   )   s   r   c                   @   s   e Zd ZeZdS )SimpleBlockchainN)__name__
__module____qualname__r   backgroundCallerr   r   r   r   r   ,   s    r   c                       s6   e Zd Ze Zd fdd	Zdd Zdd Z  Z	S )		KeySeriesNc                    s   t  |||| d| _d S )NF)super__init__running)selfapi_idpriceinterval	on_rotate	__class__r   r   r   2   s   
zKeySeries.__init__c                    sT    j rJ  jjdt jttj jdd d _  fdd}t	|  dS )z\
            Start offering and selling data encryption keys in the background.
            zGStarting key rotation every {interval} seconds for api_id="{api_id}" ..)bytes)r   r   Tc                      s6    j r  I d H  t jI d H   j sd S d S r   )r   _rotater	   sleep	_intervalr   r   r   r   rotate_with_interval@   s
   z-KeySeries.start.<locals>.rotate_with_intervalN)
r   loginfor   r#   uuidUUID_api_idr	   create_task)r   r%   r   r$   r   start6   s   
zKeySeries.startc                 C   s"   | j std| jjd| _ dS )zE
            Stop offering/selling data encryption keys.
            z&cannot stop {} - not currently runningFN)r   RuntimeErrorformatr   r   r$   r   r   r   stopG   s   
zKeySeries.stopr   )
r   r   r   txaiomake_loggerr&   r   r,   r/   __classcell__r   r   r   r   r   /   s
    r   c                   @   s   e Zd ZdZeej_dS )SimpleSellerz
        Simple XBR seller component. This component can be used by a XBR seller delegate to
        handle the automated selling of data encryption keys to the XBR market maker.
        N)r   r   r   __doc__r   r   r3   r   r   r   r   r3   P   s    r3   c                   @   s   e Zd ZdS )SimpleBuyerN)r   r   r   r   r   r   r   r5   W   s    r5   )autobahnr   HAS_XBRr(   r	   r0   autobahn.utilr   autobahn.xbr._interfacesr   r   r   r   r   r   r   r3   r5   registerr   r   r   r   <module>   s*   !


