Withdraw Excess Lamports

What Does Withdraw Excess Lamports Do?

WithdrawExcessLamports moves SOL held by a Token Program account above its rent-exempt minimum to a destination account. Token balances and mint supply are untouched — only the surplus lamports move.

This recovers SOL that was previously stranded: lamports sent to a token account, mint, or multisig (all owned by the Token Program) could not otherwise be moved.

Source Reference

ItemDescriptionSource
WithdrawExcessLamportsThe instruction (discriminator 38).Source
process_withdraw_excess_lamportsProcessor logic and authority checks.Source

Accounts

AccountDescription
sourceWritable. The token account, mint, or multisig to withdraw from.
destinationWritable. Receives the excess lamports.
authoritySigns based on the source account type (see below).

Who Can Sign

The required signer depends on the type of the source account:

Source accountSigner
Token accountThe token account owner (or its multisig signers).
Mint with a mint authorityThe mint authority.
Mint without a mint authorityThe mint account itself must sign (see the note below).
MultisigThe configured M-of-N signers.

The "mint without a mint authority" case is uncommon. When it applies, the mint account is the signer: a program-owned (off-curve) mint signs via a CPI from its owning program, and a keypair (on-curve) mint signs with its key.

Native (wrapped SOL) token accounts are not supported and return NativeNotSupported. The withdrawal cannot drop the source account below its rent-exempt minimum.

How to Withdraw Excess Lamports

The example uses a configured @solana/kit client — see Transfer Tokens for client setup.

Withdraw excess lamports (Kit)
import { getWithdrawExcessLamportsInstruction } from "@solana-program/token";
// source/destination: addresses of the account to drain and the lamport recipient.
// authority: a TransactionSigner that signs per the source account type.
const instruction = getWithdrawExcessLamportsInstruction({
source,
destination,
authority
});
await client.sendTransaction([instruction]);

For a multisig authority, pass the co-signers with multiSigners.

Is this page helpful?

Tabla de Contenidos

Editar Página
Withdraw Excess Lamports | Solana