EDIT
The allowance is set, the issue is just that metamask detect no token name nor amount that is allowed.
In my HTML/JS
amount = parseInt(web3.toWei(amount, "ether" ));
tokeninstance.approve(mainadd,amount,function(error, transactionHash){
if (!error){
$("#allowanceresult").html("TX hash: "+transactionHash+"<br>")
toastr.success("Approval successfull!")
}else{
$("#allowanceresult").html("Error: "+error+"<br>")
toastr.error("Approval failed!");
}
In Solidity interface
function approve(address guy, uint wad) public returns (bool);
Doing the approve function in remix manually work, I'm on ropsten, but using metamask + the HTML/JS dapp function up there, getting user input (show correctly in wei) and input predefined address (correct format), metamask show me this, still on ropsten:
Am I missing something? It's always like that I made my send() web3.js functions, I use the same web3.js file than I always do.
Checking on ropsten both side by side Event (from remix and metamask), it's clearly both same data inputed, same address and same wei ammount. 🙁
Best Answer
When calling a smart contract function from javascript, send the
uint
argument as a BigNumber. I guess you can try that?amount = new BigNumber(web3.toWei(amount, "ether" ));