Skip to content

Commit

Permalink
Merge branch 'master' into actions
Browse files Browse the repository at this point in the history
  • Loading branch information
arihantbansal authored Jul 15, 2024
2 parents 2593ee8 + 51434aa commit d81a664
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,22 @@ router.get('/blinks/deposit', async (req: Request, res: Response) => {
});
await driftClient.subscribe();

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

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

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

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

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

Expand Down Expand Up @@ -166,7 +173,7 @@ router.get('/blinks/deposit', async (req: Request, res: Response) => {
disabled,
links,
};

driftClient.unsubscribe();

return res.json(response);
Expand Down

0 comments on commit d81a664

Please sign in to comment.