Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: query param until_block not working in several endpoints #2101

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/api/query-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function parseUntilBlockQuery(
): undefined | number | string {
if (!untilBlock) return;
if (typeof untilBlock === 'string') {
if (unanchored !== undefined) {
if (unanchored) {
// if mutually exclusive unachored is also specified, throw bad request error
throw new InvalidRequestError(
`can't handle both 'unanchored' and 'until_block' in the same request`,
`can't handle both 'unanchored=true' and 'until_block' in the same request`,
InvalidRequestErrorType.bad_request
);
}
Expand Down
6 changes: 6 additions & 0 deletions src/tests/address-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,12 @@ describe('address tests', () => {
};
expect(JSON.parse(fetchAddrBalance1.text)).toEqual(expectedResp1);

const fetchAddrBalance1AtBlock = await supertest(api.server).get(
`/extended/v1/address/${testAddr2}/balances?until_block=1`
);
expect(fetchAddrBalance1AtBlock.status).toBe(200);
expect(fetchAddrBalance1AtBlock.type).toBe('application/json');

const fetchAddrBalance2 = await supertest(api.server).get(
`/extended/v1/address/${testContractAddr}/balances`
);
Expand Down
Loading