When I try to use this call this method in remix browser it gets mined.
//addAsset function adds an asset along with an owner
function addAsset(address newOwner,bytes32 description, uint cost) returns(string) {
if (msg.sender == issuer) {
assetCount++;
Asset memory tempAsset = Asset(assetCount,newOwner,description,cost);
setAssetOwnership(newOwner,assetCount,tempAsset);
return "asset created";
} else {
return "you are not the owner of contract";
}
}
But when I call the same method in the browser via web3 object, I get this.
<script>
if (typeof web3 !== 'undefined') {
var web3 = new Web3(web3.currentProvider);
}
else
{
// set the provider you want from Web3.providers
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
console.log(web3);
web3.eth.defaultAccount = web3.eth.accounts[0];
var vishContract = web3.eth.contract(CONTRACT-OPCODE);
//trying to increase the gas limit here, not sure if its correct
// var contract = vishContract.at('CONTRACT ADDRESS', {gasLimit: "10000000"});
var contract = vishContract.at('CONTRACT ADDRESS');
function getIssuerId(){
document.getElementById("issuerId").innerText = contract.issuer();
}
</script>
I saw similar questions posted, most of them were resolved by changing string to bytes32 or it was mentioned that their contract is huge, mine isn't.
I am still fairly new with smart contracts. Can anyone please help me out here?
Thanks in advance :)