fix: use TronGrid API to build approve tx with raw_data_hex - #65
fix: use TronGrid API to build approve tx with raw_data_hex#65Tristenyang wants to merge 2 commits into
Conversation
|
Thanks for the contribution. I checked this against the issue and it does address the immediate The main reason is that this PR changes the approval success semantics: it treats We’ve opened #66, which fixes the signer payload compatibility issue without changing the existing transaction lifecycle semantics. Appreciate you identifying the right failure point. |
|
Thanks for the contribution. We’re going to close this PR because the same That fix keeps the existing tronpy transaction-building path, adds the missing unsigned payload fields for agent-wallet signing, and includes test coverage for the approval payload. So we won’t merge this older TronGrid-based implementation as-is. Thanks again for reporting and working through the issue. |
Description
TronClientSigner.ensure_allowance()fails when approving token allowance on TRON networks.The root cause is that tronpy's
build()+to_json()produces a transaction dict withoutraw_data_hex, butagent-wallet'sTronSigner.sign_transaction()requires it:InsufficientAllowanceError: Approval transaction failed: Tron sign_transaction failed:
Payload must be an unsigned transaction with {raw_data_hex}.
This PR switches from tronpy local transaction building to the TronGrid HTTP API (
wallet/triggersmartcontract),which returns the full transaction object including
raw_data_hex. Also usesbase58-decoded 41-prefixed hexaddresses for TronGrid API compatibility, and strips the
41prefix for ABI-encoded parameters.Closes #64
Tests
ruff checkandruff format --checkpass with no issuestest_evm_address_converter_normalizes_to_checksum) is pre-existing onmainand unrelated to this changebankofai-x402==0.5.8andbankofai-agent-wallet==2.4.0: token approveChecklist