Skip to content

Commit

Permalink
subscribe to drift client
Browse files Browse the repository at this point in the history
  • Loading branch information
arihantbansal committed Jul 13, 2024
1 parent ce45cab commit d76c2a7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
BulkAccountLoader,
calculateDepositRate,
convertToNumber,
PERCENTAGE_PRECISION,
} from '@drift-labs/sdk';
import {
clamp,
Expand Down Expand Up @@ -114,15 +113,14 @@ router.get('/blinks/deposit', async (req: Request, res: Response) => {
accountLoader: bulkAccountLoader,
},
});
await driftClient.subscribe();

let title = `Deposit ${depositToken} into Drift`;

const spotMarket = driftClient.getSpotMarketAccount(spotMarketConfig.marketIndex);

if (spotMarket) {
const apr = convertToNumber(calculateDepositRate(spotMarket), new BN(PERCENTAGE_PRECISION));

console.log('APR:', apr);
const apr = convertToNumber(calculateDepositRate(spotMarket), new BN(10000));

if (apr >= 0.1) {
title = `Deposit ${depositToken} into Drift and earn ${apr}% APR`;
Expand Down

0 comments on commit d76c2a7

Please sign in to comment.