-
Notifications
You must be signed in to change notification settings - Fork 198
feat: enable butter for TRON #11769
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
feat: enable butter for TRON #11769
Conversation
…nChainId) Add TRON chain ID mapping to ButterSwap helpers.ts for the Butter API. This maps the Butter API chain ID 728126428 to KnownChainIds.TronMainnet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… handling - Import tronChainId from @shapeshiftoss/caip - Add TRON_NATIVE_ADDRESS constant (T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb) - Handle TRON native token in sellAssetAddress resolution - Handle TRON native token in buyAssetAddress resolution This follows the same pattern as the existing Solana native address handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…TradeQuote Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ndle butterSwapTransactionMetadata Add butterSwapTransactionMetadata to the destructuring from the trade step and include butterSwapTransactionMetadata.to in the fallback chain for determining the transaction destination address. This enables the existing tron-utils to work with ButterSwap quotes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…TronTransaction to ButterSwap endpoints Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis pull request adds Tron blockchain support to ButterSwap swapper. Changes include importing and exporting Tron transaction utilities, extending chain validation logic to include Tron, adding Tron chain ID mappings, implementing Tron transaction status checking with contractRet-based logic, and extending destination address resolution for Tron transactions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
…as-a-swapper-but-we-didn-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/swapper/src/swappers/ButterSwap/swapperApi/checkTradeStatus.ts`:
- Around line 63-71: The current logic in checkTradeStatus (variables:
contractRet, tx.confirmations, TxStatus) leaves many confirmed TRON transactions
with non‑'SUCCESS' contractRet as Pending; change the branching so that if
tx.confirmations > 0 then any contractRet !== 'SUCCESS' is set to
TxStatus.Failed (only 'SUCCESS' => TxStatus.Confirmed), and keep the existing
behavior for unconfirmed TXs where contractRet === 'REVERT' maps to
TxStatus.Failed otherwise TxStatus.Pending; update the ternary/if logic
accordingly to use these checks.
premiumjibles
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and was able to get quotes across a variety of pairs I tired. Tested ETH on arb -> TRX https://jam.dev/c/64a0536a-e48b-49a4-bed9-1dfd12b5ea7f
Was unable to test TRX -> TRC tokens due to limited funds without doing a million dust transactions. Will leave that to release testing
…as-a-swapper-but-we-didn-
Description
This task activates TRON blockchain support for the existing Butter swapper integration, enabling users to swap tokens to and from the TRON chain using the ButterSwap protocol. Butter is already integrated as a swapper in the ShapeShift platform supporting EVM chains, Bitcoin, and Solana. This implementation extends that support to include TRON by adding the necessary chain ID mappings, native token address handling, chain validation updates, and TRON-specific transaction building/fee methods.
Issue (if applicable)
closes #11214
Risk
Low
Testing
Engineering
Operations
Screenshots (if applicable)
https://jam.dev/c/476682f3-bffa-4af2-8549-8474fd511422
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.