Skip to content

Commit

Permalink
fix(staking): use Pyth units in locked accounts api
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvankhademi committed Sep 26, 2024
1 parent 4f983ee commit f2107b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/staking/src/app/api/v1/locked_accounts/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PythStakingClient } from "@pythnetwork/staking-sdk";
import { FRACTION_PRECISION } from "@pythnetwork/staking-sdk/src/constants";
import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
import { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js";
import type { NextRequest } from "next/server";
Expand Down Expand Up @@ -76,12 +77,12 @@ export async function GET(req: NextRequest) {
const lock = await stakingClient.getUnlockSchedule(position, true);
return {
custodyAccount: custodyAccount.address.toBase58(),
actualAmount: Number(custodyAccount.amount),
actualAmount: Number(custodyAccount.amount) / FRACTION_PRECISION,
lock: {
type: lock.type,
schedule: lock.schedule.map((unlock) => ({
date: unlock.date,
amount: Number(unlock.amount),
amount: Number(unlock.amount) / FRACTION_PRECISION,
})),
},
};
Expand Down

0 comments on commit f2107b1

Please sign in to comment.