fix: use TronGrid API to build approve tx with raw_data_hex#65
Open
Tristenyang wants to merge 2 commits intoBofAI:mainfrom
Open
fix: use TronGrid API to build approve tx with raw_data_hex#65Tristenyang wants to merge 2 commits intoBofAI:mainfrom
Tristenyang wants to merge 2 commits intoBofAI:mainfrom
Conversation
Collaborator
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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