Skip to main content
The approve() and revoke() functions grant and remove delegate spending authority for compressed tokens. Only the token owner can perform these operations. Before we approve or revoke delegates, we need:
  • compressed token accounts to delegate or revoke delegation from, and
  • an SPL mint with a token pool for compression. This token pool can be created for new SPL mints via createMint() or added to existing SPL mints via createTokenPool().

Full Code Example

Prerequisites

Make sure you have dependencies and developer environment set up!
Dependencies
Alternatives:
Developer EnvironmentBy default, this guide uses Localnet.
Alternative: Using DevnetFollow these steps to create an RPC Connection. Replace <your_api_key> with your API key before running.
Get your API Key here, if you don’t have one yet.

Approve / Revoke Delegates

Approve delegate authority for compressed tokens. The delegate can spend up to the approved amount.
approve-delegates.ts

Troubleshooting

Attempting to revoke non-delegated accounts.

Advanced Configuration

Next Steps

That’s it! Explore more guides in our cookbook section, or check out the advanced guides.