I am trying to test out the spl token 2022 program to make a token with the transfer fee extentsion. So far I have the following:

let extension_types = vec![spl_token_2022::extension::ExtensionType::TransferFeeAmount];
let space = spl_token_2022::extension::ExtensionType::get_account_len::<spl_token_2022::state::Mint>(&extension_types);
// first create the mint account for the new NFT
let mint_rent = rent::Rent::default().minimum_balance(space);

let create_idx = solana_program::system_instruction::create_account(
    space as u64,

let config_init_idx = spl_token_2022::extension::transfer_fee::instruction::initialize_transfer_fee_config(
    &spl_token_2022::ID, &mint_address.pubkey(), None, None, 500, 5000).unwrap();

let txn = Transaction::new_signed_with_payer(
    &vec![create_idx, config_init_idx],
    &[&wallet, &mint_address],
let signature = connection.send_and_confirm_transaction(&txn)?;

but i get:

Error processing Instruction 1: invalid account data for instruction"

I've been struggling to really find any documentation of how to do this in rust.. but this seemed like the right way to start. Once the config is created i think i should just be able to initialize the mint and continue as normal.. but i'm stuck on this stage.

Anyone done this before and knows what i'm doing wrong?

1 Answer 1


I figured it out, the extension type should have been:

let extension_types = vec![spl_token_2022::extension::ExtensionType::TransferFeeConfig];

then it all worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.