mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-09 20:12:06 +10:00
25 lines
891 B
TypeScript
25 lines
891 B
TypeScript
import { Filter, FilterResult } from './pool-filters';
|
|
import { Connection } from '@solana/web3.js';
|
|
import { LiquidityStateV4 } from '@raydium-io/raydium-sdk';
|
|
import { logger } from '../helpers';
|
|
|
|
export class BurnFilter implements Filter {
|
|
constructor(private readonly connection: Connection) {}
|
|
|
|
async execute(poolState: LiquidityStateV4): Promise<FilterResult> {
|
|
try {
|
|
const amount = await this.connection.getTokenSupply(poolState.lpMint, this.connection.commitment);
|
|
const burned = amount.value.uiAmount === 0;
|
|
return { ok: burned, message: burned ? undefined : "Burned -> Creator didn't burn LP" };
|
|
} catch (e: any) {
|
|
if (e.code == -32602) {
|
|
return { ok: true };
|
|
}
|
|
|
|
logger.error({ mint: poolState.baseMint }, `Failed to check if LP is burned`);
|
|
}
|
|
|
|
return { ok: false, message: 'Failed to check if LP is burned' };
|
|
}
|
|
}
|