-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vote endpoints now return proposal hash and voting hashes, added cert…
…_index param to proposal votes endpoint, spec updates
- Loading branch information
Showing
8 changed files
with
40 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
CREATE OR REPLACE FUNCTION grest.committee_votes(_committee_hash text) | ||
RETURNS TABLE ( | ||
tx_hash text, | ||
proposal_tx_hash text, | ||
cert_index integer, | ||
vote_tx_hash text, | ||
block_time integer, | ||
vote text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
ENCODE(tx.hash, 'hex')::text AS tx_hash, | ||
ENCODE(prop_tx.hash, 'hex')::text AS proposal_tx_hash, | ||
gap.index AS cert_index, | ||
ENCODE(vote_tx.hash, 'hex')::text AS vote_tx_hash, | ||
EXTRACT(EPOCH FROM b.time)::integer AS block_time, | ||
vp.vote | ||
FROM public.committee_hash AS ch | ||
INNER JOIN public.voting_procedure AS vp ON ch.id = vp.committee_voter | ||
INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id | ||
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.tx prop_tx ON gap.tx_id = prop_tx.id | ||
INNER JOIN public.tx vote_tx on vp.tx_id = vote_tx.id | ||
INNER JOIN public.block AS b ON vote_tx.block_id = b.id | ||
WHERE ch.raw = DECODE(_committee_hash, 'hex') | ||
ORDER BY | ||
block_time DESC; | ||
vote_tx.id DESC; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.committee_votes IS 'Get all committee votes cast by given committee member or collective'; -- noqa: LT01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
CREATE OR REPLACE FUNCTION grest.drep_votes(_drep_id text) | ||
RETURNS TABLE ( | ||
tx_hash text, | ||
proposal_tx_hash text, | ||
cert_index integer, | ||
vote_tx_hash text, | ||
block_time integer, | ||
vote text | ||
) | ||
LANGUAGE sql STABLE | ||
AS $$ | ||
SELECT | ||
ENCODE(tx.hash, 'hex')::text AS tx_hash, | ||
ENCODE(prop_tx.hash, 'hex')::text AS proposal_tx_hash, | ||
gap.index AS cert_index, | ||
ENCODE(vote_tx.hash, 'hex')::text AS vote_tx_hash, | ||
EXTRACT(EPOCH FROM b.time)::integer AS block_time, | ||
vp.vote | ||
FROM public.drep_hash AS dh | ||
INNER JOIN public.voting_procedure AS vp ON dh.id = vp.drep_voter | ||
INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id | ||
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.tx prop_tx ON gap.tx_id = prop_tx.id | ||
INNER JOIN public.tx vote_tx on vp.tx_id = vote_tx.id | ||
INNER JOIN public.block AS b ON vote_tx.block_id = b.id | ||
WHERE dh.view = _drep_id | ||
ORDER BY | ||
block_time DESC; | ||
vote_tx.id DESC; | ||
$$; | ||
|
||
COMMENT ON FUNCTION grest.drep_votes IS 'Get all DRep votes cast from specified DRep ID'; -- noqa: LT01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters