I want to transfer a Bep20 custom token from a wallet to another using web3.js in Binance Smart Chain. I can transfer BNB using this code:
// Create transaction
const myTransfer = async () => {
console.log(
`Attempting to make transaction from ${addressFrom} to ${addressTo}`
);
const createTransaction = await web3.eth.accounts.signTransaction(
{
from: addressFrom,
to: addressTo,
value: 'value',
gas: '30000',
},
privateKey
);
// Deploy transaction
const createReceipt = await web3.eth.sendSignedTransaction(
createTransaction.rawTransaction
);
console.log(
`Transaction successful with hash: ${createReceipt.transactionHash}`
);
};
How can I send a token from the same wallet?