Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get market id? #275

Open
winktool opened this issue Jun 14, 2024 · 1 comment
Open

How to get market id? #275

winktool opened this issue Jun 14, 2024 · 1 comment

Comments

@winktool
Copy link

I want to write a Solana smart contract to get the market id via Cross Program Invocation (CPI) by providing the address of the tokens ,is this achievable, is there a simple example please? Thanks.

@riordanp
Copy link
Contributor

riordanp commented Jul 3, 2024

Hi, the market pubkey cannot be derived from the token mints. There can be many markets for a given pair. You would have to look it up off-chain using a getProgramAccounts RPC call with a memcmp filter or two to target the correct base_mint/quote_mint, then choose the best market for your pair by whatever criteria and pass that in to your program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants