Skip to content

Commit

Permalink
Add withdrawal to proposal list incl schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Scitz0 committed Jul 31, 2024
1 parent 8d134f9 commit 940cc77
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 21 deletions.
25 changes: 19 additions & 6 deletions files/grest/rpc/governance/proposal_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ RETURNS TABLE (
meta_url text,
meta_hash text,
meta_json jsonb,
comment text,
language text,
is_valid boolean
meta_comment text,
meta_language text,
meta_is_valid boolean,
withdrawal jsonb
)
LANGUAGE sql STABLE
AS $$
Expand All @@ -39,13 +40,25 @@ AS $$
va.url AS meta_url,
ENCODE(va.data_hash, 'hex') AS meta_hash,
ocvd.json AS meta_json,
ocvd.comment AS comment,
ocvd.language AS language,
ocvd.is_valid AS is_valid
ocvd.comment AS meta_comment,
ocvd.language AS meta_language,
ocvd.is_valid AS meta_is_valid,
CASE WHEN tw.id IS NULL THEN NULL
ELSE
JSONB_BUILD_OBJECT(
'stake_address', (
SELECT sa2.view
FROM stake_address AS sa2
WHERE sa2.id = tw.stake_address_id
),
'amount', tw.amount::text
)
END AS withdrawal
FROM public.gov_action_proposal AS gap
INNER JOIN public.tx ON gap.tx_id = tx.id
INNER JOIN public.block AS b ON tx.block_id = b.id
INNER JOIN public.stake_address AS sa ON gap.return_address = sa.id
LEFT JOIN public.treasury_withdrawal AS tw ON gap.id = tw.gov_action_proposal_id
LEFT JOIN public.voting_anchor AS va ON gap.voting_anchor_id = va.id
LEFT JOIN public.off_chain_vote_data AS ocvd ON va.id = ocvd.voting_anchor_id
ORDER BY
Expand Down
17 changes: 14 additions & 3 deletions specs/results/koiosapi-guild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5167,12 +5167,23 @@ components:
$ref: "#/components/schemas/drep_metadata/items/properties/hash"
meta_json:
$ref: "#/components/schemas/drep_metadata/items/properties/json"
comment:
meta_comment:
$ref: "#/components/schemas/drep_metadata/items/properties/comment"
language:
meta_language:
$ref: "#/components/schemas/drep_metadata/items/properties/language"
is_valid:
meta_is_valid:
$ref: "#/components/schemas/drep_metadata/items/properties/is_valid"
withdrawal:
type:
- object
- 'null'
description: If not null, The amount withdrawn from treasury into stake address by this this proposal
properties:
stake_address:
$ref: "#/components/schemas/account_history/items/properties/stake_address"
amount:
type: string
example: "31235800000"
proposal_votes:
type: array
description: List of all votes cast on specified governance action
Expand Down
17 changes: 14 additions & 3 deletions specs/results/koiosapi-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5167,12 +5167,23 @@ components:
$ref: "#/components/schemas/drep_metadata/items/properties/hash"
meta_json:
$ref: "#/components/schemas/drep_metadata/items/properties/json"
comment:
meta_comment:
$ref: "#/components/schemas/drep_metadata/items/properties/comment"
language:
meta_language:
$ref: "#/components/schemas/drep_metadata/items/properties/language"
is_valid:
meta_is_valid:
$ref: "#/components/schemas/drep_metadata/items/properties/is_valid"
withdrawal:
type:
- object
- 'null'
description: If not null, The amount withdrawn from treasury into stake address by this this proposal
properties:
stake_address:
$ref: "#/components/schemas/account_history/items/properties/stake_address"
amount:
type: string
example: "31235800000"
proposal_votes:
type: array
description: List of all votes cast on specified governance action
Expand Down
17 changes: 14 additions & 3 deletions specs/results/koiosapi-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5167,12 +5167,23 @@ components:
$ref: "#/components/schemas/drep_metadata/items/properties/hash"
meta_json:
$ref: "#/components/schemas/drep_metadata/items/properties/json"
comment:
meta_comment:
$ref: "#/components/schemas/drep_metadata/items/properties/comment"
language:
meta_language:
$ref: "#/components/schemas/drep_metadata/items/properties/language"
is_valid:
meta_is_valid:
$ref: "#/components/schemas/drep_metadata/items/properties/is_valid"
withdrawal:
type:
- object
- 'null'
description: If not null, The amount withdrawn from treasury into stake address by this this proposal
properties:
stake_address:
$ref: "#/components/schemas/account_history/items/properties/stake_address"
amount:
type: string
example: "31235800000"
proposal_votes:
type: array
description: List of all votes cast on specified governance action
Expand Down
17 changes: 14 additions & 3 deletions specs/results/koiosapi-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5167,12 +5167,23 @@ components:
$ref: "#/components/schemas/drep_metadata/items/properties/hash"
meta_json:
$ref: "#/components/schemas/drep_metadata/items/properties/json"
comment:
meta_comment:
$ref: "#/components/schemas/drep_metadata/items/properties/comment"
language:
meta_language:
$ref: "#/components/schemas/drep_metadata/items/properties/language"
is_valid:
meta_is_valid:
$ref: "#/components/schemas/drep_metadata/items/properties/is_valid"
withdrawal:
type:
- object
- 'null'
description: If not null, The amount withdrawn from treasury into stake address by this this proposal
properties:
stake_address:
$ref: "#/components/schemas/account_history/items/properties/stake_address"
amount:
type: string
example: "31235800000"
proposal_votes:
type: array
description: List of all votes cast on specified governance action
Expand Down
17 changes: 14 additions & 3 deletions specs/templates/4-api-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2466,12 +2466,23 @@ schemas:
$ref: "#/components/schemas/drep_metadata/items/properties/hash"
meta_json:
$ref: "#/components/schemas/drep_metadata/items/properties/json"
comment:
meta_comment:
$ref: "#/components/schemas/drep_metadata/items/properties/comment"
language:
meta_language:
$ref: "#/components/schemas/drep_metadata/items/properties/language"
is_valid:
meta_is_valid:
$ref: "#/components/schemas/drep_metadata/items/properties/is_valid"
withdrawal:
type:
- object
- 'null'
description: If not null, The amount withdrawn from treasury into stake address by this this proposal
properties:
stake_address:
$ref: "#/components/schemas/account_history/items/properties/stake_address"
amount:
type: string
example: "31235800000"
proposal_votes:
type: array
description: List of all votes cast on specified governance action
Expand Down

0 comments on commit 940cc77

Please sign in to comment.