forked from mito-systems/sol-mem-gen
Remove quotes service injection in server
This commit is contained in:
parent
2e735c51dd
commit
b886aca067
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user