1

Is there a way to retrieve the token extension fee for SolToken2022? When we pass the Mint address, it returns the transfer fee.

Edit:

const fee = await getTransferFeeConfig(mint
  );

  console.log("fee: ", fee);

**error**
Error fetching transfer fee config: TypeError: Cannot read properties of undefined (reading 'length')

1 Answer 1

1

You can use getTransferFeeConfig from @solana/spl-token to do this.

https://solana-labs.github.io/solana-program-library/token/js/functions/getTransferFeeConfig.html

Edit:

getTransferFeeConfig requires the mint data as an input

You can get that using getMint from @solana/spl-token

https://solana-labs.github.io/solana-program-library/token/js/functions/getMint.html

Example:

const tokenMintData = await getMint(
  connection, 
  tokenMintPubkey, 
  commitment, 
  TOKEN_PROGRAM_ID
)

const transferFeeConfig = getTransferFeeConfig(tokenMintData)

5
  • Hi @Zombi, check the question I edited question, now using the TransferFeeConfig. Should I pass like this?
    – Bobz
    Commented Mar 7 at 13:12
  • Should I send minting Address or mint Object?
    – Bobz
    Commented Mar 7 at 13:39
  • Updated my answer 🫡
    – Zombi
    Commented Mar 7 at 13:49
  • TokenAccountNotFoundError- same error as I'm working on SPL2022
    – Bobz
    Commented Mar 7 at 13:57
  • You'll just need to substitute TOKEN_PROGRAM_ID with TOKEN_2022_PROGRAM_ID, but otherwise this is correct!
    – Jon C
    Commented Mar 9 at 12:05

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.