Skip to content

Commit

Permalink
reworked coretime/info endpoint to be more informative
Browse files Browse the repository at this point in the history
  • Loading branch information
filvecchiato committed Dec 20, 2024
1 parent e8a0808 commit 2fc1636
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 132 deletions.
53 changes: 33 additions & 20 deletions docs/src/openapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,6 @@ paths:
schema:
pattern: '^0[xX][0-9a-fA-F]{1,64}$|[0-9]{1,12}'
type: string
- name: coreId
in: query
description: Core identifier.
required: false
schema:
pattern: '^0[xX][0-9a-fA-F]{1,64}$|[0-9]{1,12}'
type: string
responses:
"200":
description: successful operation
Expand Down Expand Up @@ -3223,8 +3216,37 @@ components:
$ref: '#/components/schemas/BlockIdentifiers'
configuration:
$ref: '#/components/schemas/CoretimeConfig'
saleInfo:
$ref: '#/components/schemas/CoretimeSaleInfo'
currentRegion:
type: object
properties:
start:
type: string
description: The start time.
end:
type: string
description: The end time.
cores:
type: object
properties:
total:
type: string
description: The total number of cores.
available:
type: string
description: The number of free cores.
sold:
type: string
description: The number of reserved cores.
currentCorePrice:
type: string
description: The current core price.
selloutPrice:
type: string
description: The sellout price.
firstCore:
type: string
description: The first core id.

CoretimeRelayInfoResponse:
type: object
properties:
Expand Down Expand Up @@ -3341,9 +3363,6 @@ components:
CoretimeConfig:
type: object
properties:
advanceNotice:
type: string
description: The advance notice.
interludeLength:
type: string
description: The interlude length.
Expand All @@ -3353,15 +3372,9 @@ components:
regionLength:
type: string
description: The region length.
idealBulkProportion:
type: string
description: The ideal bulk proportion.
renewalBump:
type: string
description: The renewal bump.
contributionTimeout:
RelayBlocksPerTimeslice:
type: string
description: The contribution timeout.
description: The number of relay chain blocks per timeslice.
CoretimeSaleInfo:
type: object
properties:
Expand Down
6 changes: 2 additions & 4 deletions src/controllers/coretime/CoretimeGenericController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ export default class CoretimeGenericController extends AbstractController<Coreti
CoretimeGenericController.sanitizedSend(res, await this.service.getCoretimeInfo(hash));
};

private getCoretimeCores: RequestHandler = async ({ query: { at, core } }, res): Promise<void> => {
private getCoretimeCores: RequestHandler = async ({ query: { at } }, res): Promise<void> => {
this.checkCoretimeModule();

const hash = await this.getHashFromAt(at);

const coreId = core ? (core as unknown as string) : undefined;

CoretimeGenericController.sanitizedSend(res, await this.service.getCoretimeCores(hash, coreId));
CoretimeGenericController.sanitizedSend(res, await this.service.getCoretimeCores(hash));
};

private checkCoretimeModule = (): void => {
Expand Down
Loading

0 comments on commit 2fc1636

Please sign in to comment.