diff --git a/files/grest/rpc/02_indexes/13_3_00.sql b/files/grest/rpc/02_indexes/13_3_00.sql index e954029d..c4ee4216 100644 --- a/files/grest/rpc/02_indexes/13_3_00.sql +++ b/files/grest/rpc/02_indexes/13_3_00.sql @@ -1,5 +1,6 @@ CREATE INDEX IF NOT EXISTS pool_stat_pool_hash_id ON pool_stat(pool_hash_id); CREATE INDEX IF NOT EXISTS pool_stat_epoch_no ON pool_stat(epoch_no); -CREATE INDEX IF NOT EXISTS idx_drep_hash_view ON drep_hash (view); +-- CREATE INDEX IF NOT EXISTS idx_drep_hash_view ON drep_hash (view); +CREATE INDEX IF NOT EXISTS idx_drep_hash_raw ON drep_hash (raw); CREATE INDEX IF NOT EXISTS idx_reward_rest_addr_id ON reward_rest (addr_id); CREATE INDEX IF NOT EXISTS idx_reward_rest_spendable_epoch ON reward_rest (spendable_epoch); \ No newline at end of file diff --git a/files/grest/rpc/03_utilities/cip129.sql b/files/grest/rpc/03_utilities/cip129.sql index 43043e8c..6233173d 100644 --- a/files/grest/rpc/03_utilities/cip129.sql +++ b/files/grest/rpc/03_utilities/cip129.sql @@ -22,12 +22,12 @@ -- `....0011` | Script Hash CREATE OR REPLACE FUNCTION grest.cip129_cc_hot_to_hex(_cc_hot text) -RETURNS bytea +RETURNS text LANGUAGE plpgsql STABLE AS $$ BEGIN IF LENGTH(_cc_hot) = 60 THEN - RETURN substring(b32_decode(_cc_hot) from 2); + RETURN SUBSTRING(b32_decode(_cc_hot) from 3); ELSE RETURN b32_decode(_cc_hot); END IF; @@ -48,12 +48,12 @@ END; $$; CREATE OR REPLACE FUNCTION grest.cip129_cc_cold_to_hex(_cc_cold text) -RETURNS bytea +RETURNS text LANGUAGE plpgsql STABLE AS $$ BEGIN IF LENGTH(_cc_cold) = 61 THEN - RETURN substring(b32_decode(_cc_cold) from 2); + RETURN SUBSTRING(b32_decode(_cc_cold) from 3); ELSE RETURN b32_decode(_cc_cold); END IF; @@ -74,12 +74,12 @@ END; $$; CREATE OR REPLACE FUNCTION grest.cip129_drep_id_to_hex(_drep_id text) -RETURNS bytea +RETURNS text LANGUAGE plpgsql STABLE AS $$ BEGIN IF LENGTH(_drep_id) = 58 THEN - RETURN substring(b32_decode(_drep_id) from 2); + RETURN SUBSTRING(b32_decode(_drep_id) from 3); ELSE RETURN b32_decode(_drep_id); END IF; @@ -99,9 +99,32 @@ BEGIN END; $$; +CREATE OR REPLACE FUNCTION grest.cip129_from_gov_action_id(_proposal_id text) +RETURNS text[] +LANGUAGE plpgsql STABLE +AS $$ +DECLARE + proposal_id_hex text; +BEGIN + SELECT INTO proposal_id_hex b32_decode(_proposal_id); + RETURN ARRAY[LEFT(proposal_id_hex, 64), ('x' || RIGHT(proposal_id_hex, -64))::bit(8)::int::text]; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_to_gov_action_id(_tx_hash bytea, _index bigint) +RETURNS text +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + RETURN b32_encode('gov_action', (_tx_hash || DECODE(LPAD(TO_HEX(_index), 2, '0'), 'hex'))::text); +END; +$$; + COMMENT ON FUNCTION grest.cip129_cc_hot_to_hex IS 'Returns binary hex from Constitutional Committee Hot Credential ID in old or new (CIP-129) format'; -- noqa: LT01 COMMENT ON FUNCTION grest.cip129_hex_to_cc_hot IS 'Returns Constitutional Committee Hot Credential ID in CIP-129 format from raw binary hex'; -- noqa: LT01 COMMENT ON FUNCTION grest.cip129_cc_cold_to_hex IS 'Returns binary hex from Constitutional Committee Cold Credential ID in old or new (CIP-129) format'; -- noqa: LT01 COMMENT ON FUNCTION grest.cip129_hex_to_cc_cold IS 'Returns Constitutional Committee Cold Credential ID in CIP-129 format from raw binary hex'; -- noqa: LT01 COMMENT ON FUNCTION grest.cip129_drep_id_to_hex IS 'Returns binary hex from DRep Credential ID in old or new (CIP-129) format'; -- noqa: LT01 COMMENT ON FUNCTION grest.cip129_hex_to_drep_id IS 'Returns DRep Credential ID in CIP-129 format from raw binary hex'; -- noqa: LT01 +COMMENT ON FUNCTION grest.cip129_from_gov_action_id IS 'Returns string array containing transaction hash and certificate index from Governance Action Proposal ID in CIP-129 format'; -- noqa: LT01 +COMMENT ON FUNCTION grest.cip129_to_gov_action_id IS 'Returns Governance Action Proposal ID in CIP-129 format from transaction hash appended by index of certificate within the transaction'; -- noqa: LT01 diff --git a/files/grest/rpc/account/account_info.sql b/files/grest/rpc/account/account_info.sql index 4f4cfcb1..227b7e0d 100644 --- a/files/grest/rpc/account/account_info.sql +++ b/files/grest/rpc/account/account_info.sql @@ -3,7 +3,7 @@ RETURNS TABLE ( stake_address varchar, status text, delegated_pool varchar, - delegated_drep varchar, + delegated_drep text, total_balance text, utxo text, rewards text, @@ -75,7 +75,7 @@ BEGIN LEFT JOIN ( SELECT dv.addr_id, - dh.view AS delegated_drep + COALESCE(grest.cip129_hex_to_drep_id(dh.raw, dh.has_script), dh.view::text) AS delegated_drep FROM delegation_vote AS dv INNER JOIN drep_hash AS dh ON dh.id = dv.drep_hash_id WHERE dv.addr_id = ANY(sa_id_list) diff --git a/files/grest/rpc/account/account_info_cached.sql b/files/grest/rpc/account/account_info_cached.sql index 5d3ac0fc..59622b66 100644 --- a/files/grest/rpc/account/account_info_cached.sql +++ b/files/grest/rpc/account/account_info_cached.sql @@ -3,11 +3,13 @@ RETURNS TABLE ( stake_address varchar, status text, delegated_pool varchar, + delegated_drep text, total_balance text, utxo text, rewards text, withdrawals text, rewards_available text, + deposit text, reserves text, treasury text ) @@ -33,11 +35,13 @@ BEGIN 'not registered' END AS status, sdc.pool_id AS pool_id, + vote_t.delegated_drep, sdc.total_balance::text, sdc.utxo::text, sdc.rewards::text, sdc.withdrawals::text, sdc.rewards_available::text, + 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 grest.stake_distribution_cache AS sdc @@ -55,10 +59,34 @@ BEGIN WHERE stake_deregistration.addr_id = stake_registration.addr_id AND stake_deregistration.tx_id > stake_registration.tx_id ) - ) AS registered + ) AS registered, + ( + SELECT sr.deposit FROM stake_registration AS sr + WHERE sr.addr_id = sas.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 AS sas WHERE sas.id = ANY(sa_id_list) ) AS status_t ON sdc.stake_address = status_t.view + LEFT JOIN ( + SELECT + dv.addr_id, + COALESCE(grest.cip129_hex_to_drep_id(dh.raw, dh.has_script), dh.view::text) AS delegated_drep + FROM delegation_vote AS dv + INNER JOIN drep_hash AS dh ON dh.id = dv.drep_hash_id + WHERE dv.addr_id = ANY(sa_id_list) + AND NOT EXISTS ( + SELECT TRUE + FROM delegation_vote AS dv1 + WHERE dv1.addr_id = dv.addr_id + AND dv1.id > dv.id) + ) AS vote_t ON vote_t.addr_id = status_t.id LEFT JOIN ( SELECT r.addr_id, @@ -95,11 +123,13 @@ BEGIN z.stake_address, ai.status, ai.delegated_pool AS pool_id, + ai.delegated_drep, ai.total_balance::text, ai.utxo::text, ai.rewards::text, ai.withdrawals::text, ai.rewards_available::text, + ai.deposit, ai.reserves, ai.treasury FROM diff --git a/files/grest/rpc/governance/committee_info.sql b/files/grest/rpc/governance/committee_info.sql index a39c810f..8f4f3778 100644 --- a/files/grest/rpc/governance/committee_info.sql +++ b/files/grest/rpc/governance/committee_info.sql @@ -1,5 +1,6 @@ CREATE OR REPLACE FUNCTION grest.committee_info() RETURNS TABLE ( + proposal_id text, proposal_tx_hash text, proposal_index bigint, quorum_numerator bigint, @@ -32,6 +33,15 @@ BEGIN RETURN QUERY ( SELECT + CASE + WHEN c.gov_action_proposal_id IS NULL THEN NULL + ELSE ( + SELECT grest.cip129_to_gov_action_id(tx.hash, gap.index) + FROM gov_action_proposal AS gap + INNER JOIN tx on gap.tx_id = tx.id + WHERE gap.id = c.gov_action_proposal_id + ) + END, CASE WHEN c.gov_action_proposal_id IS NULL THEN NULL ELSE ( @@ -65,8 +75,10 @@ BEGIN ELSE 'authorized' END, + 'cc_cold_id', (SELECT grest.cip129_hex_to_cc_cold(ch_cold.raw, ch_cold.has_script)), 'cc_cold_hex', ENCODE(ch_cold.raw, 'hex'), 'cc_cold_has_script', ch_cold.has_script, + 'cc_hot_id', CASE WHEN hot_key.raw IS NULL THEN NULL ELSE (SELECT grest.cip129_hex_to_cc_hot(hot_key.raw, hot_key.has_script)) END, 'cc_hot_hex', CASE WHEN hot_key.raw IS NULL THEN NULL ELSE ENCODE(hot_key.raw, 'hex') END, 'cc_hot_has_script', CASE WHEN hot_key.has_script IS NULL THEN NULL ELSE hot_key.has_script END, 'expiration_epoch', cm.expiration_epoch diff --git a/files/grest/rpc/governance/committee_votes.sql b/files/grest/rpc/governance/committee_votes.sql index 20b5f875..14436892 100644 --- a/files/grest/rpc/governance/committee_votes.sql +++ b/files/grest/rpc/governance/committee_votes.sql @@ -1,5 +1,6 @@ -CREATE OR REPLACE FUNCTION grest.committee_votes(_committee_hash text DEFAULT NULL) +CREATE OR REPLACE FUNCTION grest.committee_votes(_cc_hot_id text DEFAULT NULL) RETURNS TABLE ( + proposal_id text, proposal_tx_hash text, proposal_index integer, vote_tx_hash text, @@ -11,6 +12,7 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT + grest.cip129_to_gov_action_id(prop_tx.hash, gap.index), ENCODE(prop_tx.hash, 'hex'), gap.index, ENCODE(vote_tx.hash, 'hex'), @@ -27,11 +29,11 @@ AS $$ LEFT JOIN public.voting_anchor AS va ON vp.voting_anchor_id = va.id WHERE CASE - WHEN _committee_hash IS NULL THEN TRUE - ELSE ch.raw = DECODE(_committee_hash, 'hex') + WHEN _cc_hot_id IS NULL THEN TRUE + ELSE ch.raw = DECODE((SELECT grest.cip129_cc_hot_to_hex(_cc_hot_id)), 'hex') END ORDER BY vote_tx.id DESC; $$; -COMMENT ON FUNCTION grest.committee_votes IS 'Get all committee votes cast by given committee member or collective'; -- noqa: LT01 +COMMENT ON FUNCTION grest.committee_votes IS 'Get all committee votes cast by given committee member or collective, or all if omitted'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/drep_delegators.sql b/files/grest/rpc/governance/drep_delegators.sql index 9915a92d..ab87da0d 100644 --- a/files/grest/rpc/governance/drep_delegators.sql +++ b/files/grest/rpc/governance/drep_delegators.sql @@ -13,14 +13,18 @@ DECLARE last_reg_tx_id bigint; BEGIN - SELECT INTO drep_idx id - FROM public.drep_hash - WHERE view = _drep_id; - IF STARTS_WITH(_drep_id,'drep_') THEN -- predefined DRep roles + SELECT INTO drep_idx id + FROM public.drep_hash + WHERE view = _drep_id; + last_reg_tx_id := 0; ELSE + SELECT INTO drep_idx id + FROM public.drep_hash + WHERE raw = DECODE((SELECT grest.cip129_drep_id_to_hex(_drep_id)), 'hex'); + SELECT INTO last_reg_tx_id MAX(tx_id) FROM public.drep_registration WHERE drep_hash_id = drep_idx diff --git a/files/grest/rpc/governance/drep_info.sql b/files/grest/rpc/governance/drep_info.sql index e2f35415..ce58a642 100644 --- a/files/grest/rpc/governance/drep_info.sql +++ b/files/grest/rpc/governance/drep_info.sql @@ -1,6 +1,6 @@ CREATE OR REPLACE FUNCTION grest.drep_info(_drep_ids text []) RETURNS TABLE ( - drep_id character varying, + drep_id text, hex text, has_script boolean, registered boolean, @@ -15,6 +15,7 @@ LANGUAGE plpgsql AS $$ DECLARE curr_epoch word31type; + drep_ids_raw hash28type[]; drep_list bigint[]; drep_activity word64type; BEGIN @@ -23,14 +24,34 @@ BEGIN SELECT INTO drep_activity ep.drep_activity FROM public.epoch_param AS ep WHERE ep.epoch_no = curr_epoch; + SELECT INTO drep_ids_raw ARRAY_REMOVE(ARRAY_AGG( + CASE + WHEN STARTS_WITH(n,'drep_') THEN NULL + ELSE + DECODE(grest.cip129_drep_id_to_hex(n), 'hex') + END + ), NULL) FROM UNNEST(_drep_ids) AS n; + -- all DRep ids SELECT INTO drep_list ARRAY_AGG(id) FROM ( SELECT id FROM public.drep_hash - WHERE view = ANY(_drep_ids) + WHERE raw = ANY(drep_ids_raw) ) AS tmp; + IF 'drep_always_abstain' = ANY(_drep_ids) THEN + SELECT INTO drep_list ARRAY_APPEND(drep_list, id) + FROM public.drep_hash + WHERE view = 'drep_always_abstain'; + END IF; + + IF 'drep_always_no_confidence' = ANY(_drep_ids) THEN + SELECT INTO drep_list ARRAY_APPEND(drep_list, id) + FROM public.drep_hash + WHERE view = 'drep_always_no_confidence'; + END IF; + RETURN QUERY ( WITH @@ -95,8 +116,12 @@ BEGIN INNER JOIN block AS b ON tx.block_id = b.id ) - SELECT - DISTINCT ON (dh.view) dh.view AS drep_id, + SELECT DISTINCT ON (dh.view) + CASE + WHEN dh.raw IS NULL THEN dh.view + ELSE + grest.cip129_hex_to_drep_id(dh.raw, dh.has_script) + END AS drep_id, ENCODE(dh.raw, 'hex')::text AS hex, dh.has_script AS has_script, (CASE WHEN starts_with(dh.view,'drep_') OR (COALESCE(dr.deposit, 0) >= 0 AND dr.drep_hash_id IS NOT NULL) THEN TRUE ELSE FALSE END) AS registered, @@ -119,4 +144,4 @@ BEGIN END; $$; -COMMENT ON FUNCTION grest.drep_info IS 'Get bulk DRep info from bech32 formatted DRep IDs, incl predefined roles ''drep_always_abstain'' and ''drep_always_no_confidence'''; -- noqa: LT01 +COMMENT ON FUNCTION grest.drep_info IS 'Get bulk DRep info from bech32 formatted DRep IDs (CIP-5 | CIP-129), incl predefined roles ''drep_always_abstain'' and ''drep_always_no_confidence'''; -- noqa: LT01 diff --git a/files/grest/rpc/governance/drep_list.sql b/files/grest/rpc/governance/drep_list.sql index c43c7311..3e6d0226 100644 --- a/files/grest/rpc/governance/drep_list.sql +++ b/files/grest/rpc/governance/drep_list.sql @@ -1,14 +1,14 @@ CREATE OR REPLACE FUNCTION grest.drep_list() RETURNS TABLE ( - drep_id character varying, + drep_id text, hex text, has_script boolean, registered boolean ) LANGUAGE sql STABLE AS $$ - SELECT - DISTINCT ON (dh.view) dh.view AS drep_id, + SELECT DISTINCT ON (dh.raw) + grest.cip129_hex_to_drep_id(dh.raw, dh.has_script) AS drep_id, ENCODE(dh.raw, 'hex')::text AS hex, dh.has_script AS has_script, (CASE @@ -18,7 +18,7 @@ AS $$ FROM public.drep_hash AS dh INNER JOIN public.drep_registration AS dr ON dh.id = dr.drep_hash_id ORDER BY - dh.view, dr.tx_id DESC; + dh.raw, dr.tx_id DESC; $$; COMMENT ON FUNCTION grest.asset_list IS 'Get a raw listing of all active delegated representatives, aka DReps'; --noqa: LT01 diff --git a/files/grest/rpc/governance/drep_metadata.sql b/files/grest/rpc/governance/drep_metadata.sql index 87ea5033..ebf35824 100644 --- a/files/grest/rpc/governance/drep_metadata.sql +++ b/files/grest/rpc/governance/drep_metadata.sql @@ -1,36 +1,48 @@ CREATE OR REPLACE FUNCTION grest.drep_metadata(_drep_ids text []) RETURNS TABLE ( - drep_id character varying, + drep_id text, hex text, - url text, + has_script boolean, + url character varying, hash text, json jsonb, bytes text, - warning text, - language text, - comment text, + warning character varying, + language character varying, + comment character varying, is_valid boolean ) -LANGUAGE sql STABLE +LANGUAGE plpgsql AS $$ - SELECT - DISTINCT ON (dh.view) dh.view AS drep_id, - ENCODE(dh.raw, 'hex')::text AS hex, - va.url, - ENCODE(va.data_hash, 'hex') AS hash, - ocvd.json, - ENCODE(ocvd.bytes,'hex')::text AS bytes, - ocvd.warning AS warning, - ocvd.language AS language, - ocvd.comment AS comment, - COALESCE(is_valid, true) AS is_valid - FROM public.drep_hash AS dh - INNER JOIN public.drep_registration AS dr ON dh.id = dr.drep_hash_id - LEFT JOIN public.voting_anchor AS va ON dr.voting_anchor_id = va.id - LEFT JOIN public.off_chain_vote_data AS ocvd ON va.id = ocvd.voting_anchor_id - WHERE dh.view = ANY(_drep_ids) - ORDER BY - dh.view, dr.tx_id DESC; +DECLARE + drep_ids_raw hash28type[]; +BEGIN + + SELECT INTO drep_ids_raw ARRAY_AGG(DECODE(grest.cip129_drep_id_to_hex(n), 'hex')) FROM UNNEST(_drep_ids) AS n; + + RETURN QUERY ( + SELECT DISTINCT ON (dh.raw) + grest.cip129_hex_to_drep_id(dh.raw, dh.has_script) AS drep_id, + ENCODE(dh.raw, 'hex')::text AS hex, + dh.has_script AS has_script, + va.url, + ENCODE(va.data_hash, 'hex') AS hash, + ocvd.json, + ENCODE(ocvd.bytes,'hex')::text AS bytes, + ocvd.warning AS warning, + ocvd.language AS language, + ocvd.comment AS comment, + COALESCE(ocvd.is_valid, true) AS is_valid + FROM public.drep_hash AS dh + INNER JOIN public.drep_registration AS dr ON dh.id = dr.drep_hash_id + LEFT JOIN public.voting_anchor AS va ON dr.voting_anchor_id = va.id + LEFT JOIN public.off_chain_vote_data AS ocvd ON va.id = ocvd.voting_anchor_id + WHERE dh.raw = ANY(drep_ids_raw) + ORDER BY + dh.raw, dr.tx_id DESC + ); + +END; $$; COMMENT ON FUNCTION grest.drep_metadata IS 'Get bulk DRep metadata from bech32 formatted DRep IDs'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/drep_updates.sql b/files/grest/rpc/governance/drep_updates.sql index 4ac51138..f569794b 100644 --- a/files/grest/rpc/governance/drep_updates.sql +++ b/files/grest/rpc/governance/drep_updates.sql @@ -1,7 +1,8 @@ CREATE OR REPLACE FUNCTION grest.drep_updates(_drep_id text DEFAULT NULL) RETURNS TABLE ( - drep_id character varying, + drep_id text, hex text, + has_script boolean, update_tx_hash text, cert_index integer, block_time integer, @@ -14,8 +15,9 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT - dh.view AS drep_id, + grest.cip129_hex_to_drep_id(dh.raw, dh.has_script) AS drep_id, ENCODE(dh.raw, 'hex')::text AS hex, + dh.has_script AS has_script, ENCODE(tx.hash, 'hex')::text AS update_tx_hash, dr.cert_index, EXTRACT(EPOCH FROM b.time)::integer AS block_time, @@ -37,7 +39,7 @@ AS $$ WHERE CASE WHEN _drep_id IS NULL THEN TRUE - ELSE dh.view = _drep_id + ELSE dh.raw = DECODE((SELECT grest.cip129_drep_id_to_hex(_drep_id)), 'hex') END ORDER BY block_time DESC; diff --git a/files/grest/rpc/governance/drep_votes.sql b/files/grest/rpc/governance/drep_votes.sql index 31214e36..4b32a831 100644 --- a/files/grest/rpc/governance/drep_votes.sql +++ b/files/grest/rpc/governance/drep_votes.sql @@ -1,5 +1,6 @@ CREATE OR REPLACE FUNCTION grest.drep_votes(_drep_id text) RETURNS TABLE ( + proposal_id text, proposal_tx_hash text, proposal_index integer, vote_tx_hash text, @@ -11,6 +12,7 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT + grest.cip129_to_gov_action_id(prop_tx.hash, gap.index), ENCODE(prop_tx.hash, 'hex'), gap.index, ENCODE(vote_tx.hash, 'hex'), @@ -25,7 +27,7 @@ AS $$ 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 LEFT JOIN public.voting_anchor AS va ON vp.voting_anchor_id = va.id - WHERE dh.view = _drep_id + WHERE dh.raw = DECODE((SELECT grest.cip129_drep_id_to_hex(_drep_id)), 'hex') ORDER BY vote_tx.id DESC; $$; diff --git a/files/grest/rpc/governance/proposal_list.sql b/files/grest/rpc/governance/proposal_list.sql index 67c44ce4..3910d3ef 100644 --- a/files/grest/rpc/governance/proposal_list.sql +++ b/files/grest/rpc/governance/proposal_list.sql @@ -1,6 +1,7 @@ CREATE OR REPLACE FUNCTION grest.proposal_list() RETURNS TABLE ( block_time integer, + proposal_id text, proposal_tx_hash text, proposal_index integer, proposal_type text, @@ -26,6 +27,7 @@ LANGUAGE sql STABLE AS $$ SELECT EXTRACT(EPOCH FROM b.time)::integer, + grest.cip129_to_gov_action_id(tx.hash, gap.index), ENCODE(tx.hash, 'hex'), gap.index, gap.type, diff --git a/files/grest/rpc/governance/proposal_votes.sql b/files/grest/rpc/governance/proposal_votes.sql index c7822697..c6beee12 100644 --- a/files/grest/rpc/governance/proposal_votes.sql +++ b/files/grest/rpc/governance/proposal_votes.sql @@ -1,23 +1,42 @@ -CREATE OR REPLACE FUNCTION grest.proposal_votes(_proposal_tx_hash text, _proposal_index integer) +CREATE OR REPLACE FUNCTION grest.proposal_votes(_proposal_id text) RETURNS TABLE ( block_time integer, voter_role text, - voter text, + voter_id text, voter_hex text, - vote text, - meta_url text, + voter_has_script boolean, + vote vote, + meta_url character varying, meta_hash text ) -LANGUAGE sql STABLE +LANGUAGE plpgsql AS $$ - SELECT z.* +DECLARE + proposal text[]; +BEGIN + + SELECT INTO proposal grest.cip129_from_gov_action_id(_proposal_id); + + RETURN QUERY ( + SELECT z.* FROM ( - SELECT - distinct on (COALESCE(ENCODE(ch.raw, 'hex'), dh.view, ph.view)) + SELECT DISTINCT ON (COALESCE(dh.raw, ph.hash_raw, ch.raw)) EXTRACT(EPOCH FROM vote_block.time)::integer AS block_time, - vp.voter_role, - COALESCE(ENCODE(ch.raw, 'hex'), dh.view, ph.view) as voter, - COALESCE(ENCODE(ch.raw, 'hex'), ENCODE(dh.raw, 'hex'), ENCODE(ph.hash_raw, 'hex')) as voter_hex, + vp.voter_role::text, + CASE + WHEN dh.raw IS NOT NULL THEN grest.cip129_hex_to_drep_id(dh.raw, dh.has_script) + WHEN ph.view IS NOT NULL THEN ph.view + WHEN ch.raw IS NOT NULL THEN grest.cip129_hex_to_cc_hot(ch.raw, ch.has_script) + ELSE + '' -- shouldn't happen + END, + COALESCE(ENCODE(ch.raw, 'hex'), ENCODE(dh.raw, 'hex'), ENCODE(ph.hash_raw, 'hex')) AS voter_hex, + CASE + WHEN dh.raw IS NOT NULL THEN dh.has_script + WHEN ch.raw IS NOT NULL THEN ch.has_script + ELSE + FALSE + END AS voter_has_script, vp.vote, va.url, ENCODE(va.data_hash, 'hex') @@ -26,22 +45,25 @@ AS $$ INNER JOIN public.tx ON gap.tx_id = tx.id INNER JOIN public.tx AS vote_tx ON vp.tx_id = vote_tx.id INNER JOIN public.block AS vote_block ON vote_tx.block_id = vote_block.id - LEFT JOIN public.drep_hash AS dh ON vp.drep_voter = dh.id + LEFT JOIN public.drep_hash AS dh ON vp.drep_voter = dh.id LEFT JOIN public.pool_hash AS ph ON vp.pool_voter = ph.id LEFT JOIN public.committee_hash AS ch ON vp.committee_voter = ch.id LEFT JOIN public.voting_anchor AS va ON vp.voting_anchor_id = va.id - WHERE tx.hash = DECODE(_proposal_tx_hash, 'hex') - AND gap.index = _proposal_index - -- will we need a similar filters to the one below for pool and committee member retirements? + WHERE tx.hash = DECODE(proposal[1], 'hex') + AND gap.index = proposal[2]::smallint + -- TODO: will we need a similar filters to the one below for pool and committee member retirements? AND ( CASE WHEN dh.view IS NOT NULL THEN ((SELECT coalesce(dreg.deposit, 0) FROM drep_registration AS dreg WHERE dreg.drep_hash_id = dh.id ORDER BY id DESC LIMIT 1) >= 0) ELSE true END) ORDER by - COALESCE(ENCODE(ch.raw, 'hex'), dh.view, ph.view), + COALESCE(dh.raw, ph.hash_raw, ch.raw), block_time DESC - ) z ORDER BY block_time desc; + ) z ORDER BY block_time desc + ); + +END; $$; COMMENT ON FUNCTION grest.proposal_votes IS 'Get all votes cast on specified governance action'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/proposal_voting_summary.sql b/files/grest/rpc/governance/proposal_voting_summary.sql new file mode 100644 index 00000000..4f02102b --- /dev/null +++ b/files/grest/rpc/governance/proposal_voting_summary.sql @@ -0,0 +1,259 @@ +CREATE OR REPLACE FUNCTION grest.proposal_voting_summary(_proposal_id text) +RETURNS TABLE ( + proposal_type text, + epoch_no integer, + drep_yes_votes_cast integer, + drep_yes_vote_power lovelace, + drep_yes_pct numeric, + drep_no_votes_cast integer, + drep_no_vote_power lovelace, + drep_no_pct numeric, + pool_yes_votes_cast integer, + pool_yes_vote_power lovelace, + pool_yes_pct numeric, + pool_no_votes_cast integer, + pool_no_vote_power lovelace, + pool_no_pct numeric, + committee_yes_votes_cast integer, + committee_yes_pct numeric, + committee_no_votes_cast integer, + committee_no_pct numeric +) +LANGUAGE plpgsql +as $$ +DECLARE + proposal text[]; +BEGIN + + SELECT INTO proposal grest.cip129_from_gov_action_id(_proposal_id); + + RETURN QUERY ( + WITH + proposal_epoch_data AS ( + SELECT + gap.id AS gov_action_proposal_id, + gap.type AS proposal_type, + expired_epoch, + ratified_epoch, + (coalesce(ratified_epoch, expired_epoch, dropped_epoch, ( SELECT MAX(no) FROM epoch))) AS epoch_of_interest + FROM gov_action_proposal gap + INNER JOIN tx t ON gap.tx_id = t.id AND t.hash = DECODE(proposal[1], 'hex') AND gap.index = proposal[2]::smallint + ), + tot_drep_power AS ( + SELECT ped.gov_action_proposal_id, SUM(amount) AS tot_drep_power + FROM drep_distr AS dd + INNER JOIN proposal_epoch_data AS ped ON dd.epoch_no = epoch_of_interest + GROUP BY ped.gov_action_proposal_id + ), + active_prop_drep_votes AS ( + SELECT + ped.gov_action_proposal_id, + coalesce(SUM(amount),0) AS active_drep_vote_total, + vote, + COUNT(*) AS active_drep_votes_cast + FROM proposal_epoch_data AS ped + INNER JOIN voting_procedure AS vp ON vp.voter_role = 'DRep' AND vp.gov_action_proposal_id = ped.gov_action_proposal_id + LEFT JOIN drep_distr AS dd ON vp.drep_voter = dd.hash_id AND dd.epoch_no = ped.epoch_of_interest + GROUP BY ped.gov_action_proposal_id, vote + ), + always_no_conf_data AS ( + SELECT + ped.gov_action_proposal_id, + amount AS always_no_conf + FROM proposal_epoch_data AS ped + INNER JOIN drep_distr AS dd ON dd.epoch_no = ped.epoch_of_interest + INNER JOIN drep_hash AS dh ON dh.view = 'drep_always_no_confidence' AND dd.hash_id = dh.id + ), + always_abstain_data AS ( + SELECT + ped.gov_action_proposal_id, + amount AS always_abstain + FROM proposal_epoch_data AS ped + INNER JOIN drep_distr AS dd ON dd.epoch_no = ped.epoch_of_interest + INNER JOIN drep_hash AS dh ON dh.view = 'drep_always_abstain' AND dd.hash_id = dh.id + ), + tot_pool_power AS ( + SELECT + ped.gov_action_proposal_id, + SUM(voting_power) AS tot_pool_power + FROM proposal_epoch_data AS ped + INNER JOIN pool_stat ON pool_stat.epoch_no = ped.epoch_of_interest + GROUP BY ped.gov_action_proposal_id, pool_stat.epoch_no + ), + active_prop_pool_votes AS ( + SELECT + ped.gov_action_proposal_id, + SUM(voting_power) AS active_pool_vote_total, + vote, + COUNT(*) AS pool_votes_cast + FROM proposal_epoch_data AS ped + INNER JOIN voting_procedure AS vp ON vp.voter_role = 'SPO' AND vp.gov_action_proposal_id = ped.gov_action_proposal_id + INNER JOIN pool_stat ON vp.pool_voter = pool_stat.pool_hash_id AND pool_stat.epoch_no = ped.epoch_of_interest + GROUP BY ped.gov_action_proposal_id, vote + ), + committee_votes AS ( + SELECT + ped.gov_action_proposal_id, + vote, + COUNT(*) AS committee_votes_cast + FROM proposal_epoch_data AS ped + INNER JOIN voting_procedure AS vp ON vp.voter_role = 'ConstitutionalCommittee' + AND vp.gov_action_proposal_id = ped.gov_action_proposal_id + AND NOT EXISTS ( + SELECT null + FROM voting_procedure AS vp2 + WHERE vp2.gov_action_proposal_id = vp.gov_action_proposal_id + AND vp2.committee_voter = vp.committee_voter AND vp2.id > vp.id) + GROUP BY ped.gov_action_proposal_id, vote + ), + tot_committee_size AS ( + SELECT + ped.gov_action_proposal_id, + count(cm.id) AS committee_size + FROM epoch_state AS epstate + INNER JOIN proposal_epoch_data AS ped on epstate.epoch_no = ped.epoch_of_interest + INNER JOIN committee AS c on epstate.committee_id = c.id + INNER JOIN committee_member AS cm on cm.committee_id = c.id + GROUP BY ped.gov_action_proposal_id + ), + combined_data AS ( + SELECT + ped.gov_action_proposal_id, + ped.proposal_type, + ped.epoch_of_interest, + tot_drep_power, + always_no_conf, + always_abstain, + committee_size, + tot_pool_power + FROM proposal_epoch_data AS ped + INNER JOIN tot_drep_power ON tot_drep_power.gov_action_proposal_id = ped.gov_action_proposal_id + INNER JOIN always_no_conf_data ON always_no_conf_data.gov_action_proposal_id = ped.gov_action_proposal_id + INNER JOIN always_abstain_data ON always_abstain_data.gov_action_proposal_id = ped.gov_action_proposal_id + INNER JOIN tot_pool_power ON tot_pool_power.gov_action_proposal_id = ped.gov_action_proposal_id + INNER JOIN tot_committee_size on tot_committee_size.gov_action_proposal_id = ped.gov_action_proposal_id + ) + + SELECT + y.proposal_type::text AS proposal_type, + y.epoch_of_interest AS epoch_no, + y.drep_yes_votes_cast::integer, + y.drep_yes_vote_power::lovelace, + ROUND(y.drep_yes_vote_power * 100 / y.drep_non_abstain_total, 2) AS drep_yes_pct, + y.drep_no_votes_cast::integer, + (y.drep_non_abstain_total - y.drep_yes_vote_power)::lovelace AS drep_no_vote_power, + ROUND((y.drep_non_abstain_total - y.drep_yes_vote_power) * 100 / y.drep_non_abstain_total, 2) AS drep_no_pct, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE y.pool_yes_votes_cast + END)::integer AS pool_yes_votes_cast, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE y.pool_yes_vote_power + END)::lovelace AS pool_yes_vote_power, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE ROUND(y.pool_yes_vote_power * 100 / y.pool_non_abstain_total, 2) + END) AS pool_yes_pct, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE y.pool_no_votes_cast + END)::integer AS pool_no_votes_cast, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE (y.pool_non_abstain_total - y.pool_yes_vote_power) + END)::lovelace AS pool_no_vote_power, + (CASE + WHEN y.proposal_type IN ('ParameterChange', 'TreasuryWithdrawals', 'NewConstitution') THEN 0 + ELSE ROUND((y.pool_non_abstain_total - y.pool_yes_vote_power) * 100 / y.pool_non_abstain_total, 2) + END) AS pool_no_pct, + y.committee_yes_votes_cast::integer, + (CASE + WHEN y.proposal_type IN ('NoConfidence', 'NewCommittee') THEN 0 + ELSE ROUND((y.committee_yes_votes_cast * 100 / y.committee_non_abstain_total), 2) + END) AS committee_yes_pct, + (CASE + WHEN y.proposal_type IN ('NoConfidence', 'NewCommittee') THEN 0 + ELSE y.committee_no_votes_cast + END)::integer AS committee_no_votes_cast, + (CASE + WHEN y.proposal_type IN ('NoConfidence', 'NewCommittee') THEN 0 + ELSE ROUND((committee_non_abstain_total - y.committee_yes_votes_cast) * 100 / y.committee_non_abstain_total, 2) + END) AS committee_no_pct + FROM + ( + SELECT + c1.*, + ( + SELECT coalesce(SUM(active_drep_votes_cast), 0) + FROM active_prop_drep_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Yes' + ) AS drep_yes_votes_cast, + ( + SELECT coalesce(SUM(active_drep_vote_total), 0) + FROM active_prop_drep_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Yes' + ) AS drep_yes_vote_power, + ( + SELECT coalesce(SUM(active_drep_votes_cast), 0) + FROM active_prop_drep_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'No' + ) AS drep_no_votes_cast, + ( + SELECT coalesce(SUM(active_drep_vote_total), 0) + FROM active_prop_drep_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'No' + ) + always_no_conf AS drep_no_vote_power, + ( + SELECT coalesce(SUM(active_drep_vote_total),0) + FROM active_prop_drep_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Abstain' + ) + always_abstain AS drep_abstain_vote_power, + tot_drep_power - always_abstain - ( + SELECT coalesce(SUM(active_drep_vote_total), 0) + FROM active_prop_drep_votes AS c3 + WHERE c3.gov_action_proposal_id = c1.gov_action_proposal_id AND c3.vote = 'Abstain' + ) AS drep_non_abstain_total, + ( + SELECT coalesce(SUM(active_pool_vote_total), 0) + FROM active_prop_pool_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Yes' + ) AS pool_yes_vote_power, + tot_pool_power - ( + SELECT coalesce(SUM(active_pool_vote_total), 0) + FROM active_prop_pool_votes c3 + WHERE c3.gov_action_proposal_id = c1.gov_action_proposal_id AND c3.vote = 'Abstain' + ) AS pool_non_abstain_total, + ( + SELECT coalesce(SUM(pool_votes_cast), 0) + FROM active_prop_pool_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Yes' + ) AS pool_yes_votes_cast, + ( + SELECT coalesce(SUM(pool_votes_cast), 0) + FROM active_prop_pool_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'No' + ) AS pool_no_votes_cast, + ( + SELECT coalesce(SUM(committee_votes_cast), 0) + FROM committee_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'Yes' + ) AS committee_yes_votes_cast, + ( + SELECT coalesce(SUM(committee_votes_cast), 0) + FROM committee_votes AS c2 + WHERE c2.gov_action_proposal_id = c1.gov_action_proposal_id AND c2.vote = 'No' + ) AS committee_no_votes_cast, + committee_size - ( + SELECT coalesce(SUM(committee_votes_cast), 0) + FROM committee_votes AS c3 + WHERE c3.gov_action_proposal_id = c1.gov_action_proposal_id AND c3.vote = 'Abstain' + ) AS committee_non_abstain_total + FROM combined_data AS c1 + ) AS y + ORDER BY 1 DESC + ); +END; +$$; + +COMMENT ON FUNCTION grest.proposal_votes IS 'Get a summary of votes cast on specified governance action'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/voter_proposal_list.sql b/files/grest/rpc/governance/voter_proposal_list.sql index 14810f9a..d110c7f5 100644 --- a/files/grest/rpc/governance/voter_proposal_list.sql +++ b/files/grest/rpc/governance/voter_proposal_list.sql @@ -1,6 +1,7 @@ -CREATE OR REPLACE FUNCTION grest.voter_proposal_list(_credential text) +CREATE OR REPLACE FUNCTION grest.voter_proposal_list(_voter_id text) RETURNS TABLE ( block_time integer, + proposal_id text, proposal_tx_hash text, proposal_index bigint, proposal_type govactiontype, @@ -31,11 +32,12 @@ DECLARE _gap_id_list bigint[]; BEGIN - 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'); - ELSIF _spo_id IS NULL THEN - SELECT INTO _committee_member_id id FROM public.committee_hash WHERE raw = DECODE(_credential, 'hex'); + IF STARTS_WITH(_voter_id, 'drep') THEN + SELECT INTO _drep_id id FROM public.drep_hash WHERE raw = DECODE((SELECT grest.cip129_drep_id_to_hex(_voter_id)), 'hex'); + ELSIF STARTS_WITH(_voter_id, 'pool') THEN + SELECT INTO _spo_id id FROM public.pool_hash WHERE view = _voter_id; + ELSIF STARTS_WITH(_voter_id, 'cc_hot') THEN + SELECT INTO _committee_member_id id FROM public.committee_hash WHERE raw = DECODE((SELECT grest.cip129_cc_hot_to_hex(_voter_id)), 'hex'); END IF; SELECT INTO _gap_id_list ARRAY_AGG(gov_action_proposal_id) @@ -55,6 +57,7 @@ BEGIN RETURN QUERY ( SELECT EXTRACT(EPOCH FROM b.time)::integer, + grest.cip129_to_gov_action_id(tx.hash, gap.index), ENCODE(tx.hash, 'hex'), gap.index, gap.type, diff --git a/specs/results/koiosapi-guild.yaml b/specs/results/koiosapi-guild.yaml index 971c02dc..22fb030f 100644 --- a/specs/results/koiosapi-guild.yaml +++ b/specs/results/koiosapi-guild.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0a + version: v1.2.0 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -154,6 +154,8 @@ servers: description: Preview Network - url: https://preprod.koios.rest/api/v1 description: Preprod Network + - url: https://sancho.koios.rest/api/v1 + description: Sanchonet Network paths: /tip: #RPC @@ -1478,7 +1480,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_committee_hash" + - $ref: "#/components/parameters/_cc_hot_id" responses: "200": description: Success!! @@ -1520,7 +1522,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_credential" + - $ref: "#/components/parameters/_voter_id" responses: "200": description: Success!! @@ -1536,22 +1538,42 @@ paths: $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 - + operationId: voter_proposal_list + /proposal_voting_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_voting_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Voting Summary + description: Summary of votes for given proposal + operationId: proposal_voting_summary /proposal_votes: #RPC get: tags: - Governance parameters: - - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/parameters/_proposal_index" + - $ref: "#/components/parameters/_proposal_id" responses: "200": description: Success!! content: application/json: schema: - $ref: "#/components/schemas/committee_votes" + $ref: "#/components/schemas/proposal_votes" "400": $ref: "#/components/responses/BadRequest" "401": @@ -2089,10 +2111,10 @@ components: in: query required: false allowEmptyValue: true - _credential: + _voter_id: deprecated: false - name: _credential - description: Voter (Drep, SPO, Committee Member) in Hex format + name: _voter_id + description: Voter ID (Drep, SPO, Committee Member) in Bech32 format (CIP-5 | CIP-129) schema: type: string example: "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r" @@ -2119,13 +2141,13 @@ components: in: query required: false allowEmptyValue: true - _committee_hash: + _cc_hot_id: deprecated: false - name: _committee_hash - description: Committee hash in hexadecimal format (hex) + name: _cc_hot_id + description: Committee member hot key ID in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472" + example: "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7" in: query required: false allowEmptyValue: true @@ -2199,26 +2221,16 @@ components: in: query required: true allowEmptyValue: false - _proposal_tx_hash: + _proposal_id: deprecated: false - name: _proposal_tx_hash - description: Transaction Hash of government proposal in hexadecimal format (hex) - example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + name: _proposal_id + description: Government proposal ID in CIP-129 Bech32 format + example: "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf" schema: type: string in: query required: true allowEmptyValue: false - _proposal_index: - deprecated: false - name: _proposal_index - description: Index of governance proposal in transaction - schema: - type: number - example: 0 - in: query - required: true - allowEmptyValue: false requestBodies: block_hashes: content: @@ -2903,19 +2915,19 @@ components: example: 294 circulation: type: string - description: Circulating UTxOs for given epoch (in lovelaces) + description: Circulating UTxOs for given epoch (in numbers) example: 32081169442642320 treasury: type: string - description: Funds in treasury for given epoch (in lovelaces) + description: Funds in treasury for given epoch (in numbers) example: 637024173474141 reward: type: string - description: Rewards accumulated as of given epoch (in lovelaces) + description: Rewards accumulated as of given epoch (in numbers) example: 506871250479840 supply: type: string - description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in lovelaces) + description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in numbers) example: 33228495612391330 reserves: type: string @@ -3045,7 +3057,7 @@ components: example: 312 active_stake: type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) + description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) example: "31235800000" active_stake_pct: type: @@ -3073,21 +3085,21 @@ components: example: 0.125 fixed_cost: type: string - description: Pool fixed cost per epoch (in lovelaces) + description: Pool fixed cost per epoch (in numbers) example: "340000000" pool_fees: type: string - description: Total amount of fees earned by pool owners in that epoch (in lovelaces) + description: Total amount of fees earned by pool owners in that epoch (in numbers) example: "123327382" deleg_rewards: type: string - description: Total amount of rewards earned by delegators in that epoch (in lovelaces) + description: Total amount of rewards earned by delegators in that epoch (in numbers) example: "123456789123" member_rewards: type: - string - 'null' - description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) + description: Total amount of rewards earned by members (delegator - owner) in that epoch (in numbers) example: "123456780123" epoch_ros: type: number @@ -3131,13 +3143,13 @@ components: type: - string - 'null' - description: Pool pledge in lovelace + description: Pool pledge in number example: "64000000000000" deposit: type: - string - 'null' - description: Pool's registration deposit in lovelace + description: Pool's registration deposit in number example: "500000000" reward_addr: type: @@ -3318,7 +3330,7 @@ components: $ref: "#/components/schemas/account_history/items/properties/stake_address" amount: type: string - description: Current delegator live stake (in lovelace) + description: Current delegator live stake (in number) example: 64328591517480 active_epoch_no: type: number @@ -3556,13 +3568,13 @@ components: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake address + description: The amount (in number) required for a deposit to register a stake address example: 2000000 pool_deposit: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake pool + description: The amount (in number) required for a deposit to register a stake pool example: 500000000 max_epoch: type: @@ -3963,13 +3975,13 @@ components: type: - string - 'null' - description: Total output of the block (in lovelace) + description: Total output of the block (in number) example: 92384672389 total_fees: type: - string - 'null' - description: Total fees of the block (in lovelace) + description: Total fees of the block (in number) example: 2346834 num_confirmations: type: number @@ -4171,15 +4183,15 @@ components: type: - 'null' - string - description: Account's current delegation status to DRep ID in Bech32 format - example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 + description: Account's current delegation status to DRep ID in CIP-129 Bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 delegated_pool: anyOf: - type: 'null' - $ref: "#/components/schemas/pool_list/items/properties/pool_id_bech32" total_balance: type: string - description: Total balance of the account including UTxO, rewards and MIRs (in lovelace) + description: Total balance of the account including UTxO, rewards and MIRs (in number) example: 207116800428 utxo: type: string @@ -4291,7 +4303,7 @@ components: $ref: "#/components/schemas/reserve_withdrawals/items/properties/spendable_epoch" amount: type: string - description: Amount of rewards earned (in lovelace) + description: Amount of rewards earned (in number) type: type: string description: The source of the rewards @@ -4381,7 +4393,7 @@ components: example: 301 active_stake: type: string - description: Active stake amount (in lovelaces) + description: Active stake amount (in numbers) example: 682334162 tx_info: description: Array of detailed information about transaction(s) @@ -4415,15 +4427,15 @@ components: example: 391 total_output: type: string - description: Total sum of all transaction outputs (in lovelaces) + description: Total sum of all transaction outputs (in numbers) example: 157832856 fee: type: string - description: Total Transaction fee (in lovelaces) + description: Total Transaction fee (in numbers) example: 172761 treasury_donation: type: string - description: Total Donation to on-chain treasury (in lovelaces) + description: Total Donation to on-chain treasury (in numbers) example: 0 deposit: type: string @@ -4564,7 +4576,7 @@ components: properties: amount: type: string - description: Withdrawal amount (in lovelaces) + description: Withdrawal amount (in numbers) example: 9845162 stake_addr: type: string @@ -4727,7 +4739,7 @@ components: voter_role: $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" voter: - $ref: "#/components/schemas/proposal_votes/items/properties/voter" + $ref: "#/components/schemas/proposal_votes/items/properties/voter_id" voter_hex: $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" vote: @@ -5143,15 +5155,15 @@ components: properties: drep_id: type: string - description: DRep ID in bech32 format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: DRep ID in CIP-129 bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 hex: type: string description: DRep ID in hex format - example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd has_script: type: boolean - description: Flag which shows if this DRep credentials are a script hash + description: Flag which shows if this credential is a script hash example: false registered: type: boolean @@ -5161,7 +5173,7 @@ components: type: - string - 'null' - description: DRep's registration deposit in lovelace + description: DRep's registration deposit in number example: 500000000 active: type: boolean @@ -5243,6 +5255,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" url: $ref: "#/components/schemas/drep_info/items/properties/url" hash: @@ -5289,6 +5303,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" update_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" cert_index: @@ -5315,6 +5331,8 @@ components: type: array items: properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5349,6 +5367,10 @@ components: properties: block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_id: + type: string + description: Proposal Action ID in accordance with CIP-129 format + example: 'gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh' proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5361,7 +5383,7 @@ components: description: Proposal Action Type example: ParameterChange proposal_description: - type: string + type: object description: Description for Proposal Action example: '{"tag": "InfoAction"}' deposit: @@ -5437,6 +5459,81 @@ components: type: array items: $ref: "#/components/schemas/proposal_list/items" + proposal_voting_summary: + description: Summary of votes for given proposal + type: array + items: + properties: + proposal_type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + epoch_no: + type: number + description: Epoch for which data was collated + example: 441 + drep_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by dreps + example: 7 + drep_yes_vote_power: + type: number + description: Power of 'yes' votes from dreps + example: 31146839512742 + drep_yes_pct: + type: number + description: Percentage of 'yes' votes from dreps + example: 60.72 + drep_no_votes_cast: + type: number + description: Number of 'no' votes casted by dreps + example: 0 + drep_no_vote_power: + type: number + description: Power of 'no' votes from dreps + example: 20148194577715 + drep_no_pct: + type: number + description: Percentage of 'no' votes from dreps + example: 39.28 + pool_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by pools + example: 1 + pool_yes_vote_power: + type: number + description: Power of 'yes' votes from pools + example: 5234000000 + pool_yes_pct: + type: number + description: Percentage of 'yes' votes from pools + example: 13.12 + pool_no_votes_cast: + type: number + description: Number of 'no' votes casted by pools + example: 0 + pool_no_vote_power: + type: number + description: Power of 'no' votes from pools + example: 0 + pool_no_pct: + type: number + description: Percentage of 'no' votes from pools + example: 0 + committee_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by committee + example: 5 + committee_yes_pct: + type: number + description: Percentage of 'yes' votes from committee + example: 71.43 + committee_no_votes_cast: + type: number + description: Number of 'no' votes casted by committee + example: 1 + committee_no_pct: + type: number + description: Percentage of 'no' votes from committee + example: 28.57 proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5449,14 +5546,16 @@ components: description: The role of the voter enum: ["ConstitutionalCommittee", "DRep", "SPO"] example: DRep - voter: + voter_id: type: string - description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: Voter's DRep ID (CIP-129 bech32 format), pool ID (bech32 format) or committee hot ID (CIP-129 bech32 format) + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 voter_hex: type: string description: Voter's DRep ID , pool ID or committee hash in hex format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd + voter_has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" vote: $ref: "#/components/schemas/drep_votes/items/properties/vote" meta_url: @@ -5467,6 +5566,8 @@ components: description: Current governance committee type: object properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5494,7 +5595,7 @@ components: example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf cc_cold_has_script: type: boolean - description: Flag which shows if this committee member cold credential is a script hash + description: Flag which shows if this credential is a script hash example: false cc_hot_hex: type: @@ -5506,7 +5607,7 @@ components: type: - boolean - 'null' - description: Flag which shows if this committee member hot credential is a script hash + description: Flag which shows if this credential is a script hash example: false expiration_epoch: type: number diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index 52dc9b8c..ba0d62e1 100644 --- a/specs/results/koiosapi-mainnet.yaml +++ b/specs/results/koiosapi-mainnet.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0a + version: v1.2.0 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -154,6 +154,8 @@ servers: description: Preview Network - url: https://preprod.koios.rest/api/v1 description: Preprod Network + - url: https://sancho.koios.rest/api/v1 + description: Sanchonet Network paths: /tip: #RPC @@ -1478,7 +1480,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_committee_hash" + - $ref: "#/components/parameters/_cc_hot_id" responses: "200": description: Success!! @@ -1520,7 +1522,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_credential" + - $ref: "#/components/parameters/_voter_id" responses: "200": description: Success!! @@ -1536,22 +1538,42 @@ paths: $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 - + operationId: voter_proposal_list + /proposal_voting_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_voting_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Voting Summary + description: Summary of votes for given proposal + operationId: proposal_voting_summary /proposal_votes: #RPC get: tags: - Governance parameters: - - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/parameters/_proposal_index" + - $ref: "#/components/parameters/_proposal_id" responses: "200": description: Success!! content: application/json: schema: - $ref: "#/components/schemas/committee_votes" + $ref: "#/components/schemas/proposal_votes" "400": $ref: "#/components/responses/BadRequest" "401": @@ -2089,10 +2111,10 @@ components: in: query required: false allowEmptyValue: true - _credential: + _voter_id: deprecated: false - name: _credential - description: Voter (Drep, SPO, Committee Member) in Hex format + name: _voter_id + description: Voter ID (Drep, SPO, Committee Member) in Bech32 format (CIP-5 | CIP-129) schema: type: string example: "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3" @@ -2119,13 +2141,13 @@ components: in: query required: false allowEmptyValue: true - _committee_hash: + _cc_hot_id: deprecated: false - name: _committee_hash - description: Committee hash in hexadecimal format (hex) + name: _cc_hot_id + description: Committee member hot key ID in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "49fa008218cd619afe6aa8a1a93303f242440722b314f36bda2c2e23" + example: "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7" in: query required: false allowEmptyValue: true @@ -2199,26 +2221,16 @@ components: in: query required: true allowEmptyValue: false - _proposal_tx_hash: + _proposal_id: deprecated: false - name: _proposal_tx_hash - description: Transaction Hash of government proposal in hexadecimal format (hex) - example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + name: _proposal_id + description: Government proposal ID in CIP-129 Bech32 format + example: "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf" schema: type: string in: query required: true allowEmptyValue: false - _proposal_index: - deprecated: false - name: _proposal_index - description: Index of governance proposal in transaction - schema: - type: number - example: 0 - in: query - required: true - allowEmptyValue: false requestBodies: block_hashes: content: @@ -2903,19 +2915,19 @@ components: example: 294 circulation: type: string - description: Circulating UTxOs for given epoch (in lovelaces) + description: Circulating UTxOs for given epoch (in numbers) example: 32081169442642320 treasury: type: string - description: Funds in treasury for given epoch (in lovelaces) + description: Funds in treasury for given epoch (in numbers) example: 637024173474141 reward: type: string - description: Rewards accumulated as of given epoch (in lovelaces) + description: Rewards accumulated as of given epoch (in numbers) example: 506871250479840 supply: type: string - description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in lovelaces) + description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in numbers) example: 33228495612391330 reserves: type: string @@ -3045,7 +3057,7 @@ components: example: 312 active_stake: type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) + description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) example: "31235800000" active_stake_pct: type: @@ -3073,21 +3085,21 @@ components: example: 0.125 fixed_cost: type: string - description: Pool fixed cost per epoch (in lovelaces) + description: Pool fixed cost per epoch (in numbers) example: "340000000" pool_fees: type: string - description: Total amount of fees earned by pool owners in that epoch (in lovelaces) + description: Total amount of fees earned by pool owners in that epoch (in numbers) example: "123327382" deleg_rewards: type: string - description: Total amount of rewards earned by delegators in that epoch (in lovelaces) + description: Total amount of rewards earned by delegators in that epoch (in numbers) example: "123456789123" member_rewards: type: - string - 'null' - description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) + description: Total amount of rewards earned by members (delegator - owner) in that epoch (in numbers) example: "123456780123" epoch_ros: type: number @@ -3131,13 +3143,13 @@ components: type: - string - 'null' - description: Pool pledge in lovelace + description: Pool pledge in number example: "64000000000000" deposit: type: - string - 'null' - description: Pool's registration deposit in lovelace + description: Pool's registration deposit in number example: "500000000" reward_addr: type: @@ -3318,7 +3330,7 @@ components: $ref: "#/components/schemas/account_history/items/properties/stake_address" amount: type: string - description: Current delegator live stake (in lovelace) + description: Current delegator live stake (in number) example: 64328591517480 active_epoch_no: type: number @@ -3556,13 +3568,13 @@ components: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake address + description: The amount (in number) required for a deposit to register a stake address example: 2000000 pool_deposit: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake pool + description: The amount (in number) required for a deposit to register a stake pool example: 500000000 max_epoch: type: @@ -3963,13 +3975,13 @@ components: type: - string - 'null' - description: Total output of the block (in lovelace) + description: Total output of the block (in number) example: 92384672389 total_fees: type: - string - 'null' - description: Total fees of the block (in lovelace) + description: Total fees of the block (in number) example: 2346834 num_confirmations: type: number @@ -4171,15 +4183,15 @@ components: type: - 'null' - string - description: Account's current delegation status to DRep ID in Bech32 format - example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 + description: Account's current delegation status to DRep ID in CIP-129 Bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 delegated_pool: anyOf: - type: 'null' - $ref: "#/components/schemas/pool_list/items/properties/pool_id_bech32" total_balance: type: string - description: Total balance of the account including UTxO, rewards and MIRs (in lovelace) + description: Total balance of the account including UTxO, rewards and MIRs (in number) example: 207116800428 utxo: type: string @@ -4291,7 +4303,7 @@ components: $ref: "#/components/schemas/reserve_withdrawals/items/properties/spendable_epoch" amount: type: string - description: Amount of rewards earned (in lovelace) + description: Amount of rewards earned (in number) type: type: string description: The source of the rewards @@ -4381,7 +4393,7 @@ components: example: 301 active_stake: type: string - description: Active stake amount (in lovelaces) + description: Active stake amount (in numbers) example: 682334162 tx_info: description: Array of detailed information about transaction(s) @@ -4415,15 +4427,15 @@ components: example: 391 total_output: type: string - description: Total sum of all transaction outputs (in lovelaces) + description: Total sum of all transaction outputs (in numbers) example: 157832856 fee: type: string - description: Total Transaction fee (in lovelaces) + description: Total Transaction fee (in numbers) example: 172761 treasury_donation: type: string - description: Total Donation to on-chain treasury (in lovelaces) + description: Total Donation to on-chain treasury (in numbers) example: 0 deposit: type: string @@ -4564,7 +4576,7 @@ components: properties: amount: type: string - description: Withdrawal amount (in lovelaces) + description: Withdrawal amount (in numbers) example: 9845162 stake_addr: type: string @@ -4727,7 +4739,7 @@ components: voter_role: $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" voter: - $ref: "#/components/schemas/proposal_votes/items/properties/voter" + $ref: "#/components/schemas/proposal_votes/items/properties/voter_id" voter_hex: $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" vote: @@ -5143,15 +5155,15 @@ components: properties: drep_id: type: string - description: DRep ID in bech32 format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: DRep ID in CIP-129 bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 hex: type: string description: DRep ID in hex format - example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd has_script: type: boolean - description: Flag which shows if this DRep credentials are a script hash + description: Flag which shows if this credential is a script hash example: false registered: type: boolean @@ -5161,7 +5173,7 @@ components: type: - string - 'null' - description: DRep's registration deposit in lovelace + description: DRep's registration deposit in number example: 500000000 active: type: boolean @@ -5243,6 +5255,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" url: $ref: "#/components/schemas/drep_info/items/properties/url" hash: @@ -5289,6 +5303,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" update_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" cert_index: @@ -5315,6 +5331,8 @@ components: type: array items: properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5349,6 +5367,10 @@ components: properties: block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_id: + type: string + description: Proposal Action ID in accordance with CIP-129 format + example: 'gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh' proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5361,7 +5383,7 @@ components: description: Proposal Action Type example: ParameterChange proposal_description: - type: string + type: object description: Description for Proposal Action example: '{"tag": "InfoAction"}' deposit: @@ -5437,6 +5459,81 @@ components: type: array items: $ref: "#/components/schemas/proposal_list/items" + proposal_voting_summary: + description: Summary of votes for given proposal + type: array + items: + properties: + proposal_type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + epoch_no: + type: number + description: Epoch for which data was collated + example: 441 + drep_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by dreps + example: 7 + drep_yes_vote_power: + type: number + description: Power of 'yes' votes from dreps + example: 31146839512742 + drep_yes_pct: + type: number + description: Percentage of 'yes' votes from dreps + example: 60.72 + drep_no_votes_cast: + type: number + description: Number of 'no' votes casted by dreps + example: 0 + drep_no_vote_power: + type: number + description: Power of 'no' votes from dreps + example: 20148194577715 + drep_no_pct: + type: number + description: Percentage of 'no' votes from dreps + example: 39.28 + pool_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by pools + example: 1 + pool_yes_vote_power: + type: number + description: Power of 'yes' votes from pools + example: 5234000000 + pool_yes_pct: + type: number + description: Percentage of 'yes' votes from pools + example: 13.12 + pool_no_votes_cast: + type: number + description: Number of 'no' votes casted by pools + example: 0 + pool_no_vote_power: + type: number + description: Power of 'no' votes from pools + example: 0 + pool_no_pct: + type: number + description: Percentage of 'no' votes from pools + example: 0 + committee_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by committee + example: 5 + committee_yes_pct: + type: number + description: Percentage of 'yes' votes from committee + example: 71.43 + committee_no_votes_cast: + type: number + description: Number of 'no' votes casted by committee + example: 1 + committee_no_pct: + type: number + description: Percentage of 'no' votes from committee + example: 28.57 proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5449,14 +5546,16 @@ components: description: The role of the voter enum: ["ConstitutionalCommittee", "DRep", "SPO"] example: DRep - voter: + voter_id: type: string - description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: Voter's DRep ID (CIP-129 bech32 format), pool ID (bech32 format) or committee hot ID (CIP-129 bech32 format) + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 voter_hex: type: string description: Voter's DRep ID , pool ID or committee hash in hex format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd + voter_has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" vote: $ref: "#/components/schemas/drep_votes/items/properties/vote" meta_url: @@ -5467,6 +5566,8 @@ components: description: Current governance committee type: object properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5494,7 +5595,7 @@ components: example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf cc_cold_has_script: type: boolean - description: Flag which shows if this committee member cold credential is a script hash + description: Flag which shows if this credential is a script hash example: false cc_hot_hex: type: @@ -5506,7 +5607,7 @@ components: type: - boolean - 'null' - description: Flag which shows if this committee member hot credential is a script hash + description: Flag which shows if this credential is a script hash example: false expiration_epoch: type: number diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index ed6454ca..11d29f49 100644 --- a/specs/results/koiosapi-preprod.yaml +++ b/specs/results/koiosapi-preprod.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0a + version: v1.2.0 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -154,6 +154,8 @@ servers: description: Preview Network - url: https://preprod.koios.rest/api/v1 description: Preprod Network + - url: https://sancho.koios.rest/api/v1 + description: Sanchonet Network paths: /tip: #RPC @@ -1478,7 +1480,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_committee_hash" + - $ref: "#/components/parameters/_cc_hot_id" responses: "200": description: Success!! @@ -1520,7 +1522,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_credential" + - $ref: "#/components/parameters/_voter_id" responses: "200": description: Success!! @@ -1536,22 +1538,42 @@ paths: $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 - + operationId: voter_proposal_list + /proposal_voting_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_voting_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Voting Summary + description: Summary of votes for given proposal + operationId: proposal_voting_summary /proposal_votes: #RPC get: tags: - Governance parameters: - - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/parameters/_proposal_index" + - $ref: "#/components/parameters/_proposal_id" responses: "200": description: Success!! content: application/json: schema: - $ref: "#/components/schemas/committee_votes" + $ref: "#/components/schemas/proposal_votes" "400": $ref: "#/components/responses/BadRequest" "401": @@ -2089,10 +2111,10 @@ components: in: query required: false allowEmptyValue: true - _credential: + _voter_id: deprecated: false - name: _credential - description: Voter (Drep, SPO, Committee Member) in Hex format + name: _voter_id + description: Voter ID (Drep, SPO, Committee Member) in Bech32 format (CIP-5 | CIP-129) schema: type: string example: "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" @@ -2119,13 +2141,13 @@ components: in: query required: false allowEmptyValue: true - _committee_hash: + _cc_hot_id: deprecated: false - name: _committee_hash - description: Committee hash in hexadecimal format (hex) + name: _cc_hot_id + description: Committee member hot key ID in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "f8f56120e1ec00feb088ece39ef14f07339afeb37b4e949ff12b89ff" + example: "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7" in: query required: false allowEmptyValue: true @@ -2199,26 +2221,16 @@ components: in: query required: true allowEmptyValue: false - _proposal_tx_hash: + _proposal_id: deprecated: false - name: _proposal_tx_hash - description: Transaction Hash of government proposal in hexadecimal format (hex) - example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + name: _proposal_id + description: Government proposal ID in CIP-129 Bech32 format + example: "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf" schema: type: string in: query required: true allowEmptyValue: false - _proposal_index: - deprecated: false - name: _proposal_index - description: Index of governance proposal in transaction - schema: - type: number - example: 0 - in: query - required: true - allowEmptyValue: false requestBodies: block_hashes: content: @@ -2903,19 +2915,19 @@ components: example: 294 circulation: type: string - description: Circulating UTxOs for given epoch (in lovelaces) + description: Circulating UTxOs for given epoch (in numbers) example: 32081169442642320 treasury: type: string - description: Funds in treasury for given epoch (in lovelaces) + description: Funds in treasury for given epoch (in numbers) example: 637024173474141 reward: type: string - description: Rewards accumulated as of given epoch (in lovelaces) + description: Rewards accumulated as of given epoch (in numbers) example: 506871250479840 supply: type: string - description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in lovelaces) + description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in numbers) example: 33228495612391330 reserves: type: string @@ -3045,7 +3057,7 @@ components: example: 312 active_stake: type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) + description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) example: "31235800000" active_stake_pct: type: @@ -3073,21 +3085,21 @@ components: example: 0.125 fixed_cost: type: string - description: Pool fixed cost per epoch (in lovelaces) + description: Pool fixed cost per epoch (in numbers) example: "340000000" pool_fees: type: string - description: Total amount of fees earned by pool owners in that epoch (in lovelaces) + description: Total amount of fees earned by pool owners in that epoch (in numbers) example: "123327382" deleg_rewards: type: string - description: Total amount of rewards earned by delegators in that epoch (in lovelaces) + description: Total amount of rewards earned by delegators in that epoch (in numbers) example: "123456789123" member_rewards: type: - string - 'null' - description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) + description: Total amount of rewards earned by members (delegator - owner) in that epoch (in numbers) example: "123456780123" epoch_ros: type: number @@ -3131,13 +3143,13 @@ components: type: - string - 'null' - description: Pool pledge in lovelace + description: Pool pledge in number example: "64000000000000" deposit: type: - string - 'null' - description: Pool's registration deposit in lovelace + description: Pool's registration deposit in number example: "500000000" reward_addr: type: @@ -3318,7 +3330,7 @@ components: $ref: "#/components/schemas/account_history/items/properties/stake_address" amount: type: string - description: Current delegator live stake (in lovelace) + description: Current delegator live stake (in number) example: 64328591517480 active_epoch_no: type: number @@ -3556,13 +3568,13 @@ components: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake address + description: The amount (in number) required for a deposit to register a stake address example: 2000000 pool_deposit: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake pool + description: The amount (in number) required for a deposit to register a stake pool example: 500000000 max_epoch: type: @@ -3963,13 +3975,13 @@ components: type: - string - 'null' - description: Total output of the block (in lovelace) + description: Total output of the block (in number) example: 92384672389 total_fees: type: - string - 'null' - description: Total fees of the block (in lovelace) + description: Total fees of the block (in number) example: 2346834 num_confirmations: type: number @@ -4171,15 +4183,15 @@ components: type: - 'null' - string - description: Account's current delegation status to DRep ID in Bech32 format - example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 + description: Account's current delegation status to DRep ID in CIP-129 Bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 delegated_pool: anyOf: - type: 'null' - $ref: "#/components/schemas/pool_list/items/properties/pool_id_bech32" total_balance: type: string - description: Total balance of the account including UTxO, rewards and MIRs (in lovelace) + description: Total balance of the account including UTxO, rewards and MIRs (in number) example: 207116800428 utxo: type: string @@ -4291,7 +4303,7 @@ components: $ref: "#/components/schemas/reserve_withdrawals/items/properties/spendable_epoch" amount: type: string - description: Amount of rewards earned (in lovelace) + description: Amount of rewards earned (in number) type: type: string description: The source of the rewards @@ -4381,7 +4393,7 @@ components: example: 301 active_stake: type: string - description: Active stake amount (in lovelaces) + description: Active stake amount (in numbers) example: 682334162 tx_info: description: Array of detailed information about transaction(s) @@ -4415,15 +4427,15 @@ components: example: 391 total_output: type: string - description: Total sum of all transaction outputs (in lovelaces) + description: Total sum of all transaction outputs (in numbers) example: 157832856 fee: type: string - description: Total Transaction fee (in lovelaces) + description: Total Transaction fee (in numbers) example: 172761 treasury_donation: type: string - description: Total Donation to on-chain treasury (in lovelaces) + description: Total Donation to on-chain treasury (in numbers) example: 0 deposit: type: string @@ -4564,7 +4576,7 @@ components: properties: amount: type: string - description: Withdrawal amount (in lovelaces) + description: Withdrawal amount (in numbers) example: 9845162 stake_addr: type: string @@ -4727,7 +4739,7 @@ components: voter_role: $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" voter: - $ref: "#/components/schemas/proposal_votes/items/properties/voter" + $ref: "#/components/schemas/proposal_votes/items/properties/voter_id" voter_hex: $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" vote: @@ -5143,15 +5155,15 @@ components: properties: drep_id: type: string - description: DRep ID in bech32 format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: DRep ID in CIP-129 bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 hex: type: string description: DRep ID in hex format - example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd has_script: type: boolean - description: Flag which shows if this DRep credentials are a script hash + description: Flag which shows if this credential is a script hash example: false registered: type: boolean @@ -5161,7 +5173,7 @@ components: type: - string - 'null' - description: DRep's registration deposit in lovelace + description: DRep's registration deposit in number example: 500000000 active: type: boolean @@ -5243,6 +5255,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" url: $ref: "#/components/schemas/drep_info/items/properties/url" hash: @@ -5289,6 +5303,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" update_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" cert_index: @@ -5315,6 +5331,8 @@ components: type: array items: properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5349,6 +5367,10 @@ components: properties: block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_id: + type: string + description: Proposal Action ID in accordance with CIP-129 format + example: 'gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh' proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5361,7 +5383,7 @@ components: description: Proposal Action Type example: ParameterChange proposal_description: - type: string + type: object description: Description for Proposal Action example: '{"tag": "InfoAction"}' deposit: @@ -5437,6 +5459,81 @@ components: type: array items: $ref: "#/components/schemas/proposal_list/items" + proposal_voting_summary: + description: Summary of votes for given proposal + type: array + items: + properties: + proposal_type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + epoch_no: + type: number + description: Epoch for which data was collated + example: 441 + drep_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by dreps + example: 7 + drep_yes_vote_power: + type: number + description: Power of 'yes' votes from dreps + example: 31146839512742 + drep_yes_pct: + type: number + description: Percentage of 'yes' votes from dreps + example: 60.72 + drep_no_votes_cast: + type: number + description: Number of 'no' votes casted by dreps + example: 0 + drep_no_vote_power: + type: number + description: Power of 'no' votes from dreps + example: 20148194577715 + drep_no_pct: + type: number + description: Percentage of 'no' votes from dreps + example: 39.28 + pool_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by pools + example: 1 + pool_yes_vote_power: + type: number + description: Power of 'yes' votes from pools + example: 5234000000 + pool_yes_pct: + type: number + description: Percentage of 'yes' votes from pools + example: 13.12 + pool_no_votes_cast: + type: number + description: Number of 'no' votes casted by pools + example: 0 + pool_no_vote_power: + type: number + description: Power of 'no' votes from pools + example: 0 + pool_no_pct: + type: number + description: Percentage of 'no' votes from pools + example: 0 + committee_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by committee + example: 5 + committee_yes_pct: + type: number + description: Percentage of 'yes' votes from committee + example: 71.43 + committee_no_votes_cast: + type: number + description: Number of 'no' votes casted by committee + example: 1 + committee_no_pct: + type: number + description: Percentage of 'no' votes from committee + example: 28.57 proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5449,14 +5546,16 @@ components: description: The role of the voter enum: ["ConstitutionalCommittee", "DRep", "SPO"] example: DRep - voter: + voter_id: type: string - description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: Voter's DRep ID (CIP-129 bech32 format), pool ID (bech32 format) or committee hot ID (CIP-129 bech32 format) + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 voter_hex: type: string description: Voter's DRep ID , pool ID or committee hash in hex format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd + voter_has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" vote: $ref: "#/components/schemas/drep_votes/items/properties/vote" meta_url: @@ -5467,6 +5566,8 @@ components: description: Current governance committee type: object properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5494,7 +5595,7 @@ components: example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf cc_cold_has_script: type: boolean - description: Flag which shows if this committee member cold credential is a script hash + description: Flag which shows if this credential is a script hash example: false cc_hot_hex: type: @@ -5506,7 +5607,7 @@ components: type: - boolean - 'null' - description: Flag which shows if this committee member hot credential is a script hash + description: Flag which shows if this credential is a script hash example: false expiration_epoch: type: number diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index 8d3d3bff..390ba1c9 100644 --- a/specs/results/koiosapi-preview.yaml +++ b/specs/results/koiosapi-preview.yaml @@ -8,7 +8,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0a + version: v1.2.0 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. @@ -154,6 +154,8 @@ servers: description: Preview Network - url: https://preprod.koios.rest/api/v1 description: Preprod Network + - url: https://sancho.koios.rest/api/v1 + description: Sanchonet Network paths: /tip: #RPC @@ -1478,7 +1480,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_committee_hash" + - $ref: "#/components/parameters/_cc_hot_id" responses: "200": description: Success!! @@ -1520,7 +1522,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_credential" + - $ref: "#/components/parameters/_voter_id" responses: "200": description: Success!! @@ -1536,22 +1538,42 @@ paths: $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 - + operationId: voter_proposal_list + /proposal_voting_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_voting_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Voting Summary + description: Summary of votes for given proposal + operationId: proposal_voting_summary /proposal_votes: #RPC get: tags: - Governance parameters: - - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/parameters/_proposal_index" + - $ref: "#/components/parameters/_proposal_id" responses: "200": description: Success!! content: application/json: schema: - $ref: "#/components/schemas/committee_votes" + $ref: "#/components/schemas/proposal_votes" "400": $ref: "#/components/responses/BadRequest" "401": @@ -2025,7 +2047,7 @@ components: description: Epoch Number to fetch details for schema: type: string - example: "12" + example: "675" in: query required: false allowEmptyValue: true @@ -2089,13 +2111,13 @@ components: in: query required: false allowEmptyValue: true - _credential: + _voter_id: deprecated: false - name: _credential - description: Voter (Drep, SPO, Committee Member) in Hex format + name: _voter_id + description: Voter ID (Drep, SPO, Committee Member) in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + example: "drep17rksqsgqx8ej3rtc3x4gjm8a44u6w3qcshfm46yc9tq4zeffuzj" in: query required: true allowEmptyValue: false @@ -2105,7 +2127,7 @@ components: description: DRep ID in bech32 format schema: type: string - example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + example: "drep17rksqsgqx8ej3rtc3x4gjm8a44u6w3qcshfm46yc9tq4zeffuzj" in: query required: true allowEmptyValue: false @@ -2115,17 +2137,17 @@ components: description: DRep ID in bech32 format schema: type: string - example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + example: "drep17rksqsgqx8ej3rtc3x4gjm8a44u6w3qcshfm46yc9tq4zeffuzj" in: query required: false allowEmptyValue: true - _committee_hash: + _cc_hot_id: deprecated: false - name: _committee_hash - description: Committee hash in hexadecimal format (hex) + name: _cc_hot_id + description: Committee member hot key ID in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "7ceede7d6a89e006408e6b7c6acb3dd094b3f6817e43b4a36d01535b" + example: "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7" in: query required: false allowEmptyValue: true @@ -2199,26 +2221,16 @@ components: in: query required: true allowEmptyValue: false - _proposal_tx_hash: + _proposal_id: deprecated: false - name: _proposal_tx_hash - description: Transaction Hash of government proposal in hexadecimal format (hex) - example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + name: _proposal_id + description: Government proposal ID in CIP-129 Bech32 format + example: "gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh" schema: type: string in: query required: true allowEmptyValue: false - _proposal_index: - deprecated: false - name: _proposal_index - description: Index of governance proposal in transaction - schema: - type: number - example: 0 - in: query - required: true - allowEmptyValue: false requestBodies: block_hashes: content: @@ -2724,7 +2736,7 @@ components: type: string example: _drep_ids: - - drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts + - drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s - drep1g5vl99xcpv8uce5hhh50xe3fh68tl9f8hcprleekw0c6jhhr45f utxo_refs_with_extended: content: @@ -2903,19 +2915,19 @@ components: example: 294 circulation: type: string - description: Circulating UTxOs for given epoch (in lovelaces) + description: Circulating UTxOs for given epoch (in numbers) example: 32081169442642320 treasury: type: string - description: Funds in treasury for given epoch (in lovelaces) + description: Funds in treasury for given epoch (in numbers) example: 637024173474141 reward: type: string - description: Rewards accumulated as of given epoch (in lovelaces) + description: Rewards accumulated as of given epoch (in numbers) example: 506871250479840 supply: type: string - description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in lovelaces) + description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in numbers) example: 33228495612391330 reserves: type: string @@ -3045,7 +3057,7 @@ components: example: 312 active_stake: type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) + description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) example: "31235800000" active_stake_pct: type: @@ -3073,21 +3085,21 @@ components: example: 0.125 fixed_cost: type: string - description: Pool fixed cost per epoch (in lovelaces) + description: Pool fixed cost per epoch (in numbers) example: "340000000" pool_fees: type: string - description: Total amount of fees earned by pool owners in that epoch (in lovelaces) + description: Total amount of fees earned by pool owners in that epoch (in numbers) example: "123327382" deleg_rewards: type: string - description: Total amount of rewards earned by delegators in that epoch (in lovelaces) + description: Total amount of rewards earned by delegators in that epoch (in numbers) example: "123456789123" member_rewards: type: - string - 'null' - description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) + description: Total amount of rewards earned by members (delegator - owner) in that epoch (in numbers) example: "123456780123" epoch_ros: type: number @@ -3131,13 +3143,13 @@ components: type: - string - 'null' - description: Pool pledge in lovelace + description: Pool pledge in number example: "64000000000000" deposit: type: - string - 'null' - description: Pool's registration deposit in lovelace + description: Pool's registration deposit in number example: "500000000" reward_addr: type: @@ -3318,7 +3330,7 @@ components: $ref: "#/components/schemas/account_history/items/properties/stake_address" amount: type: string - description: Current delegator live stake (in lovelace) + description: Current delegator live stake (in number) example: 64328591517480 active_epoch_no: type: number @@ -3556,13 +3568,13 @@ components: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake address + description: The amount (in number) required for a deposit to register a stake address example: 2000000 pool_deposit: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake pool + description: The amount (in number) required for a deposit to register a stake pool example: 500000000 max_epoch: type: @@ -3963,13 +3975,13 @@ components: type: - string - 'null' - description: Total output of the block (in lovelace) + description: Total output of the block (in number) example: 92384672389 total_fees: type: - string - 'null' - description: Total fees of the block (in lovelace) + description: Total fees of the block (in number) example: 2346834 num_confirmations: type: number @@ -4171,15 +4183,15 @@ components: type: - 'null' - string - description: Account's current delegation status to DRep ID in Bech32 format - example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 + description: Account's current delegation status to DRep ID in CIP-129 Bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 delegated_pool: anyOf: - type: 'null' - $ref: "#/components/schemas/pool_list/items/properties/pool_id_bech32" total_balance: type: string - description: Total balance of the account including UTxO, rewards and MIRs (in lovelace) + description: Total balance of the account including UTxO, rewards and MIRs (in number) example: 207116800428 utxo: type: string @@ -4291,7 +4303,7 @@ components: $ref: "#/components/schemas/reserve_withdrawals/items/properties/spendable_epoch" amount: type: string - description: Amount of rewards earned (in lovelace) + description: Amount of rewards earned (in number) type: type: string description: The source of the rewards @@ -4381,7 +4393,7 @@ components: example: 301 active_stake: type: string - description: Active stake amount (in lovelaces) + description: Active stake amount (in numbers) example: 682334162 tx_info: description: Array of detailed information about transaction(s) @@ -4415,15 +4427,15 @@ components: example: 391 total_output: type: string - description: Total sum of all transaction outputs (in lovelaces) + description: Total sum of all transaction outputs (in numbers) example: 157832856 fee: type: string - description: Total Transaction fee (in lovelaces) + description: Total Transaction fee (in numbers) example: 172761 treasury_donation: type: string - description: Total Donation to on-chain treasury (in lovelaces) + description: Total Donation to on-chain treasury (in numbers) example: 0 deposit: type: string @@ -4564,7 +4576,7 @@ components: properties: amount: type: string - description: Withdrawal amount (in lovelaces) + description: Withdrawal amount (in numbers) example: 9845162 stake_addr: type: string @@ -4727,7 +4739,7 @@ components: voter_role: $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" voter: - $ref: "#/components/schemas/proposal_votes/items/properties/voter" + $ref: "#/components/schemas/proposal_votes/items/properties/voter_id" voter_hex: $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" vote: @@ -5143,15 +5155,15 @@ components: properties: drep_id: type: string - description: DRep ID in bech32 format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: DRep ID in CIP-129 bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 hex: type: string description: DRep ID in hex format - example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd has_script: type: boolean - description: Flag which shows if this DRep credentials are a script hash + description: Flag which shows if this credential is a script hash example: false registered: type: boolean @@ -5161,7 +5173,7 @@ components: type: - string - 'null' - description: DRep's registration deposit in lovelace + description: DRep's registration deposit in number example: 500000000 active: type: boolean @@ -5243,6 +5255,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" url: $ref: "#/components/schemas/drep_info/items/properties/url" hash: @@ -5289,6 +5303,8 @@ components: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" update_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" cert_index: @@ -5315,6 +5331,8 @@ components: type: array items: properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5349,6 +5367,10 @@ components: properties: block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_id: + type: string + description: Proposal Action ID in accordance with CIP-129 format + example: 'gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh' proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5361,7 +5383,7 @@ components: description: Proposal Action Type example: ParameterChange proposal_description: - type: string + type: object description: Description for Proposal Action example: '{"tag": "InfoAction"}' deposit: @@ -5437,6 +5459,81 @@ components: type: array items: $ref: "#/components/schemas/proposal_list/items" + proposal_voting_summary: + description: Summary of votes for given proposal + type: array + items: + properties: + proposal_type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + epoch_no: + type: number + description: Epoch for which data was collated + example: 441 + drep_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by dreps + example: 7 + drep_yes_vote_power: + type: number + description: Power of 'yes' votes from dreps + example: 31146839512742 + drep_yes_pct: + type: number + description: Percentage of 'yes' votes from dreps + example: 60.72 + drep_no_votes_cast: + type: number + description: Number of 'no' votes casted by dreps + example: 0 + drep_no_vote_power: + type: number + description: Power of 'no' votes from dreps + example: 20148194577715 + drep_no_pct: + type: number + description: Percentage of 'no' votes from dreps + example: 39.28 + pool_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by pools + example: 1 + pool_yes_vote_power: + type: number + description: Power of 'yes' votes from pools + example: 5234000000 + pool_yes_pct: + type: number + description: Percentage of 'yes' votes from pools + example: 13.12 + pool_no_votes_cast: + type: number + description: Number of 'no' votes casted by pools + example: 0 + pool_no_vote_power: + type: number + description: Power of 'no' votes from pools + example: 0 + pool_no_pct: + type: number + description: Percentage of 'no' votes from pools + example: 0 + committee_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by committee + example: 5 + committee_yes_pct: + type: number + description: Percentage of 'yes' votes from committee + example: 71.43 + committee_no_votes_cast: + type: number + description: Number of 'no' votes casted by committee + example: 1 + committee_no_pct: + type: number + description: Percentage of 'no' votes from committee + example: 28.57 proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5449,14 +5546,16 @@ components: description: The role of the voter enum: ["ConstitutionalCommittee", "DRep", "SPO"] example: DRep - voter: + voter_id: type: string - description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: Voter's DRep ID (CIP-129 bech32 format), pool ID (bech32 format) or committee hot ID (CIP-129 bech32 format) + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 voter_hex: type: string description: Voter's DRep ID , pool ID or committee hash in hex format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd + voter_has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" vote: $ref: "#/components/schemas/drep_votes/items/properties/vote" meta_url: @@ -5467,6 +5566,8 @@ components: description: Current governance committee type: object properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -5494,7 +5595,7 @@ components: example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf cc_cold_has_script: type: boolean - description: Flag which shows if this committee member cold credential is a script hash + description: Flag which shows if this credential is a script hash example: false cc_hot_hex: type: @@ -5506,7 +5607,7 @@ components: type: - boolean - 'null' - description: Flag which shows if this committee member hot credential is a script hash + description: Flag which shows if this credential is a script hash example: false expiration_epoch: type: number diff --git a/specs/templates/1-api-info.yaml b/specs/templates/1-api-info.yaml index 0620905d..6e3bf50f 100644 --- a/specs/templates/1-api-info.yaml +++ b/specs/templates/1-api-info.yaml @@ -7,7 +7,7 @@ info: license: name: Creative Commons Attribution 4.0 International url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE - version: v1.2.0a + version: v1.2.0 description: | Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples. diff --git a/specs/templates/2-api-params.yaml b/specs/templates/2-api-params.yaml index d26b348e..15141c99 100644 --- a/specs/templates/2-api-params.yaml +++ b/specs/templates/2-api-params.yaml @@ -79,10 +79,10 @@ parameters: in: query required: false allowEmptyValue: true - _credential: + _voter_id: deprecated: false - name: _credential - description: Voter (Drep, SPO, Committee Member) in Hex format + name: _voter_id + description: Voter ID (Drep, SPO, Committee Member) in Bech32 format (CIP-5 | CIP-129) schema: type: string example: "##_drep_id_param##" @@ -109,13 +109,13 @@ parameters: in: query required: false allowEmptyValue: true - _committee_hash: + _cc_hot_id: deprecated: false - name: _committee_hash - description: Committee hash in hexadecimal format (hex) + name: _cc_hot_id + description: Committee member hot key ID in Bech32 format (CIP-5 | CIP-129) schema: type: string - example: "##_committee_hash_param##" + example: "##_cc_hot_id_param##" in: query required: false allowEmptyValue: true @@ -189,23 +189,13 @@ parameters: in: query required: true allowEmptyValue: false - _proposal_tx_hash: + _proposal_id: deprecated: false - name: _proposal_tx_hash - description: Transaction Hash of government proposal in hexadecimal format (hex) - example: "##_proposal_tx_hash_param##" + name: _proposal_id + description: Government proposal ID in CIP-129 Bech32 format + example: "##_proposal_id_param##" schema: type: string in: query required: true allowEmptyValue: false - _proposal_index: - deprecated: false - name: _proposal_index - description: Index of governance proposal in transaction - schema: - type: number - example: 0 - in: query - required: true - allowEmptyValue: false diff --git a/specs/templates/4-api-schemas.yaml b/specs/templates/4-api-schemas.yaml index df537706..a338603a 100644 --- a/specs/templates/4-api-schemas.yaml +++ b/specs/templates/4-api-schemas.yaml @@ -80,19 +80,19 @@ schemas: example: 294 circulation: type: string - description: Circulating UTxOs for given epoch (in lovelaces) + description: Circulating UTxOs for given epoch (in numbers) example: 32081169442642320 treasury: type: string - description: Funds in treasury for given epoch (in lovelaces) + description: Funds in treasury for given epoch (in numbers) example: 637024173474141 reward: type: string - description: Rewards accumulated as of given epoch (in lovelaces) + description: Rewards accumulated as of given epoch (in numbers) example: 506871250479840 supply: type: string - description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in lovelaces) + description: Total Active Supply (sum of treasury funds, rewards, UTxOs, deposits and fees) for given epoch (in numbers) example: 33228495612391330 reserves: type: string @@ -222,7 +222,7 @@ schemas: example: 312 active_stake: type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) + description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) example: "31235800000" active_stake_pct: type: @@ -250,21 +250,21 @@ schemas: example: 0.125 fixed_cost: type: string - description: Pool fixed cost per epoch (in lovelaces) + description: Pool fixed cost per epoch (in numbers) example: "340000000" pool_fees: type: string - description: Total amount of fees earned by pool owners in that epoch (in lovelaces) + description: Total amount of fees earned by pool owners in that epoch (in numbers) example: "123327382" deleg_rewards: type: string - description: Total amount of rewards earned by delegators in that epoch (in lovelaces) + description: Total amount of rewards earned by delegators in that epoch (in numbers) example: "123456789123" member_rewards: type: - string - 'null' - description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) + description: Total amount of rewards earned by members (delegator - owner) in that epoch (in numbers) example: "123456780123" epoch_ros: type: number @@ -308,13 +308,13 @@ schemas: type: - string - 'null' - description: Pool pledge in lovelace + description: Pool pledge in number example: "64000000000000" deposit: type: - string - 'null' - description: Pool's registration deposit in lovelace + description: Pool's registration deposit in number example: "500000000" reward_addr: type: @@ -495,7 +495,7 @@ schemas: $ref: "#/components/schemas/account_history/items/properties/stake_address" amount: type: string - description: Current delegator live stake (in lovelace) + description: Current delegator live stake (in number) example: 64328591517480 active_epoch_no: type: number @@ -733,13 +733,13 @@ schemas: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake address + description: The amount (in number) required for a deposit to register a stake address example: 2000000 pool_deposit: type: - string - 'null' - description: The amount (in lovelace) required for a deposit to register a stake pool + description: The amount (in number) required for a deposit to register a stake pool example: 500000000 max_epoch: type: @@ -1140,13 +1140,13 @@ schemas: type: - string - 'null' - description: Total output of the block (in lovelace) + description: Total output of the block (in number) example: 92384672389 total_fees: type: - string - 'null' - description: Total fees of the block (in lovelace) + description: Total fees of the block (in number) example: 2346834 num_confirmations: type: number @@ -1348,15 +1348,15 @@ schemas: type: - 'null' - string - description: Account's current delegation status to DRep ID in Bech32 format - example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 + description: Account's current delegation status to DRep ID in CIP-129 Bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 delegated_pool: anyOf: - type: 'null' - $ref: "#/components/schemas/pool_list/items/properties/pool_id_bech32" total_balance: type: string - description: Total balance of the account including UTxO, rewards and MIRs (in lovelace) + description: Total balance of the account including UTxO, rewards and MIRs (in number) example: 207116800428 utxo: type: string @@ -1468,7 +1468,7 @@ schemas: $ref: "#/components/schemas/reserve_withdrawals/items/properties/spendable_epoch" amount: type: string - description: Amount of rewards earned (in lovelace) + description: Amount of rewards earned (in number) type: type: string description: The source of the rewards @@ -1558,7 +1558,7 @@ schemas: example: 301 active_stake: type: string - description: Active stake amount (in lovelaces) + description: Active stake amount (in numbers) example: 682334162 tx_info: description: Array of detailed information about transaction(s) @@ -1592,15 +1592,15 @@ schemas: example: 391 total_output: type: string - description: Total sum of all transaction outputs (in lovelaces) + description: Total sum of all transaction outputs (in numbers) example: 157832856 fee: type: string - description: Total Transaction fee (in lovelaces) + description: Total Transaction fee (in numbers) example: 172761 treasury_donation: type: string - description: Total Donation to on-chain treasury (in lovelaces) + description: Total Donation to on-chain treasury (in numbers) example: 0 deposit: type: string @@ -1741,7 +1741,7 @@ schemas: properties: amount: type: string - description: Withdrawal amount (in lovelaces) + description: Withdrawal amount (in numbers) example: 9845162 stake_addr: type: string @@ -1904,7 +1904,7 @@ schemas: voter_role: $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" voter: - $ref: "#/components/schemas/proposal_votes/items/properties/voter" + $ref: "#/components/schemas/proposal_votes/items/properties/voter_id" voter_hex: $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" vote: @@ -2320,15 +2320,15 @@ schemas: properties: drep_id: type: string - description: DRep ID in bech32 format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: DRep ID in CIP-129 bech32 format + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 hex: type: string description: DRep ID in hex format - example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd has_script: type: boolean - description: Flag which shows if this DRep credentials are a script hash + description: Flag which shows if this credential is a script hash example: false registered: type: boolean @@ -2338,7 +2338,7 @@ schemas: type: - string - 'null' - description: DRep's registration deposit in lovelace + description: DRep's registration deposit in number example: 500000000 active: type: boolean @@ -2420,6 +2420,8 @@ schemas: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" url: $ref: "#/components/schemas/drep_info/items/properties/url" hash: @@ -2466,6 +2468,8 @@ schemas: $ref: "#/components/schemas/drep_info/items/properties/drep_id" hex: $ref: "#/components/schemas/drep_info/items/properties/hex" + has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" update_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" cert_index: @@ -2492,6 +2496,8 @@ schemas: type: array items: properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -2526,6 +2532,10 @@ schemas: properties: block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_id: + type: string + description: Proposal Action ID in accordance with CIP-129 format + example: 'gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh' proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -2538,7 +2548,7 @@ schemas: description: Proposal Action Type example: ParameterChange proposal_description: - type: string + type: object description: Description for Proposal Action example: '{"tag": "InfoAction"}' deposit: @@ -2614,6 +2624,81 @@ schemas: type: array items: $ref: "#/components/schemas/proposal_list/items" + proposal_voting_summary: + description: Summary of votes for given proposal + type: array + items: + properties: + proposal_type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + epoch_no: + type: number + description: Epoch for which data was collated + example: 441 + drep_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by dreps + example: 7 + drep_yes_vote_power: + type: number + description: Power of 'yes' votes from dreps + example: 31146839512742 + drep_yes_pct: + type: number + description: Percentage of 'yes' votes from dreps + example: 60.72 + drep_no_votes_cast: + type: number + description: Number of 'no' votes casted by dreps + example: 0 + drep_no_vote_power: + type: number + description: Power of 'no' votes from dreps + example: 20148194577715 + drep_no_pct: + type: number + description: Percentage of 'no' votes from dreps + example: 39.28 + pool_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by pools + example: 1 + pool_yes_vote_power: + type: number + description: Power of 'yes' votes from pools + example: 5234000000 + pool_yes_pct: + type: number + description: Percentage of 'yes' votes from pools + example: 13.12 + pool_no_votes_cast: + type: number + description: Number of 'no' votes casted by pools + example: 0 + pool_no_vote_power: + type: number + description: Power of 'no' votes from pools + example: 0 + pool_no_pct: + type: number + description: Percentage of 'no' votes from pools + example: 0 + committee_yes_votes_cast: + type: number + description: Number of 'yes' votes casted by committee + example: 5 + committee_yes_pct: + type: number + description: Percentage of 'yes' votes from committee + example: 71.43 + committee_no_votes_cast: + type: number + description: Number of 'no' votes casted by committee + example: 1 + committee_no_pct: + type: number + description: Percentage of 'no' votes from committee + example: 28.57 proposal_votes: type: array description: List of all votes cast on specified governance action @@ -2626,14 +2711,16 @@ schemas: description: The role of the voter enum: ["ConstitutionalCommittee", "DRep", "SPO"] example: DRep - voter: + voter_id: type: string - description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + description: Voter's DRep ID (CIP-129 bech32 format), pool ID (bech32 format) or committee hot ID (CIP-129 bech32 format) + example: drep1yfhyq6tztjksqqpd5lglc3zr2tn8vylgjh9xzz7n2p4l4lgk3qam3 voter_hex: type: string description: Voter's DRep ID , pool ID or committee hash in hex format - example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + example: 6e4069625cad00002da7d1fc444352e67613e895ca610bd3506bfafd + voter_has_script: + $ref: "#/components/schemas/drep_info/items/properties/has_script" vote: $ref: "#/components/schemas/drep_votes/items/properties/vote" meta_url: @@ -2644,6 +2731,8 @@ schemas: description: Current governance committee type: object properties: + proposal_id: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_id" proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" proposal_index: @@ -2671,7 +2760,7 @@ schemas: example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf cc_cold_has_script: type: boolean - description: Flag which shows if this committee member cold credential is a script hash + description: Flag which shows if this credential is a script hash example: false cc_hot_hex: type: @@ -2683,7 +2772,7 @@ schemas: type: - boolean - 'null' - description: Flag which shows if this committee member hot credential is a script hash + description: Flag which shows if this credential is a script hash example: false expiration_epoch: type: number diff --git a/specs/templates/api-main.yaml b/specs/templates/api-main.yaml index c42901a1..899e64d4 100644 --- a/specs/templates/api-main.yaml +++ b/specs/templates/api-main.yaml @@ -9,6 +9,8 @@ servers: description: Preview Network - url: https://preprod.koios.rest/api/v1 description: Preprod Network + - url: https://sancho.koios.rest/api/v1 + description: Sanchonet Network paths: /tip: #RPC @@ -1333,7 +1335,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_committee_hash" + - $ref: "#/components/parameters/_cc_hot_id" responses: "200": description: Success!! @@ -1375,7 +1377,7 @@ paths: tags: - Governance parameters: - - $ref: "#/components/parameters/_credential" + - $ref: "#/components/parameters/_voter_id" responses: "200": description: Success!! @@ -1391,22 +1393,42 @@ paths: $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 - + operationId: voter_proposal_list + /proposal_voting_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_voting_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Voting Summary + description: Summary of votes for given proposal + operationId: proposal_voting_summary /proposal_votes: #RPC get: tags: - Governance parameters: - - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/parameters/_proposal_index" + - $ref: "#/components/parameters/_proposal_id" responses: "200": description: Success!! content: application/json: schema: - $ref: "#/components/schemas/committee_votes" + $ref: "#/components/schemas/proposal_votes" "400": $ref: "#/components/responses/BadRequest" "401": diff --git a/specs/templates/example-map.json b/specs/templates/example-map.json index fd9a16de..0f2291d2 100644 --- a/specs/templates/example-map.json +++ b/specs/templates/example-map.json @@ -9,7 +9,7 @@ "_epoch_no": { "m": "320", "g": "6219", - "pv": "12", + "pv": "675", "pp": "31" }, "_earned_epoch_no": { @@ -75,20 +75,26 @@ "_drep_id": { "m": "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3", "g": "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r", - "pv": "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts", + "pv": "drep17rksqsgqx8ej3rtc3x4gjm8a44u6w3qcshfm46yc9tq4zeffuzj", "pp": "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" }, - "_committee_hash": { - "m": "49fa008218cd619afe6aa8a1a93303f242440722b314f36bda2c2e23", - "g": "65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472", - "pv": "7ceede7d6a89e006408e6b7c6acb3dd094b3f6817e43b4a36d01535b", - "pp": "f8f56120e1ec00feb088ece39ef14f07339afeb37b4e949ff12b89ff" + "_cc_hot_id": { + "m": "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7", + "g": "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7", + "pv": "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7", + "pp": "cc_hot1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvcdjk7" }, - "_proposal_tx_hash": { - "m": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", - "g": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", - "pv": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", - "pp": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + "_proposal_id": { + "m": "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf", + "g": "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf", + "pv": "gov_action17m93skslaxyd45gpr6ernkdzs852h564wsterr8l6lheu7hu7kvsqecyqdh", + "pp": "gov_action1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpzklpgpf" + }, + "_voter_id": { + "m": "['pool1w83ux7vrwafrsuz044knxl9xxtr38q5jj2l3p28fl3g26faqqwg', 'drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s']", + "g": "['pool1w83ux7vrwafrsuz044knxl9xxtr38q5jj2l3p28fl3g26faqqwg', 'drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s']", + "pv": "['pool1w83ux7vrwafrsuz044knxl9xxtr38q5jj2l3p28fl3g26faqqwg', 'drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s']", + "pp": "['pool1w83ux7vrwafrsuz044knxl9xxtr38q5jj2l3p28fl3g26faqqwg', 'drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s']" }, "_pool_bech32": { "m": "pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc", @@ -197,7 +203,7 @@ "drep_ids1": { "m": "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3", "g": "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r", - "pv": "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts", + "pv": "drep1yt76he02dprm2af6x26vg76mhs2vajlg43cr9jh9dq3f2qs68ts3s", "pp": "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" }, "drep_ids2": {