Skip to content

Add TRON Phase 1: read-only balances + portfolio integration - #15

Merged
szhygulin merged 2 commits into
mainfrom
feat/tron-phase1-read
Apr 14, 2026
Merged

Add TRON Phase 1: read-only balances + portfolio integration#15
szhygulin merged 2 commits into
mainfrom
feat/tron-phase1-read

Conversation

@szhygulin

Copy link
Copy Markdown
Collaborator

Summary

  • Adds TRON as a non-EVM chain without disturbing the EVM type surface: SupportedChain stays EVM-only, TRON lives in a parallel SupportedNonEvmChain union, AnyChain is the new cross-chain entry-point type, and isEvmChain() narrows.
  • Read path: get_token_balance accepts chain: "tron" with base58 wallet/token; get_portfolio_summary accepts an optional tronAddress that folds TRX + canonical TRC-20 stablecoins (USDT, USDC, USDD, TUSD) into the same total via breakdown.tron / tronUsd / coverage.tron.
  • Interactive setup prompts for a TronGrid API key (validates against the USDT-TRC20 accounts endpoint); TRON_API_KEY env var overrides config.

Scope notes

  • Phase 1 only — balance reads + schemas + setup. Transaction preparation and Ledger signing land in follow-up PRs (Phases 2 and 3).
  • TRON has no DeFi/LP/staking coverage here — none of Aave/Compound/Morpho/Uniswap/Lido/EigenLayer are deployed on TRON. Readers short-circuit on non-EVM chains.
  • Multi-wallet + tronAddress combinations throw (ambiguous which EVM wallet the TRON address pairs with); callers must use single-wallet mode.

Test plan

  • npm run build — clean
  • npm test — 265/265 passing, including 26 new TRON tests (chain registration invariants, isEvmChain, isTronAddress, TRON_TOKENS, resolveTronApiKey precedence, schema acceptance, getTronBalances / getTronTokenBalance with stubbed fetch, dispatch)
  • Manual: run recon-crypto-mcp-setup and confirm the TronGrid prompt validates against a live key
  • Manual: call get_portfolio_summary with an EVM wallet + tronAddress and confirm TRON slice appears in breakdown.tron with TRX + TRC-20 values

🤖 Generated with Claude Code

@szhygulin
szhygulin force-pushed the feat/tron-phase1-read branch from bb6ee6a to 95369f5 Compare April 14, 2026 05:36
szhygulin and others added 2 commits April 14, 2026 09:17
Introduces non-EVM chain support without disturbing the EVM type
surface: SupportedChain stays EVM-only, TRON lives in a parallel
SupportedNonEvmChain union, and AnyChain is the cross-chain entry
point. Adds TronGrid-backed balance reads (TRX + canonical TRC-20
stablecoins), a TronBalance/TronPortfolioSlice type pair, optional
tronAddress on get_portfolio_summary, TRON dispatch in
get_token_balance, and an interactive setup prompt for TRON_API_KEY.
Phases 2 (tx preparation) and 3 (Ledger signing) land separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extends Phase 1 with a `get_tron_staking` tool and folds staking into
`get_portfolio_summary`. Reads `frozenV2` and `unfrozenV2` from the
`/v1/accounts` payload (Stake 2.0 model) and claimable voting rewards
from `/wallet/getReward`. Surfaces bandwidth/energy split, ISO unlock
timestamps, and USD totals; `tronStakingUsd` appears on the portfolio
summary alongside `tronUsd`. Actual claim/unstake transactions land in
Phase 2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@szhygulin
szhygulin force-pushed the feat/tron-phase1-read branch from 1b57eec to 150322c Compare April 14, 2026 06:17
@szhygulin
szhygulin merged commit 8855ceb into main Apr 14, 2026
2 checks passed
@szhygulin
szhygulin deleted the feat/tron-phase1-read branch April 25, 2026 02:15
szhygulin added a commit that referenced this pull request Apr 27, 2026
Captures the architectural rule that follow-up issues #15 (security-skill)
and #402 (mcp) both violated: VaultPilot's companion skills ship SKILL.md
only, not executables. A skill-shipped CLI can't exist, so MCP-side
"detect bin on PATH" plans have nothing to point at.

Implication for [AGENT TASK] blocks: inline node -e scripts stay inline.
Shrinkable, labelable, redesignable (drop a sub-check, move browser-side)
— but not movable into a non-existent skill bin. PR #400's labeling step
is the full fix for #396, not a partial one.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
szhygulin added a commit that referenced this pull request Apr 28, 2026
Beyond adversarial cases (prompt injection, rogue subagent, malicious
skill, deliberately rogue agent), a safety-tuned non-injected agent
can still produce harmful behavior through hallucinated addresses /
chain IDs, stale knowledge of deprecated contracts, post-training-
cutoff protocols, long-context attention drift, sycophancy under
user pressure, cross-tool reasoning gaps, numeric mistakes, and
tool-name confusion.

Threat-model-wise these are functionally equivalent to a narrow
agent compromise: the agent emits bytes / advice / args that don't
match user intent, with no adversarial intent required. Two edits:

1. "Why trust VaultPilot?" preamble — explicit second paragraph
   naming the honest-model-error category alongside the adversarial
   cases, with the user-facing implication that benign-looking
   responses should not be trusted more than adversarial ones.

2. "Threat → what catches it" — new bullet listing each model-error
   sub-class and which specific defenses (PREPARE RECEIPT, Inv #1.a,
   Inv #2.5, Inv #14, Inv #15, agent-side ABI decode, Ledger device
   display, skill-side unconditional refusals) catch it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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