Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7925

Raydium swap tracking

$
0
0

First of all I am new to Solana and Raydium (already build a dexsceener clone for Ethereum uniswap)

I am looking for some help to track swaps on Raydium, currently I do subscribe to the '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8', // Raydium Liquidity Pool V4

Check for ray_logs, any log with log_type: 3 or 4 I then decode.

const swapBaseInLog = struct([  u8('log_type'),  u64('amount_in'),  u64('minimum_out'),  u64('direction'),  u64('user_source'),  u64('pool_coin'),  u64('pool_pc'),  u64('out_amount'),]);const swapBaseOutLog = struct([  u8('log_type'),  u64('max_in'),  u64('amount_out'),  u64('direction'),  u64('user_source'),  u64('pool_coin'),  u64('pool_pc'),  u64('deduct_in'),]);export const logTypeToStruct = new Map([  [3, swapBaseInLog],   // Assuming `log_type` 4 is for `swapBaseInLog`  [4, swapBaseOutLog],  // Assuming `log_type` 5 is for `swapBaseOutLog`]);// decoded result{  log_type: 3,  amount_in: 1000000000n, // amount that went into the pool  minimum_out: 16010218519n,  direction: 2n, // direction: 1 = base to quote, 2 = quote to base  user_source: 1000000000n,  pool_coin: 1239979198994n, // new baseToken liquidity (reserves) amount  pool_pc: 21473529774465n, // new quoteToken liquidity (reserves) amount  out_amount: 17260473921n // amount that went out of the pool}

But at this point I am stuck as to which pool/token these logs belong to?

For the current project I am only interested in a few pool, not all, I do have a list of pools, but its to much to open a subscription for each pool.

ChatGpt is no help at this point, discord dev channel for raydium also no help, my last changce is posting a question here hoping that somone has some info to help me get to the next step.

Thanks.


Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>