TRON: pre-flight simulation, status polling, verify-decode preview - #43
Merged
Conversation
- Pre-flight TRC-20 sends via /wallet/triggerconstantcontract — catches balance/blocklist/pause reverts at prepare time instead of on broadcast. - Populate estimatedEnergyUsed + estimatedEnergyCostSun from the dry-run so verify_tx_decode can frame fee_limit as a cap vs expected burn. - Extend get_transaction_status to TRON via TronGrid gettransactionbyid + gettransactioninfobyid. - Claim-rewards cooldown: surface remaining time (Xh Ym) from latest_withdraw_time when the 24h window hasn't elapsed. - verify_tx_decode on TRON now returns the decoded action preview + fee framing instead of a generic "EVM-only" fallback. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
TRON blocks every ~3s; the uniform 5s poll interval added perceptible latency over the actual inclusion time. Split the cadence into a per-chain table: 3s/1min for TRON + L2s, 5s/2min for Ethereum L1. Undershooting the block time is fine — the node just returns "unknown" / "pending" on the extra polls. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
/wallet/triggerconstantcontractcatch balance/blocklist/pause reverts at prepare time instead of on broadcast, and populateestimatedEnergyUsed+estimatedEnergyCostSunso previews can framefee_limitas a cap vs expected burn.get_transaction_statusnow handleschain: "tron"via TronGrid (gettransactionbyid+gettransactioninfobyid), keeping the same{status, blockNumber, fee, ...}shape as the EVM path.prepare_tron_claim_rewardssurfaces remaining cooldown time (Xh Ym) fromlatest_withdraw_timewhen the 24h window hasn't elapsed.verify_tx_decodeon TRON returns a decoded action preview + fee framing instead of the generic "EVM-only" fallback.Test plan
npx vitest run— 429 tests pass (added pre-flight-revert + energy-cost coverage intron-phase2-prepare.test.ts; updatedverification.test.tsTRONverify_tx_decodeassertions).npm run buildclean.Error(string)reason.get_transaction_status({chain:"tron"})untilsuccess, confirmblockNumber+feeTrxpopulate.prepare_tron_claim_rewardstwice in a row; second call should surface the remaining-cooldown message.🤖 Generated with Claude Code