0

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:

enter image description here

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. :(

  • Did you get any solution ? – Sibiraj PR Jan 1 at 7:26
1

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" ));

  • Yup I did, the allowance method is working in the UI – btc4cash Oct 12 '18 at 6:13
  • What I fon't understand is metamask showing undefined token/amount allowed – btc4cash Oct 12 '18 at 6:14
  • Can you try doing "Add Custom Token" in metamask? – user2774555 Oct 12 '18 at 6:46
  • I tried but it weirdly disappeared when I closed and opened back metamask. I'll retry in the morning, it have sense theses data used when interacting with the token and showing data to metamask ui! – btc4cash Oct 12 '18 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.