-
Notifications
You must be signed in to change notification settings - Fork 197
fix: tron Tx parsing fixes #11531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix: tron Tx parsing fixes #11531
Conversation
Fixes incomplete transaction parsing for TRX → USDT swaps where only the USDT receive was shown but the TRX send was missing. The issue occurred when users swap through a router contract. The transaction flow is: 1. User initiates swap by calling router contract 2. Router sends user's TRX to swap pool (internal transaction) 3. Swap pool sends USDT back to user Previously, internal transactions were only detected if the caller or recipient matched the user's pubkey. This missed the TRX send because the router contract was the caller, not the user. The fix extracts the transaction initiator from raw_data.contract[0] and uses it to identify user-initiated internal transfers. When a contract sends TRX on behalf of the user, we now create a Send transfer with the user as the "from" address. Added diagnostic logging to track RPC responses and transfer parsing for debugging. Logs will be removed after testing confirms the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR modifies the TronChainAdapter to detect transaction initiators from contract parameters and passes this information to the internal transfer parser. The parsing logic shifts from binary (send/receive) to three-state logic (direct send, direct receive, user-initiated) to correctly attribute transfers within composite transactions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-12-17T14:50:01.629ZApplied to files:
📚 Learning: 2025-12-04T22:57:50.850ZApplied to files:
🧬 Code graph analysis (1)packages/chain-adapters/src/tron/TronChainAdapter.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Clean up console logs added during investigation. All logs removed: - RPC response logging in api.ts - TRC20 transfer parsing logs - Internal transfer parsing logs - Final combined transfer logs Core fix remains: detecting TRX sends in user-initiated swap transactions by correlating transaction initiator with internal transfers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Description
Fixes incomplete transaction parsing for TRX → USDT swaps where only the USDT receive was shown but the TRX send was missing (#11526).
The issue occurred when users swap through a router contract. The transaction flow is:
Previously, internal transactions were only detected if the caller or recipient matched the user's pubkey. This missed the TRX send because the router contract was the caller, not the user.
The fix extracts the transaction initiator from
raw_data.contract[0].parameter.value.owner_addressand uses it to identify user-initiated internal transfers. When a contract sends TRX on behalf of the user, we now create a Send transfer with the user as the "from" address.Note: Includes diagnostic logging for testing. Logs will be removed after verification.
Issue (if applicable)
closes #11526
Risk
Testing
Engineering
[TRON_*]prefixed diagnostic outputOperations
Screenshots (if applicable)
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.