Skip to content

Commit

Permalink
chore: changelog
Browse files Browse the repository at this point in the history
fix: types

fix: types

fix: types
  • Loading branch information
vladimirvolek committed Dec 5, 2023
1 parent 8bcf08d commit bc84b7b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"cdbsync",
"dbsync",
"delegators",
"Drep",
"dreps",
"elgohr",
"emurgo",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- `/governance/dreps`
- `/governance/dreps/{hash}`
- `/governance/dreps/{hash}/distribution`
- feature flag to turn on/off `CIP-1694` support
- support for Cardano Sanchonet
- translation of cost models from numerical IDs to strings,
required for `cardano-db-sync 13.1.1.3` and newer [#130](https://github.com/blockfrost/blockfrost-backend-ryo/pull/130)
Expand Down
3 changes: 2 additions & 1 deletion src/routes/governance/dreps/hash/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import * as QueryTypes from '../../../../types/queries/blocks.js';
import * as ResponseTypes from '../../../../types/responses/blocks.js';
import { getDbSync } from '../../../../utils/database.js';
import { SQLQuery } from '../../../../sql/index.js';
import { DrepRequestParameters } from '../../../../types/queries/governance.js';

async function route(fastify: FastifyInstance) {
fastify.route({
url: '/governance/dreps/:hash/distribution',
method: 'GET',
// TODO: add schema when available
// schema: getSchemaForEndpoint('/governance/dreps/{hash}/distribution'),
handler: async (request: FastifyRequest<QueryTypes.RequestParameters>, reply) => {
handler: async (request: FastifyRequest<DrepRequestParameters>, reply) => {
const clientDbSync = await getDbSync(fastify);

const { rows }: { rows: ResponseTypes.Block[] } = await clientDbSync.query<QueryTypes.Block>(
Expand Down
3 changes: 2 additions & 1 deletion src/routes/governance/dreps/hash/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import * as ResponseTypes from '../../../../types/responses/blocks.js';
import { getDbSync } from '../../../../utils/database.js';
import { handle404 } from '../../../../utils/error-handler.js';
import { SQLQuery } from '../../../../sql/index.js';
import { DrepRequestParameters } from '../../../../types/queries/governance.js';

async function route(fastify: FastifyInstance) {
fastify.route({
url: '/governance/dreps/:hash',
method: 'GET',
// TODO: add schema when available
// schema: getSchemaForEndpoint('/governance/dreps/{hash}'),
handler: async (request: FastifyRequest<QueryTypes.RequestParameters>, reply) => {
handler: async (request: FastifyRequest<DrepRequestParameters>, reply) => {
const clientDbSync = await getDbSync(fastify);

const { rows }: { rows: ResponseTypes.Block[] } = await clientDbSync.query<QueryTypes.Block>(
Expand Down
3 changes: 2 additions & 1 deletion src/routes/governance/dreps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { SQLQuery } from '../../../sql/index.js';
import * as QueryTypes from '../../../types/queries/epochs.js';
import * as ResponseTypes from '../../../types/responses/epochs.js';
import { getDbSync } from '../../../utils/database.js';
import { DrepRequestParameters } from '../../../types/queries/governance.js';

async function route(fastify: FastifyInstance) {
fastify.route({
url: '/governance/dreps',
method: 'GET',
// TODO: add schema when available
// schema: getSchemaForEndpoint('/epochs/latest'),
handler: async (request: FastifyRequest<QueryTypes.RequestParameters>, reply) => {
handler: async (request: FastifyRequest<DrepRequestParameters>, reply) => {
const clientDbSync = await getDbSync(fastify);

try {
Expand Down
1 change: 0 additions & 1 deletion src/types/queries/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export type { ResultFound } from '../common.js';
export interface RequestParameters {
Params: {
hash_or_number: string;
hash: string;
};
Querystring: {
count: number;
Expand Down
1 change: 0 additions & 1 deletion src/types/queries/epochs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface RequestParameters {
Querystring: {
count: number;
page: number;
order: 'asc' | 'desc';
};
}

Expand Down
12 changes: 12 additions & 0 deletions src/types/queries/governance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Order } from '../common.js';

export interface DrepRequestParameters {
Params: {
hash: string;
};
Querystring: {
count: number;
page: number;
order: Order;
};
}

0 comments on commit bc84b7b

Please sign in to comment.