예제 #1
0
    def __init__(self, *args, **kwargs):
        import bitshares
        kwargs.pop('offline', None)  # overwrite

        self.ping_callback = kwargs.pop("ping_callback", None)

        self.conn_node = kwargs.pop('node', "")
        self.conn_rpcuser = kwargs.pop('rpcuser', "")
        self.conn_rpcpassword = kwargs.pop('rpcpassword', "")

        #self.bts = lambda: 0 #bitshares.BitShares(*args, offline=True, **kwargs)
        self.bts = bitshares.BitShares(*args,
                                       offline=True,
                                       wallet=None,
                                       store=None,
                                       **kwargs)
        self.bts.rpc = None
        self.store = None
        self.offline = True

        self.subscribed_accounts = set()
        self.subscribed_markets = set()

        self.minicache_accnames = {}  # 1.2.ID to name
        self.fave_coinnames = set()  # semi-random
        self.fave_markets = set()  # same
def _get_configured_instance():
    network = Config.get("network_type")
    connection = Config.get("bitshares", "connection", network)
    if connection.get("num_retries", None) is None:
        connection["num_retries"] = -1
    logging.getLogger(__name__).debug(
        "BitShares connection is initialized with with given config ... \n")
    return bitshares.BitShares(**connection)
예제 #3
0
def shared_bitshares_instance():
    """ This method will initialize ``SharedInstance.instance`` and return it.
        The purpose of this method is to have offer single default
        bitshares instance that can be reused by multiple classes.
    """
    if not SharedInstance.instance:
        clear_cache()
        SharedInstance.instance = bts.BitShares(**SharedInstance.config)
    return SharedInstance.instance
예제 #4
0
def shared_bitshares_instance():
    """ This method will initialize ``_shared_bitshares_instance`` and return it.
        The purpose of this method is to have offer single default
        bitshares instance that can be reused by multiple classes.
    """
    global _shared_bitshares_instance
    if not _shared_bitshares_instance:
        _shared_bitshares_instance = bts.BitShares()
    return _shared_bitshares_instance