1

I have tried this solution and it worked but only if I use privateKey of the wallet which I used to create custom tokens but what if I want to send from B wallet to C wallet and when I am trying it, the transaction is happening but it's failing.

Failed transaction

var contract = new ethers.Contract(contractAddress, abi, wallet);

var numberOfTokens = ethers.utils.parseUnits('10.0',numberOfDecimals);
var options = { gasLimit: 1500000, gasPrice: ethers.utils.parseUnits('1.0', 'gwei') };

contract.transferFrom(fromAddress, targetAddress,numberOfTokens,options).then(function (tx) { console.log(tx); });

thanks

| improve this question | | | | |
  • Has the token owner added an approve for the tokens? They can't be transferred without his consent. – Lauri Peltonen Mar 20 '19 at 13:08
  • i am the owner but how to approve the transfer? – iamsujit Mar 20 '19 at 17:17

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.