Skip to content

feat(sdk-coin-ton): add setFullWithdrawalMessage() via w comment to SingleNominatorWithdrawBuilder#8297

Open
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
feat/ton-single-nominator-full-withdrawal
Open

feat(sdk-coin-ton): add setFullWithdrawalMessage() via w comment to SingleNominatorWithdrawBuilder#8297
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
feat/ton-single-nominator-full-withdrawal

Conversation

@bitgo-ai-agent-dev
Copy link

Summary

Implements the full-withdrawal path for TON single nominator contracts (orbs-network/single-nominator), resolving ST-802.

The single nominator contract supports a text comment "w" that drains balance - gas - MIN_TON_FOR_STORAGE automatically. This PR adds setFullWithdrawalMessage() to SingleNominatorWithdrawBuilder, mirroring the existing TonWhalesWithdrawalBuilder.setFullWithdrawalMessage().

Changes

  • constants.ts: Add SINGLE_NOMINATOR_WITHDRAW_ALL_COMMENT = 'w'
  • iface.ts: Add isFullUnstake?: boolean to TxData interface
  • transaction.ts: Add isFullUnstake field to Transaction, expose in toJson(), load in fromRawTransaction(), detect "w" comment in parser to set SingleNominatorWithdraw type and isFullUnstake = true
  • singleNominatorWithdrawBuilder.ts: Add setFullWithdrawalMessage() — sets isFullUnstake = true and message = 'w'
  • test/unit/singleNominatorWithdrawBuilder.ts: Add test cases for full withdrawal build and round-trip

Usage

// Partial (existing)
builder.setWithdrawAmount('500000000000').setWithdrawMessage();

// Full (new)
builder.setFullWithdrawalMessage();
// → plain transfer with text comment "w"

Test plan

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

🤖 Generated with Claude Code

…WithdrawBuilder

Implements the "w" comment withdrawal path for TON single nominator
contracts (orbs-network/single-nominator). This allows draining the
full balance minus gas and MIN_TON_FOR_STORAGE automatically, without
needing to specify an amount.

- Add SINGLE_NOMINATOR_WITHDRAW_ALL_COMMENT = 'w' constant
- Add isFullUnstake?: boolean to TxData interface
- Add isFullUnstake field to Transaction class, expose in toJson()
- Add setFullWithdrawalMessage() to SingleNominatorWithdrawBuilder
- Parser detects "w" comment transactions, sets SingleNominatorWithdraw
  type and isFullUnstake = true
- Add unit tests for setFullWithdrawalMessage() flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bitgo-ai-agent-dev bitgo-ai-agent-dev bot requested a review from a team as a code owner March 15, 2026 23:33
@linear
Copy link

linear bot commented Mar 15, 2026

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.

0 participants