mirror of
https://github.com/fdundjer/solana-sniper-bot.git
synced 2025-11-15 09:11:18 +10:00
tsc & prettier
This commit is contained in:
30
cache/pool.cache.ts
vendored
30
cache/pool.cache.ts
vendored
@ -1,20 +1,20 @@
|
||||
import { LiquidityStateV4 } from '@raydium-io/raydium-sdk';
|
||||
import { logger } from '../helpers';
|
||||
import { LiquidityStateV4 } from "@raydium-io/raydium-sdk";
|
||||
import { logger } from "../helpers";
|
||||
|
||||
export class PoolCache {
|
||||
private readonly keys: Map<string, { id: string; state: LiquidityStateV4 }> = new Map<
|
||||
string,
|
||||
{ id: string; state: LiquidityStateV4 }
|
||||
>();
|
||||
private readonly keys: Map<string, { id: string; state: LiquidityStateV4 }> = new Map<
|
||||
string,
|
||||
{ id: string; state: LiquidityStateV4 }
|
||||
>();
|
||||
|
||||
public save(id: string, state: LiquidityStateV4) {
|
||||
if (!this.keys.has(state.baseMint.toString())) {
|
||||
logger.trace(`Caching new pool for mint: ${state.baseMint.toString()}`);
|
||||
this.keys.set(state.baseMint.toString(), { id, state });
|
||||
}
|
||||
}
|
||||
public save(id: string, state: LiquidityStateV4) {
|
||||
if (!this.keys.has(state.baseMint.toString())) {
|
||||
logger.trace(`Caching new pool for mint: ${state.baseMint.toString()}`);
|
||||
this.keys.set(state.baseMint.toString(), { id, state });
|
||||
}
|
||||
}
|
||||
|
||||
public async get(mint: string): Promise<{ id: string; state: LiquidityStateV4 }> {
|
||||
return this.keys.get(mint)!;
|
||||
}
|
||||
public async get(mint: string): Promise<{ id: string; state: LiquidityStateV4 }> {
|
||||
return this.keys.get(mint)!;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user