Knowledge base
Basics5 min read

Approve and SetAuthority: what they actually do

Two SPL Token instructions decide who can spend your tokens. Understanding them is the difference between spotting a drain and signing one. Here is what each does and why it outlives the transaction.

What Approve does

Approve sets a delegate — a third-party address — and a delegatedAmount, its spending limit, on a token account. The delegate can transfer tokens up to that limit without a new signature from you. The remaining delegatedAmount decreases as it is spent and has no automatic time expiry. Revoke removes the delegate; Approve(0) sets a zero allowance but does not clear the delegate field.

What ApproveChecked adds

ApproveChecked does the same but also asserts the token mint and decimals. This guards against confusion where an approval is accidentally applied to the wrong token. This does not establish that the delegate is trustworthy: both instructions create an ordinary token-account delegation with a spending limit, not the mint-level Token-2022 PermanentDelegate extension.

What SetAuthority does

SetAuthority changes the authorities of an account or mint: the owner, the close authority, and for a mint the freeze/mint authority. An owner change hands over full account control; close authority alone cannot transfer the token balance. Closing a non-native token account requires a zero token balance; extensions may add constraints. Wrapped SOL is an exception: its account can be closed with a balance to reclaim SOL.

Why they outlive the transaction

This is state on the account itself, not on the transaction. Do not rely on a swap to remove authorities: they can persist unless explicitly changed or revoked. The remaining allowance decreases as it is spent but does not expire merely with time. Inspect the post-swap state.

How to inspect and revoke

Look at the token account delegate field in an explorer or the approval manager in your wallet. Remove unknown delegations with Revoke. SpaceSwap shows available delegate data for monitored input/output token accounts and blocks detected prohibited SetAuthority/Approve instructions. Before signing, it attempts to compare delegate, owner and close authority in simulation for associated input, output and wrapped-SOL accounts. This is not a whole-wallet check or a guarantee of the executed state. Unavailable data or simulation is disclosed before signing: the confirm button names the consent to send without the second check, and the wallet signature gives it; cancelling costs nothing.

Key takeaways

  • Approve permits spending within the remaining allowance without a new owner signature; Revoke removes the delegation.
  • The owner has full account control; close authority alone does not permit token transfers.
  • Authorities can persist after a swap; check explicit changes and the remaining allowance.
  • Check the delegate before signing and revoke unknown approvals.

Ready to swap with pre-sign checks?

SpaceSwap blocks drain instructions, bounds writable accounts and simulates the transaction before signing. Funds are signed only in your wallet.

Open swap