From 27d07be8e7145024466e67bd28af5f8e9c9f9f22 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Sun, 30 Sep 2018 17:17:34 -0700 Subject: [PATCH] expand parameters of Blockchain.connect to include deployment and compilation options. --- nucypher/blockchain/eth/chains.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nucypher/blockchain/eth/chains.py b/nucypher/blockchain/eth/chains.py index 31d8ae86e..38c9aef70 100644 --- a/nucypher/blockchain/eth/chains.py +++ b/nucypher/blockchain/eth/chains.py @@ -6,6 +6,7 @@ from web3.contract import Contract from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainDeployerInterface from nucypher.blockchain.eth.registry import EthereumContractRegistry +from nucypher.blockchain.eth.sol.compile import SolidityCompiler class Blockchain: @@ -44,11 +45,17 @@ class Blockchain: @classmethod def connect(cls, provider_uri: str = None, - registry_filepath: str = None) -> 'Blockchain': + registry_filepath: str = None, + deployer: bool = False, + compile: bool = False, + ) -> 'Blockchain': if cls._instance is NO_BLOCKCHAIN_AVAILABLE: registry = EthereumContractRegistry(registry_filepath=registry_filepath) - cls._instance = cls(interface=BlockchainInterface(provider_uri=provider_uri, registry=registry)) + compiler = SolidityCompiler() if compile is True else None + InterfaceClass = BlockchainDeployerInterface if deployer is True else BlockchainInterface + interface = InterfaceClass(provider_uri=provider_uri, registry=registry, compiler=compiler) + cls._instance = cls(interface=interface) else: if provider_uri is not None: existing_uri = cls._instance.interface.provider_uri