Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 1x | import { DISCRIMINATORS } from '../../constants';
import { PoolEventType } from '../../types';
import { RaydiumLiquidityParserBase, ParseEventConfig } from './parser-raydium-liquidity-base';
export class RaydiumV4PoolParser extends RaydiumLiquidityParserBase {
public getPoolAction(data: Buffer): PoolEventType | null {
const instructionType = data.slice(0, 1);
Iif (instructionType.equals(DISCRIMINATORS.RAYDIUM.CREATE)) return 'CREATE';
Iif (instructionType.equals(DISCRIMINATORS.RAYDIUM.ADD_LIQUIDITY)) return 'ADD';
Iif (instructionType.equals(DISCRIMINATORS.RAYDIUM.REMOVE_LIQUIDITY)) return 'REMOVE';
return null;
}
public getEventConfig(type: PoolEventType): ParseEventConfig {
const configs = {
CREATE: { eventType: 'CREATE' as const, poolIdIndex: 4, lpMintIndex: 7 },
ADD: { eventType: 'ADD' as const, poolIdIndex: 1, lpMintIndex: 5 },
REMOVE: { eventType: 'REMOVE' as const, poolIdIndex: 1, lpMintIndex: 5 },
};
return configs[type];
}
}
|