Beispiel #1
0
    def connect_blockchain(self, emitter, debug):
        # TODO: Move to common method shared with the rest of the CLI
        try:
            eth_node = None
            if self.geth:
                eth_node = get_geth_provider_process()

            # Note: For test compatibility.
            if not BlockchainInterfaceFactory.is_interface_initialized(
                    provider_uri=self.provider_uri):
                BlockchainInterfaceFactory.initialize_interface(
                    provider_uri=self.provider_uri,
                    provider_process=eth_node,
                    poa=self.poa,
                    light=self.light,
                    sync=False,
                    emitter=emitter)

            blockchain = BlockchainInterfaceFactory.get_interface(
                provider_uri=self.provider_uri)

            emitter.echo(message="Reading Latest Chaindata...")
            blockchain.connect()
            return blockchain
        except Exception as e:
            if debug:
                raise
            click.secho(str(e), bold=True, fg='red')
            raise click.Abort
Beispiel #2
0
    def __init__(self, dev: bool, network: str, provider_uri: str, geth: bool,
                 federated_only: bool, discovery_port: int, pay_with: str,
                 registry_filepath: str, middleware: RestMiddleware,
                 gas_strategy: str, signer_uri: str):

        if federated_only and geth:
            raise click.BadOptionUsage(
                option_name="--geth",
                message="--federated-only cannot be used with the --geth flag")

        # Managed Ethereum Client
        eth_node = NO_BLOCKCHAIN_CONNECTION
        if geth:
            eth_node = get_geth_provider_process()
            provider_uri = eth_node.provider_uri(scheme='file')

        self.dev = dev
        self.domains = {network} if network else None
        self.provider_uri = provider_uri
        self.signer_uri = signer_uri
        self.gas_strategy = gas_strategy
        self.geth = geth
        self.federated_only = federated_only
        self.eth_node = eth_node
        self.pay_with = pay_with
        self.discovery_port = discovery_port
        self.registry_filepath = registry_filepath
        self.middleware = middleware
Beispiel #3
0
    def __init__(self,
                 geth,
                 provider_uri,
                 worker_address,
                 federated_only,
                 rest_host,
                 rest_port,
                 db_filepath,
                 network,
                 registry_filepath,
                 dev,
                 poa,
                 light,
                 gas_strategy,
                 signer_uri,
                 availability_check,
                 lonely: bool
                 ):

        if federated_only:
            if geth:
                raise click.BadOptionUsage(option_name="--geth", message="--geth cannot be used in federated mode.")

            if registry_filepath:
                raise click.BadOptionUsage(option_name="--registry-filepath",
                                           message=f"--registry-filepath cannot be used in federated mode.")

        eth_node = NO_BLOCKCHAIN_CONNECTION
        if geth:
            eth_node = get_geth_provider_process()
            provider_uri = eth_node.provider_uri(scheme='file')

        self.eth_node = eth_node
        self.provider_uri = provider_uri
        self.signer_uri = signer_uri
        self.worker_address = worker_address
        self.federated_only = federated_only
        self.rest_host = rest_host
        self.rest_port = rest_port  # FIXME: not used in generate()
        self.db_filepath = db_filepath
        self.domain = network
        self.registry_filepath = registry_filepath
        self.dev = dev
        self.poa = poa
        self.light = light
        self.gas_strategy = gas_strategy
        self.availability_check = availability_check
        self.lonely = lonely
Beispiel #4
0
    def __init__(self, geth, dev, network, provider_uri, host, db_filepath,
                 checksum_address, registry_filepath, poa, port):

        eth_node = NO_BLOCKCHAIN_CONNECTION
        if geth:
            eth_node = get_geth_provider_process(dev)
            provider_uri = eth_node.provider_uri

        self.eth_node = eth_node
        self.provider_uri = provider_uri
        self.domains = {network} if network else None
        self.dev = dev
        self.host = host
        self.db_filepath = db_filepath
        self.checksum_address = checksum_address
        self.registry_filepath = registry_filepath
        self.poa = poa
        self.port = port