TRON Phase 2: transaction preparation (preview-only) - #21
Merged
Conversation
Prepares (preview-only) native TRX sends, canonical TRC-20 transfers (USDT/USDC/USDD/TUSD), and WithdrawBalance claims via TronGrid. The TRON tx shape (raw_data_hex + fee_limit) diverges from the EVM UnsignedTx, so handles live in a separate tron-tx-store to keep send_transaction's EVM-only security pipeline from being shortcut by type confusion. Signing lands with Phase 3 via @ledgerhq/hw-app-trx over USB HID. Co-Authored-By: Claude Opus 4.6 <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
prepare_*tools:prepare_tron_native_send,prepare_tron_token_send,prepare_tron_claim_rewards. Each calls TronGrid (createtransaction/triggersmartcontract/withdrawbalance) withvisible: true, validates base58 addresses and amounts, and issues an opaque handle.UnsignedTronTx) and its handle store separate from EVM sosend_transaction's EVM-only security pipeline (eth_call re-simulation, chain-id check, spender allowlist) can't be silently shortcut by type confusion. TRON handles are preview-only in this release;send_transactionrefuses them until Phase 3 lands USB HID signing via@ledgerhq/hw-app-trx.UNKNOWNin the preview.Test plan
npx vitest run— 285/285 pass (17 new tests intest/tron-phase2-prepare.test.tscovering base58 decode, TRC-20 param layout, POST body shape, handle issuance, and both TronGrid error shapes).npm run build— clean tsc.prepare_tron_*against a real address and cross-referencetxIDwith a direct TronGrid call.send_transactionrefuses a TRON handle (EVM-only consume path).prepare_tron_claim_rewardsand confirm TronGrid's message is surfaced verbatim.Follow-ups
freezeBalanceV2,unfreezeBalanceV2,withdrawExpireUnfreezefor Stake 2.0 bandwidth/energy management.@ledgerhq/hw-app-trx(Ledger Live's WalletConnect relay does not honortron:— verified 2026-04-14).🤖 Generated with Claude Code