Exemplo n.º 1
0
    def from_configuration_file(cls, config: NodeConfiguration) -> 'BlockchainInterface':
        # Parse
        payload = parse_blockchain_config(filepath=config.config_file_location)

        # Init deps
        compiler = SolidityCompiler() if payload['compile'] else None
        registry = EthereumContractRegistry.from_config(config=config)
        interface_class = BlockchainInterface if not payload['deploy'] else BlockchainDeployerInterface

        # init class
        interface = interface_class(timeout=payload['timeout'],
                                    provider_uri=payload['provider_uri'],
                                    compiler=compiler,
                                    registry=registry)

        return interface
Exemplo n.º 2
0
    def from_config(cls, filepath=None) -> 'BlockchainInterface':
        # Parse
        filepath = filepath if filepath is None else DEFAULT_INI_FILEPATH
        payload = parse_blockchain_config(filepath=filepath)

        # Init deps
        compiler = SolidityCompiler() if payload['compile'] else None
        registry = EthereumContractRegistry.from_config(filepath=filepath)
        interface_class = BlockchainInterface if not payload['deploy'] else BlockchainDeployerInterface

        # init class
        circumflex = interface_class(timeout=payload['timeout'],
                                     provider_uri=payload['provider_uri'],
                                     compiler=compiler,
                                     registry=registry)

        return circumflex