Closed m0x61h0x64i closed 1 year ago
i cant even see the function to see how it works,
this console.log(contract.methods.calcFee.toString()) shows :
function () { [native code] }
see our documentation
@start940315 i got no results about calcFee function on the documentation, i want to calculate send USDT fee.
but when i want to send a transaction i can see its fee I have done this :
import TronWeb from 'tronweb'
const tronWeb = new TronWeb({
fullHost: 'https://api.trongrid.io',
privateKey: '981...........',
headers: { 'TRON-PRO-API-KEY': process.env.TRON_PRO_API_KEY }
})
const functionSelector = 'transfer(address,uint256)';
const parameter = [{type:'address',value:'TEngJ8cwfWbGMcHRNEDqwzY9QGzY3HGd91'},{type:'uint256',value:100}]
const tx = await tronWeb.transactionBuilder.triggerSmartContract('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', functionSelector, {}, parameter);
const signedTx = await tronWeb.trx.sign(tx.transaction);
console.log(signedTx)
it shows an object which it has a raw_data property and raw_data has a fee_limit with value of 150000000, what does this value means ? whats my transaction fee now?
fee_limit means the transaction must be finished under the fee_limit. You can know the fee consumed on tronscan.
Hi @start940315, thanks for your answer, i have checked https://tronscan.org/#/token20/TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t but i cant see USDT fee, i tried to find it but i couldnt.
can you tell me where it is ?
USDT transaction is a normal smart contract triggering. So you can use estimateEnergy function in transaction Builder
this returns 0 but the actual fee of USDT is not 0, how can i use calcFee method ? they are no documents and no auto completions and issue or reference about this, please help