From b886aca06703a295688ab0c26457302547699cf4 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Thu, 30 Jan 2025 15:45:17 +0530 Subject: [PATCH] Remove quotes service injection in server --- quotes-service.ts | 6 +++--- server.ts | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/quotes-service.ts b/quotes-service.ts index bfdb871..bb3d72a 100644 --- a/quotes-service.ts +++ b/quotes-service.ts @@ -24,10 +24,10 @@ class QuotesService { const quoteResponse = await response.json(); // Handle price with Big.js, then convert to BN - const priceFromAPI = new Big(quoteResponse['data'][USDC_MINT]['price']).toFixed(6); - const price = new BN(new Big(priceFromAPI).times(new Big(10).pow(6)).toString()); + const priceMTMFor1USDC = new Big(quoteResponse['data'][USDC_MINT]['price']).toFixed(6); + 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) { this.cachedQuotes.shift(); } diff --git a/server.ts b/server.ts index 8ee34d4..86253c6 100644 --- a/server.ts +++ b/server.ts @@ -29,7 +29,6 @@ declare global { app.prepare().then(() => { const server = createServer(async (req, res) => { const parsedUrl = parse(req.url!, true); - (req as any).quotesService = quotesService; handle(req, res, parsedUrl); });