File tree Expand file tree Collapse file tree 2 files changed +15
-20
lines changed
packages/toolboxes/tron/src Expand file tree Collapse file tree 2 files changed +15
-20
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @swapkit/toolbox-tron " : patch
3+ ---
4+
5+ Fixes TRC 20 transfers
Original file line number Diff line number Diff line change @@ -408,32 +408,22 @@ export const createTronToolbox = async (params: TRONToolboxParams = {}): Promise
408408 return txid ;
409409 }
410410
411- // TRC20 transfer
412- const contractAddress = assetValue . address ;
413- if ( ! contractAddress ) {
414- throw new SwapKitError ( "toolbox_tron_invalid_token_identifier" , {
415- identifier : assetValue . toString ( ) ,
416- } ) ;
417- }
418-
419- const feeLimit = getMaxTransactionFee ( ) ;
420- const contract = tronWeb . contract ( TRC20_ABI , contractAddress ) ;
421-
422- if ( ! contract . methods ?. transfer ) {
423- throw new SwapKitError ( "toolbox_tron_token_transfer_failed" ) ;
424- }
425-
426- const result = await contract . transfer ( recipient , assetValue . getBaseValue ( "string" ) ) . send ( {
411+ // TRC20 Token Transfer - always use createTransaction + sign pattern
412+ const transaction = await createTransaction ( {
413+ recipient,
414+ assetValue,
415+ memo,
427416 from : fromAddress ,
428- feeLimit,
429- callValue : 0 ,
430417 } ) ;
431418
432- if ( ! result ) {
419+ const signedTx = await signer . signTransaction ( transaction ) ;
420+ const { txid } = await tronWeb . trx . sendRawTransaction ( signedTx ) ;
421+
422+ if ( ! txid ) {
433423 throw new SwapKitError ( "toolbox_tron_token_transfer_failed" ) ;
434424 }
435425
436- return result ;
426+ return txid ;
437427 } ;
438428
439429 const estimateTransactionFee = async ( {
You can’t perform that action at this time.
0 commit comments