feat: add Tron chain support to lintent.org#49
Conversation
New files: - tronExecution.ts: open escrow, approve tokens, get block timestamp - tronSolver.ts: fill outputs, claim, validate proofs, read state - chainType.ts: isTronChain / isEvmChain helpers - tronlink.ts: TronLink connection utilities - WalletStatus.svelte: wallet status component - tronSupport.test.ts: unit tests for chain type utilities Bug fixes: - solver.ts: use eth_getBlockByNumber instead of eth_getBlockByHash (blockByHash is unreliable on many public RPCs); add Tron-aware fill timestamp path for EVM->Tron outputs Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- config.ts: add Tron chain config, TRON_MAINNET_INPUT/OUTPUT_SETTLER - app.d.ts: add TronWeb type declarations - state.svelte.ts: add TronLink account tracking, accountForChain() - intentFactory.ts: use intent.inputSettler (not store.inputSettler) to correctly save TRON_MAINNET_INPUT_SETTLER for Tron source intents - flowProgress.ts: add Tron branch in isInputChainFinalised() - intentExecution.ts: route Tron source intents to openTronEscrowIntent - ConnectWallet.svelte: show TronLink connect option - FillIntent.svelte: Tron-aware isFilled() via readTronFillRecord - ReceiveMessage.svelte: Tron-aware receipt/timestamp in isValidated() - Finalise.svelte: handle Tron source chain claim - IssueIntent.svelte: handle Tron input token approval/open - +page.svelte: guard account() for disconnected TronLink - FlowStepTracker.svelte: display Tron chain steps - intent.ts: containerToIntent dispatches to Tron intent type - vite.config.ts: add TronLink global polyfill Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Switches from local file: reference to the published npm package. 0.1.2 fixes Polymer oracle resolution for Tron->EVM intents (output.oracle now resolves from the input chain, not the output chain). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
tronExecution.ts was missing getTronBlockTimestamp (needed by solver.ts and ReceiveMessage.svelte for Tron fill timestamp lookups). Also fixes orderToTronTuple to convert user and inputOracle to Tron base58 format — TronLink encodes address-typed fields incorrectly when given 0x hex. app.d.ts: add TronWeb.trx.getBlock type declaration. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR performs a major architectural migration from a local intent library and chain-name-based configuration to ChangesIntent Library Migration & Configuration
Svelte Components & UI
🎯 4 (Complex) | ⏱️ ~75 minutes
✨ 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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🚀 Preview deployed! Worker: |
…-lintentorg # Conflicts: # src/lib/config.ts
|
🚀 Preview deployed! Worker: |
getClient() throws for Tron chainId (not in clientsById), causing getOrderProgressChecks to always return all-false for any Tron-involved order. Add Tron-specific branches in isOutputFilled, isOutputValidatedOnChain, and isInputChainFinalised using TronWeb helpers instead of viem. Add readTronIsOutputFilled and getTronTransactionFrom to tronSolver.ts, and declare getTransaction on the TronWeb.trx type stub in app.d.ts. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed! Worker: |
readTronOrderStatus hits TronGrid (api.trongrid.io) without an API key and gets 429 on the first call. The catch handler previously discarded the error leaving claimedByChain[chainId] as undefined, which rendered the greyed "Finalise" placeholder instead of the active "Claim" button. - Cache the Tron orderStatus call via getOrFetchRpc (30s TTL) to avoid hammering TronGrid on repeated polls - On any error, set claimedByChain[chainId] = false so the button falls through to the active Claim path instead of staying in the loading state Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed! Worker: |
Add 15s error backoff to rpcCache so 429 failures don't immediately retry and create a thundering herd. Also use 2min/3min TTLs for Tron balance/allowance checks instead of 30s/60s to reduce request frequency against api.trongrid.io's rate-limited public endpoint. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed! Worker: |
|
🚀 Preview deployed! Worker: |
Bump @lifi/intent 0.1.2 -> 0.1.6 (which carries the canonical Tron settlers) and point the Tron Polymer oracle at the canonical deployment, matching the public docs and lifi-order-service. - InputSettler / OutputSettler now resolve via @lifi/intent@0.1.6 (0xef1b6845... / 0x52a5f2a9...) - PolymerOracle (config.ts): 0xfa5fabd7... -> 0x1d586aa1... Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed! Worker: |
Summary
tronSolver.tsandtronExecution.tsfor Tron-specific order handling, along withtronlink.tsutilities and chain-type helpers@lifi/intentto 0.1.2as anycasts, adds new unit and e2e tests (Tron support, wallet client switching, recipient field, order validation)Test plan
bun test— all unit tests pass including new Tron testsescrow-standard-blackbox,escrow-standard-live)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Chores