1

Here is my code snippet to return the msg.sender:

function showSender() public view returns (address)  
{  
    return (msg.sender);  
}

But when I try to call this function using this:

Coin.deployed().then(function(instance) { return instance.showSender.call();});

Then there is an error showing:

Error: Invalid number of parameters for "showSender". Got 0 expected 2!
at Promise (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/execute.js:128:1)
at Object._createTxObject (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:699:1)
at Object.InvalidNumberOfParams (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-helpers/src/errors.js:32:1)

The function showSender does not have any parameter, then why is the error showing up. Someone please give a solution.

  • 1
    Change showSender to showSender(). – goodvibration May 24 at 6:13
  • 1
    Then I have to remove the .call() right?? - @goodvibration – Shailesh Mishra May 24 at 6:16
  • 1
    Yes............... – goodvibration May 24 at 6:22
  • 1
    It's still showing up the same error :( - @goodvibration – Shailesh Mishra May 24 at 6:23
  • 1
    You're probably using a different ABI or something (probably because you forgot to recompile). – goodvibration May 24 at 6:33

Your Answer

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

Browse other questions tagged or ask your own question.