Trouble Tracking Raydium Pool Changes for External Accounts with onProgramAccountChange
Trouble Tracking Raydium Pool Changes for External Accounts with onProgramAccountChange
Loading saved threads...
David · External communityPost link
External question — Solana Stack Exchange
Author: David
Original post: https://solana.stackexchange.com/questions/17141
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I'm setting up a listener to track changes in Raydium pools using onProgramAccountChange on Solana. My goal is to detect when certain external accounts interact with or initialize Raydium liquidity pools. However, it seems like the updates aren’t being captured as expected when these accounts perform specific actions, like creating or updating a pool.
Here’s a simplified version of the subscription code:
private async subscribeToRaydiumPools(config: { quoteToken: Token }) {
const filters = [
{ dataSize: LIQUIDITY_STATE_LAYOUT_V4.span },
{
memcmp: {
offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf('quoteMint'),
bytes: config.quoteToken.mint.toBase58(),
},
},
// Additional filters…
];
const raydiumSubscription = this.connection.onProgramAccountChange(
MAINNET_PROGRAM_ID.AmmV4,
async (updatedAccountInfo) => {
this.emit('pool', updatedAccountInfo);
},
this.connection.commitment,
filters
);
return raydiumSubscription;
}
The intention here is to track not only liquidity pools on Raydium, but also when specific accounts interact with Raydium to create liquidity pools. For example, in some cases, external programs like Pump Fun or bonding curve mechanisms interact with Raydium to create or modify pools, yet this code doesn’t seem to capture those interactions. Similarly, I’d like to track interactions on token creation or liquidity pool pages, specifically to capture the pool keys associated with those actions.
Is there a way to modify this setup to capture these events more reliably, similar to how we’d capture direct Raydium events?
Quote
Report
Ake · External communityPost link
External answer — Solana Stack Exchange
Author: Ake
Original post: https://solana.stackexchange.com/a/18477
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
What you want is listening to all
initialize2
instruction containing transactions and decoding them with one of the
Raydium IDLs
.
As a working solution example (and since you mentioned pump.fun), here's one that uses blockSubscribe and the Rayidum AMM idl and prints the new tokens and new pools.
See
Listening to pump.fun migrations to Raydium
.
You can tune it for your needs, it's the same process.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Solana Stack Exchange Author: David Source score (net votes, not local likes): 0 Original post: https://solana.stackexchange.com/questions/17141 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm setting up a listener to track changes in Raydium pools using onProgramAccountChange on Solana. My goal is to detect when certain external accounts interact with or initialize Raydium liquidity pools. However, it seems like the updates aren’t being captured as expected when these accounts perform specific actions, like creating or updating a pool. Here’s a simplified version of the subscription code: private async subscribeToRaydiumPools(config: { quoteToken: Token }) { const filters = [ { dataSize: LIQUIDITY_STATE_LAYOUT_V4.span }, { memcmp: { offset: LIQUIDITY_STATE_LAYOUT_V4.offsetOf('quoteMint'), bytes: config.quoteToken.mint.toBase58(), }, }, // Additional filters… ]; const raydiumSubscription = this.connection.onProgramAccountChange( MAINNET_PROGRAM_ID.AmmV4, async (updatedAccountInfo) => { this.emit('pool', updatedAccountInfo); }, this.connection.commitment, filters ); return raydiumSubscription; } The intention here is to track not only liquidity pools on Raydium, but also when specific accounts interact with Raydium to create liquidity pools. For example, in some cases, external programs like Pump Fun or bonding curve mechanisms interact with Raydium to create or modify pools, yet this code doesn’t seem to capture those interactions. Similarly, I’d like to track interactions on token creation or liquidity pool pages, specifically to capture the pool keys associated with those actions. Is there a way to modify this setup to capture these events more reliably, similar to how we’d capture direct Raydium events?
Checking account access…