From 9768a6792c9aa21a5e3ec5dd5140c2371965281c Mon Sep 17 00:00:00 2001 From: rdlrt <3169068+rdlrt@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:27:15 +1000 Subject: [PATCH] Fix specs for voter_proposal_list --- .../rpc/governance/voter_proposal_list.sql | 8 ++--- specs/results/koiosapi-guild.yaml | 33 +++++++++++++++++++ specs/results/koiosapi-mainnet.yaml | 33 +++++++++++++++++++ specs/results/koiosapi-preprod.yaml | 33 +++++++++++++++++++ specs/results/koiosapi-preview.yaml | 33 +++++++++++++++++++ specs/templates/2-api-params.yaml | 10 ++++++ specs/templates/api-main.yaml | 23 +++++++++++++ 7 files changed, 169 insertions(+), 4 deletions(-) diff --git a/files/grest/rpc/governance/voter_proposal_list.sql b/files/grest/rpc/governance/voter_proposal_list.sql index ddbafba1..14810f9a 100644 --- a/files/grest/rpc/governance/voter_proposal_list.sql +++ b/files/grest/rpc/governance/voter_proposal_list.sql @@ -1,4 +1,4 @@ -CREATE OR REPLACE FUNCTION grest.voter_proposal_list(credential text) +CREATE OR REPLACE FUNCTION grest.voter_proposal_list(_credential text) RETURNS TABLE ( block_time integer, proposal_tx_hash text, @@ -31,11 +31,11 @@ DECLARE _gap_id_list bigint[]; BEGIN - SELECT INTO _drep_id id FROM public.drep_hash WHERE raw = DECODE(credential, 'hex'); + SELECT INTO _drep_id id FROM public.drep_hash WHERE raw = DECODE(_credential, 'hex'); IF _drep_id IS NULL THEN - SELECT INTO _spo_id id FROM public.pool_hash WHERE hash_raw = DECODE(credential, 'hex'); + SELECT INTO _spo_id id FROM public.pool_hash WHERE hash_raw = DECODE(_credential, 'hex'); ELSIF _spo_id IS NULL THEN - SELECT INTO _committee_member_id id FROM public.committee_hash WHERE raw = DECODE(credential, 'hex'); + SELECT INTO _committee_member_id id FROM public.committee_hash WHERE raw = DECODE(_credential, 'hex'); END IF; SELECT INTO _gap_id_list ARRAY_AGG(gov_action_proposal_id) diff --git a/specs/results/koiosapi-guild.yaml b/specs/results/koiosapi-guild.yaml index 80ab5c57..971c02dc 100644 --- a/specs/results/koiosapi-guild.yaml +++ b/specs/results/koiosapi-guild.yaml @@ -1515,6 +1515,29 @@ paths: summary: Proposals List description: List of all governance proposals operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + /proposal_votes: #RPC get: tags: @@ -2066,6 +2089,16 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r" + in: query + required: true + allowEmptyValue: false _drep_id: deprecated: false name: _drep_id diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index 400f2a87..52dc9b8c 100644 --- a/specs/results/koiosapi-mainnet.yaml +++ b/specs/results/koiosapi-mainnet.yaml @@ -1515,6 +1515,29 @@ paths: summary: Proposals List description: List of all governance proposals operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + /proposal_votes: #RPC get: tags: @@ -2066,6 +2089,16 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3" + in: query + required: true + allowEmptyValue: false _drep_id: deprecated: false name: _drep_id diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index 4f83995e..ed6454ca 100644 --- a/specs/results/koiosapi-preprod.yaml +++ b/specs/results/koiosapi-preprod.yaml @@ -1515,6 +1515,29 @@ paths: summary: Proposals List description: List of all governance proposals operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + /proposal_votes: #RPC get: tags: @@ -2066,6 +2089,16 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + in: query + required: true + allowEmptyValue: false _drep_id: deprecated: false name: _drep_id diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index eb3e4174..8d3d3bff 100644 --- a/specs/results/koiosapi-preview.yaml +++ b/specs/results/koiosapi-preview.yaml @@ -1515,6 +1515,29 @@ paths: summary: Proposals List description: List of all governance proposals operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + /proposal_votes: #RPC get: tags: @@ -2066,6 +2089,16 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + in: query + required: true + allowEmptyValue: false _drep_id: deprecated: false name: _drep_id diff --git a/specs/templates/2-api-params.yaml b/specs/templates/2-api-params.yaml index 2c72440f..d26b348e 100644 --- a/specs/templates/2-api-params.yaml +++ b/specs/templates/2-api-params.yaml @@ -79,6 +79,16 @@ parameters: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "##_drep_id_param##" + in: query + required: true + allowEmptyValue: false _drep_id: deprecated: false name: _drep_id diff --git a/specs/templates/api-main.yaml b/specs/templates/api-main.yaml index 0fcd5213..c42901a1 100644 --- a/specs/templates/api-main.yaml +++ b/specs/templates/api-main.yaml @@ -1370,6 +1370,29 @@ paths: summary: Proposals List description: List of all governance proposals operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + /proposal_votes: #RPC get: tags: