I have contract method transferFrom
that failed when I calling it the site's from backend, but in the same time it works from Remix.
Both calls are performed through Metamask. Initially I thought that it could be related to gas amount but when I called method from Remix and specified gas amount that was used for failed transaction - it works, so I have no idea what is the problem.
Here is failed transaction that called using this code:
Eth.contract._approve(toAddress, fromAddress, amount)
.then(async result => {
const tx = await Eth.contract.transferFrom.sendTransaction(fromAddress, toAddress, amount);
return res.json({success: true, data: {from: fromAddress, to: toAddress, amount: amount, tx: tx}});
})
.catch(error => {
return res.boom.badImplementation('Unable to approve transfer ' + amount + ' tokens to the address ' + fromAddress, {success: false});
});
_approve
is special function in the contract that accessible only for contract owner and has 3 parameters insteand of 2 required by ERC20 interface.
And here is working transaction that is called from Remix with the same contract loaded.