From e7adf15e427a9c63286ad80e265675925c8f8285 Mon Sep 17 00:00:00 2001 From: Mike Shultz Date: Mon, 28 Jan 2019 21:52:38 -0700 Subject: [PATCH] Show tx hash before waiting on it to be mined. Issue #55 --- solidbyte/deploy/objects.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/solidbyte/deploy/objects.py b/solidbyte/deploy/objects.py index f29a500..b36d098 100644 --- a/solidbyte/deploy/objects.py +++ b/solidbyte/deploy/objects.py @@ -509,7 +509,7 @@ def _transact(self, tx: MultiDict) -> str: log.debug("Deployment transaction hash for {}: {}".format(self.name, deploy_txhash.hex())) - return deploy_txhash + return deploy_txhash.hex() def _assemble_and_hash_bytecode(self, bytecode: str, links: Optional[dict] = None) -> Tuple[str, str]: @@ -577,9 +577,13 @@ def _deploy(self, *args, **kwargs) -> Web3Contract: log.debug("Creating deploy transaction...") deploy_tx = self._create_deploy_transaction(bytecode, gas, gas_price, *args, **kwargs) - log.info("Sending deploy transaction for {}. This may take a moment...".format(self.name)) deploy_txhash = self._transact(deploy_tx) + log.info("Sending deploy transaction {} for contract {}. This may take a moment...".format( + deploy_txhash, + self.name, + )) + # Wait for it to be mined deploy_receipt = self.web3.eth.waitForTransactionReceipt(deploy_txhash) @@ -600,7 +604,7 @@ def _deploy(self, *args, **kwargs) -> Web3Contract: ) ) - log.info("Successfully deployed {}. {}".format(self.name, deploy_txhash.hex())) + log.info("Successfully deployed {}. Transaction has been mined.".format(self.name)) self.deployments.append(Deployment( bytecode_hash=bytecode_hash,