diff --git a/api/[net]/[address].ts b/api/[net]/[address].ts index 8dd539a79..bf2e299a4 100644 --- a/api/[net]/[address].ts +++ b/api/[net]/[address].ts @@ -1,7 +1,6 @@ import { VercelRequest, VercelResponse } from "@vercel/node"; import ECLIPSE_TESTNET_DATA from "../../data/final_data_testnet.json"; import ECLIPSE_MAINNET_DATA from "../../data/final_data_mainnet.json"; -import { BN } from "@coral-xyz/anchor"; interface IData { user: { @@ -43,6 +42,7 @@ export default function (req: VercelRequest, res: VercelResponse) { ); const { net, address } = req.query; + const pubkey = address as string; let currentData: ICachedData[]; @@ -54,11 +54,16 @@ export default function (req: VercelRequest, res: VercelResponse) { return res.status(400).send("INVALID NETWORK"); } + const offset = Number(req.query.offset) || 0; + const size = Number(req.query.size) || undefined; const userItem = currentData.find((item) => item.address === pubkey); const userData = address && userItem ? userItem : null; const finalData: IData = { user: userData ? { ...userData } : null, - leaderboard: currentData, + leaderboard: currentData.slice( + offset, + size ? offset + size : currentData.length + ), }; res.json(finalData); diff --git a/data/events_snap_testnet.json b/data/events_snap_testnet.json index 5c9913687..56bf076d8 100644 --- a/data/events_snap_testnet.json +++ b/data/events_snap_testnet.json @@ -899,4 +899,4 @@ ], "closed": [] } -} \ No newline at end of file +} diff --git a/data/previous_config_testnet.json b/data/previous_config_testnet.json index 2f6a9d654..86e43f4e8 100644 --- a/data/previous_config_testnet.json +++ b/data/previous_config_testnet.json @@ -1,3 +1,3 @@ { "lastTxHash": "3TXmTyeNnrGjWpM2ZhYSzWqcsXmUdzXxaLQm6K7T8WqvyLBv6MZMmbQq7NL9bwwPS83uZowLaX7jQ5xM4SpML4nQ" -} \ No newline at end of file +}