Open winktool opened 3 months ago
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.
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.