On my account in Shasta I have 5k TRX and the same amount of USDT. I'm trying to send USDT. So far it's failed with a result Failed -Out of Energy
. For instance:
async function transferTronTRC20Token(amount, privateKey, contractAddress) {
let url = TRON_API_URL;
const tronWeb = new TronWeb({
fullHost: url,
headers: {},
privateKey: privateKey,
});
const options = {
feeLimit: 10_000_000,
callValue: 0
};
const tx = await tronWeb.transactionBuilder.triggerSmartContract(
contractAddress,
'transfer(address,uint256)',
options,
[{
type: 'address',
value: toWallet
}, {
type: 'uint256',
value: amount * 1_000_000
}]
);
if (!tx.result || !tx.result.result) {
return console.error(`triggerSmartContract: ${tx}`);
}
const signedTx = await tronWeb.trx.sign(tx.transaction);
if (!signedTx.signature) {
return console.error(`trx.sign: ${signedTx}`);
}
return await tronWeb.trx.sendRawTransaction(signedTx);
}
===>
The USDT contract I use is:
TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs
How can it be?