mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-18 02:31:18 +10:00
tsc & prettier
This commit is contained in:
@ -1,36 +1,36 @@
|
||||
import { Filter, FilterResult } from './pool-filters';
|
||||
import { Connection } from '@solana/web3.js';
|
||||
import { LiquidityPoolKeysV4 } from '@raydium-io/raydium-sdk';
|
||||
import { logger } from '../helpers';
|
||||
import { Filter, FilterResult } from "./pool-filters";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import { LiquidityPoolKeysV4 } from "@raydium-io/raydium-sdk";
|
||||
import { logger } from "../helpers";
|
||||
|
||||
export class BurnFilter implements Filter {
|
||||
private cachedResult: FilterResult | undefined = undefined;
|
||||
private cachedResult: FilterResult | undefined = undefined;
|
||||
|
||||
constructor(private readonly connection: Connection) {}
|
||||
constructor(private readonly connection: Connection) {}
|
||||
|
||||
async execute(poolKeys: LiquidityPoolKeysV4): Promise<FilterResult> {
|
||||
if (this.cachedResult) {
|
||||
return this.cachedResult;
|
||||
}
|
||||
async execute(poolKeys: LiquidityPoolKeysV4): Promise<FilterResult> {
|
||||
if (this.cachedResult) {
|
||||
return this.cachedResult;
|
||||
}
|
||||
|
||||
try {
|
||||
const amount = await this.connection.getTokenSupply(poolKeys.lpMint, this.connection.commitment);
|
||||
const burned = amount.value.uiAmount === 0;
|
||||
const result = { ok: burned, message: burned ? undefined : "Burned -> Creator didn't burn LP" };
|
||||
try {
|
||||
const amount = await this.connection.getTokenSupply(poolKeys.lpMint, this.connection.commitment);
|
||||
const burned = amount.value.uiAmount === 0;
|
||||
const result = { ok: burned, message: burned ? undefined : "Burned -> Creator didn't burn LP" };
|
||||
|
||||
if (result.ok) {
|
||||
this.cachedResult = result;
|
||||
}
|
||||
if (result.ok) {
|
||||
this.cachedResult = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (e: any) {
|
||||
if (e.code == -32602) {
|
||||
return { ok: true };
|
||||
}
|
||||
return result;
|
||||
} catch (e: any) {
|
||||
if (e.code == -32602) {
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
logger.error({ mint: poolKeys.baseMint }, `Failed to check if LP is burned`);
|
||||
}
|
||||
logger.error({ mint: poolKeys.baseMint }, `Failed to check if LP is burned`);
|
||||
}
|
||||
|
||||
return { ok: false, message: 'Failed to check if LP is burned' };
|
||||
}
|
||||
return { ok: false, message: "Failed to check if LP is burned" };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user