Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/staking/src/app/api/v1/locked_accounts/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import type { NextRequest } from "next/server";
import { z } from "zod";

import { IS_MAINNET, RPC } from "../../../../config/server";
import { tokensToString } from "../../../../tokens";

const UnlockScheduleSchema = z.object({
date: z.date(),
amount: z.number(),
amount: z.string(),
});

const LockSchema = z.object({
Expand All @@ -19,7 +20,7 @@ const LockSchema = z.object({
const ResponseSchema = z.array(
z.object({
custodyAccount: z.string(),
actualAmount: z.number(),
actualAmount: z.string(),
lock: LockSchema,
}),
);
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: tokensToString(custodyAccount.amount),
lock: {
type: lock.type,
schedule: lock.schedule.map((unlock) => ({
date: unlock.date,
amount: Number(unlock.amount),
amount: tokensToString(unlock.amount),
})),
},
};
Expand Down
Loading