Supporting Solana Token Extensions: Transfer Hooks, Metadata, and Magna’s Implementation

Photo of Bruno Faviero as Avatar Image
Rohan Suri
April 6, 2026

Token extensions are part of Solana’s Token 2022 standard, an upgraded version of their original SPL Token program. Instead of writing a custom protocol every time you need extra functionality (like transfer fees, metadata, compliance rules, or treasury control), Token Extensions let you enable these features natively at the token level.

Think of it as Solana giving tokens superpowers, without forcing teams to build completely new infrastructure.

Why Do They Matter?

Token launches today are no longer, “mint, distribute, and list”

Teams now want tokens that can:

  • Charge a fee on every transfer
  • Enforce compliance or whitelist addresses
  • Track or update metada on-chain
  • Grant permanent delegate access to specific contacts or treasuries
  • Close mints once supply is finalized
  • Run custom logic every time tokens move (transfer hooks)

Before Token 2022, all of this required custom token programs, audits, and maintenance. That slows teams down, creates fragmentation across the ecosystem where every custom protocol becomes its own compatibility problem, and makes infrastructure compatibility a nightmare. 

Token Extensions fix that. They introduce standardized, modular features that wallets, infrastructure providers, and custodians can support out of the box.

What Does This Mean For Our Users?

Because the future of token launches isn’t static. We work with teams right at the moment their token enters the world, claim portals, vesting, treasury setup, and early distribution.

More and more, we were seeing:

  • Tokens with transfer fees or special metadata
  • Teams requiring compliance logic before transferring tokens
  • Projects using Token 2022 instead of SPL Token

We had two options:

  • Build custom logic for every token with special rules
  • Or support Token Extensions natively and make Magna compatible with where Solana is headed

We chose the second.

The Implementation

Token 2022 is a new standard created by the Solana Foundation to provide extra functionality to Tokens on Solana. Token Extensions are optional features that you can add to a token that was created with the Token 2022 standard, which add extra functionality. These extensions range from TransferFeeConfig  (having a fee on every transfer), to else

General technical implementation:

Relevant PR’s: 

  • On program/contract side:
    • Account -> InterfaceAccount
      • For any TokenAccounts/ATA’s
    • Program -> Interface 
      • For the Token Program
  • On the app side
    • Explicitly pass in token 2022 program into any functions using the `@solana/spl-token` package (we used getMint & getAssociatedTokenAddressSync

Transfer Hook

Explanation of how transfer hooks work: 

  • Deploy a “transfer hook program” that follows a specific interface 
  • Connect your token 2022 token to the transfer hook program
  • Call the initialize_extra_account_meta_list on your transfer hook program
  • On a transfer, the token will automatically call the “transfer hook function”

Implementing Transfer Hooks was the most difficult part of this integration. As we did before, we’ll break it into the program side and the app side. 

Program side

 let cpi_ctx = CpiContext::new_with_signer(       
     token_program.to_account_info(),       
      Transfer {           
           from: from_ata.to_account_info(),           
           to: to_ata.to_account_info(),           
             authority: from_authority.to_account_info(),       
             },       
             signer_seeds,   
      );  
   token::transfer(cpi_ctx, withdraw_amount)?;

Turns into:

     spl_token_2022::onchain::invoke_transfer_checked(       
          &token_program.key,       
          from_ata.to_account_info(),       
          mint.to_account_info(),       
          to_ata.to_account_info(),       
          from_authority.to_account_info(),       
          &remaining_accounts,       
          withdraw_amount,       
          decimals,       
          &signer_seeds,   
)?;


App side:

private async handleTransferHook(   
tokenMint: PublicKey,  
transferIx: TransactionInstruction,   
source: PublicKey,   
destination: PublicKey,   
authority: PublicKey,   
amount: bigint, 
) {   
const mint = await getMint(this.connection, tokenMint, undefined, this.tokenProgramId)const transferHook = await getTransferHook(mint);

if (transferHook) {    
await addExtraAccountMetasForExecute(      
this.connection,       
transferIx,       
transferHook.programId,       
source,       
tokenMint,      
destination,       
authority,       
amount,    
);  
}

Explanation of both:

On the smart contract side, we need to switch from a normal transfer to a transfer_checked instruction if we want to be compatible with more complicated T22 extensions (such as TransferHook, TransferFee, and more). While doing the change, I found that the anchor implementation of `TransferChecked` is quite buggy unreliable with the Token 2022 program, and instead opted to use the raw solana invoke_transfer_checked function (which the anchor `TransferChecked` wraps, so it’s the same thing.

The app side was a bit more complicated. When we create a transfer hook program, this means that there is a brand new (arbitrary) instruction with it’s own accounts that need to be passed through. In order to do this programmatically for your app to be compatible with any transfer hook, we need to use the addExtraAccountMetasForExecute function. Essentially, when you have an instruction in your program that is transferring tokens, there are extra accounts that need to be passed into that instruction in order for the transfer hook to know what context to run the hook in. The addExtraAccountMetasForExecute takes care of all of this by taking in an instruction, and altering it to include the accounts that it derives from the programId of the hook. 

What This Means in Practice

Supporting Token Extensions natively means Magna doesn't break when your token does something interesting. Transfer fees, compliance hooks, permanent delegates, closed mints — these aren't edge cases anymore. They're becoming standard operating procedure for serious token launches on Solana.

The old path was: build custom logic, get it audited, hope your infrastructure partners can keep up. That's slow, fragile, and expensive.

The new path is: use Token 2022, lean on the standard, and work with infrastructure that's already compatible.

That's what we built toward. And it changes the integration story significantly for claim portals, vesting schedules, and early distribution. Magna now handles the complexity of Token Extensions without requiring teams to route around us.

What's Next

We're continuing to expand coverage across the Token Extension surface. The transfer hook implementation was the hardest part. The rest gets easier from here.

If you're building on Token 2022 and want to talk through how Magna fits into your stack, reach out.

Photo of Bruno Faviero as Avatar Image
Rohan Suri
April 6, 2026

Automate Your Token Operations Today

Magna offers white glove onboarding and streamlined migrations from your existing providers.