javascript - web3.js calling transfer function return Invalid number of arguments to Solidity function -


i'm using web3.js use function on form submit, transfer(address _to, uint256 _value)

i'm able call contract function, erro: invalid number of arguments solidity function trying use transfer function, suppling both address , amount of token.

here part of code:

function sendtoken(to, amount){   var = to;  var amount = amount;        var settx = contract.transfer(to,amount);  return settx;     } 

calling (don't worry, contract correctly called in contract var

var formdata = getformobj("tokeform");  console.log(formdata.destinationtoke); console.log(formdata.amounttoke); var tx = sendtoken(destinationtoke, amounttoke); var tx = json.stringify(tx, null, "  ");  console.log(tx); 

this error. here contract function:

 function transfer(address _to, uint256 _value)     {       if (genesisaddress[_to]) throw;        if (balances[msg.sender] < _value) throw;        if (balances[_to] + _value < balances[_to]) throw;        if (genesisaddress[msg.sender])       {            minedblocks = block.number - initialblockcount;          if(minedblocks % 2 != 0){            minedblocks = minedblocks - 1;          }             if (minedblocks < 23652000)              {                    availableamount = rewardperblockperaddress*minedblocks;                    totalmaxavailableamount = initialsupplyperaddress - availableamount;                    availablebalance = balances[msg.sender] - totalmaxavailableamount;                    if (_value > availablebalance) throw;              }       }       balances[msg.sender] -= _value;       balances[_to] += _value;       transfer(msg.sender, _to, _value);     } 

any ideas why error? seems suppling right element. i'm not used web3.js @ all, , thought call function same fo withs others on current contract return correct data, balance of token , rate.

    console.log(formdata.destinationtoke); console.log(formdata.amounttoke); var tx = sendtoken(destinationtoke, amounttoke); 

to :

  console.log(formdata.destinationtoke); console.log(formdata.amounttoke); var tx = sendtoken(formdata.destinationtoke, formdata.amounttoke); 

magic, returning data


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -