I am trying to deploy a contract from another factory contract and then return the address of the newly created contract. The address it returns however is the transaction hash
We ran across this problem today, and we're solving it as follows:
In the creation of the new contract raise an event.
Then once the block has been mined use the transaction hash and call web3.eth.getTransaction
:
http://web3js.readthedocs.io/en/1.0/web3-eth.html#gettransaction
Then look at the logs
object and you should find the event called by your newly created contract with its address.
Note: this assumes you're able to update the Solidity code for the contract being created, or that it already calls such an event upon creation.