Exemplo n.º 1
0
    def __init__(self,
                 node="",
                 rpcuser="",
                 rpcpassword="",
                 debug=False,
                 skip_wallet_init=False,
                 **kwargs):

        self.define_classes()
        assert self.rpc_class
        assert self.wallet_class
        assert self.default_key_store_app_name
        assert self.transactionbuilder_class
        assert self.proposalbuilder_class
        assert self.account_class
        assert self.blockchainobject_class

        # More specific set of APIs to register to
        if "apis" not in kwargs:
            kwargs["apis"] = ["database", "network_broadcast"]

        self.rpc = None
        self.debug = debug

        self.offline = bool(kwargs.get("offline", False))
        self.nobroadcast = bool(kwargs.get("nobroadcast", False))
        self.unsigned = bool(kwargs.get("unsigned", False))
        self.expiration = int(kwargs.get("expiration", 30))
        self.bundle = bool(kwargs.get("bundle", False))
        self.blocking = bool(kwargs.get("blocking", False))

        # Legacy Proposal attributes
        self.proposer = kwargs.get("proposer", None)
        self.proposal_expiration = int(
            kwargs.get("proposal_expiration", 60 * 60 * 24))
        self.proposal_review = int(kwargs.get("proposal_review", 0))

        # Store self.config for access through other Classes
        kwargs["appname"] = self.default_key_store_app_name
        self.config = kwargs.get("config_store",
                                 SqliteConfigurationStore(**kwargs))

        # Connect
        if not self.offline:
            self.connect(node=node,
                         rpcuser=rpcuser,
                         rpcpassword=rpcpassword,
                         **kwargs)

        # txbuffers/propbuffer are initialized and cleared
        self.clear()

        if not skip_wallet_init:
            self.wallet = kwargs.get(
                "wallet", self.wallet_class(blockchain_instance=self,
                                            **kwargs))
Exemplo n.º 2
0
    def __init__(self, path, create=True, **kwargs):
        log.info("Initializing storage %s create: %s" %(path, str(create)))
        #super(BitsharesStorageExtra, self).__init__(path=path, create=create, **kwargs)

        # Bitshares
        self.configStorage = SqliteConfigurationStore(path=path, create=create)
        self.keyStorage = SqliteEncryptedKeyStore(config=self.configStorage, path=path, create=create)
        self.blindStorage = SqliteBlindHistoryStore(path=path, create=create)

        # Extra storages
        self.accountStorage = Accounts(path=path, create=create)
        self.blindAccountStorage = BlindAccounts(path=path, create=create)
        #self.labelStorage = Label(path, create=create)
        self.assetStorage = Assets(path=path, create=create)
        self.historyStorage = History(path=path, create=create)
        self.remotesStorage = Remotes(path=path, create=create)
        self.gatewayStorage = ExternalHistory(path=path, create=create)

        # Set latest db version
        #self.configStorage["db_version"] = "3"
        from bitsharesextra.chatstorage import ChatRooms
        self.chatroomStorage = ChatRooms(path=path, create=create)
Exemplo n.º 3
0
def get_default_config_store(*args, **kwargs):
    if "appname" not in kwargs:
        kwargs["appname"] = "peerplays"
    return SqliteConfigurationStore(*args, **kwargs)
Exemplo n.º 4
0
from graphenestorage import (
    InRamConfigurationStore,
    InRamEncryptedKeyStore,
    InRamPlainKeyStore,
    SqliteConfigurationStore,
    SqliteEncryptedKeyStore,
    SQLiteFile,
    SqlitePlainKeyStore,
)

url = "wss://node.bitshares.eu"
InRamConfigurationStore.setdefault("node", url)
SqliteConfigurationStore.setdefault("node", url)


def get_default_config_store(*args, **kwargs):
    if "appname" not in kwargs:
        kwargs["appname"] = "bitshares"
    return SqliteConfigurationStore(*args, **kwargs)


def get_default_key_store(config, *args, **kwargs):
    if "appname" not in kwargs:
        kwargs["appname"] = "bitshares"
    return SqliteEncryptedKeyStore(config=config, **kwargs)
Exemplo n.º 5
0
# -*- coding: utf-8 -*-
from graphenestorage import (
    InRamConfigurationStore,
    InRamEncryptedKeyStore,
    InRamPlainKeyStore,
    SqliteConfigurationStore,
    SqliteEncryptedKeyStore,
    SQLiteFile,
    SqlitePlainKeyStore,
)

url = "wss://node.bitshares.eu"
SqliteConfigurationStore.setdefault("node", url)
SqliteConfigurationStore.setdefault("order-expiration", 356 * 24 * 60 * 60)


def get_default_config_store(*args, **kwargs):
    if "appname" not in kwargs:
        kwargs["appname"] = "bitshares"
    return SqliteConfigurationStore(*args, **kwargs)


def get_default_key_store(config, *args, **kwargs):
    if "appname" not in kwargs:
        kwargs["appname"] = "bitshares"
    return SqliteEncryptedKeyStore(config=config, **kwargs)