Skip to main content

Introduction

Exit a native staking position, wait for cooldown, then withdraw SOL to the Swig wallet. Use a full exit to close out the delegation, or a partial exit to keep part earning rewards. TypeScript and Python prepare these transactions. The acting role needs Stake program access and sufficient staking permission. Each example prepares a transaction; sign, submit, and confirm it before the next step. Query positions to check state between steps.

SDK examples

Exit a position

TypeScript uses yieldClient = swig.yield.forWallet({ swigConfigAddress, network: 'mainnet' }); Python uses the configured swig client and swig_config_address. Prepare deactivation of the whole position. Withdrawal becomes available after cooldown.

Exit part of a position

Split a fully active position and deactivate the split. Both parts must meet the network’s minimum delegation.
Submit and confirm partialExit.transaction / partial_exit.transaction. Track its exitingPositionAddress / exiting_position_address during cooldown.

Withdraw a position

After the exiting position becomes inactive, return its SOL above the rent reserve to the wallet.
Sign, submit, and confirm withdrawal.transaction. The returned withdrawalLamports / withdrawal_lamports is the amount this transaction returns; the rent reserve remains in the stake account.

Flow

Input

Output

TypeScript fields are shown; Python uses snake_case. Returned lamport amounts are exact decimal strings. Indexed withdrawable amounts may include rent, but the prepared withdrawal keeps the rent reserve.

Errors