Skip to content

feat: add Tron support (TRX + USDT on Tron)#117

Merged
kaladinlight merged 2 commits into
shapeshift:developfrom
CumpsD:chainflip_trx
Jun 22, 2026
Merged

feat: add Tron support (TRX + USDT on Tron)#117
kaladinlight merged 2 commits into
shapeshift:developfrom
CumpsD:chainflip_trx

Conversation

@CumpsD

@CumpsD CumpsD commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Chainflip recently added native TRX (trx.tron) and USDT on Tron (usdt.tron). This wires both as swappable assets.

This app is a swap-only frontend over Chainflip — the user pastes a destination address; no key derivation/signing for the receiving chain. So adding Tron only requires declaring the assets, mapping to Chainflip IDs, validating pasted addresses, and wiring market data.

Changes

  • constants/caip.tstronChainId, trxAssetId, usdtOnTronAssetId constants (+ namespace/reference map entries, trxAssetId in FEE_ASSET_IDS)
  • constants/assets.ts — TRX + USDT-on-Tron entries in initialAssets (precision 6, tronscan explorer, Trust Wallet icons; USDT-Tron links to canonical USDT via relatedAssetKey for the network badge)
  • queries/chainflip/assets.ts — map asset IDs to trx.tron / usdt.tron
  • lib/validation.ts — Tron address validation via multicoin-address-validator (TRX)
  • queries/marketData/index.ts — coingecko ids tron / tether

Asset modal, quote, and swap flows are chain-agnostic and pick up the new assets automatically.

CAIP identifiers

Asset assetId
TRX tron:0x2b6653dc/slip44:195
USDT (Tron) tron:0x2b6653dc/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Testing

  • yarn type-check, yarn lint, yarn test (9/9) all pass
  • Manual in-app verification (live quote, address validation, icons) still recommended before merge

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Tron asset support for TRX and USDT (TRC-20) across asset pricing and trading flows.
    • Enabled Tron-aware address validation for safer transaction handling.
  • Tests
    • Added Vitest coverage for Tron address validation and Tron asset mapping conversions.
  • Chores
    • Simplified the Vitest test pool/worker configuration.

Chainflip added trx.tron (native TRX) and usdt.tron (USDT on Tron).
Wire both as swappable assets:

- caip: tronChainId, trxAssetId, usdtOnTronAssetId constants
- assets: TRX + USDT-Tron entries (precision 6, tronscan explorer)
- chainflip: map assetIds to trx.tron / usdt.tron
- validation: Tron address validation via multicoin-address-validator
- marketData: coingecko ids tron / tether

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@CumpsD is attempting to deploy a commit to the ShapeShift Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ad1ee27-9215-4f23-af5c-57ec1c18593f

📥 Commits

Reviewing files that changed from the base of the PR and between 943d435 and dbd0821.

📒 Files selected for processing (5)
  • src/constants/caip.ts
  • src/lib/validation.test.ts
  • src/lib/validation.ts
  • src/queries/chainflip/assets.test.ts
  • vitest.config.ts
💤 Files with no reviewable changes (1)
  • vitest.config.ts

📝 Walkthrough

Walkthrough

Tron network support is added across five files: new CAIP constants for the Tron chain and assets, TRX and USDT TRC-20 entries in the static asset list, Tron address validation logic, and mappings from the new asset IDs to Chainflip and CoinGecko identifiers.

Changes

Tron Asset Integration

Layer / File(s) Summary
CAIP constants and asset definitions
src/constants/caip.ts, src/constants/assets.ts
Exports tronChainId, trxAssetId, and usdtOnTronAssetId; registers TRX and USDT TRC-20 in initialAssets with explorer links and network metadata.
Address validation
src/lib/validation.ts, src/lib/validation.test.ts
Exports isValidAddressSync; adds a tronChainId case using WAValidator.validate(..., 'TRX'); covers validation across EVM, Solana, Bitcoin, and Tron chains.
Chainflip asset integration
src/queries/chainflip/assets.ts, src/queries/chainflip/assets.test.ts
Maps trxAssetIdtrx.tron and usdtOnTronAssetIdusdt.tron; validates transformation with test case for Tron assets.
Market data asset integration
src/queries/marketData/index.ts
Maps trxAssetId → CoinGecko tron and usdtOnTronAssetId → CoinGecko tether.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 Hop, hop, onto the Tron!
TRX and USDT carry on,
New chain constants, fresh and bright,
Validators check with all their might.
The rabbit stamps the block with glee —
Tron is here, for you and me! 🌐

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Tron support (TRX + USDT on Tron)' directly and clearly summarizes the primary objective of the changeset: adding support for Tron blockchain with two specific assets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- caip.ts: group constants by chain (chainId, native asset, then tokens) for
  easy extension; remove unused CHAIN_NAMESPACE/CHAIN_REFERENCE/ASSET_NAMESPACE/
  ASSET_REFERENCE maps and FEE_ASSET_IDS (none referenced in the repo)
- add Tron coverage to the Chainflip asset-mapping test (trx.tron, usdt.tron)
- add address-validation tests covering EVM/Solana/BTC/Tron incl. cross-chain
  rejection; export isValidAddressSync for testability
- vitest: drop isolate:false/singleThread pooling which shared one module
  registry and made the marketData axios mock order-dependent (tests failed
  when run together); default isolated pool makes the suite deterministic

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
og Ready Ready Preview, Comment Jun 22, 2026 9:18pm

Request Review

@kaladinlight kaladinlight merged commit 217879e into shapeshift:develop Jun 22, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants