0

I try to find a solution for my problem since hours but I couldn't find an answer for my question, so you're my last hope.

I'm experimenting with spl-token-swap, precisely with TokenSwap.swapInstruction() but I can not figure out the values for some of the expected parameters. These are the parameters I'm struggling with:

  • tokenSwap
  • poolMint
  • feeAccount
  • sourceTokenProgramId
  • destinationTokenProgramId
  • poolTokenProgramId

It'd would be really helpful if someone could tell me, where I can find those values on Solscan.

That's the best tutorial I found so far but it seems a bit outdated because sourceTokenProgramId, destinationTokenProgramId and poolTokenProgramId are not existing in this tutorial: https://www.soldev.app/course/token-swap

I'm happy about any answer which leads me in the right direction.

1 Answer 1

0

To clarify some bits, trading happens through a market, which has an associated liquidity provider mint and fee account. These fields are all stored on the market.

And when trading, you go from a "source" token to a "destination" token, meaning you put "source" tokens into the pool and receive "destination" tokens in return.

Normally, there was always just one token program, but with the release of token-2022, it's possible for there to be multiple token programs in an instruction, so it's necessary to pass in the token program associated with each mint to be safe.

So with all that in mind, here's a description of the arguments:

  • tokenSwap: the market address
  • poolMint: the mint for liquidity providers on that market. This address is stored in the tokenSwap account
  • feeAccount: the token account that receives fees. This address is also stored in the tokenSwap account
  • sourceTokenProgramId: the token program that manages the source token mint
  • destinationProgramId: the token program that manages the destination token mint
  • poolTokenProgramId: the token program that manages the mint for liquidity providers
1
  • Thanks! It helped a lot.
    – Stefan D.
    Commented Jan 21 at 3:03

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.