I’m a bit confused on sending tokens from one address to another.
Say for example, I want to send AVAX native from one address to another,
I can successfully do it with sendTransaction which is just
await sendTransaction({
to,
value: parseEther(value),
})
I don’t need to pass in an erc20 token address, since it’s native.
Now, say I want to send USDT on Avalanche, that is an erc20. I can’t seem to just use sendTransaction
, instead I need to do:
await writeContractAsync({
abi: erc20Abi,
address: txDetails.tokenAddress,
functionName: 'transfer',
args: [txDetails.to, parsed],
});
Is that the correct approach? Or am I over complicating things?