I was doing a USDC transaction on the Ropsten network but in the Metamask documentation I didn't see any place where transactions with tokens were directly touched, I was trying some things I found without success. An example of what I found I took from How to send some custom tokens with MetaMask API?
ethereum.request({
method: "eth_sendTransaction",
params: [
{
from: ethereum.selectedAddress,
to: "0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
data: tokenContract.methods
.transfer("My Wallet", "0.0001")
.encodeABI(),
}
]
});
The problem here is that tokenContract is not defined and I have no idea how to define it
I also found VERY old and really obsolete answers, where mostly web3js is used (And MetaMask doesn't allow to work with web3js anymore as far as I understand, I've already tried it).