Skip to content

Commit

Permalink
Remove strict pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
gostkin committed Dec 21, 2023
1 parent 9cb536a commit 7b9117b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
12 changes: 0 additions & 12 deletions webserver/server/app/controllers/DelegationForPoolController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ export class DelegationForPoolController extends Controller {
);
}

const slotRangeSize = requestBody.range.maxSlot - requestBody.range.minSlot;
if (slotRangeSize > POOL_DELEGATION_LIMIT.SLOT_RANGE) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return errorResponse(
StatusCodes.BAD_REQUEST,
genErrorMessage(Errors.SlotRangeLimitExceeded, {
limit: POOL_DELEGATION_LIMIT.SLOT_RANGE,
found: slotRangeSize,
})
);
}

const response = await tx<DelegationForPoolResponse>(pool, async dbTx => {
const data = await delegationsForPool({
pools: requestBody.pools.map(poolId => Buffer.from(poolId, 'hex')),
Expand Down
24 changes: 0 additions & 24 deletions webserver/server/app/controllers/ProjectedNftRangeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import type { EndpointTypes } from '../../../shared/routes';
import { Routes } from '../../../shared/routes';
import { projectedNftRange, projectedNftRangeByAddress } from '../services/ProjectedNftRange';
import type {ProjectedNftRangeResponse} from '../../../shared/models/ProjectedNftRange';
import {PROJECTED_NFT_LIMIT} from "../../../shared/constants";
import {Errors, genErrorMessage} from "../../../shared/errors";

const route = Routes.projectedNftEventsRange;

Expand All @@ -28,30 +26,8 @@ export class ProjectedNftRangeController extends Controller {
const slotRangeSize = requestBody.range.maxSlot - requestBody.range.minSlot;

if (requestBody.address !== undefined) {
if (slotRangeSize > PROJECTED_NFT_LIMIT.SINGLE_USER_SLOT_RANGE) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return errorResponse(
StatusCodes.BAD_REQUEST,
genErrorMessage(Errors.SlotRangeLimitExceeded, {
limit: PROJECTED_NFT_LIMIT.SINGLE_USER_SLOT_RANGE,
found: slotRangeSize,
})
);
}

return await this.handle_by_address_query(requestBody.address, requestBody);
} else {
if (slotRangeSize > PROJECTED_NFT_LIMIT.SLOT_RANGE) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return errorResponse(
StatusCodes.BAD_REQUEST,
genErrorMessage(Errors.SlotRangeLimitExceeded, {
limit: PROJECTED_NFT_LIMIT.SLOT_RANGE,
found: slotRangeSize,
})
);
}

return await this.handle_general_query(requestBody);
}
}
Expand Down
6 changes: 0 additions & 6 deletions webserver/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,4 @@ export const DEX_PRICE_LIMIT = {

export const POOL_DELEGATION_LIMIT = {
POOLS: 50,
SLOT_RANGE: 20000,
};

export const PROJECTED_NFT_LIMIT = {
SLOT_RANGE: 100000,
SINGLE_USER_SLOT_RANGE: 10000000000,
};

0 comments on commit 7b9117b

Please sign in to comment.