Skip to content

Commit ecf2335

Browse files
authored
Merge pull request #377 from wavesplatform/pairs-limit-increase
Pairs limit 1000
2 parents 7bf679b + 1933ada commit ecf2335

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/http/_common/filters/filters.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { DEFAULT_MAX_LIMIT } from './';
1212
import { CommonFilters } from './types';
1313

1414
// default limit is 100
15-
const limitFilter =
15+
export const limit =
1616
(max: number): CommonFilters['limit'] =>
1717
(raw) => {
1818
if (isNil(raw)) {
@@ -30,25 +30,25 @@ const limitFilter =
3030
};
3131

3232
// default sort is SortOrder.Descending
33-
const sortFilter: CommonFilters['sort'] = (s) =>
33+
const sort: CommonFilters['sort'] = (s) =>
3434
typeof s === 'undefined'
3535
? ok(undefined)
3636
: isSortOrder(s)
3737
? ok(s)
3838
: error(new ParseError(new Error('Invalid sort value')));
3939

40-
const afterFilter: CommonFilters['after'] = parseTrimmedStringIfDefined;
40+
const after: CommonFilters['after'] = parseTrimmedStringIfDefined;
4141

4242
export default {
4343
timeStart: parseDate,
4444
timeEnd: parseDate,
4545
blockTimeStart: parseDate,
4646
blockTimeEnd: parseDate,
47-
limit: limitFilter(DEFAULT_MAX_LIMIT),
47+
limit: limit(DEFAULT_MAX_LIMIT),
4848
sender: parseTrimmedStringIfDefined,
4949
senders: parseArrayQuery,
50-
sort: sortFilter,
51-
after: afterFilter,
50+
sort,
51+
after,
5252
ids: parseArrayQuery,
5353
query: parseTrimmedStringIfDefined,
5454
};

src/http/pairs/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import { parseArrayQuery, parseBool, parsePairs } from '../../utils/parsers';
1111
import { ParseArrayQuery } from '../../utils/parsers/parseArrayQuery';
1212
import { parseFilterValues } from '../_common/filters';
1313
import { ParsedFilterValues, Parser } from '../_common/filters/types';
14-
import commonFilters from '../_common/filters/filters';
14+
import commonFilters, { limit } from '../_common/filters/filters';
1515
import { withMatcher } from '../_common/utils';
1616

17+
const PAIRS_MAX_LIMIT = 1000;
18+
1719
export type ParseMatchExactly = Parser<boolean[]>;
1820
export const parseMatchExactly: ParseMatchExactly = (
1921
matchExactlyRaw?: string
@@ -40,6 +42,7 @@ export const mgetOrSearchParser = parseFilterValues({
4042
match_exactly: parseMatchExactly,
4143
search_by_asset: commonFilters.query,
4244
search_by_assets: parseArrayQuery as ParseArrayQuery, // merge function type and overloads
45+
limit: limit(PAIRS_MAX_LIMIT),
4346
});
4447

4548
type ParserFnType = typeof mgetOrSearchParser;

0 commit comments

Comments
 (0)