diff --git a/files/grest/rpc/governance/committee_info.sql b/files/grest/rpc/governance/committee_info.sql index 1de55545..57cd3e31 100644 --- a/files/grest/rpc/governance/committee_info.sql +++ b/files/grest/rpc/governance/committee_info.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION grest.committee_info() RETURNS TABLE ( proposal_tx_hash text, - cert_index bigint, + proposal_index bigint, quorum_numerator bigint, quorum_denominator bigint, members jsonb diff --git a/files/grest/rpc/governance/committee_votes.sql b/files/grest/rpc/governance/committee_votes.sql index 0007f105..d96f833b 100644 --- a/files/grest/rpc/governance/committee_votes.sql +++ b/files/grest/rpc/governance/committee_votes.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION grest.committee_votes(_committee_hash text) RETURNS TABLE ( proposal_tx_hash text, - cert_index integer, + proposal_index integer, vote_tx_hash text, block_time integer, vote text @@ -9,10 +9,10 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT - ENCODE(prop_tx.hash, 'hex')::text AS proposal_tx_hash, - gap.index AS cert_index, - ENCODE(vote_tx.hash, 'hex')::text AS vote_tx_hash, - EXTRACT(EPOCH FROM b.time)::integer AS block_time, + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, vp.vote FROM public.committee_hash AS ch INNER JOIN public.voting_procedure AS vp ON ch.id = vp.committee_voter diff --git a/files/grest/rpc/governance/drep_votes.sql b/files/grest/rpc/governance/drep_votes.sql index d8010ae5..520eb88f 100644 --- a/files/grest/rpc/governance/drep_votes.sql +++ b/files/grest/rpc/governance/drep_votes.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION grest.drep_votes(_drep_id text) RETURNS TABLE ( proposal_tx_hash text, - cert_index integer, + proposal_index integer, vote_tx_hash text, block_time integer, vote text @@ -9,10 +9,10 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT - ENCODE(prop_tx.hash, 'hex')::text AS proposal_tx_hash, - gap.index AS cert_index, - ENCODE(vote_tx.hash, 'hex')::text AS vote_tx_hash, - EXTRACT(EPOCH FROM b.time)::integer AS block_time, + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, vp.vote FROM public.drep_hash AS dh INNER JOIN public.voting_procedure AS vp ON dh.id = vp.drep_voter diff --git a/files/grest/rpc/governance/proposal_list.sql b/files/grest/rpc/governance/proposal_list.sql index f7cf17d5..851c1c3a 100644 --- a/files/grest/rpc/governance/proposal_list.sql +++ b/files/grest/rpc/governance/proposal_list.sql @@ -1,8 +1,8 @@ CREATE OR REPLACE FUNCTION grest.proposal_list() RETURNS TABLE ( - proposal_tx_hash text, - cert_index integer, block_time integer, + proposal_tx_hash text, + proposal_index integer, proposal_type text, proposal_description jsonb, deposit text, @@ -25,25 +25,25 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT - ENCODE(tx.hash, 'hex')::text AS proposal_tx_hash, - gap.index AS cert_index, - EXTRACT(EPOCH FROM b.time)::integer AS block_time, - gap.type AS proposal_type, - gap.description AS proposal_description, - gap.deposit::text AS deposit, - sa.view AS return_address, - b.epoch_no AS proposed_epoch, - gap.ratified_epoch AS ratified_epoch, - gap.enacted_epoch AS enacted_epoch, - gap.dropped_epoch AS dropped_epoch, - gap.expired_epoch AS expired_epoch, - gap.expiration AS expiration, - va.url AS meta_url, - ENCODE(va.data_hash, 'hex') AS meta_hash, - ocvd.json AS meta_json, - ocvd.comment AS meta_comment, - ocvd.language AS meta_language, - ocvd.is_valid AS meta_is_valid, + EXTRACT(EPOCH FROM b.time)::integer, + ENCODE(tx.hash, 'hex'), + gap.index, + gap.type, + gap.description, + gap.deposit::text, + sa.view, + b.epoch_no, + gap.ratified_epoch, + gap.enacted_epoch, + gap.dropped_epoch, + gap.expired_epoch, + gap.expiration, + va.url, + ENCODE(va.data_hash, 'hex'), + ocvd.json, + ocvd.comment, + ocvd.language, + ocvd.is_valid, CASE WHEN tw.id IS NULL THEN NULL ELSE @@ -58,7 +58,7 @@ AS $$ END AS withdrawal, CASE WHEN pp.id IS NULL THEN NULL - ELSE ( SELECT ROW_TO_JSON(pp.*) ) + ELSE ( SELECT JSONB_STRIP_NULLS(TO_JSONB(pp.*)) - array['id','registered_tx_id','epoch_no'] ) END AS param_proposal FROM public.gov_action_proposal AS gap INNER JOIN public.tx ON gap.tx_id = tx.id diff --git a/files/grest/rpc/governance/proposal_votes.sql b/files/grest/rpc/governance/proposal_votes.sql index 0ce56e41..20a530ea 100644 --- a/files/grest/rpc/governance/proposal_votes.sql +++ b/files/grest/rpc/governance/proposal_votes.sql @@ -1,4 +1,4 @@ -CREATE OR REPLACE FUNCTION grest.proposal_votes(_proposal_tx_hash text, _cert_index integer) +CREATE OR REPLACE FUNCTION grest.proposal_votes(_proposal_tx_hash text, _proposal_index integer) RETURNS TABLE ( block_time integer, voter_role text, @@ -26,6 +26,7 @@ AS $$ 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 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? AND ( CASE diff --git a/files/grest/rpc/pool/pool_votes.sql b/files/grest/rpc/pool/pool_votes.sql index 10146645..f88a5bb6 100644 --- a/files/grest/rpc/pool/pool_votes.sql +++ b/files/grest/rpc/pool/pool_votes.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE FUNCTION grest.pool_votes(_pool_bech32 text) RETURNS TABLE ( proposal_tx_hash text, - cert_index integer, + proposal_index integer, vote_tx_hash text, block_time integer, vote text @@ -9,10 +9,10 @@ RETURNS TABLE ( LANGUAGE sql STABLE AS $$ SELECT - ENCODE(prop_tx.hash, 'hex')::text AS proposal_tx_hash, - gap.index AS cert_index, - ENCODE(vote_tx.hash, 'hex')::text AS vote_tx_hash, - EXTRACT(EPOCH FROM b.time)::integer AS block_time, + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, vp.vote FROM public.pool_hash ph INNER JOIN public.voting_procedure AS vp ON ph.id = vp.pool_voter diff --git a/files/grest/rpc/transactions/tx_info.sql b/files/grest/rpc/transactions/tx_info.sql index 39add46e..8582e257 100644 --- a/files/grest/rpc/transactions/tx_info.sql +++ b/files/grest/rpc/transactions/tx_info.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE FUNCTION grest.tx_info( _withdrawals boolean DEFAULT false, _certs boolean DEFAULT false, _scripts boolean DEFAULT false, - _bytecode boolean DEFAULT false + _bytecode boolean DEFAULT false, + _governance boolean DEFAULT false ) RETURNS TABLE ( tx_hash text, @@ -34,7 +35,9 @@ RETURNS TABLE ( metadata jsonb, certificates jsonb, native_scripts jsonb, - plutus_contracts jsonb + plutus_contracts jsonb, + voting_procedures jsonb, + proposal_procedures jsonb ) LANGUAGE plpgsql AS $$ @@ -91,7 +94,7 @@ BEGIN ENCODE(tx.hash, 'hex') AS tx_hash, tx_out.index AS tx_index, tx_out.value::text AS value, - ENCODE(tx_out.data_hash, 'hex') AS datum_hash, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -146,7 +149,7 @@ BEGIN ENCODE(tx.hash, 'hex') AS tx_hash, tx_out.index AS tx_index, tx_out.value::text AS value, - ENCODE(tx_out.data_hash, 'hex') AS datum_hash, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -194,14 +197,14 @@ BEGIN _all_inputs AS ( SELECT - tx_out.consumed_by_tx_id AS tx_id, - tx_out.address AS payment_addr_bech32, + tx_out.consumed_by_tx_id AS tx_id, + tx_out.address AS payment_addr_bech32, ENCODE(tx_out.payment_cred, 'hex') AS payment_addr_cred, - sa.view AS stake_addr, - ENCODE(tx.hash, 'hex') AS tx_hash, - tx_out.index AS tx_index, - tx_out.value::text AS value, - ENCODE(tx_out.data_hash, 'hex') AS datum_hash, + sa.view AS stake_addr, + ENCODE(tx.hash, 'hex') AS tx_hash, + tx_out.index AS tx_index, + tx_out.value::text AS value, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -253,7 +256,7 @@ BEGIN ENCODE(tx.hash, 'hex') AS tx_hash, tx_out.index AS tx_index, tx_out.value::text AS value, - ENCODE(tx_out.data_hash, 'hex') AS datum_hash, + tx_out.data_hash AS datum_hash, (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -293,7 +296,7 @@ BEGIN ENCODE(tx.hash, 'hex') AS tx_hash, tx_out.index AS tx_index, tx_out.value::text AS value, - ENCODE(tx_out.data_hash, 'hex') AS datum_hash, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -401,7 +404,8 @@ BEGIN 'index', sr.cert_index, 'type', 'stake_registration', 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view + 'stake_address', sa.view, + 'deposit', sr.deposit::text ) ) AS data FROM public.stake_registration AS sr @@ -431,7 +435,7 @@ BEGIN d.tx_id, JSONB_BUILD_OBJECT( 'index', d.cert_index, - 'type', 'delegation', + 'type', 'pool_delegation', 'info', JSONB_BUILD_OBJECT( 'stake_address', sa.view, 'pool_id_bech32', ph.view, @@ -502,59 +506,7 @@ BEGIN JSONB_BUILD_OBJECT( 'index', NULL, -- cert_index not stored in param_proposal table 'type', 'param_proposal', - 'info', JSONB_STRIP_NULLS(JSONB_BUILD_OBJECT( - 'min_fee_a', pp.min_fee_a, - 'min_fee_b', pp.min_fee_b, - 'max_block_size', pp.max_block_size, - 'max_tx_size', pp.max_tx_size, - 'max_bh_size', pp.max_bh_size, - 'key_deposit', pp.key_deposit, - 'pool_deposit', pp.pool_deposit, - 'max_epoch', pp.max_epoch, - 'optimal_pool_count', pp.optimal_pool_count, - 'influence', pp.influence, - 'monetary_expand_rate', pp.monetary_expand_rate, - 'treasury_growth_rate', pp.treasury_growth_rate, - 'decentralisation', pp.decentralisation, - 'entropy', pp.entropy, - 'protocol_major', pp.protocol_major, - 'protocol_minor', pp.protocol_minor, - 'min_utxo_value', pp.min_utxo_value, - 'min_pool_cost', pp.min_pool_cost, - 'cost_model', cm.costs, - 'price_mem', pp.price_mem, - 'price_step', pp.price_step, - 'max_tx_ex_mem', pp.max_tx_ex_mem, - 'max_tx_ex_steps', pp.max_tx_ex_steps, - 'max_block_ex_mem', pp.max_block_ex_mem, - 'max_block_ex_steps', pp.max_block_ex_steps, - 'max_val_size', pp.max_val_size, - 'collateral_percent', pp.collateral_percent, - 'max_collateral_inputs', pp.max_collateral_inputs, - 'coins_per_utxo_size', pp.coins_per_utxo_size, - 'pvt_motion_no_confidence', pp.pvt_motion_no_confidence, - 'pvt_committee_normal', pp.pvt_committee_normal, - 'pvt_committee_no_confidence', pp.pvt_committee_no_confidence, - 'pvt_hard_fork_initiation', pp.pvt_hard_fork_initiation, - 'dvt_motion_no_confidence', pp.dvt_motion_no_confidence, - 'dvt_committee_normal', pp.dvt_committee_normal, - 'dvt_committee_no_confidence', pp.dvt_committee_no_confidence, - 'dvt_update_to_constitution', pp.dvt_update_to_constitution, - 'dvt_hard_fork_initiation', pp.dvt_hard_fork_initiation, - 'dvt_p_p_network_group', pp.dvt_p_p_network_group, - 'dvt_p_p_economic_group', pp.dvt_p_p_economic_group, - 'dvt_p_p_technical_group', pp.dvt_p_p_technical_group, - 'dvt_p_p_gov_group', pp.dvt_p_p_gov_group, - 'dvt_treasury_withdrawal', pp.dvt_treasury_withdrawal, - 'committee_min_size', pp.committee_min_size, - 'committee_max_term_length', pp.committee_max_term_length, - 'gov_action_lifetime', pp.gov_action_lifetime, - 'gov_action_deposit', pp.gov_action_deposit, - 'drep_deposit', pp.drep_deposit, - 'drep_activity', pp.drep_activity, - 'pvtpp_security_group', pp.pvtpp_security_group, - 'min_fee_ref_script_cost_per_byte', pp.min_fee_ref_script_cost_per_byte - )) + 'info', JSONB_STRIP_NULLS(TO_JSONB(pp.*)) - array['id','registered_tx_id','epoch_no'] ) AS data FROM public.param_proposal AS pp INNER JOIN cost_model AS cm ON cm.id = pp.cost_model_id @@ -605,6 +557,128 @@ BEGIN INNER JOIN public.pool_update AS pu ON pu.registered_tx_id = pic.tx_id WHERE _certs IS TRUE AND pic.tx_id = ANY(_tx_id_list) + -- + UNION ALL + -- + SELECT + dv.tx_id, + JSONB_BUILD_OBJECT( + 'index', dv.cert_index, + 'type', 'vote_delegation', + 'info', JSONB_BUILD_OBJECT( + 'stake_address', sa.view, + 'drep_id', dh.view, + 'drep_hex', ENCODE(dh.raw, 'hex') + ) + ) AS data + FROM public.delegation_vote AS dv + INNER JOIN public.drep_hash AS dh ON dh.id = dv.drep_hash_id + INNER JOIN public.stake_address AS sa ON sa.id = dv.addr_id + WHERE _certs IS TRUE + AND dv.tx_id = ANY(_tx_id_list) + -- + UNION ALL + -- + SELECT + dr.tx_id, + JSONB_BUILD_OBJECT( + 'index', dr.cert_index, + 'type', 'drep_registration', + 'info', JSONB_BUILD_OBJECT( + 'drep_id', dh.view, + 'drep_hex', ENCODE(dh.raw, 'hex'), + 'deposit', dr.deposit::text, + 'meta_url', va.url, + 'meta_hash', va.data_hash + ) + ) AS data + FROM public.drep_registration AS dr + INNER JOIN public.drep_hash AS dh ON dh.id = dr.drep_hash_id + LEFT JOIN public.voting_anchor AS va ON va.id = dr.voting_anchor_id + WHERE _certs IS TRUE + AND dr.tx_id = ANY(_tx_id_list) + AND dr.deposit IS NOT NULL + AND dr.deposit >= 0 + -- + UNION ALL + -- + SELECT + dr.tx_id, + JSONB_BUILD_OBJECT( + 'index', dr.cert_index, + 'type', 'drep_update', + 'info', JSONB_BUILD_OBJECT( + 'drep_id', dh.view, + 'drep_hex', ENCODE(dh.raw, 'hex'), + 'meta_url', va.url, + 'meta_hash', va.data_hash + ) + ) AS data + FROM public.drep_registration AS dr + INNER JOIN public.drep_hash AS dh ON dh.id = dr.drep_hash_id + LEFT JOIN public.voting_anchor AS va ON va.id = dr.voting_anchor_id + WHERE _certs IS TRUE + AND dr.tx_id = ANY(_tx_id_list) + AND dr.deposit IS NULL + -- + UNION ALL + -- + SELECT + dr.tx_id, + JSONB_BUILD_OBJECT( + 'index', dr.cert_index, + 'type', 'drep_retire', + 'info', JSONB_BUILD_OBJECT( + 'drep_id', dh.view, + 'drep_hex', ENCODE(dh.raw, 'hex') + ) + ) AS data + FROM public.drep_registration AS dr + INNER JOIN public.drep_hash AS dh ON dh.id = dr.drep_hash_id + WHERE _certs IS TRUE + AND dr.tx_id = ANY(_tx_id_list) + AND dr.deposit IS NOT NULL + AND dr.deposit < 0 + -- + UNION ALL + -- + SELECT + cr.tx_id, + JSONB_BUILD_OBJECT( + 'index', cr.cert_index, + 'type', 'committee_hot_auth', + 'info', JSONB_BUILD_OBJECT( + 'cc_cold_hex', ENCODE(ch_cold.raw, 'hex'), + 'cc_cold_has_script', ch_cold.has_script, + 'cc_hot_hex', ENCODE(ch_hot.raw, 'hex'), + 'cc_hot_has_script', ch_hot.has_script + ) + ) AS data + FROM public.committee_registration AS cr + INNER JOIN public.committee_hash AS ch_cold ON ch_cold.id = cr.cold_key_id + INNER JOIN public.committee_hash AS ch_hot ON ch_hot.id = cr.hot_key_id + WHERE _certs IS TRUE + AND cr.tx_id = ANY(_tx_id_list) + -- + UNION ALL + -- + SELECT + cdr.tx_id, + JSONB_BUILD_OBJECT( + 'index', cdr.cert_index, + 'type', 'committee_resign', + 'info', JSONB_BUILD_OBJECT( + 'cc_cold_hex', ENCODE(ch.raw, 'hex'), + 'cc_cold_has_script', ch.has_script, + 'meta_url', va.url, + 'meta_hash', va.data_hash + ) + ) AS data + FROM public.committee_de_registration AS cdr + INNER JOIN public.committee_hash AS ch ON ch.id = cdr.cold_key_id + LEFT JOIN public.voting_anchor AS va ON va.id = cdr.voting_anchor_id + WHERE _certs IS TRUE + AND cdr.tx_id = ANY(_tx_id_list) ) AS tmp GROUP BY tx_id ), @@ -644,10 +718,10 @@ BEGIN redeemer.unit_mem, rd.hash AS rd_hash, rd.value AS rd_value, + script.hash AS script_hash, CASE WHEN _bytecode IS TRUE THEN script.bytes END AS script_bytes, - script.bytes AS script_bytes, script.serialised_size AS script_serialised_size, tx.valid_contract FROM redeemer @@ -746,6 +820,78 @@ BEGIN WHERE _scripts IS TRUE ) AS tmp GROUP BY tx_id + ), + + _all_voting_procedures AS ( + SELECT + tx_id, + JSONB_AGG(data) AS list + FROM ( + SELECT + vp.tx_id, + JSONB_BUILD_OBJECT( + 'proposal_tx_hash', ENCODE(tx.hash, 'hex'), + 'proposal_index', gap.index, + 'voter_role', vp.voter_role, + 'voter', COALESCE(ENCODE(ch.raw, 'hex'), dh.view, ph.view), + 'voter_hex', COALESCE(ENCODE(ch.raw, 'hex'), ENCODE(dh.raw, 'hex'), ENCODE(ph.hash_raw, 'hex')), + 'vote', vp.vote + ) AS data + FROM voting_procedure AS vp + INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id + INNER JOIN public.tx ON gap.tx_id = tx.id + 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 + WHERE _governance IS TRUE + AND vp.tx_id = ANY(_tx_id_list) + ) AS tmp + GROUP BY tx_id + ), + + _all_proposal_procedures AS ( + SELECT + tx_id, + JSONB_AGG(data) AS list + FROM ( + SELECT + gap.tx_id, + JSONB_BUILD_OBJECT( + 'index', gap.index, + 'type', gap.type, + 'description', gap.description, + 'deposit', gap.deposit::text, + 'return_address', sa.view, + 'expiration', gap.expiration, + 'meta_url', va.url, + 'meta_hash', ENCODE(va.data_hash, 'hex'), + 'withdrawal', CASE + WHEN tw.id IS NULL THEN NULL + ELSE + JSONB_BUILD_OBJECT( + 'stake_address', ( + SELECT sa2.view + FROM stake_address AS sa2 + WHERE sa2.id = tw.stake_address_id + ), + 'amount', tw.amount::text + ) + END, + 'param_proposal', CASE + WHEN pp.id IS NULL THEN NULL + ELSE ( SELECT JSONB_STRIP_NULLS(TO_JSONB(pp.*)) - array['id','registered_tx_id','epoch_no'] ) + END + ) AS data + FROM gov_action_proposal AS gap + INNER JOIN public.stake_address AS sa ON gap.return_address = sa.id + LEFT JOIN public.treasury_withdrawal AS tw ON gap.id = tw.gov_action_proposal_id + LEFT JOIN public.param_proposal AS pp ON gap.param_proposal = pp.id + LEFT JOIN public.cost_model AS cm ON cm.id = pp.cost_model_id + LEFT JOIN public.voting_anchor AS va ON gap.voting_anchor_id = va.id + WHERE _governance IS TRUE + AND gap.tx_id = ANY(_tx_id_list) + ) AS tmp + GROUP BY tx_id ) SELECT @@ -867,7 +1013,7 @@ BEGIN 'tx_hash', ao.tx_hash, 'tx_index', tx_index, 'value', value, - 'datum_hash', datum_hash, + 'datum_hash', ENCODE(datum_hash, 'hex'), 'inline_datum', inline_datum, 'reference_script', reference_script, 'asset_list', COALESCE(JSONB_AGG(asset_list) FILTER (WHERE asset_list IS NOT NULL), JSONB_BUILD_ARRAY()) @@ -882,7 +1028,9 @@ BEGIN COALESCE((SELECT ame.list FROM _all_metadata AS ame WHERE _metadata IS TRUE AND ame.tx_id = atx.id), NULL), COALESCE((SELECT ac.list FROM _all_certs AS ac WHERE _certs IS TRUE AND ac.tx_id = atx.id), JSONB_BUILD_ARRAY()), COALESCE((SELECT ans.list FROM _all_native_scripts AS ans WHERE _scripts IS TRUE AND ans.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT apc.list FROM _all_plutus_contracts AS apc WHERE _scripts IS TRUE AND apc.tx_id = atx.id), JSONB_BUILD_ARRAY()) + COALESCE((SELECT apc.list FROM _all_plutus_contracts AS apc WHERE _scripts IS TRUE AND apc.tx_id = atx.id), JSONB_BUILD_ARRAY()), + COALESCE((SELECT avp.list FROM _all_voting_procedures AS avp WHERE _governance IS TRUE AND avp.tx_id = atx.id), JSONB_BUILD_ARRAY()), + COALESCE((SELECT app.list FROM _all_proposal_procedures AS app WHERE _governance IS TRUE AND app.tx_id = atx.id), JSONB_BUILD_ARRAY()) FROM _all_tx AS atx WHERE atx.id = ANY(_tx_id_list) ); diff --git a/specs/results/koiosapi-guild.yaml b/specs/results/koiosapi-guild.yaml index 2c765fb5..83f77477 100644 --- a/specs/results/koiosapi-guild.yaml +++ b/specs/results/koiosapi-guild.yaml @@ -1301,6 +1301,28 @@ paths: description: Get the list of current or all asset transaction hashes (newest first) operationId: asset_txs + /drep_epoch_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_epoch_no" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_epoch_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Epoch Summary + description: Summary of voting power and DRep count for each epoch + operationId: drep_epoch_summary /drep_list: #RPC get: tags: @@ -1409,6 +1431,48 @@ paths: summary: DReps Votes description: List of all votes casted by requested delegated representative (DRep) operationId: drep_votes + /drep_delegators: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_delegators" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Delegators + description: List of all delegators to requested delegated representative (DRep). + operationId: drep_delegators + /committee_info: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Information + description: Information about active committee and its members + operationId: committee_info /committee_votes: #RPC get: tags: @@ -1457,7 +1521,7 @@ paths: - Governance parameters: - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + - $ref: "#/components/parameters/_proposal_index" responses: "200": description: Success!! @@ -2112,6 +2176,16 @@ components: 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: @@ -2458,6 +2532,10 @@ components: format: boolean type: boolean description: Controls whether to include bytecode for associated reference/plutus scripts + _governance: + format: boolean + type: boolean + description: Controls whether to include governance certificates, votes and proposals in the result example: _tx_hashes: - bf04578d452dd3acb7c70fbac32dc972cb69f932f804171cfb4268f5af0228e7 @@ -4596,6 +4674,52 @@ components: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_hash" value: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_value" + voting_procedures: + type: + - array + - 'null' + description: Governance votes in a transaction (if any) + items: + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + voter_role: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" + voter: + $ref: "#/components/schemas/proposal_votes/items/properties/voter" + voter_hex: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + proposal_procedures: + type: + - array + - 'null' + description: Governance proposals in a transaction (if any) + items: + properties: + index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + description: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_description" + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + $ref: "#/components/schemas/proposal_list/items/properties/return_address" + expiration: + $ref: "#/components/schemas/proposal_list/items/properties/expiration" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + withdrawal: + $ref: "#/components/schemas/proposal_list/items/properties/withdrawal" + param_proposal: + $ref: "#/components/schemas/proposal_list/items/properties/param_proposal" tx_cbor: description: Raw Transaction(s) in CBOR format item: @@ -5012,6 +5136,21 @@ components: type: string description: A hash of the contents of the metadata URL example: dc208474e195442d07a5b6d42af19bb2db02229427dfb53ab23122e6b0e2487d + drep_epoch_summary: + description: Summary of voting power and DRep count for each epoch + type: array + items: + properties: + epoch_no: + $ref: "#/components/schemas/blocks/items/properties/epoch_no" + amount: + type: string + description: The total amount of voting power between all DReps including pre-defined roles for the epoch. + example: 599496769641 + dreps: + type: number + description: The total number of DReps with vote power for the epoch. + example: 324 drep_list: description: List of all active delegated representatives (DReps) type: array @@ -5115,8 +5254,8 @@ components: properties: proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" vote_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" block_time: @@ -5141,12 +5280,14 @@ components: type: array items: properties: - proposal_tx_hash: - $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + type: number + description: Index of governance proposal in transaction + example: 0 proposal_type: type: string enum: ["ParameterChange", "HardForkInitiation", "TreasuryWithdrawals", "NoConfidence", "NewCommittee", "NewConstitution", "InfoAction"] @@ -5223,7 +5364,7 @@ components: type: - object - 'null' - example: {"id": 15, "key": null, "entropy": null, "epoch_no": null, "influence": null, "max_epoch": null, "min_fee_a": null, "min_fee_b": null, "price_mem": null, "price_step": null, "key_deposit": 1000000, "max_bh_size": null, "max_tx_size": null, "drep_deposit": null, "max_val_size": null, "pool_deposit": null, "cost_model_id": null, "drep_activity": null, "max_tx_ex_mem": null, "min_pool_cost": null, "max_block_size": null, "min_utxo_value": null, "protocol_major": null, "protocol_minor": null, "max_tx_ex_steps": null, "decentralisation": null, "max_block_ex_mem": null, "registered_tx_id": 12270, "dvt_p_p_gov_group": null, "collateral_percent": null, "committee_min_size": null, "gov_action_deposit": null, "max_block_ex_steps": null, "optimal_pool_count": null, "coins_per_utxo_size": null, "gov_action_lifetime": null, "dvt_committee_normal": null, "monetary_expand_rate": null, "pvt_committee_normal": null, "pvtpp_security_group": null, "treasury_growth_rate": null, "dvt_p_p_network_group": null, "max_collateral_inputs": null, "dvt_p_p_economic_group": null, "dvt_p_p_technical_group": null, "dvt_treasury_withdrawal": null, "dvt_hard_fork_initiation": null, "dvt_motion_no_confidence": null, "pvt_hard_fork_initiation": null, "pvt_motion_no_confidence": null, "committee_max_term_length": null, "dvt_update_to_constitution": null, "dvt_committee_no_confidence": null, "pvt_committee_no_confidence": null, "min_fee_ref_script_cost_per_byte": null} + example: {"key_deposit": 1000000} proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5250,10 +5391,10 @@ components: description: Current governance committee type: object properties: - tx_hash: + proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" quorum_numerator: type: number example: 67 diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index 2229f8c4..198ce5b7 100644 --- a/specs/results/koiosapi-mainnet.yaml +++ b/specs/results/koiosapi-mainnet.yaml @@ -1301,6 +1301,28 @@ paths: description: Get the list of current or all asset transaction hashes (newest first) operationId: asset_txs + /drep_epoch_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_epoch_no" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_epoch_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Epoch Summary + description: Summary of voting power and DRep count for each epoch + operationId: drep_epoch_summary /drep_list: #RPC get: tags: @@ -1409,6 +1431,48 @@ paths: summary: DReps Votes description: List of all votes casted by requested delegated representative (DRep) operationId: drep_votes + /drep_delegators: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_delegators" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Delegators + description: List of all delegators to requested delegated representative (DRep). + operationId: drep_delegators + /committee_info: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Information + description: Information about active committee and its members + operationId: committee_info /committee_votes: #RPC get: tags: @@ -1457,7 +1521,7 @@ paths: - Governance parameters: - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + - $ref: "#/components/parameters/_proposal_index" responses: "200": description: Success!! @@ -2112,6 +2176,16 @@ components: 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: @@ -2458,6 +2532,10 @@ components: format: boolean type: boolean description: Controls whether to include bytecode for associated reference/plutus scripts + _governance: + format: boolean + type: boolean + description: Controls whether to include governance certificates, votes and proposals in the result example: _tx_hashes: - f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e @@ -4596,6 +4674,52 @@ components: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_hash" value: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_value" + voting_procedures: + type: + - array + - 'null' + description: Governance votes in a transaction (if any) + items: + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + voter_role: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" + voter: + $ref: "#/components/schemas/proposal_votes/items/properties/voter" + voter_hex: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + proposal_procedures: + type: + - array + - 'null' + description: Governance proposals in a transaction (if any) + items: + properties: + index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + description: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_description" + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + $ref: "#/components/schemas/proposal_list/items/properties/return_address" + expiration: + $ref: "#/components/schemas/proposal_list/items/properties/expiration" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + withdrawal: + $ref: "#/components/schemas/proposal_list/items/properties/withdrawal" + param_proposal: + $ref: "#/components/schemas/proposal_list/items/properties/param_proposal" tx_cbor: description: Raw Transaction(s) in CBOR format item: @@ -5012,6 +5136,21 @@ components: type: string description: A hash of the contents of the metadata URL example: dc208474e195442d07a5b6d42af19bb2db02229427dfb53ab23122e6b0e2487d + drep_epoch_summary: + description: Summary of voting power and DRep count for each epoch + type: array + items: + properties: + epoch_no: + $ref: "#/components/schemas/blocks/items/properties/epoch_no" + amount: + type: string + description: The total amount of voting power between all DReps including pre-defined roles for the epoch. + example: 599496769641 + dreps: + type: number + description: The total number of DReps with vote power for the epoch. + example: 324 drep_list: description: List of all active delegated representatives (DReps) type: array @@ -5115,8 +5254,8 @@ components: properties: proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" vote_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" block_time: @@ -5141,12 +5280,14 @@ components: type: array items: properties: - proposal_tx_hash: - $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + type: number + description: Index of governance proposal in transaction + example: 0 proposal_type: type: string enum: ["ParameterChange", "HardForkInitiation", "TreasuryWithdrawals", "NoConfidence", "NewCommittee", "NewConstitution", "InfoAction"] @@ -5223,7 +5364,7 @@ components: type: - object - 'null' - example: {"id": 15, "key": null, "entropy": null, "epoch_no": null, "influence": null, "max_epoch": null, "min_fee_a": null, "min_fee_b": null, "price_mem": null, "price_step": null, "key_deposit": 1000000, "max_bh_size": null, "max_tx_size": null, "drep_deposit": null, "max_val_size": null, "pool_deposit": null, "cost_model_id": null, "drep_activity": null, "max_tx_ex_mem": null, "min_pool_cost": null, "max_block_size": null, "min_utxo_value": null, "protocol_major": null, "protocol_minor": null, "max_tx_ex_steps": null, "decentralisation": null, "max_block_ex_mem": null, "registered_tx_id": 12270, "dvt_p_p_gov_group": null, "collateral_percent": null, "committee_min_size": null, "gov_action_deposit": null, "max_block_ex_steps": null, "optimal_pool_count": null, "coins_per_utxo_size": null, "gov_action_lifetime": null, "dvt_committee_normal": null, "monetary_expand_rate": null, "pvt_committee_normal": null, "pvtpp_security_group": null, "treasury_growth_rate": null, "dvt_p_p_network_group": null, "max_collateral_inputs": null, "dvt_p_p_economic_group": null, "dvt_p_p_technical_group": null, "dvt_treasury_withdrawal": null, "dvt_hard_fork_initiation": null, "dvt_motion_no_confidence": null, "pvt_hard_fork_initiation": null, "pvt_motion_no_confidence": null, "committee_max_term_length": null, "dvt_update_to_constitution": null, "dvt_committee_no_confidence": null, "pvt_committee_no_confidence": null, "min_fee_ref_script_cost_per_byte": null} + example: {"key_deposit": 1000000} proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5250,10 +5391,10 @@ components: description: Current governance committee type: object properties: - tx_hash: + proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" quorum_numerator: type: number example: 67 diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index bbaba003..f148e07f 100644 --- a/specs/results/koiosapi-preprod.yaml +++ b/specs/results/koiosapi-preprod.yaml @@ -1301,6 +1301,28 @@ paths: description: Get the list of current or all asset transaction hashes (newest first) operationId: asset_txs + /drep_epoch_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_epoch_no" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_epoch_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Epoch Summary + description: Summary of voting power and DRep count for each epoch + operationId: drep_epoch_summary /drep_list: #RPC get: tags: @@ -1409,6 +1431,48 @@ paths: summary: DReps Votes description: List of all votes casted by requested delegated representative (DRep) operationId: drep_votes + /drep_delegators: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_delegators" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Delegators + description: List of all delegators to requested delegated representative (DRep). + operationId: drep_delegators + /committee_info: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Information + description: Information about active committee and its members + operationId: committee_info /committee_votes: #RPC get: tags: @@ -1457,7 +1521,7 @@ paths: - Governance parameters: - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + - $ref: "#/components/parameters/_proposal_index" responses: "200": description: Success!! @@ -2112,6 +2176,16 @@ components: 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: @@ -2458,6 +2532,10 @@ components: format: boolean type: boolean description: Controls whether to include bytecode for associated reference/plutus scripts + _governance: + format: boolean + type: boolean + description: Controls whether to include governance certificates, votes and proposals in the result example: _tx_hashes: - d10133964da9e443b303917fd0b7644ae3d01c133deff85b4f59416c2d00f530 @@ -4596,6 +4674,52 @@ components: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_hash" value: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_value" + voting_procedures: + type: + - array + - 'null' + description: Governance votes in a transaction (if any) + items: + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + voter_role: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" + voter: + $ref: "#/components/schemas/proposal_votes/items/properties/voter" + voter_hex: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + proposal_procedures: + type: + - array + - 'null' + description: Governance proposals in a transaction (if any) + items: + properties: + index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + description: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_description" + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + $ref: "#/components/schemas/proposal_list/items/properties/return_address" + expiration: + $ref: "#/components/schemas/proposal_list/items/properties/expiration" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + withdrawal: + $ref: "#/components/schemas/proposal_list/items/properties/withdrawal" + param_proposal: + $ref: "#/components/schemas/proposal_list/items/properties/param_proposal" tx_cbor: description: Raw Transaction(s) in CBOR format item: @@ -5012,6 +5136,21 @@ components: type: string description: A hash of the contents of the metadata URL example: dc208474e195442d07a5b6d42af19bb2db02229427dfb53ab23122e6b0e2487d + drep_epoch_summary: + description: Summary of voting power and DRep count for each epoch + type: array + items: + properties: + epoch_no: + $ref: "#/components/schemas/blocks/items/properties/epoch_no" + amount: + type: string + description: The total amount of voting power between all DReps including pre-defined roles for the epoch. + example: 599496769641 + dreps: + type: number + description: The total number of DReps with vote power for the epoch. + example: 324 drep_list: description: List of all active delegated representatives (DReps) type: array @@ -5115,8 +5254,8 @@ components: properties: proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" vote_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" block_time: @@ -5141,12 +5280,14 @@ components: type: array items: properties: - proposal_tx_hash: - $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + type: number + description: Index of governance proposal in transaction + example: 0 proposal_type: type: string enum: ["ParameterChange", "HardForkInitiation", "TreasuryWithdrawals", "NoConfidence", "NewCommittee", "NewConstitution", "InfoAction"] @@ -5223,7 +5364,7 @@ components: type: - object - 'null' - example: {"id": 15, "key": null, "entropy": null, "epoch_no": null, "influence": null, "max_epoch": null, "min_fee_a": null, "min_fee_b": null, "price_mem": null, "price_step": null, "key_deposit": 1000000, "max_bh_size": null, "max_tx_size": null, "drep_deposit": null, "max_val_size": null, "pool_deposit": null, "cost_model_id": null, "drep_activity": null, "max_tx_ex_mem": null, "min_pool_cost": null, "max_block_size": null, "min_utxo_value": null, "protocol_major": null, "protocol_minor": null, "max_tx_ex_steps": null, "decentralisation": null, "max_block_ex_mem": null, "registered_tx_id": 12270, "dvt_p_p_gov_group": null, "collateral_percent": null, "committee_min_size": null, "gov_action_deposit": null, "max_block_ex_steps": null, "optimal_pool_count": null, "coins_per_utxo_size": null, "gov_action_lifetime": null, "dvt_committee_normal": null, "monetary_expand_rate": null, "pvt_committee_normal": null, "pvtpp_security_group": null, "treasury_growth_rate": null, "dvt_p_p_network_group": null, "max_collateral_inputs": null, "dvt_p_p_economic_group": null, "dvt_p_p_technical_group": null, "dvt_treasury_withdrawal": null, "dvt_hard_fork_initiation": null, "dvt_motion_no_confidence": null, "pvt_hard_fork_initiation": null, "pvt_motion_no_confidence": null, "committee_max_term_length": null, "dvt_update_to_constitution": null, "dvt_committee_no_confidence": null, "pvt_committee_no_confidence": null, "min_fee_ref_script_cost_per_byte": null} + example: {"key_deposit": 1000000} proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5250,10 +5391,10 @@ components: description: Current governance committee type: object properties: - tx_hash: + proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" quorum_numerator: type: number example: 67 diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index 0f226569..b633a68e 100644 --- a/specs/results/koiosapi-preview.yaml +++ b/specs/results/koiosapi-preview.yaml @@ -1301,6 +1301,28 @@ paths: description: Get the list of current or all asset transaction hashes (newest first) operationId: asset_txs + /drep_epoch_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_epoch_no" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_epoch_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Epoch Summary + description: Summary of voting power and DRep count for each epoch + operationId: drep_epoch_summary /drep_list: #RPC get: tags: @@ -1409,6 +1431,48 @@ paths: summary: DReps Votes description: List of all votes casted by requested delegated representative (DRep) operationId: drep_votes + /drep_delegators: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_delegators" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Delegators + description: List of all delegators to requested delegated representative (DRep). + operationId: drep_delegators + /committee_info: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Information + description: Information about active committee and its members + operationId: committee_info /committee_votes: #RPC get: tags: @@ -1457,7 +1521,7 @@ paths: - Governance parameters: - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + - $ref: "#/components/parameters/_proposal_index" responses: "200": description: Success!! @@ -2112,6 +2176,16 @@ components: 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: @@ -2458,6 +2532,10 @@ components: format: boolean type: boolean description: Controls whether to include bytecode for associated reference/plutus scripts + _governance: + format: boolean + type: boolean + description: Controls whether to include governance certificates, votes and proposals in the result example: _tx_hashes: - f1592b29b79ae85d753913dd25644c60925a4a0683979faa33832fead4b4bd9c @@ -4596,6 +4674,52 @@ components: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_hash" value: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_value" + voting_procedures: + type: + - array + - 'null' + description: Governance votes in a transaction (if any) + items: + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + voter_role: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" + voter: + $ref: "#/components/schemas/proposal_votes/items/properties/voter" + voter_hex: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + proposal_procedures: + type: + - array + - 'null' + description: Governance proposals in a transaction (if any) + items: + properties: + index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + description: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_description" + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + $ref: "#/components/schemas/proposal_list/items/properties/return_address" + expiration: + $ref: "#/components/schemas/proposal_list/items/properties/expiration" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + withdrawal: + $ref: "#/components/schemas/proposal_list/items/properties/withdrawal" + param_proposal: + $ref: "#/components/schemas/proposal_list/items/properties/param_proposal" tx_cbor: description: Raw Transaction(s) in CBOR format item: @@ -5012,6 +5136,21 @@ components: type: string description: A hash of the contents of the metadata URL example: dc208474e195442d07a5b6d42af19bb2db02229427dfb53ab23122e6b0e2487d + drep_epoch_summary: + description: Summary of voting power and DRep count for each epoch + type: array + items: + properties: + epoch_no: + $ref: "#/components/schemas/blocks/items/properties/epoch_no" + amount: + type: string + description: The total amount of voting power between all DReps including pre-defined roles for the epoch. + example: 599496769641 + dreps: + type: number + description: The total number of DReps with vote power for the epoch. + example: 324 drep_list: description: List of all active delegated representatives (DReps) type: array @@ -5115,8 +5254,8 @@ components: properties: proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" vote_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" block_time: @@ -5141,12 +5280,14 @@ components: type: array items: properties: - proposal_tx_hash: - $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + type: number + description: Index of governance proposal in transaction + example: 0 proposal_type: type: string enum: ["ParameterChange", "HardForkInitiation", "TreasuryWithdrawals", "NoConfidence", "NewCommittee", "NewConstitution", "InfoAction"] @@ -5223,7 +5364,7 @@ components: type: - object - 'null' - example: {"id": 15, "key": null, "entropy": null, "epoch_no": null, "influence": null, "max_epoch": null, "min_fee_a": null, "min_fee_b": null, "price_mem": null, "price_step": null, "key_deposit": 1000000, "max_bh_size": null, "max_tx_size": null, "drep_deposit": null, "max_val_size": null, "pool_deposit": null, "cost_model_id": null, "drep_activity": null, "max_tx_ex_mem": null, "min_pool_cost": null, "max_block_size": null, "min_utxo_value": null, "protocol_major": null, "protocol_minor": null, "max_tx_ex_steps": null, "decentralisation": null, "max_block_ex_mem": null, "registered_tx_id": 12270, "dvt_p_p_gov_group": null, "collateral_percent": null, "committee_min_size": null, "gov_action_deposit": null, "max_block_ex_steps": null, "optimal_pool_count": null, "coins_per_utxo_size": null, "gov_action_lifetime": null, "dvt_committee_normal": null, "monetary_expand_rate": null, "pvt_committee_normal": null, "pvtpp_security_group": null, "treasury_growth_rate": null, "dvt_p_p_network_group": null, "max_collateral_inputs": null, "dvt_p_p_economic_group": null, "dvt_p_p_technical_group": null, "dvt_treasury_withdrawal": null, "dvt_hard_fork_initiation": null, "dvt_motion_no_confidence": null, "pvt_hard_fork_initiation": null, "pvt_motion_no_confidence": null, "committee_max_term_length": null, "dvt_update_to_constitution": null, "dvt_committee_no_confidence": null, "pvt_committee_no_confidence": null, "min_fee_ref_script_cost_per_byte": null} + example: {"key_deposit": 1000000} proposal_votes: type: array description: List of all votes cast on specified governance action @@ -5250,10 +5391,10 @@ components: description: Current governance committee type: object properties: - tx_hash: + proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" quorum_numerator: type: number example: 67 diff --git a/specs/templates/2-api-params.yaml b/specs/templates/2-api-params.yaml index b622045e..2c72440f 100644 --- a/specs/templates/2-api-params.yaml +++ b/specs/templates/2-api-params.yaml @@ -189,3 +189,13 @@ parameters: 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/3-api-requestBodies.yaml b/specs/templates/3-api-requestBodies.yaml index 6c5aed22..394a15da 100644 --- a/specs/templates/3-api-requestBodies.yaml +++ b/specs/templates/3-api-requestBodies.yaml @@ -344,6 +344,10 @@ requestBodies: format: boolean type: boolean description: Controls whether to include bytecode for associated reference/plutus scripts + _governance: + format: boolean + type: boolean + description: Controls whether to include governance certificates, votes and proposals in the result example: _tx_hashes: - ##tx_ids_tx_hashes1_rb## diff --git a/specs/templates/4-api-schemas.yaml b/specs/templates/4-api-schemas.yaml index 1d8eadab..5d351400 100644 --- a/specs/templates/4-api-schemas.yaml +++ b/specs/templates/4-api-schemas.yaml @@ -1884,6 +1884,52 @@ schemas: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_hash" value: $ref: "#/components/schemas/script_redeemers/items/properties/redeemers/items/properties/datum_value" + voting_procedures: + type: + - array + - 'null' + description: Governance votes in a transaction (if any) + items: + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + voter_role: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_role" + voter: + $ref: "#/components/schemas/proposal_votes/items/properties/voter" + voter_hex: + $ref: "#/components/schemas/proposal_votes/items/properties/voter_hex" + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + proposal_procedures: + type: + - array + - 'null' + description: Governance proposals in a transaction (if any) + items: + properties: + index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + type: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_type" + description: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_description" + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + $ref: "#/components/schemas/proposal_list/items/properties/return_address" + expiration: + $ref: "#/components/schemas/proposal_list/items/properties/expiration" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + withdrawal: + $ref: "#/components/schemas/proposal_list/items/properties/withdrawal" + param_proposal: + $ref: "#/components/schemas/proposal_list/items/properties/param_proposal" tx_cbor: description: Raw Transaction(s) in CBOR format item: @@ -2300,6 +2346,21 @@ schemas: type: string description: A hash of the contents of the metadata URL example: dc208474e195442d07a5b6d42af19bb2db02229427dfb53ab23122e6b0e2487d + drep_epoch_summary: + description: Summary of voting power and DRep count for each epoch + type: array + items: + properties: + epoch_no: + $ref: "#/components/schemas/blocks/items/properties/epoch_no" + amount: + type: string + description: The total amount of voting power between all DReps including pre-defined roles for the epoch. + example: 599496769641 + dreps: + type: number + description: The total number of DReps with vote power for the epoch. + example: 324 drep_list: description: List of all active delegated representatives (DReps) type: array @@ -2403,8 +2464,8 @@ schemas: properties: proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" vote_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" block_time: @@ -2429,12 +2490,14 @@ schemas: type: array items: properties: - proposal_tx_hash: - $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" block_time: $ref: "#/components/schemas/blocks/items/properties/block_time" + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + type: number + description: Index of governance proposal in transaction + example: 0 proposal_type: type: string enum: ["ParameterChange", "HardForkInitiation", "TreasuryWithdrawals", "NoConfidence", "NewCommittee", "NewConstitution", "InfoAction"] @@ -2511,7 +2574,7 @@ schemas: type: - object - 'null' - example: {"id": 15, "key": null, "entropy": null, "epoch_no": null, "influence": null, "max_epoch": null, "min_fee_a": null, "min_fee_b": null, "price_mem": null, "price_step": null, "key_deposit": 1000000, "max_bh_size": null, "max_tx_size": null, "drep_deposit": null, "max_val_size": null, "pool_deposit": null, "cost_model_id": null, "drep_activity": null, "max_tx_ex_mem": null, "min_pool_cost": null, "max_block_size": null, "min_utxo_value": null, "protocol_major": null, "protocol_minor": null, "max_tx_ex_steps": null, "decentralisation": null, "max_block_ex_mem": null, "registered_tx_id": 12270, "dvt_p_p_gov_group": null, "collateral_percent": null, "committee_min_size": null, "gov_action_deposit": null, "max_block_ex_steps": null, "optimal_pool_count": null, "coins_per_utxo_size": null, "gov_action_lifetime": null, "dvt_committee_normal": null, "monetary_expand_rate": null, "pvt_committee_normal": null, "pvtpp_security_group": null, "treasury_growth_rate": null, "dvt_p_p_network_group": null, "max_collateral_inputs": null, "dvt_p_p_economic_group": null, "dvt_p_p_technical_group": null, "dvt_treasury_withdrawal": null, "dvt_hard_fork_initiation": null, "dvt_motion_no_confidence": null, "pvt_hard_fork_initiation": null, "pvt_motion_no_confidence": null, "committee_max_term_length": null, "dvt_update_to_constitution": null, "dvt_committee_no_confidence": null, "pvt_committee_no_confidence": null, "min_fee_ref_script_cost_per_byte": null} + example: {"key_deposit": 1000000} proposal_votes: type: array description: List of all votes cast on specified governance action @@ -2538,10 +2601,10 @@ schemas: description: Current governance committee type: object properties: - tx_hash: + proposal_tx_hash: $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" - cert_index: - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" quorum_numerator: type: number example: 67 diff --git a/specs/templates/api-main.yaml b/specs/templates/api-main.yaml index 279d052a..9ad0e9df 100644 --- a/specs/templates/api-main.yaml +++ b/specs/templates/api-main.yaml @@ -1156,6 +1156,28 @@ paths: description: Get the list of current or all asset transaction hashes (newest first) operationId: asset_txs + /drep_epoch_summary: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_epoch_no" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_epoch_summary" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Epoch Summary + description: Summary of voting power and DRep count for each epoch + operationId: drep_epoch_summary /drep_list: #RPC get: tags: @@ -1264,6 +1286,48 @@ paths: summary: DReps Votes description: List of all votes casted by requested delegated representative (DRep) operationId: drep_votes + /drep_delegators: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_delegators" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Delegators + description: List of all delegators to requested delegated representative (DRep). + operationId: drep_delegators + /committee_info: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Information + description: Information about active committee and its members + operationId: committee_info /committee_votes: #RPC get: tags: @@ -1312,7 +1376,7 @@ paths: - Governance parameters: - $ref: "#/components/parameters/_proposal_tx_hash" - - $ref: "#/components/schemas/drep_updates/items/properties/cert_index" + - $ref: "#/components/parameters/_proposal_index" responses: "200": description: Success!!