Skip to content

TRON Phase 2b: Stake 2.0 freeze/unfreeze/withdraw-expire-unfreeze - #22

Merged
szhygulin merged 1 commit into
mainfrom
feat/tron-phase2b-stake-writes
Apr 14, 2026
Merged

TRON Phase 2b: Stake 2.0 freeze/unfreeze/withdraw-expire-unfreeze#22
szhygulin merged 1 commit into
mainfrom
feat/tron-phase2b-stake-writes

Conversation

@szhygulin

Copy link
Copy Markdown
Collaborator

Summary

  • Adds three TRON Stake 2.0 preparation tools: prepare_tron_freeze, prepare_tron_unfreeze, prepare_tron_withdraw_expire_unfreeze. Each hits TronGrid's v2 staking endpoints with visible: true, uppercases the bandwidth/energy resource at the edge, and returns an opaque handle.
  • UnsignedTronTx.action union extended additively — freeze, unfreeze, withdraw_expire_unfreeze.
  • Preview-only in this release, consistent with Phase 2: send_transaction refuses TRON handles until the USB HID signer lands.
  • prepare_tron_freeze's description explicitly calls out that freezing alone does not earn rewards — VoteWitness is required and is queued separately as Phase 2c (see follow-up issue).

Test plan

  • npx vitest run — 296/296 pass (11 new tests in test/tron-phase2b-stake-writes.test.ts covering POST body shape, resource uppercasing, preview copy, handle issuance, and TronGrid error passthrough for overshoot/no-mature cases).
  • npm run build — clean tsc.
  • Manual: call prepare_tron_freeze with resource: "bandwidth" against a real address; inspect the returned txID and cross-check against a direct /wallet/freezebalancev2 call.
  • Manual: call prepare_tron_unfreeze with an overshoot amount; confirm TronGrid's less than frozen balance surfaces verbatim.
  • Manual: call prepare_tron_withdraw_expire_unfreeze on an address with no matured slices; confirm no expire unfreeze surfaces.

Follow-ups

  • Phase 2c (tracked separately): SR listing + prepare_tron_vote — required for freezes to actually accrue rewards.
  • Phase 3: USB HID signing via @ledgerhq/hw-app-trx.

🤖 Generated with Claude Code

Adds three preparation tools for TRON Stake 2.0 resource management:
freeze TRX for bandwidth or energy (gains voting power), unfreeze (begins
the 14-day cooldown), and sweep matured slices back to liquid TRX.
Resource names use lowercase on the API surface (matching the staking
reader) and are uppercased at the TronGrid edge. Preview-only until the
Phase 3 USB HID signer lands; send_transaction still refuses TRON handles.

The freeze tool description flags explicitly that rewards require a
separate VoteWitness step (queued as Phase 2c).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@szhygulin
szhygulin merged commit 08aa6db into main Apr 14, 2026
2 checks passed
@szhygulin
szhygulin deleted the feat/tron-phase2b-stake-writes 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