I'm deploying a contract with web3js successfully, but the fallback function does not get called a second time after finishing the deployment.
I read that this was an on-going issue (people not implementing it properly?), but I couldn't solve it even with dirty fixes like waiting for quiet some time and then try to access the contract.address.
Successfully deployed contract: https://ropsten.etherscan.io/tx/0xee03d8da3546e9c8aef1bc1704d20708f34b33f54c2ccfeccb870f5baeb242e6
var deployedContract = contract.new(constructor_param,params,function(error,result){
if(error){
console.log("error contract.new: " + error);
} else {
console.log("fallback no error");
if(result.address){
// gets set in the second call
console.log("contract address: " + result.address);
console.log(createEtherscanIoUrl('address',result.address));
} else {
// gets set in the first call
console.log("contract transaction hash: " + result.transactionHash);
console.log(createEtherscanIoUrl('tx',result.transactionHash));
}
}
});
function createEtherscanIoUrl(type,hashOrNumber){
var etherscanBaseUrl='https://ropsten.etherscan.io/';
var url = etherscanBaseUrl;
if(type === 'tx'){
url += 'tx/'+hashOrNumber;
} else if(type === 'block'){
url += 'block/'+hashOrNumber;
} else if(type === 'address'){
url += 'address/'+hashOrNumber;
}
return url;
}
How can I solve this issue, as I'm not able to continue working with the freshly deployed contract when I'm not receiving the address after deployment.
As I'm quiet new to this topic which causes me being limited in thinking about how to solve this issue. Any hint/help appreciated.