Beyond the common create, mint, and transfer operations, the Token Program is also called from on-chain programs via CPI and includes instructions for recovering lamports:
Calling the Token Program via CPI
Invoke the Token Program from an on-chain program — transfer, mint, and burn tokens, sign with a PDA authority, and batch instructions into a single CPI.
Withdraw Excess Lamports
Recover SOL above the rent-exempt minimum from token accounts, mints, and multisig accounts without changing token balances.
Unwrap Lamports
Convert wrapped SOL back into lamports, in full or in part, without closing the token account.
WithdrawExcessLamports and UnwrapLamports are available through the
@solana-program/token
client. Calling the Token Program via CPI applies to on-chain programs.
Lamport recovery
WithdrawExcessLamports recovers SOL above the rent-exempt minimum from
token accounts, mints, and multisig accounts. UnwrapLamports converts
wrapped SOL in a native token account back into lamports.
Is this page helpful?