Skip to content

TRON: pre-flight simulation, status polling, verify-decode preview - #43

Merged
szhygulin merged 2 commits into
mainfrom
feat/tron-preflight-status
Apr 21, 2026
Merged

TRON: pre-flight simulation, status polling, verify-decode preview#43
szhygulin merged 2 commits into
mainfrom
feat/tron-preflight-status

Conversation

@szhygulin

Copy link
Copy Markdown
Collaborator

Summary

  • Pre-flight TRC-20 sends through /wallet/triggerconstantcontract catch balance/blocklist/pause reverts at prepare time instead of on broadcast, and populate estimatedEnergyUsed + estimatedEnergyCostSun so previews can frame fee_limit as a cap vs expected burn.
  • get_transaction_status now handles chain: "tron" via TronGrid (gettransactionbyid + gettransactioninfobyid), keeping the same {status, blockNumber, fee, ...} shape as the EVM path.
  • prepare_tron_claim_rewards surfaces remaining cooldown time (Xh Ym) from latest_withdraw_time when the 24h window hasn't elapsed.
  • verify_tx_decode on 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 in tron-phase2-prepare.test.ts; updated verification.test.ts TRON verify_tx_decode assertions).
  • npm run build clean.
  • Live check: prepare a TRC-20 send with a deliberately-short balance; confirm the handle is refused with the decoded Error(string) reason.
  • Live check: broadcast a TRX transfer, poll get_transaction_status({chain:"tron"}) until success, confirm blockNumber + feeTrx populate.
  • Live check: call prepare_tron_claim_rewards twice in a row; second call should surface the remaining-cooldown message.

🤖 Generated with Claude Code

szhygulin and others added 2 commits April 21, 2026 13:29
- 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>
@szhygulin
szhygulin merged commit 1331dfe into main Apr 21, 2026
3 checks passed
@szhygulin szhygulin mentioned this pull request Apr 21, 2026
3 tasks
@szhygulin
szhygulin deleted the feat/tron-preflight-status branch April 25, 2026 02:15
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.

1 participant