2

Having mint addresses of two spl tokens on Solana mainnet, I need to find public key of all possible markets (i.e. marketId in the following code snippet) available on Solana to get token swap info from:

const tokenSwap = await TokenSwap.loadTokenSwap(
    con,
    new PublicKey(marketId),// << HERE
    TOKEN_SWAP_PROGRAM_ID,
    payerAaccount
);

I could not find any repository (similar to Raydium or Serum lp addresses) on github or anywhere else. Where can I find a list of liquid markets for spl token swap program? and/or is there any other way to calculate or retrieve token swap info based on token mint addresses?

Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87

1 Answers1

1

To get the addresses of markets for two mint addresses, you'll need to go through a few steps.

Note, however, that the current TOKEN_SWAP_PROGRAM_ID is deprecated by Serum in favor of using the Serum orderbooks. You may have to use their SDKs for Serum, or Raydium's to interact with those programs.

Jon C
  • 7,019
  • 10
  • 17
  • Don't you know any API that does all these tasks and exposes an updated list of markets? – Ehsan Khodarahmi Dec 24 '21 at 06:49
  • 1
    There's no API on the swap program, but if you're using Orca, they have an easy to use SDK: https://github.com/orca-so/typescript-sdk, Raydium also has an SDK: https://github.com/raydium-io/raydium-sdk, and Serum has these resources: https://github.com/project-serum/serum-ts – Jon C Dec 24 '21 at 14:52