Skip to content

feat(sdk-coin-ton): add setFullWithdrawalMessage() for full unstake#8302

Merged
feng-bitgo merged 1 commit intomasterfrom
fguo/SC-6175
Mar 16, 2026
Merged

feat(sdk-coin-ton): add setFullWithdrawalMessage() for full unstake#8302
feng-bitgo merged 1 commit intomasterfrom
fguo/SC-6175

Conversation

@feng-bitgo
Copy link
Contributor

What & Why

The TON single nominator contract supports two withdrawal paths:

  1. OP::WITHDRAW (0x1000) — withdraw specific amount (can't withdraw all)
  2. Text comment "w" — drains balance - gas - MIN_TON_FOR_STORAGE automatically

BitGoJS only implemented path 1. This PR adds setFullWithdrawalMessage() to SingleNominatorWithdrawBuilder, mirroring TonWhalesWithdrawalBuilder.setFullWithdrawalMessage().

Changes

  • Add SINGLE_NOMINATOR_WITHDRAW_ALL_COMMENT = 'w' constant
  • Add setFullWithdrawalMessage() to SingleNominatorWithdrawBuilder
  • Detect "w" comment in transaction parser → sets SingleNominatorWithdraw type (no withdrawAmount)
  • Add unit tests for full withdrawal build and round-trip

Full withdrawal is inferred by transactionType === SingleNominatorWithdraw && !withdrawAmount.

Test Plan

  • Full withdrawal builds a SingleNominatorWithdraw tx with withdrawAmount === undefined
  • Transaction round-trips correctly (build → parse → rebuild → same bytes)
  • Signed transaction round-trip preserves signatures
  • Existing partial withdraw tests unaffected

Related

🤖 Generated with Claude Code

Implements the full-withdrawal path for TON single nominator contracts
via text comment "w". When present, the contract drains
balance - gas - MIN_TON_FOR_STORAGE automatically.

- Add SINGLE_NOMINATOR_WITHDRAW_ALL_COMMENT = 'w' constant
- Add setFullWithdrawalMessage() to SingleNominatorWithdrawBuilder
- Detect "w" comment in transaction parser to set SingleNominatorWithdraw type
- Add unit tests for full withdrawal build and round-trip

Full withdrawal is inferred by transactionType === SingleNominatorWithdraw
&& !withdrawAmount, mirroring TonWhales handling.

SC-6175

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

TICKET: SC-6175
@feng-bitgo feng-bitgo marked this pull request as ready for review March 16, 2026 15:04
@feng-bitgo feng-bitgo requested a review from a team as a code owner March 16, 2026 15:04
@feng-bitgo feng-bitgo merged commit 738c1c7 into master Mar 16, 2026
21 checks passed
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.

2 participants