I managed to get call() working.
I'm not using Metamask - just the ganache GUI accounts.
However now Im getting following error:
UnhandledPromiseRejectionWarning: Error: Returned error: VM Exception while processing transaction: revert ERC20: transfer amount exceeds allowance
See full code below:
==================================================================
const Web3 = require('web3');
const UpToken = require('../build/contracts/UpToken.json');
if (typeof web3 !== 'undefined') {
var web3 = new Web3(web3.currentProvider)
} else {
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'))
}
const init = async () => {
let accounts = await web3.eth.getAccounts();
web3.eth.defaultAccount = accounts[0];
const id = await web3.eth.net.getId();
const deployedNetwork = UpToken.networks[id];
const contrato = new web3.eth.Contract(
UpToken.abi,
deployedNetwork.address,
{from: '0x23c63608dDbB5EE00A0628196020CA353aE8351d', // default from address
gas: 6721975,
gasPrice: '20000000000'} // default gas price in wei, 20 gwei in this case
);
await contrato.methods.approve('0x05d62294C5809800644D28939ea0177B432187df', 101).call();
await contrato.methods.transferFrom('0x23c63608dDbB5EE00A0628196020CA353aE8351d', '0xe0788Ce42F19ae49A7817b865Ac8eed74D2D343A', 102).call();
}
init();
Jul 27, 2021, 1:10 PM
you are trying to approve the contract tokens or your tokens using the contract
Jul 27, 2021, 1:13 PM
Created an upgradeable token.
Onwer is account1
destination is account2
trying to transfer token from owner to destination
Onwer is account1
destination is account2
trying to transfer token from owner to destination
Jul 27, 2021, 1:15 PM
my question is different
you are trying to approve who?
Jul 27, 2021, 1:19 PM
Token address
Jul 27, 2021, 1:27 PM