Skip to content

Commit

Permalink
Update specs (WIP)
Browse files Browse the repository at this point in the history
Add additional vote metadata fields to proposal_list
  • Loading branch information
rdlrt committed Jul 29, 2024
1 parent ad2274b commit 6e6909c
Show file tree
Hide file tree
Showing 8 changed files with 1,042 additions and 64 deletions.
26 changes: 19 additions & 7 deletions files/grest/rpc/account/account_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RETURNS TABLE (
rewards text,
withdrawals text,
rewards_available text,
deposit text,
reserves text,
treasury text
)
Expand Down Expand Up @@ -38,6 +39,7 @@ BEGIN
COALESCE(rewards_t.rewards, 0)::text AS rewards,
COALESCE(withdrawals_t.withdrawals, 0)::text AS withdrawals,
(COALESCE(rewards_t.rewards, 0) + COALESCE(reserves_t.reserves, 0) + COALESCE(treasury_t.treasury, 0) - COALESCE(withdrawals_t.withdrawals, 0))::text AS rewards_available,
COALESCE(status_t.deposit,0)::text AS deposit,
COALESCE(reserves_t.reserves, 0)::text AS reserves,
COALESCE(treasury_t.treasury, 0)::text AS treasury
FROM
Expand All @@ -46,17 +48,27 @@ BEGIN
sa.id,
sa.view,
EXISTS (
SELECT TRUE FROM stake_registration
WHERE
stake_registration.addr_id = sa.id
SELECT TRUE FROM stake_registration AS sr
WHERE sr.addr_id = sa.id
AND NOT EXISTS (
SELECT TRUE
FROM stake_deregistration
FROM stake_deregistration AS sd
WHERE
stake_deregistration.addr_id = stake_registration.addr_id
AND stake_deregistration.tx_id > stake_registration.tx_id
sd.addr_id = sr.addr_id
AND sd.tx_id > sr.tx_id
)
) AS registered
) AS registered,
(
SELECT sr.deposit FROM stake_registration AS sr
WHERE sr.addr_id = sa.id
AND NOT EXISTS (
SELECT TRUE
FROM stake_deregistration AS sd
WHERE
sd.addr_id = sr.addr_id
AND sd.tx_id > sr.tx_id
)
) AS deposit
FROM public.stake_address sa
WHERE sa.id = ANY(sa_id_list)
) AS status_t
Expand Down
10 changes: 8 additions & 2 deletions files/grest/rpc/governance/proposal_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ RETURNS TABLE (
expiration integer,
meta_url text,
meta_hash text,
meta_json jsonb
meta_json jsonb,
comment text,
language text,
is_valid boolean
)
LANGUAGE sql STABLE
AS $$
Expand All @@ -33,7 +36,10 @@ AS $$
gap.expiration AS expiration,
va.url AS meta_url,
ENCODE(va.data_hash, 'hex') AS meta_hash,
ocvd.json AS meta_json
ocvd.json AS meta_json,
ocvd.comment AS comment,
ocvd.language AS language,
ocvd.is_valid AS is_valid
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
Expand Down
214 changes: 203 additions & 11 deletions specs/results/koiosapi-guild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,180 @@ paths:
summary: Asset Transactions
description: Get the list of current or all asset transaction hashes (newest first)
operationId: asset_txs

/drep_list: #RPC
get:
tags:
- Governance
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/drep_list"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: DReps List
description: List of all active delegated representatives (DReps)
operationId: drep_list
/drep_info: #RPC
post:
tags:
- Governance
requestBody:
$ref: "#/components/requestBodies/drep_id_bulk"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/drep_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: DReps Info
description: Get detailed information about requested delegated representatives (DReps)
operationId: drep_info
/drep_metadata: #RPC
post:
tags:
- Governance
requestBody:
$ref: "#/components/requestBodies/drep_id_bulk"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/drep_metadata"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: DReps Metadata
description: List metadata for requested delegated representatives (DReps)
operationId: drep_metadata
/drep_updates: #RPC
get:
tags:
- Governance
parameters:
- $ref: "#/components/parameters/_drep_id_optional"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/drep_updates"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: DReps Updates
description: List of updates for requested (or all) delegated representatives (DReps)
operationId: drep_updates
/drep_votes: #RPC
get:
tags:
- Governance
parameters:
- $ref: "#/components/parameters/_drep_id"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/drep_votes"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: DReps Votes
description: List of all votes casted by requested delegated representative (DRep)
operationId: drep_votes
/committee_votes: #RPC
get:
tags:
- Governance
parameters:
- $ref: "#/components/parameters/_committee_hash"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/committee_votes"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Committee Votes
description: List of all votes casted by given committee member or collective
operationId: committee_votes
/proposal_list: #RPC
get:
tags:
- Governance
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: Proposals List
description: List of all governance proposals
operationId: proposal_list
/proposal_votes: #RPC
get:
tags:
- Governance
parameters:
- $ref: "#/components/parameters/_tx_hash"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/committee_votes"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Proposal Votes
description: List of all votes cast on specified governance action
operationId: proposal_votes

/pool_list: #RPC
get:
tags:
Expand Down Expand Up @@ -1545,6 +1719,28 @@ paths:
summary: Pool Relays
description: A list of registered relays for all pools
operationId: pool_relays
/pool_votes: #RPC
get:
tags:
- Governance
parameters:
- $ref: "#/components/parameters/_pool_bech32"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/pool_votes"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Pool Votes
description: List of all votes casted by a pool
operationId: pool_votes
/pool_metadata: #RPC
post:
tags:
Expand Down Expand Up @@ -1697,6 +1893,7 @@ paths:
summary: Datum Information
description: List of datum information for given datum hashes
operationId: datum_info

/ogmios: #ogmios-api
post:
tags:
Expand Down Expand Up @@ -3785,6 +3982,7 @@ components:
- type: 'null'
- type: string
description: Account's current delegation status to DRep ID in Bech32 format
example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0
delegated_pool:
anyOf:
- type: 'null'
Expand All @@ -3807,8 +4005,12 @@ components:
example: 12105104750
rewards_available:
type: string
description: Total rewards available for withdawal
description: Total rewards available for withdrawal
example: 44352623297
deposit:
type: string
description: Total deposit available for withdrawal
example: 2000000
reserves:
type: string
description: Total reserves MIR value of the account
Expand All @@ -3817,16 +4019,6 @@ components:
type: string
description: Total treasury MIR value of the account
example: "0"
deposit:
type: string
description: Total deposit reserved from the account
eample: 2000000
drep_id:
anyOf:
- string
- type: 'null'
description: Delegated DRep ID in bech32 format
example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0
utxo_infos:
description: Array of complete UTxO information
type: array
Expand Down
Loading

0 comments on commit 6e6909c

Please sign in to comment.