I'm trying to write a simple function retrieving the contract address with a simple call. Anyway while the address value is correct in the function scope, the return value calling the function in that way is giving me an undefined error.
//Here the call
console.log("Indirizo con chiamata",App.getContractAddress());
//Here the function code
getContractAddress: function() {
RevenueShare.setProvider(web3.currentProvider);
myContractInstance=RevenueShare.deployed();
myContractInstance.then(function(instance){
return instance.address;
}).then(function(address){
console.log("Indirizzo in funzione:",address);
return address;
});
},
Any Help???
RevenueShare.deployed()
call. ifinstance.address
is undefined then there is a problem in the contract deployment. try to loginstance.address
and see what it gives. – Kaki Master Of Time Apr 5 '18 at 15:03