Skip to content

Commit

Permalink
feat: from to in asset transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Aug 30, 2023
1 parent eb3047c commit 02c2c75
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- bumped blockfrost-tests to 2.8.0
- !from&to breaking change [] -> 400

### Added

- Flake now exports NixOS module
Expand Down
15 changes: 14 additions & 1 deletion src/routes/assets/asset/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { handleInvalidAsset } from '@blockfrost/blockfrost-utils/lib/fastify.js';
import {
getAdditionalParametersFromRequest,
handle400Custom,
handleInvalidAsset,
} from '@blockfrost/blockfrost-utils/lib/fastify.js';
import { validateAsset } from '@blockfrost/blockfrost-utils/lib/validation.js';
import { getSchemaForEndpoint } from '@blockfrost/openapi';
import { FastifyInstance, FastifyRequest } from 'fastify';
Expand All @@ -22,6 +26,15 @@ async function route(fastify: FastifyInstance) {
return handleInvalidAsset(reply);
}

const fromToParameters = getAdditionalParametersFromRequest(
request.query.from,
request.query.to,
);

if (fromToParameters === 'outOfRangeOrMalformedErr') {
return handle400Custom(reply, 'Invalid (malformed or out of range) from/to parameter(s).');
}

const clientDbSync = await getDbSync(fastify);

try {
Expand Down
2 changes: 2 additions & 0 deletions src/types/queries/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface RequestAssetsParameters {
count: number;
page: number;
order: Order;
from: string;
to: string;
};
}

Expand Down

0 comments on commit 02c2c75

Please sign in to comment.