Skip to content

Commit 4f70930

Browse files
committed
fix: missing event limit max overrides on a few endpoints
1 parent f3071a3 commit 4f70930

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/api/routes/tx.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export const TxRoutes: FastifyPluginAsync<
398398
address: Type.Optional(PrincipalSchema),
399399
type: Type.Optional(Type.Array(TransactionEventTypeSchema)),
400400
offset: OffsetParam(),
401-
limit: LimitParam(ResourceType.Event),
401+
limit: LimitParam(ResourceType.Event, undefined, undefined, 100),
402402
}),
403403
response: {
404404
200: TransactionEventsResponseSchema,
@@ -478,7 +478,7 @@ export const TxRoutes: FastifyPluginAsync<
478478
tx_id: TransactionIdParamSchema,
479479
}),
480480
querystring: Type.Object({
481-
event_limit: LimitParam(ResourceType.Event),
481+
event_limit: LimitParam(ResourceType.Event, undefined, undefined, 100),
482482
event_offset: OffsetParam(),
483483
unanchored: UnanchoredParamSchema,
484484
}),
@@ -572,7 +572,7 @@ export const TxRoutes: FastifyPluginAsync<
572572
}),
573573
querystring: Type.Object({
574574
offset: OffsetParam(),
575-
limit: LimitParam(ResourceType.Tx),
575+
limit: LimitParam(ResourceType.Tx, undefined, undefined, 200),
576576
}),
577577
response: {
578578
200: PaginatedResponse(TransactionSchema, { description: 'List of transactions' }),

src/api/schemas/params.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ export const OffsetParam = (title?: string, description?: string) =>
1212
})
1313
);
1414

15-
export const LimitParam = (resource: ResourceType, title?: string, description?: string) =>
15+
export const LimitParam = (
16+
resource: ResourceType,
17+
title?: string,
18+
description?: string,
19+
limitOverride?: number
20+
) =>
1621
Type.Optional(
1722
Type.Integer({
1823
minimum: 0,
1924
default: pagingQueryLimits[resource].defaultLimit,
20-
maximum: pagingQueryLimits[resource].maxLimit,
25+
maximum: limitOverride ?? pagingQueryLimits[resource].maxLimit,
2126
title: title ?? 'Limit',
2227
description: description ?? 'Results per page',
2328
})

0 commit comments

Comments
 (0)