From 60bb81e37f3f5384c897470aa81f33011a4a5f36 Mon Sep 17 00:00:00 2001 From: 1000101 Date: Sun, 10 Dec 2023 17:04:30 +0100 Subject: [PATCH] chore(dreps): update --- openapi.json | 74 ++++++++++++++++++- openapi.yaml | 48 +++++++++++- src/definitions.yaml | 10 ++- src/generated-types.ts | 47 +++++++++++- .../governance/dreps/{hash}/delegators.yaml | 58 +++++++++++++++ .../api/governance/dreps/{hash}/index.yaml | 14 +++- .../{distribution.yaml => metadata.yaml} | 16 +++- .../api/governance/dreps/{hash}/updates.yaml | 60 +++++++++++++++ .../governance/drep_distribution_content.yaml | 22 ------ 9 files changed, 312 insertions(+), 37 deletions(-) create mode 100644 src/paths/api/governance/dreps/{hash}/delegators.yaml rename src/paths/api/governance/dreps/{hash}/{distribution.yaml => metadata.yaml} (51%) create mode 100644 src/paths/api/governance/dreps/{hash}/updates.yaml delete mode 100644 src/schemas/governance/drep_distribution_content.yaml diff --git a/openapi.json b/openapi.json index 0010a1ae..b93dff16 100644 --- a/openapi.json +++ b/openapi.json @@ -998,6 +998,42 @@ } } }, + "/governance/dreps/{hash}/delegators": { + "get": { + "tags": [ + "Cardano » Governance" + ], + "summary": "xxx", + "description": "xxx", + "responses": { + "200": { + "description": "xxx", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/drep_delegators" + } + } + } + }, + "400": { + "$ref": "#/components/responses/400" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "418": { + "$ref": "#/components/responses/418" + }, + "429": { + "$ref": "#/components/responses/429" + }, + "500": { + "$ref": "#/components/responses/500" + } + } + } + }, "/governance/dreps/{hash}/distribution": { "get": { "tags": [ @@ -1011,7 +1047,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/drep_distribution_content" + "$ref": "#/components/schemas/drep_distribution" } } } @@ -7659,7 +7695,41 @@ } ] }, - "drep_distribution_content": { + "drep_delegators": { + "type": "array", + "items": { + "type": "object", + "properties": { + "address": { + "type": "string", + "description": "Bech32 encoded stake addresses" + }, + "amount": { + "type": "string", + "description": "Currently delegated amount" + } + }, + "required": [ + "address", + "amount" + ] + }, + "example": [ + { + "address": "stake1ux4vspfvwuus9uwyp5p3f0ky7a30jq5j80jxse0fr7pa56sgn8kha", + "amount": "1137959159981411" + }, + { + "address": "stake1uylayej7esmarzd4mk4aru37zh9yz0luj3g9fsvgpfaxulq564r5u", + "amount": "16958865648" + }, + { + "address": "stake1u8lr2pnrgf8f7vrs9lt79hc3sxm8s2w4rwvgpncks3axx6q93d4ck", + "amount": "18605647" + } + ] + }, + "drep_distribution": { "type": "array", "items": { "type": "object", diff --git a/openapi.yaml b/openapi.yaml index ff03eb3c..56304edf 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -892,6 +892,29 @@ paths: $ref: '#/components/responses/429' '500': $ref: '#/components/responses/500' + /governance/dreps/{hash}/delegators: + get: + tags: + - Cardano » Governance + summary: xxx + description: xxx + responses: + '200': + description: xxx + content: + application/json: + schema: + $ref: '#/components/schemas/drep_delegators' + '400': + $ref: '#/components/responses/400' + '403': + $ref: '#/components/responses/403' + '418': + $ref: '#/components/responses/418' + '429': + $ref: '#/components/responses/429' + '500': + $ref: '#/components/responses/500' /governance/dreps/{hash}/distribution: get: tags: @@ -904,7 +927,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/drep_distribution_content' + $ref: '#/components/schemas/drep_distribution' '400': $ref: '#/components/responses/400' '403': @@ -5615,7 +5638,28 @@ components: amount: '2000000' is_registered: true has_script: true - drep_distribution_content: + drep_delegators: + type: array + items: + type: object + properties: + address: + type: string + description: Bech32 encoded stake addresses + amount: + type: string + description: Currently delegated amount + required: + - address + - amount + example: + - address: stake1ux4vspfvwuus9uwyp5p3f0ky7a30jq5j80jxse0fr7pa56sgn8kha + amount: '1137959159981411' + - address: stake1uylayej7esmarzd4mk4aru37zh9yz0luj3g9fsvgpfaxulq564r5u + amount: '16958865648' + - address: stake1u8lr2pnrgf8f7vrs9lt79hc3sxm8s2w4rwvgpncks3axx6q93d4ck + amount: '18605647' + drep_distribution: type: array items: type: object diff --git a/src/definitions.yaml b/src/definitions.yaml index ca0ad8af..7fb1f1a9 100644 --- a/src/definitions.yaml +++ b/src/definitions.yaml @@ -334,8 +334,14 @@ paths: /governance/dreps/{hash}: $ref: ./paths/api/governance/dreps/{hash}/index.yaml - /governance/dreps/{hash}/distribution: - $ref: ./paths/api/governance/dreps/{hash}/distribution.yaml + /governance/dreps/{hash}/delegators: + $ref: ./paths/api/governance/dreps/{hash}/delegators.yaml + + /governance/dreps/{hash}/metadata: + $ref: ./paths/api/governance/dreps/{hash}/metadata.yaml + + /governance/dreps/{hash}/updates: + $ref: ./paths/api/governance/dreps/{hash}/updates.yaml # /governance/proposals: # $ref: ./paths/api/governance/proposals/index.yaml diff --git a/src/generated-types.ts b/src/generated-types.ts index 80effbc9..11fdb3b1 100644 --- a/src/generated-types.ts +++ b/src/generated-types.ts @@ -476,6 +476,27 @@ export interface paths { }; }; }; + "/governance/dreps/{hash}/delegators": { + /** + * xxx + * @description xxx + */ + get: { + responses: { + /** @description xxx */ + 200: { + content: { + "application/json": components["schemas"]["drep_delegators"]; + }; + }; + 400: components["responses"]["400"]; + 403: components["responses"]["403"]; + 418: components["responses"]["418"]; + 429: components["responses"]["429"]; + 500: components["responses"]["500"]; + }; + }; + }; "/governance/dreps/{hash}/distribution": { /** * xxx @@ -486,7 +507,7 @@ export interface paths { /** @description xxx */ 200: { content: { - "application/json": components["schemas"]["drep_distribution_content"]; + "application/json": components["schemas"]["drep_distribution"]; }; }; 400: components["responses"]["400"]; @@ -3939,6 +3960,28 @@ export interface components { /** @description Flag which shows if this DRep credentials are a script hash */ has_script: boolean; }[]; + /** + * @example [ + * { + * "address": "stake1ux4vspfvwuus9uwyp5p3f0ky7a30jq5j80jxse0fr7pa56sgn8kha", + * "amount": "1137959159981411" + * }, + * { + * "address": "stake1uylayej7esmarzd4mk4aru37zh9yz0luj3g9fsvgpfaxulq564r5u", + * "amount": "16958865648" + * }, + * { + * "address": "stake1u8lr2pnrgf8f7vrs9lt79hc3sxm8s2w4rwvgpncks3axx6q93d4ck", + * "amount": "18605647" + * } + * ] + */ + drep_delegators: { + /** @description Bech32 encoded stake addresses */ + address: string; + /** @description Currently delegated amount */ + amount: string; + }[]; /** * @example [ * { @@ -3951,7 +3994,7 @@ export interface components { * } * ] */ - drep_distribution_content: ({ + drep_distribution: ({ /** @description The total amount of voting power this DRep is delegated. */ amount: string; /** @description The epoch no this distribution is about. */ diff --git a/src/paths/api/governance/dreps/{hash}/delegators.yaml b/src/paths/api/governance/dreps/{hash}/delegators.yaml new file mode 100644 index 00000000..ece82a32 --- /dev/null +++ b/src/paths/api/governance/dreps/{hash}/delegators.yaml @@ -0,0 +1,58 @@ +get: + tags: + - Cardano » Governance + summary: DRep pool delegators + description: List of Drep delegators. + parameters: + - in: path + name: drep_id + required: true + schema: + type: string + description: Bech32 or hexadecimal drep ID. + example: "drep1mvdu8slennngja7w4un6knwezufra70887zuxpprd64jxfveahn" + - in: query + name: count + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 100 + description: The number of results displayed on one page. + - in: query + name: page + required: false + schema: + type: integer + minimum: 1 + maximum: 21474836 + default: 1 + description: The page number for listing the results. + - in: query + name: order + required: false + schema: + type: string + enum: [asc, desc] + default: asc + description: | + The ordering of items from the point of view of the blockchain, + not the page listing itself. By default, we return oldest first, newest last. + responses: + "200": + description: Return the DRep delegations + content: + application/json: + schema: + $ref: ../../../../../schemas/governance/drep_delegators.yaml + "400": + $ref: ../../../../../responses/errors/400.yaml + "403": + $ref: ../../../../../responses/errors/403.yaml + "429": + $ref: ../../../../../responses/errors/429.yaml + "418": + $ref: ../../../../../responses/errors/418.yaml + "500": + $ref: ../../../../../responses/errors/500.yaml diff --git a/src/paths/api/governance/dreps/{hash}/index.yaml b/src/paths/api/governance/dreps/{hash}/index.yaml index 49b8cb32..f2de4560 100644 --- a/src/paths/api/governance/dreps/{hash}/index.yaml +++ b/src/paths/api/governance/dreps/{hash}/index.yaml @@ -1,11 +1,19 @@ get: tags: - Cardano » Governance - summary: xxx - description: xxx + summary: Specific DRep + description: DRep information. + parameters: + - in: path + name: drep_id + required: true + schema: + type: string + description: Bech32 or hexadecimal DRep ID. + example: "drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc" responses: "200": - description: xxx + description: Return the DRep information content content: application/json: schema: diff --git a/src/paths/api/governance/dreps/{hash}/distribution.yaml b/src/paths/api/governance/dreps/{hash}/metadata.yaml similarity index 51% rename from src/paths/api/governance/dreps/{hash}/distribution.yaml rename to src/paths/api/governance/dreps/{hash}/metadata.yaml index b1caf708..77696c72 100644 --- a/src/paths/api/governance/dreps/{hash}/distribution.yaml +++ b/src/paths/api/governance/dreps/{hash}/metadata.yaml @@ -1,15 +1,23 @@ get: tags: - Cardano » Governance - summary: xxx - description: xxx + summary: Specific DRep + description: DRep information. + parameters: + - in: path + name: drep_id + required: true + schema: + type: string + description: Bech32 or hexadecimal DRep ID. + example: "drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc" responses: "200": - description: xxx + description: Return the DRep metadata content. content: application/json: schema: - $ref: ../../../../../schemas/governance/drep_distribution_content.yaml + $ref: ../../../../../schemas/governance/drep_metadata.yaml "400": $ref: ../../../../../responses/errors/400.yaml "403": diff --git a/src/paths/api/governance/dreps/{hash}/updates.yaml b/src/paths/api/governance/dreps/{hash}/updates.yaml new file mode 100644 index 00000000..c6890664 --- /dev/null +++ b/src/paths/api/governance/dreps/{hash}/updates.yaml @@ -0,0 +1,60 @@ +get: + tags: + - Cardano » Governance + summary: DRep updates + description: List of certificate updates to the DRep. + parameters: + - in: path + name: drep_id + required: true + schema: + type: string + description: Bech32 or hexadecimal DRep ID. + example: "drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc" + - in: query + name: count + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 100 + description: The number of results displayed on one page. + - in: query + name: page + required: false + schema: + type: integer + minimum: 1 + maximum: 21474836 + default: 1 + description: The page number for listing the results. + - in: query + name: order + required: false + schema: + type: string + enum: [asc, desc] + default: asc + description: | + The ordering of items from the point of view of the blockchain, + not the page listing itself. By default, we return oldest first, newest last. + responses: + "200": + description: Return the Drep updates history + content: + application/json: + schema: + $ref: ../../../../schemas/governance/drep_updates.yaml + "400": + $ref: ../../../../responses/errors/400.yaml + "403": + $ref: ../../../../responses/errors/403.yaml + "404": + $ref: ../../../../responses/errors/404.yaml + "429": + $ref: ../../../../responses/errors/429.yaml + "418": + $ref: ../../../../responses/errors/418.yaml + "500": + $ref: ../../../../responses/errors/500.yaml diff --git a/src/schemas/governance/drep_distribution_content.yaml b/src/schemas/governance/drep_distribution_content.yaml deleted file mode 100644 index 33d3fb5b..00000000 --- a/src/schemas/governance/drep_distribution_content.yaml +++ /dev/null @@ -1,22 +0,0 @@ -type: array -items: - type: object - properties: - amount: - type: string - description: The total amount of voting power this DRep is delegated. - epoch: - type: integer - description: The epoch no this distribution is about. - active_until: - nullable: true - type: integer - description: The epoch no until this distribution is active. - required: - - amount - - epoch -example: - - amount: "2000000" - epoch: 432 - - amount: "300000000" - epoch: 433