tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
423 stars 271 forks source link

TriggerSmartContract - TRANSACTION REVERT #403

Closed dinno-invis1ble closed 1 year ago

dinno-invis1ble commented 1 year ago

I've developed a smart contract that facilitates sending TRX to multiple addresses in a single transaction. The function responsible for this is named distribute(address payable[] memory recipients, uint256[] memory amounts).

When utilizing tronWeb.contract().at().methods.distribute().send(), the transaction executes successfully without any issues. You can find transaction details here: Transaction Link.

However, when employing tronWeb.transactionBuilder.triggerSmartContract(contractAddress, "distribute(address[], uint256[])", options, arguments), the transaction fails with a TRANSACTION REVERT message. Additionally, there is no information about the method calling, and it seems like the function was never called. You can view the details of this failed transaction here: Transaction Link.

I suspect the reason for this failure is the improper handling of function arguments in the triggerSmartContract method. As a result, I am unable to use triggerSmartContract to sign the transaction offline, which is my desired approach.

Any insights or suggestions on how to resolve this issue would be greatly appreciated.

Thank you in advance for your help!

start940315 commented 1 year ago

Function selector should contain no white spaces. You have passed a function selector containing a white space so the method id is different from the right one.

dinno-invis1ble commented 1 year ago

Amazing! Thank you 😄