mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-17 10:11:08 +10:00
tsc & prettier
This commit is contained in:
52
cache/snipe-list.cache.ts
vendored
52
cache/snipe-list.cache.ts
vendored
@ -1,35 +1,35 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { logger, SNIPE_LIST_REFRESH_INTERVAL } from '../helpers';
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { logger, SNIPE_LIST_REFRESH_INTERVAL } from "../helpers";
|
||||
|
||||
export class SnipeListCache {
|
||||
private snipeList: string[] = [];
|
||||
private fileLocation = path.join(__dirname, '../snipe-list.txt');
|
||||
private snipeList: string[] = [];
|
||||
private fileLocation = path.join(__dirname, "../snipe-list.txt");
|
||||
|
||||
constructor() {
|
||||
setInterval(() => this.loadSnipeList(), SNIPE_LIST_REFRESH_INTERVAL);
|
||||
}
|
||||
constructor() {
|
||||
setInterval(() => this.loadSnipeList(), SNIPE_LIST_REFRESH_INTERVAL);
|
||||
}
|
||||
|
||||
public init() {
|
||||
this.loadSnipeList();
|
||||
}
|
||||
public init() {
|
||||
this.loadSnipeList();
|
||||
}
|
||||
|
||||
public isInList(mint: string) {
|
||||
return this.snipeList.includes(mint);
|
||||
}
|
||||
public isInList(mint: string) {
|
||||
return this.snipeList.includes(mint);
|
||||
}
|
||||
|
||||
private loadSnipeList() {
|
||||
logger.trace(`Refreshing snipe list...`);
|
||||
private loadSnipeList() {
|
||||
logger.trace(`Refreshing snipe list...`);
|
||||
|
||||
const count = this.snipeList.length;
|
||||
const data = fs.readFileSync(this.fileLocation, 'utf-8');
|
||||
this.snipeList = data
|
||||
.split('\n')
|
||||
.map((a) => a.trim())
|
||||
.filter((a) => a);
|
||||
const count = this.snipeList.length;
|
||||
const data = fs.readFileSync(this.fileLocation, "utf-8");
|
||||
this.snipeList = data
|
||||
.split("\n")
|
||||
.map((a) => a.trim())
|
||||
.filter((a) => a);
|
||||
|
||||
if (this.snipeList.length != count) {
|
||||
logger.info(`Loaded snipe list: ${this.snipeList.length}`);
|
||||
}
|
||||
}
|
||||
if (this.snipeList.length != count) {
|
||||
logger.info(`Loaded snipe list: ${this.snipeList.length}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user