Remove quotes service injection in server

This commit is contained in:
Adw8 2025-01-30 15:45:17 +05:30
parent 2e735c51dd
commit b886aca067
2 changed files with 3 additions and 4 deletions

View File

@ -24,10 +24,10 @@ class QuotesService {
const quoteResponse = await response.json(); const quoteResponse = await response.json();
// Handle price with Big.js, then convert to BN // Handle price with Big.js, then convert to BN
const priceFromAPI = new Big(quoteResponse['data'][USDC_MINT]['price']).toFixed(6); const priceMTMFor1USDC = new Big(quoteResponse['data'][USDC_MINT]['price']).toFixed(6);
const price = new BN(new Big(priceFromAPI).times(new Big(10).pow(6)).toString()); const priceInBaseUnits = new BN(new Big(priceMTMFor1USDC).times(new Big(10).pow(6)).toString());
this.cachedQuotes.push(price); this.cachedQuotes.push(priceInBaseUnits);
if (this.cachedQuotes.length > 3) { if (this.cachedQuotes.length > 3) {
this.cachedQuotes.shift(); this.cachedQuotes.shift();
} }

View File

@ -29,7 +29,6 @@ declare global {
app.prepare().then(() => { app.prepare().then(() => {
const server = createServer(async (req, res) => { const server = createServer(async (req, res) => {
const parsedUrl = parse(req.url!, true); const parsedUrl = parse(req.url!, true);
(req as any).quotesService = quotesService;
handle(req, res, parsedUrl); handle(req, res, parsedUrl);
}); });