diff --git a/files/grest/rpc/01_cached_tables/pool_info_cache.sql b/files/grest/rpc/01_cached_tables/pool_info_cache.sql index ca50c57d..dd589cd3 100644 --- a/files/grest/rpc/01_cached_tables/pool_info_cache.sql +++ b/files/grest/rpc/01_cached_tables/pool_info_cache.sql @@ -14,6 +14,7 @@ CREATE TABLE grest.pool_info_cache ( margin double precision NOT NULL, fixed_cost lovelace NOT NULL, pledge lovelace NOT NULL, + deposit lovelace, reward_addr character varying, owners character varying [], relays jsonb [], @@ -35,6 +36,7 @@ CREATE OR REPLACE FUNCTION grest.pool_info_insert( _margin double precision, _fixed_cost lovelace, _pledge lovelace, + _deposit lovelace, _reward_addr_id bigint, _meta_id bigint ) @@ -63,6 +65,8 @@ BEGIN _pool_status := 'retired'; END IF; + DELETE FROM grest.pool_info_cache WHERE pool_hash_id = _hash_id; + INSERT INTO grest.pool_info_cache ( tx_id, update_id, @@ -76,6 +80,7 @@ BEGIN margin, fixed_cost, pledge, + deposit, reward_addr, owners, relays, @@ -98,6 +103,7 @@ BEGIN _margin, _fixed_cost, _pledge, + _deposit, sa.view, ARRAY( SELECT sa.view @@ -184,8 +190,8 @@ BEGIN UPDATE grest.pool_info_cache SET - pool_status = _pool_status, - retiring_epoch = _retiring_epoch + pool_status = _pool_status, + retiring_epoch = _retiring_epoch WHERE pool_hash_id = _pool_hash_id AND tx_id = _latest_pool_update_tx_id; @@ -201,9 +207,20 @@ LANGUAGE plpgsql AS $$ DECLARE _latest_pool_update_id integer; + _calc_meta_id bigint; BEGIN IF (tg_table_name = 'pool_update') THEN IF (tg_op = 'INSERT') THEN + + -- for url/hash of most recent update, find last off_chain data record + SELECT coalesce(max(ocpd.pmr_id), new.meta_id) INTO _calc_meta_id + FROM off_chain_pool_data ocpd + INNER JOIN pool_metadata_ref pmr ON ocpd.pmr_id = pmr.id + INNER JOIN pool_metadata_ref pmr2 ON pmr2.id = new.meta_id AND + pmr2.pool_id = pmr.pool_id AND + pmr2.url = pmr.url AND + pmr2.hash = pmr.hash; + PERFORM grest.pool_info_insert( new.id, new.registered_tx_id, @@ -213,8 +230,9 @@ BEGIN new.margin, new.fixed_cost, new.pledge, + new.deposit, new.reward_addr_id, - new.meta_id + _calc_meta_id ); ELSIF (tg_op = 'DELETE') THEN DELETE FROM grest.pool_info_cache @@ -297,6 +315,7 @@ FOR EACH ROW EXECUTE FUNCTION grest.pool_info_retire_status(); DO $$ DECLARE _latest_pool_info_tx_id bigint; + _calc_meta_id bigint; rec RECORD; BEGIN SELECT COALESCE(MAX(tx_id), 0) INTO _latest_pool_info_tx_id FROM grest.pool_info_cache; @@ -304,6 +323,16 @@ BEGIN FOR rec IN ( SELECT * FROM public.pool_update AS pu WHERE pu.registered_tx_id > _latest_pool_info_tx_id ) LOOP + + -- for url/hash of most recent update, find last off_chain data record + SELECT coalesce(max(ocpd.pmr_id), rec.meta_id) INTO _calc_meta_id + FROM off_chain_pool_data ocpd + INNER JOIN pool_metadata_ref pmr ON ocpd.pmr_id = pmr.id + INNER JOIN pool_metadata_ref pmr2 ON pmr2.id = rec.meta_id AND + pmr2.pool_id = pmr.pool_id AND + pmr2.url = pmr.url AND + pmr2.hash = pmr.hash; + PERFORM grest.pool_info_insert( rec.id, rec.registered_tx_id, @@ -313,8 +342,9 @@ BEGIN rec.margin, rec.fixed_cost, rec.pledge, + rec.deposit, rec.reward_addr_id, - rec.meta_id + _calc_meta_id ); END LOOP; diff --git a/files/grest/rpc/02_indexes/13_3_00.sql b/files/grest/rpc/02_indexes/13_3_00.sql index 46f960f7..ec412526 100644 --- a/files/grest/rpc/02_indexes/13_3_00.sql +++ b/files/grest/rpc/02_indexes/13_3_00.sql @@ -1,2 +1,3 @@ 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); \ No newline at end of file +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); \ No newline at end of file diff --git a/files/grest/rpc/03_utilities/cip129.sql b/files/grest/rpc/03_utilities/cip129.sql new file mode 100644 index 00000000..43043e8c --- /dev/null +++ b/files/grest/rpc/03_utilities/cip129.sql @@ -0,0 +1,107 @@ +-- Binary format +-- 1 byte variable length +-- <------> <-------------------> +-- ┌────────┬─────────────────────┐ +-- │ header │ key │ +-- └────────┴─────────────────────┘ +-- 🔎 +-- ╎ 7 6 5 4 3 2 1 0 +-- ╎ ┌─┬─┬─┬─┬─┬─┬─┬─┐ +-- ╰╌╌╌╌╌╌╌╌ |t│t│t│t│c│c│c│c│ +-- └─┴─┴─┴─┴─┴─┴─┴─┘ +-- +-- Key Type (`t t t t . . . .`) | Key +-- --- | --- +-- `0000....` | CC Hot +-- `0001....` | CC Cold +-- `0010....` | DRep +-- +-- Credential Type (`. . . . c c c c`) | Semantic +-- --- | --- +-- `....0010` | Key Hash +-- `....0011` | Script Hash + +CREATE OR REPLACE FUNCTION grest.cip129_cc_hot_to_hex(_cc_hot text) +RETURNS bytea +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF LENGTH(_cc_hot) = 60 THEN + RETURN substring(b32_decode(_cc_hot) from 2); + ELSE + RETURN b32_decode(_cc_hot); + END IF; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_hex_to_cc_hot(_raw bytea, _is_script boolean) +RETURNS text +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF _is_script THEN + RETURN b32_encode('cc_hot', ('\x03'::bytea || _raw)::text); + ELSE + RETURN b32_encode('cc_hot', ('\x02'::bytea || _raw)::text); + END IF; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_cc_cold_to_hex(_cc_cold text) +RETURNS bytea +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF LENGTH(_cc_cold) = 61 THEN + RETURN substring(b32_decode(_cc_cold) from 2); + ELSE + RETURN b32_decode(_cc_cold); + END IF; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_hex_to_cc_cold(_raw bytea, _is_script boolean) +RETURNS text +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF _is_script THEN + RETURN b32_encode('cc_cold', ('\x13'::bytea || _raw)::text); + ELSE + RETURN b32_encode('cc_cold', ('\x12'::bytea || _raw)::text); + END IF; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_drep_id_to_hex(_drep_id text) +RETURNS bytea +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF LENGTH(_drep_id) = 58 THEN + RETURN substring(b32_decode(_drep_id) from 2); + ELSE + RETURN b32_decode(_drep_id); + END IF; +END; +$$; + +CREATE OR REPLACE FUNCTION grest.cip129_hex_to_drep_id(_raw bytea, _is_script boolean) +RETURNS text +LANGUAGE plpgsql STABLE +AS $$ +BEGIN + IF _is_script THEN + RETURN b32_encode('drep', ('\x23'::bytea || _raw)::text); + ELSE + RETURN b32_encode('drep', ('\x22'::bytea || _raw)::text); + END IF; +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 diff --git a/files/grest/rpc/account/account_info.sql b/files/grest/rpc/account/account_info.sql index f9d1140e..4f4cfcb1 100644 --- a/files/grest/rpc/account/account_info.sql +++ b/files/grest/rpc/account/account_info.sql @@ -3,11 +3,13 @@ RETURNS TABLE ( stake_address varchar, status text, delegated_pool varchar, + delegated_drep varchar, total_balance text, utxo text, rewards text, withdrawals text, rewards_available text, + deposit text, reserves text, treasury text ) @@ -31,11 +33,13 @@ BEGIN 'not registered' END AS status, pool_t.delegated_pool, + vote_t.delegated_drep, (COALESCE(utxo_t.utxo, 0) + COALESCE(rewards_t.rewards, 0) + COALESCE(reserves_t.reserves, 0) + COALESCE(treasury_t.treasury, 0) - COALESCE(withdrawals_t.withdrawals, 0))::text AS total_balance, COALESCE(utxo_t.utxo, 0)::text AS utxo, COALESCE(rewards_t.rewards, 0)::text AS rewards, COALESCE(withdrawals_t.withdrawals, 0)::text AS withdrawals, (COALESCE(rewards_t.rewards, 0) + COALESCE(reserves_t.reserves, 0) + COALESCE(treasury_t.treasury, 0) - COALESCE(withdrawals_t.withdrawals, 0))::text AS rewards_available, + COALESCE(status_t.deposit,0)::text AS deposit, COALESCE(reserves_t.reserves, 0)::text AS reserves, COALESCE(treasury_t.treasury, 0)::text AS treasury FROM @@ -44,28 +48,50 @@ BEGIN sa.id, sa.view, EXISTS ( - SELECT TRUE FROM stake_registration - WHERE - stake_registration.addr_id = sa.id + SELECT TRUE FROM stake_registration AS sr + WHERE sr.addr_id = sa.id AND NOT EXISTS ( SELECT TRUE - FROM stake_deregistration + FROM stake_deregistration AS sd WHERE - stake_deregistration.addr_id = stake_registration.addr_id - AND stake_deregistration.tx_id > stake_registration.tx_id + sd.addr_id = sr.addr_id + AND sd.tx_id > sr.tx_id ) - ) AS registered + ) AS registered, + ( + SELECT sr.deposit FROM stake_registration AS sr + WHERE sr.addr_id = sa.id + AND NOT EXISTS ( + SELECT TRUE + FROM stake_deregistration AS sd + WHERE + sd.addr_id = sr.addr_id + AND sd.tx_id > sr.tx_id + ) + ) AS deposit FROM public.stake_address sa WHERE sa.id = ANY(sa_id_list) ) AS status_t + LEFT JOIN ( + SELECT + dv.addr_id, + dh.view 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 delegation.addr_id, pool_hash.view AS delegated_pool FROM delegation INNER JOIN pool_hash ON pool_hash.id = delegation.pool_hash_id - WHERE - delegation.addr_id = ANY(sa_id_list) + WHERE delegation.addr_id = ANY(sa_id_list) AND NOT EXISTS ( SELECT TRUE FROM delegation AS d @@ -137,7 +163,8 @@ BEGIN ) GROUP BY t.addr_id - ) AS treasury_t ON treasury_t.addr_id = status_t.id; + ) AS treasury_t ON treasury_t.addr_id = status_t.id + ; END; $$; diff --git a/files/grest/rpc/account/account_txs.sql b/files/grest/rpc/account/account_txs.sql index d1cc4992..282f5fac 100644 --- a/files/grest/rpc/account/account_txs.sql +++ b/files/grest/rpc/account/account_txs.sql @@ -28,8 +28,7 @@ BEGIN -- SELECT consumed_by_tx_id AS tx_id FROM tx_out - WHERE - tx_out.consumed_by_tx_id IS NOT NULL + WHERE tx_out.consumed_by_tx_id IS NOT NULL AND tx_out.stake_address_id = ANY(SELECT id FROM stake_address WHERE view = _stake_address) AND tx_out.consumed_by_tx_id >= _tx_id_min ) AS tmp; @@ -43,7 +42,6 @@ BEGIN FROM public.tx INNER JOIN public.block AS b ON b.id = tx.block_id WHERE tx.id = ANY(_tx_id_list) - AND b.block_no >= _after_block_height ORDER BY b.block_no DESC; END; $$; diff --git a/files/grest/rpc/address/address_txs.sql b/files/grest/rpc/address/address_txs.sql index 93bd563b..c8ccb464 100644 --- a/files/grest/rpc/address/address_txs.sql +++ b/files/grest/rpc/address/address_txs.sql @@ -11,19 +11,26 @@ DECLARE _tx_id_min bigint; _tx_id_list bigint[]; BEGIN + SELECT INTO _tx_id_min id + FROM tx + WHERE block_id >= (SELECT id FROM block WHERE block_no >= _after_block_height ORDER BY id limit 1) + ORDER BY id limit 1; + -- all tx_out & tx_in tx ids SELECT INTO _tx_id_list ARRAY_AGG(tx_id) FROM ( SELECT tx_id FROM tx_out WHERE address = ANY (_addresses) + AND tx_id >= _tx_id_min -- UNION -- SELECT consumed_by_tx_id FROM tx_out - WHERE tx_out.address = ANY(_addresses) - AND tx_out.consumed_by_tx_id IS NOT NULL + WHERE tx_out.consumed_by_tx_id IS NOT NULL + AND tx_out.address = ANY(_addresses) + AND tx_out.consumed_by_tx_id >= _tx_id_min ) AS tmp; RETURN QUERY @@ -35,7 +42,6 @@ BEGIN FROM public.tx INNER JOIN public.block AS b ON b.id = tx.block_id WHERE tx.id = ANY(_tx_id_list) - AND b.block_no >= _after_block_height ORDER BY b.block_no DESC; END; $$; diff --git a/files/grest/rpc/address/credential_txs.sql b/files/grest/rpc/address/credential_txs.sql index 5c6b048c..ee50321c 100644 --- a/files/grest/rpc/address/credential_txs.sql +++ b/files/grest/rpc/address/credential_txs.sql @@ -50,7 +50,6 @@ BEGIN FROM public.tx INNER JOIN public.block AS b ON b.id = tx.block_id WHERE tx.id = ANY(_tx_id_list) - AND b.block_no >= _after_block_height ORDER BY b.block_no DESC; END; $$; diff --git a/files/grest/rpc/blocks/block_tx_info.sql b/files/grest/rpc/blocks/block_tx_info.sql index 4b28b89f..84041d07 100644 --- a/files/grest/rpc/blocks/block_tx_info.sql +++ b/files/grest/rpc/blocks/block_tx_info.sql @@ -5,7 +5,9 @@ CREATE OR REPLACE FUNCTION grest.block_tx_info( _assets boolean DEFAULT false, _withdrawals boolean DEFAULT false, _certs boolean DEFAULT false, - _scripts boolean DEFAULT false + _scripts boolean DEFAULT false, + _bytecode boolean DEFAULT false, + _governance boolean DEFAULT false ) RETURNS TABLE ( tx_hash text, @@ -19,6 +21,7 @@ RETURNS TABLE ( tx_size word31type, total_output text, fee text, + treasury_donation text, deposit text, invalid_before text, invalid_after text, @@ -32,808 +35,30 @@ RETURNS TABLE ( metadata jsonb, certificates jsonb, native_scripts jsonb, - plutus_contracts jsonb + plutus_contracts jsonb, + voting_procedures jsonb, + proposal_procedures jsonb ) LANGUAGE plpgsql AS $$ -DECLARE - _block_hashes_bytea bytea[]; - _block_id_list bigint[]; - _tx_id_list bigint[]; BEGIN - -- convert input _block_hashes array into bytea array - SELECT INTO _block_hashes_bytea ARRAY_AGG(hashes_bytea) - FROM ( - SELECT DISTINCT DECODE(hashes_hex, 'hex') AS hashes_bytea - FROM UNNEST(_block_hashes) AS hashes_hex - ) AS tmp; - -- all block ids - SELECT INTO _block_id_list ARRAY_AGG(id) - FROM ( - SELECT id - FROM block - WHERE hash = ANY(_block_hashes_bytea) - ) AS tmp; -- all tx ids - SELECT INTO _tx_id_list ARRAY_AGG(id) - FROM ( - SELECT id - FROM tx - WHERE tx.block_id = ANY(_block_id_list) - ) AS tmp; - - RETURN QUERY ( - WITH - -- limit by last known block, also join with block only once - _all_tx AS ( - SELECT - tx.id, - tx.hash AS tx_hash, - b.hash AS block_hash, - b.block_no AS block_height, - b.epoch_no AS epoch_no, - b.epoch_slot_no AS epoch_slot, - b.slot_no AS absolute_slot, - b.time AS tx_timestamp, - tx.block_index AS tx_block_index, - tx.size AS tx_size, - tx.out_sum AS total_output, - tx.fee, - tx.deposit, - tx.invalid_before, - tx.invalid_hereafter AS invalid_after - FROM tx - INNER JOIN block AS b ON tx.block_id = b.id - WHERE tx.id = ANY(_tx_id_list) - ), - - _all_collateral_inputs AS ( - SELECT - collateral_tx_in.tx_in_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, - (CASE WHEN ma.policy IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'policy_id', ENCODE(ma.policy, 'hex'), - 'asset_name', ENCODE(ma.name, 'hex'), - 'fingerprint', ma.fingerprint, - 'decimals', aic.decimals, - 'quantity', mto.quantity::text - ) - END - ) AS asset_list, - (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'bytes', ENCODE(datum.bytes, 'hex'), - 'value', datum.value - ) - END - ) AS inline_datum, - (CASE WHEN tx_out.reference_script_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'hash', ENCODE(script.hash, 'hex'), - 'bytes', ENCODE(script.bytes, 'hex'), - 'value', script.json, - 'type', script.type::text, - 'size', script.serialised_size - ) - END - ) AS reference_script - FROM collateral_tx_in - INNER JOIN tx_out ON tx_out.tx_id = collateral_tx_in.tx_out_id - AND tx_out.index = collateral_tx_in.tx_out_index - INNER JOIN tx ON tx_out.tx_id = tx.id - LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id - LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id - LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id - WHERE - (_inputs IS TRUE AND _scripts IS TRUE) - AND collateral_tx_in.tx_in_id = ANY(_tx_id_list) - ), - - _all_reference_inputs AS ( - SELECT - reference_tx_in.tx_in_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, - (CASE WHEN ma.policy IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'policy_id', ENCODE(ma.policy, 'hex'), - 'asset_name', ENCODE(ma.name, 'hex'), - 'fingerprint', ma.fingerprint, - 'decimals', aic.decimals, - 'quantity', mto.quantity::text - ) - END - ) AS asset_list, - (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'bytes', ENCODE(datum.bytes, 'hex'), - 'value', datum.value - ) - END - ) AS inline_datum, - (CASE WHEN tx_out.reference_script_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'hash', ENCODE(script.hash, 'hex'), - 'bytes', ENCODE(script.bytes, 'hex'), - 'value', script.json, - 'type', script.type::text, - 'size', script.serialised_size - ) - END - ) AS reference_script - FROM - reference_tx_in - INNER JOIN tx_out ON tx_out.tx_id = reference_tx_in.tx_out_id - AND tx_out.index = reference_tx_in.tx_out_index - INNER JOIN tx ON tx_out.tx_id = tx.id - LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id - LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id - LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id - WHERE - (_inputs IS TRUE AND _scripts IS TRUE) - AND reference_tx_in.tx_in_id = ANY(_tx_id_list) - ), - - _all_inputs AS ( - SELECT - 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, - (CASE WHEN ma.policy IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'policy_id', ENCODE(ma.policy, 'hex'), - 'asset_name', ENCODE(ma.name, 'hex'), - 'fingerprint', ma.fingerprint, - 'decimals', aic.decimals, - 'quantity', mto.quantity::text - ) - END - ) AS asset_list, - (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'bytes', ENCODE(datum.bytes, 'hex'), - 'value', datum.value - ) - END - ) AS inline_datum, - (CASE WHEN tx_out.reference_script_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'hash', ENCODE(script.hash, 'hex'), - 'bytes', ENCODE(script.bytes, 'hex'), - 'value', script.json, - 'type', script.type::text, - 'size', script.serialised_size - ) - END - ) AS reference_script - FROM tx_out - INNER JOIN tx ON tx_out.tx_id = tx.id - LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id - LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id - LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id - WHERE _inputs IS TRUE - AND tx_out.consumed_by_tx_id = ANY(_tx_id_list) - ), - - _all_collateral_outputs AS ( - SELECT - tx_out.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, - (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'bytes', ENCODE(datum.bytes, 'hex'), - 'value', datum.value - ) - END - ) AS inline_datum, - (CASE WHEN tx_out.reference_script_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'hash', ENCODE(script.hash, 'hex'), - 'bytes', ENCODE(script.bytes, 'hex'), - 'value', script.json, - 'type', script.type::text, - 'size', script.serialised_size - ) - END - ) AS reference_script, - REPLACE(tx_out.multi_assets_descr,'fromList ','')::jsonb AS asset_descr - FROM - collateral_tx_out AS tx_out - INNER JOIN tx ON tx_out.tx_id = tx.id - LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id - LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id - WHERE _scripts IS TRUE - AND tx_out.tx_id = ANY(_tx_id_list) - ), - - _all_outputs AS ( - SELECT - tx_out.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, - (CASE WHEN ma.policy IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'policy_id', ENCODE(ma.policy, 'hex'), - 'asset_name', ENCODE(ma.name, 'hex'), - 'fingerprint', ma.fingerprint, - 'decimals', aic.decimals, - 'quantity', mto.quantity::text - ) - END - ) AS asset_list, - (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'bytes', ENCODE(datum.bytes, 'hex'), - 'value', datum.value - ) - END - ) AS inline_datum, - (CASE WHEN tx_out.reference_script_id IS NULL THEN NULL - ELSE - JSONB_BUILD_OBJECT( - 'hash', ENCODE(script.hash, 'hex'), - 'bytes', ENCODE(script.bytes, 'hex'), - 'value', script.json, - 'type', script.type::text, - 'size', script.serialised_size - ) - END - ) AS reference_script - FROM tx_out - INNER JOIN tx ON tx_out.tx_id = tx.id - LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id - LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id - LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id - WHERE tx_out.tx_id = ANY(_tx_id_list) - ), - - _all_withdrawals AS ( - SELECT - tx_id, - JSONB_AGG(data) AS list - FROM ( - SELECT - w.tx_id, - JSONB_BUILD_OBJECT( - 'amount', w.amount::text, - 'stake_addr', sa.view - ) AS data - FROM withdrawal AS w - INNER JOIN stake_address AS sa ON w.addr_id = sa.id - WHERE _withdrawals IS TRUE - AND w.tx_id = ANY(_tx_id_list) - ) AS tmp - GROUP BY tx_id - ), - - _all_mints AS ( - SELECT - tx_id, - JSONB_AGG(data) AS list - FROM ( - SELECT - mtm.tx_id, - JSONB_BUILD_OBJECT( - 'policy_id', ENCODE(ma.policy, 'hex'), - 'asset_name', ENCODE(ma.name, 'hex'), - 'fingerprint', ma.fingerprint, - 'decimals', COALESCE(aic.decimals, 0), - 'quantity', mtm.quantity::text - ) AS data - FROM ma_tx_mint AS mtm - INNER JOIN multi_asset AS ma ON ma.id = mtm.ident - LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - WHERE _assets IS TRUE - AND mtm.tx_id = ANY(_tx_id_list) - ) AS tmp - GROUP BY tx_id - ), - - _all_metadata AS ( - SELECT - tx_id, - JSONB_OBJECT_AGG( - tm.key::text, - tm.json - ) AS list - FROM - tx_metadata AS tm - WHERE _metadata IS TRUE - AND tm.tx_id = ANY(_tx_id_list) - GROUP BY tx_id - ), - - _all_certs AS ( - SELECT - tx_id, - JSONB_AGG(data) AS list - FROM ( - SELECT - sr.tx_id, - JSONB_BUILD_OBJECT( - 'index', sr.cert_index, - 'type', 'stake_registration', - 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view - ) - ) AS data - FROM public.stake_registration AS sr - INNER JOIN public.stake_address AS sa ON sa.id = sr.addr_id - WHERE _certs IS TRUE - AND sr.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - sd.tx_id, - JSONB_BUILD_OBJECT( - 'index', sd.cert_index, - 'type', 'stake_deregistration', - 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view - ) - ) AS data - FROM public.stake_deregistration AS sd - INNER JOIN public.stake_address AS sa ON sa.id = sd.addr_id - WHERE _certs IS TRUE - AND sd.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - d.tx_id, - JSONB_BUILD_OBJECT( - 'index', d.cert_index, - 'type', 'delegation', - 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view, - 'pool_id_bech32', ph.view, - 'pool_id_hex', ENCODE(ph.hash_raw, 'hex') - ) - ) AS data - FROM public.delegation AS d - INNER JOIN public.stake_address AS sa ON sa.id = d.addr_id - INNER JOIN public.pool_hash AS ph ON ph.id = d.pool_hash_id - WHERE _certs IS TRUE - AND d.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - t.tx_id, - JSONB_BUILD_OBJECT( - 'index', t.cert_index, - 'type', 'treasury_MIR', - 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view, - 'amount', t.amount::text - ) - ) AS data - FROM public.treasury AS t - INNER JOIN public.stake_address AS sa ON sa.id = t.addr_id - WHERE _certs IS TRUE - AND t.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - r.tx_id, - JSONB_BUILD_OBJECT( - 'index', r.cert_index, - 'type', 'reserve_MIR', - 'info', JSONB_BUILD_OBJECT( - 'stake_address', sa.view, - 'amount', r.amount::text - ) - ) AS data - FROM public.reserve AS r - INNER JOIN public.stake_address AS sa ON sa.id = r.addr_id - WHERE _certs IS TRUE - AND r.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - pt.tx_id, - JSONB_BUILD_OBJECT( - 'index', pt.cert_index, - 'type', 'pot_transfer', - 'info', JSONB_BUILD_OBJECT( - 'treasury', pt.treasury::text, - 'reserves', pt.reserves::text - ) - ) AS data - FROM public.pot_transfer AS pt - WHERE _certs IS TRUE - AND pt.tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT DISTINCT ON (pp.registered_tx_id) - -- SELECT DISTINCT below because there are multiple entries for each signing key of a given transaction - pp.registered_tx_id AS tx_id, - 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 - )) - ) AS data - FROM public.param_proposal AS pp - INNER JOIN cost_model AS cm ON cm.id = pp.cost_model_id - WHERE _certs IS TRUE - AND pp.registered_tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - pr.announced_tx_id AS tx_id, - JSONB_BUILD_OBJECT( - 'index', pr.cert_index, - 'type', 'pool_retire', - 'info', JSONB_BUILD_OBJECT( - 'pool_id_bech32', ph.view, - 'pool_id_hex', ENCODE(ph.hash_raw, 'hex'), - 'retiring epoch', pr.retiring_epoch - ) - ) AS data - FROM public.pool_retire AS pr - INNER JOIN public.pool_hash AS ph ON ph.id = pr.hash_id - WHERE _certs IS TRUE - AND pr.announced_tx_id = ANY(_tx_id_list) - -- - UNION ALL - -- - SELECT - pic.tx_id, - JSONB_BUILD_OBJECT( - 'index', pu.cert_index, - 'type', 'pool_update', - 'info', JSONB_BUILD_OBJECT( - 'pool_id_bech32', pic.pool_id_bech32, - 'pool_id_hex', pic.pool_id_hex, - 'active_epoch_no', pic.active_epoch_no, - 'vrf_key_hash', pic.vrf_key_hash, - 'margin', pic.margin, - 'fixed_cost', pic.fixed_cost::text, - 'pledge', pic.pledge::text, - 'reward_addr', pic.reward_addr, - 'owners', pic.owners, - 'relays', pic.relays, - 'meta_url', pic.meta_url, - 'meta_hash', pic.meta_hash - ) - ) AS data - FROM grest.pool_info_cache AS pic - 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) - ) AS tmp - GROUP BY tx_id - ), - - _all_native_scripts AS ( - SELECT - tx_id, - JSONB_AGG(data) AS list - FROM ( - SELECT - script.tx_id, - JSONB_BUILD_OBJECT( - 'script_hash', ENCODE(script.hash, 'hex'), - 'script_json', script.json - ) AS data - FROM script - WHERE _scripts IS TRUE - AND script.tx_id = ANY(_tx_id_list) - AND script.type = 'timelock' - ) AS tmp - GROUP BY tx_id - ), - - _all_plutus_contracts AS ( - SELECT - tx_id, - JSONB_AGG(data) AS list - FROM ( - WITH - all_redeemers AS ( - SELECT - redeemer.id, - redeemer.tx_id, - redeemer.purpose, - redeemer.fee, - redeemer.unit_steps, - redeemer.unit_mem, - rd.hash AS rd_hash, - rd.value AS rd_value, - script.hash AS script_hash, - script.bytes AS script_bytes, - script.serialised_size AS script_serialised_size, - tx.valid_contract - FROM redeemer - INNER JOIN tx ON redeemer.tx_id = tx.id - INNER JOIN redeemer_data AS rd ON rd.id = redeemer.redeemer_data_id - INNER JOIN script ON redeemer.script_hash = script.hash - WHERE _scripts IS TRUE - AND redeemer.tx_id = ANY(_tx_id_list) - ), - - spend_redeemers AS ( - SELECT DISTINCT ON (redeemer.id) - redeemer.id, - inutxo.address, - ind.hash AS ind_hash, - ind.value AS ind_value - FROM redeemer - INNER JOIN tx_out AS inutxo ON inutxo.consumed_by_tx_id = redeemer.tx_id - INNER JOIN script ON redeemer.script_hash = inutxo.payment_cred - INNER JOIN datum AS ind ON ind.hash = inutxo.data_hash - WHERE _scripts IS TRUE - AND redeemer.tx_id = ANY(_tx_id_list) + RETURN QUERY + SELECT * + FROM grest.tx_info( + ( + SELECT ARRAY_AGG(ENCODE(hash, 'hex')) + FROM tx + WHERE tx.block_id = ANY( + SELECT id + FROM block + WHERE hash = ANY( + SELECT DISTINCT DECODE(hashes_hex, 'hex') + FROM UNNEST(_block_hashes) AS hashes_hex ) - - SELECT - ar.tx_id, - JSONB_BUILD_OBJECT( - 'address', - CASE - WHEN ar.purpose = 'spend' THEN - (SELECT address FROM spend_redeemers AS sr WHERE sr.id = ar.id) - END, - 'script_hash', ENCODE(ar.script_hash, 'hex'), - 'bytecode', ENCODE(ar.script_bytes, 'hex'), - 'size', ar.script_serialised_size, - 'valid_contract', ar.valid_contract, - 'input', JSONB_BUILD_OBJECT( - 'redeemer', JSONB_BUILD_OBJECT( - 'purpose', ar.purpose, - 'fee', ar.fee::text, - 'unit', JSONB_BUILD_OBJECT( - 'steps', ar.unit_steps::text, - 'mem', ar.unit_mem::text - ), - 'datum', JSONB_BUILD_OBJECT( - 'hash', ENCODE(ar.rd_hash, 'hex'), - 'value', ar.rd_value - ) - ), - 'datum', CASE WHEN ar.purpose = 'spend' THEN ( - SELECT JSONB_BUILD_OBJECT( - 'hash', ENCODE(sr.ind_hash, 'hex'), - 'value', sr.ind_value - ) - FROM spend_redeemers AS sr WHERE sr.id = ar.id - ) END - ) - ) AS data - FROM all_redeemers AS ar - WHERE _scripts IS TRUE - ) AS tmp - GROUP BY tx_id - ) - - SELECT - ENCODE(atx.tx_hash, 'hex'), - ENCODE(atx.block_hash, 'hex'), - atx.block_height, - atx.epoch_no, - atx.epoch_slot, - atx.absolute_slot, - EXTRACT(EPOCH FROM atx.tx_timestamp)::integer, - atx.tx_block_index, - atx.tx_size, - atx.total_output::text, - atx.fee::text, - atx.deposit::text, - atx.invalid_before::text, - atx.invalid_after::text, - COALESCE(( - SELECT JSONB_AGG(tx_collateral_inputs) - FROM ( - SELECT - JSONB_BUILD_OBJECT( - 'payment_addr', JSONB_BUILD_OBJECT( - 'bech32', payment_addr_bech32, - 'cred', payment_addr_cred - ), - 'stake_addr', stake_addr, - 'tx_hash', aci.tx_hash, - 'tx_index', tx_index, - 'value', value, - 'datum_hash', datum_hash, - '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()) - ) AS tx_collateral_inputs - FROM _all_collateral_inputs AS aci - WHERE (_inputs IS TRUE AND _scripts IS TRUE) AND aci.tx_id = atx.id - GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, aci.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script - ) AS tmp - ), JSONB_BUILD_ARRAY()), - ( - SELECT - JSONB_BUILD_OBJECT( - 'payment_addr', JSONB_BUILD_OBJECT( - 'bech32', payment_addr_bech32, - 'cred', payment_addr_cred - ), - 'stake_addr', stake_addr, - 'tx_hash', aco.tx_hash, - 'tx_index', tx_index, - 'value', value, - 'datum_hash', datum_hash, - 'inline_datum', inline_datum, - 'reference_script', reference_script, - 'asset_list', asset_descr - ) AS tx_collateral_outputs - FROM _all_collateral_outputs AS aco - WHERE _scripts IS TRUE AND aco.tx_id = atx.id - GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, aco.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script, asset_descr - LIMIT 1 -- there can only be one collateral output - ), - COALESCE(( - SELECT JSONB_AGG(tx_reference_inputs) - FROM ( - SELECT - JSONB_BUILD_OBJECT( - 'payment_addr', JSONB_BUILD_OBJECT( - 'bech32', payment_addr_bech32, - 'cred', payment_addr_cred - ), - 'stake_addr', stake_addr, - 'tx_hash', ari.tx_hash, - 'tx_index', tx_index, - 'value', value, - 'datum_hash', datum_hash, - '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()) - ) AS tx_reference_inputs - FROM _all_reference_inputs AS ari - WHERE (_inputs IS TRUE AND _scripts IS TRUE) AND ari.tx_id = atx.id - GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ari.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script - ) AS tmp - ), JSONB_BUILD_ARRAY()), - COALESCE(( - SELECT JSONB_AGG(tx_inputs) - FROM ( - SELECT - JSONB_BUILD_OBJECT( - 'payment_addr', JSONB_BUILD_OBJECT( - 'bech32', payment_addr_bech32, - 'cred', payment_addr_cred - ), - 'stake_addr', stake_addr, - 'tx_hash', ai.tx_hash, - 'tx_index', tx_index, - 'value', value, - 'datum_hash', datum_hash, - '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()) - ) AS tx_inputs - FROM _all_inputs AS ai - WHERE _inputs IS TRUE AND ai.tx_id = atx.id - GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ai.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script - ) AS tmp - ), JSONB_BUILD_ARRAY()), - COALESCE(( - SELECT JSONB_AGG(tx_outputs) - FROM ( - SELECT - JSONB_BUILD_OBJECT( - 'payment_addr', JSONB_BUILD_OBJECT( - 'bech32', payment_addr_bech32, - 'cred', payment_addr_cred - ), - 'stake_addr', stake_addr, - 'tx_hash', ao.tx_hash, - 'tx_index', tx_index, - 'value', value, - 'datum_hash', datum_hash, - '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()) - ) AS tx_outputs - FROM _all_outputs AS ao - WHERE ao.tx_id = atx.id - GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ao.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script - ) AS tmp - ), JSONB_BUILD_ARRAY()), - COALESCE((SELECT aw.list FROM _all_withdrawals AS aw WHERE _withdrawals IS TRUE AND aw.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT ami.list FROM _all_mints AS ami WHERE _assets IS TRUE AND ami.tx_id = atx.id), JSONB_BUILD_ARRAY()), - 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()) - FROM _all_tx AS atx - WHERE atx.id = ANY(_tx_id_list) - ); - -END; -$$; + ) + ), _inputs, _metadata, _assets, _withdrawals, _certs, _scripts, _bytecode, _governance + ); +END;$$; COMMENT ON FUNCTION grest.block_tx_info IS 'Get information about transactions for given block hashes.'; -- noqa: LT01 diff --git a/files/grest/rpc/epoch/epoch_params.sql b/files/grest/rpc/epoch/epoch_params.sql index 93534925..29884c10 100644 --- a/files/grest/rpc/epoch/epoch_params.sql +++ b/files/grest/rpc/epoch/epoch_params.sql @@ -31,7 +31,29 @@ RETURNS TABLE ( max_val_size word64type, collateral_percent word31type, max_collateral_inputs word31type, - coins_per_utxo_size text + coins_per_utxo_size text, + pvt_motion_no_confidence double precision, + pvt_committee_normal double precision, + pvt_committee_no_confidence double precision, + pvt_hard_fork_initiation double precision, + dvt_motion_no_confidence double precision, + dvt_committee_normal double precision, + dvt_committee_no_confidence double precision, + dvt_update_to_constitution double precision, + dvt_hard_fork_initiation double precision, + dvt_p_p_network_group double precision, + dvt_p_p_economic_group double precision, + dvt_p_p_technical_group double precision, + dvt_p_p_gov_group double precision, + dvt_treasury_withdrawal double precision, + committee_min_size word64type, + committee_max_term_length word64type, + gov_action_lifetime word64type, + gov_action_deposit text, + drep_deposit text, + drep_activity word64type, + pvtpp_security_group double precision, + min_fee_ref_script_cost_per_byte double precision ) LANGUAGE plpgsql AS $$ @@ -69,7 +91,29 @@ BEGIN ep.max_val_size AS max_val_size, ep.collateral_percent AS collateral_percent, ep.max_collateral_inputs AS max_collateral_inputs, - ep.coins_per_utxo_size::text AS coins_per_utxo_size + ep.coins_per_utxo_size::text AS coins_per_utxo_size, + ep.pvt_motion_no_confidence, + ep.pvt_committee_normal, + ep.pvt_committee_no_confidence, + ep.pvt_hard_fork_initiation, + ep.dvt_motion_no_confidence, + ep.dvt_committee_normal, + ep.dvt_committee_no_confidence, + ep.dvt_update_to_constitution, + ep.dvt_hard_fork_initiation, + ep.dvt_p_p_network_group, + ep.dvt_p_p_economic_group, + ep.dvt_p_p_technical_group, + ep.dvt_p_p_gov_group, + ep.dvt_treasury_withdrawal, + ep.committee_min_size, + ep.committee_max_term_length, + ep.gov_action_lifetime, + ep.gov_action_deposit::text, + ep.drep_deposit::text, + ep.drep_activity, + ep.pvtpp_security_group, + ep.min_fee_ref_script_cost_per_byte FROM epoch_param AS ep LEFT JOIN grest.epoch_info_cache AS ei ON ei.epoch_no = ep.epoch_no LEFT JOIN cost_model AS cm ON cm.id = ep.cost_model_id diff --git a/files/grest/rpc/governance/committee_info.sql b/files/grest/rpc/governance/committee_info.sql new file mode 100644 index 00000000..a39c810f --- /dev/null +++ b/files/grest/rpc/governance/committee_info.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE FUNCTION grest.committee_info() +RETURNS TABLE ( + proposal_tx_hash text, + proposal_index bigint, + quorum_numerator bigint, + quorum_denominator bigint, + members jsonb +) +LANGUAGE plpgsql +AS $$ +DECLARE + gap_id bigint; + gap_enacted_tx_id bigint; +BEGIN + + SELECT + gap.id, + CASE + WHEN gap.id IS NULL THEN NULL + ELSE ( + SELECT eic.i_last_tx_id + FROM grest.epoch_info_cache AS eic + WHERE eic.epoch_no = (gap.enacted_epoch - 1) + ) + END + INTO gap_id, gap_enacted_tx_id + FROM public.gov_action_proposal AS gap + WHERE gap.type = 'NewCommittee' + AND gap.enacted_epoch IS NOT NULL + ORDER BY gap.enacted_epoch DESC + LIMIT 1; + + RETURN QUERY ( + SELECT + CASE + WHEN c.gov_action_proposal_id IS NULL THEN NULL + ELSE ( + SELECT ENCODE(tx.hash, 'hex') + 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 ( + SELECT index + FROM gov_action_proposal AS gap + WHERE gap.id = c.gov_action_proposal_id + ) + END, + c.quorum_numerator, + c.quorum_denominator, + JSONB_AGG( + JSONB_BUILD_OBJECT( + 'status', + CASE + WHEN EXISTS ( + SELECT TRUE + FROM committee_de_registration AS cdr + WHERE cdr.cold_key_id = ch_cold.id + AND cdr.tx_id > (SELECT MAX(tx_id) FROM public.committee_registration WHERE cold_key_id = ch_cold.id) + ) THEN 'resigned' + WHEN hot_key.raw IS NULL THEN 'not_authorized' + ELSE + 'authorized' + END, + 'cc_cold_hex', ENCODE(ch_cold.raw, 'hex'), + 'cc_cold_has_script', ch_cold.has_script, + '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 + ) + ) AS members + FROM public.committee AS c + INNER JOIN public.committee_member AS cm ON c.id = cm.committee_id + INNER JOIN public.committee_hash AS ch_cold ON ch_cold.id = cm.committee_hash_id + LEFT JOIN LATERAL ( + SELECT + ch_hot.raw, + ch_hot.has_script + FROM + public.committee_registration AS cr + INNER JOIN public.committee_hash AS ch_hot ON ch_hot.id = cr.hot_key_id + WHERE + cr.cold_key_id = ch_cold.id + AND NOT EXISTS ( + SELECT TRUE + FROM committee_de_registration AS cdr + WHERE cdr.cold_key_id = cr.cold_key_id + AND cdr.tx_id > cr.tx_id + ) + -- TODO: fix once we know how to properly check for valid hot key auth cert + --AND CASE + -- WHEN gap_enacted_tx_id IS NULL THEN TRUE + -- ELSE cr.tx_id > gap_enacted_tx_id + --END + ORDER BY cr.id DESC + LIMIT 1 + ) AS hot_key ON TRUE + WHERE + CASE + WHEN gap_id IS NULL THEN c.gov_action_proposal_id IS NULL + ELSE c.gov_action_proposal_id = gap_id + END + GROUP BY c.gov_action_proposal_id, c.quorum_numerator, c.quorum_denominator + ); + +END; +$$; + +COMMENT ON FUNCTION grest.committee_info IS 'Get information about current governance committee'; --noqa: LT01 diff --git a/files/grest/rpc/governance/committee_votes.sql b/files/grest/rpc/governance/committee_votes.sql new file mode 100644 index 00000000..20b5f875 --- /dev/null +++ b/files/grest/rpc/governance/committee_votes.sql @@ -0,0 +1,37 @@ +CREATE OR REPLACE FUNCTION grest.committee_votes(_committee_hash text DEFAULT NULL) +RETURNS TABLE ( + proposal_tx_hash text, + proposal_index integer, + vote_tx_hash text, + block_time integer, + vote text, + meta_url text, + meta_hash text +) +LANGUAGE sql STABLE +AS $$ + SELECT + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, + vp.vote, + va.url, + ENCODE(va.data_hash, 'hex') + FROM public.committee_hash AS ch + INNER JOIN public.voting_procedure AS vp ON ch.id = vp.committee_voter + INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id + INNER JOIN public.tx prop_tx ON gap.tx_id = prop_tx.id + INNER JOIN public.tx vote_tx on vp.tx_id = vote_tx.id + INNER JOIN public.block AS b ON vote_tx.block_id = b.id + 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') + 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 diff --git a/files/grest/rpc/governance/drep_delegators.sql b/files/grest/rpc/governance/drep_delegators.sql new file mode 100644 index 00000000..9915a92d --- /dev/null +++ b/files/grest/rpc/governance/drep_delegators.sql @@ -0,0 +1,94 @@ +CREATE OR REPLACE FUNCTION grest.drep_delegators(_drep_id text) +RETURNS TABLE ( + stake_address text, + stake_address_hex text, + script_hash text, + epoch_no word31type, + amount text +) +LANGUAGE plpgsql +AS $$ +DECLARE + drep_idx bigint; + 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 + last_reg_tx_id := 0; + ELSE + SELECT INTO last_reg_tx_id MAX(tx_id) + FROM public.drep_registration + WHERE drep_hash_id = drep_idx + AND (deposit IS NOT NULL AND deposit >= 0); + + IF last_reg_tx_id IS NULL OR EXISTS ( + SELECT 1 + FROM public.drep_registration + WHERE drep_hash_id = drep_idx + AND deposit IS NOT NULL + AND deposit < 0 + AND tx_id > last_reg_tx_id + LIMIT 1 + ) THEN + RETURN; -- DRep not registered or de-registered, no need to continue + END IF; + END IF; + + RETURN QUERY ( + WITH + _all_delegations AS ( + SELECT * + FROM ( + SELECT + DISTINCT ON (last_delegation.addr_id) last_delegation.addr_id, + last_delegation.tx_id, + last_delegation.drep_hash_id, + sd.tx_id AS dereg_tx_id + FROM ( + SELECT + DISTINCT ON (dv1.addr_id) dv1.addr_id, + dv1.tx_id, + dv1.drep_hash_id + FROM + public.delegation_vote AS dv1 + WHERE + dv1.addr_id = ANY( + SELECT dv2.addr_id + FROM public.delegation_vote AS dv2 + WHERE dv2.drep_hash_id = drep_idx + AND dv2.tx_id >= last_reg_tx_id + ) + ORDER BY + dv1.addr_id, dv1.tx_id DESC + ) AS last_delegation + LEFT JOIN stake_deregistration AS sd ON last_delegation.addr_id = sd.addr_id AND last_delegation.tx_id < sd.tx_id + WHERE last_delegation.drep_hash_id = drep_idx + ORDER BY + last_delegation.addr_id, sd.tx_id NULLS LAST + ) AS all_delegations_w_dereg + WHERE all_delegations_w_dereg.dereg_tx_id IS NULL + ) + + SELECT + sa.view::text, + ENCODE(sa.hash_raw,'hex'), + ENCODE(sa.script_hash,'hex'), + b.epoch_no, + COALESCE(sdc.total_balance,0)::text + FROM _all_delegations AS ad + INNER JOIN stake_address AS sa ON ad.addr_id = sa.id + INNER JOIN tx ON ad.tx_id = tx.id + INNER JOIN block AS b ON tx.block_id = b.id + LEFT JOIN grest.stake_distribution_cache AS sdc ON sa.view = sdc.stake_address + ORDER BY b.epoch_no DESC, sa.view + ); + +END; +$$; + +COMMENT ON FUNCTION grest.drep_delegators IS 'Return all delegators for a specific DRep'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/drep_epoch_summary.sql b/files/grest/rpc/governance/drep_epoch_summary.sql new file mode 100644 index 00000000..bbe4206f --- /dev/null +++ b/files/grest/rpc/governance/drep_epoch_summary.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE FUNCTION grest.drep_epoch_summary(_epoch_no numeric DEFAULT NULL) +RETURNS TABLE ( + epoch_no word31type, + amount text, + dreps integer +) +LANGUAGE sql STABLE +AS $$ + SELECT + epoch_no, + SUM(amount)::text AS amount, + COUNT(hash_id) + FROM public.drep_distr + WHERE (CASE WHEN _epoch_no IS NULL THEN TRUE ELSE epoch_no = _epoch_no END) + GROUP BY epoch_no + ORDER BY epoch_no DESC; +$$; + +COMMENT ON FUNCTION grest.drep_epoch_summary IS 'Get a summary of vote power and active DReps by specified epoch or all'; --noqa: LT01 diff --git a/files/grest/rpc/governance/drep_info.sql b/files/grest/rpc/governance/drep_info.sql new file mode 100644 index 00000000..e2f35415 --- /dev/null +++ b/files/grest/rpc/governance/drep_info.sql @@ -0,0 +1,122 @@ +CREATE OR REPLACE FUNCTION grest.drep_info(_drep_ids text []) +RETURNS TABLE ( + drep_id character varying, + hex text, + has_script boolean, + registered boolean, + deposit text, + active boolean, + expires_epoch_no numeric, + amount text, + url character varying, + hash text +) +LANGUAGE plpgsql +AS $$ +DECLARE + curr_epoch word31type; + drep_list bigint[]; + drep_activity word64type; +BEGIN + + SELECT INTO curr_epoch MAX(epoch_no) FROM public.block; + + SELECT INTO drep_activity ep.drep_activity FROM public.epoch_param AS ep WHERE ep.epoch_no = curr_epoch; + + -- all DRep ids + SELECT INTO drep_list ARRAY_AGG(id) + FROM ( + SELECT id + FROM public.drep_hash + WHERE view = ANY(_drep_ids) + ) AS tmp; + + RETURN QUERY ( + WITH + + _last_registration AS ( + SELECT + DISTINCT ON (dr.drep_hash_id) drep_hash_id AS drep, + dr.tx_id, + dr.deposit + FROM + public.drep_registration AS dr + WHERE + dr.drep_hash_id = ANY(drep_list) + AND (dr.deposit IS NOT NULL AND dr.deposit >= 0) + ORDER BY + dr.drep_hash_id, dr.tx_id DESC + ), + + _last_update AS ( + SELECT + dr.drep_hash_id AS drep, + MAX(dr.tx_id) AS tx_id + FROM + public.drep_registration AS dr + WHERE + dr.drep_hash_id = ANY(drep_list) + AND dr.deposit IS NULL + GROUP BY dr.drep_hash_id + ), + + _last_vote AS ( + SELECT + drep_voter AS drep, + MAX(tx_id) AS tx_id + FROM + public.voting_procedure + WHERE + drep_voter = ANY(drep_list) + GROUP BY drep_voter + ), + + _drep_state AS ( + SELECT + drep_state.drep, + drep_state.deposit, + (CASE WHEN (curr_epoch - b.epoch_no) < drep_activity THEN TRUE ELSE FALSE END) AS active, + (b.epoch_no + drep_activity) AS expires_epoch_no + FROM ( + SELECT + all_activities.drep, + MAX(all_activities.tx_id) AS last_tx_id, + MAX(all_activities.deposit) AS deposit + FROM ( + SELECT lr.drep, lr.tx_id, lr.deposit FROM _last_registration AS lr + UNION ALL + SELECT lu.drep, lu.tx_id, 0 AS deposit FROM _last_update AS lu + UNION ALL + SELECT lv.drep, lv.tx_id, 0 AS deposit FROM _last_vote AS lv + ) AS all_activities + GROUP BY all_activities.drep + ) AS drep_state + INNER JOIN tx on drep_state.last_tx_id = tx.id + INNER JOIN block AS b ON tx.block_id = b.id + ) + + SELECT + DISTINCT ON (dh.view) dh.view 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, + (CASE WHEN (dr.deposit < 0) OR starts_with(dh.view,'drep_') THEN NULL ELSE ds.deposit END)::text AS deposit, + (CASE WHEN starts_with(dh.view,'drep_') THEN TRUE ELSE COALESCE(dr.deposit, 0) >= 0 AND ds.active END) AS active, + (CASE WHEN COALESCE(dr.deposit, 0) >= 0 THEN ds.expires_epoch_no ELSE NULL END) AS expires_epoch_no, + COALESCE(dd.amount, 0)::text AS amount, + va.url, + ENCODE(va.data_hash, 'hex') AS hash + FROM public.drep_hash AS dh + LEFT 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.drep_distr AS dd ON dh.id = dd.hash_id AND dd.epoch_no = curr_epoch + LEFT JOIN _drep_state AS ds ON dh.id = ds.drep + WHERE dh.id = ANY(drep_list) + ORDER BY + dh.view, dr.tx_id DESC + ); + +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 diff --git a/files/grest/rpc/governance/drep_list.sql b/files/grest/rpc/governance/drep_list.sql new file mode 100644 index 00000000..c43c7311 --- /dev/null +++ b/files/grest/rpc/governance/drep_list.sql @@ -0,0 +1,24 @@ +CREATE OR REPLACE FUNCTION grest.drep_list() +RETURNS TABLE ( + drep_id character varying, + hex text, + has_script boolean, + registered boolean +) +LANGUAGE sql STABLE +AS $$ + SELECT + DISTINCT ON (dh.view) dh.view AS drep_id, + ENCODE(dh.raw, 'hex')::text AS hex, + dh.has_script AS has_script, + (CASE + WHEN coalesce(dr.deposit, 0) >= 0 THEN TRUE + ELSE FALSE + END) AS registered + 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; +$$; + +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 new file mode 100644 index 00000000..87ea5033 --- /dev/null +++ b/files/grest/rpc/governance/drep_metadata.sql @@ -0,0 +1,36 @@ +CREATE OR REPLACE FUNCTION grest.drep_metadata(_drep_ids text []) +RETURNS TABLE ( + drep_id character varying, + hex text, + url text, + hash text, + json jsonb, + bytes text, + warning text, + language text, + comment text, + is_valid boolean +) +LANGUAGE sql STABLE +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; +$$; + +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 new file mode 100644 index 00000000..4ac51138 --- /dev/null +++ b/files/grest/rpc/governance/drep_updates.sql @@ -0,0 +1,46 @@ +CREATE OR REPLACE FUNCTION grest.drep_updates(_drep_id text DEFAULT NULL) +RETURNS TABLE ( + drep_id character varying, + hex text, + update_tx_hash text, + cert_index integer, + block_time integer, + action text, + deposit text, + meta_url text, + meta_hash text, + meta_json jsonb +) +LANGUAGE sql STABLE +AS $$ + SELECT + dh.view AS drep_id, + ENCODE(dh.raw, 'hex')::text AS hex, + ENCODE(tx.hash, 'hex')::text AS update_tx_hash, + dr.cert_index, + EXTRACT(EPOCH FROM b.time)::integer AS block_time, + CASE + WHEN dr.deposit IS NULL THEN 'updated' + WHEN dr.deposit > 0 THEN 'registered' + ELSE 'deregistered' + END AS action, + dr.deposit, + va.url AS meta_url, + ENCODE(va.data_hash, 'hex') AS meta_hash, + ocvd.json AS meta_json + FROM public.drep_hash AS dh + INNER JOIN public.drep_registration AS dr ON dh.id = dr.drep_hash_id + INNER JOIN public.tx ON dr.tx_id = tx.id + INNER JOIN public.block AS b ON tx.block_id = b.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 + CASE + WHEN _drep_id IS NULL THEN TRUE + ELSE dh.view = _drep_id + END + ORDER BY + block_time DESC; +$$; + +COMMENT ON FUNCTION grest.drep_updates IS 'Return all DRep updates for all DReps or only updates for specific DRep if specified'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/drep_votes.sql b/files/grest/rpc/governance/drep_votes.sql new file mode 100644 index 00000000..31214e36 --- /dev/null +++ b/files/grest/rpc/governance/drep_votes.sql @@ -0,0 +1,33 @@ +CREATE OR REPLACE FUNCTION grest.drep_votes(_drep_id text) +RETURNS TABLE ( + proposal_tx_hash text, + proposal_index integer, + vote_tx_hash text, + block_time integer, + vote text, + meta_url text, + meta_hash text +) +LANGUAGE sql STABLE +AS $$ + SELECT + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, + vp.vote, + va.url, + ENCODE(va.data_hash, 'hex') + FROM public.drep_hash AS dh + INNER JOIN public.voting_procedure AS vp ON dh.id = vp.drep_voter + INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id + INNER JOIN public.tx prop_tx ON gap.tx_id = prop_tx.id + INNER JOIN public.tx vote_tx on vp.tx_id = vote_tx.id + INNER JOIN public.block AS b ON vote_tx.block_id = b.id + LEFT JOIN public.voting_anchor AS va ON vp.voting_anchor_id = va.id + WHERE dh.view = _drep_id + ORDER BY + vote_tx.id DESC; +$$; + +COMMENT ON FUNCTION grest.drep_votes IS 'Get all DRep votes cast from specified DRep ID'; -- noqa: LT01 diff --git a/files/grest/rpc/governance/proposal_list.sql b/files/grest/rpc/governance/proposal_list.sql new file mode 100644 index 00000000..67c44ce4 --- /dev/null +++ b/files/grest/rpc/governance/proposal_list.sql @@ -0,0 +1,76 @@ +CREATE OR REPLACE FUNCTION grest.proposal_list() +RETURNS TABLE ( + block_time integer, + proposal_tx_hash text, + proposal_index integer, + proposal_type text, + proposal_description jsonb, + deposit text, + return_address text, + proposed_epoch integer, + ratified_epoch integer, + enacted_epoch integer, + dropped_epoch integer, + expired_epoch integer, + expiration integer, + meta_url text, + meta_hash text, + meta_json jsonb, + meta_comment text, + meta_language text, + meta_is_valid boolean, + withdrawal jsonb, + param_proposal jsonb +) +LANGUAGE sql STABLE +AS $$ + SELECT + 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 + JSONB_BUILD_OBJECT( + 'stake_address', ( + SELECT sa2.view + FROM stake_address AS sa2 + WHERE sa2.id = tw.stake_address_id + ), + 'amount', tw.amount::text + ) + END AS withdrawal, + 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 param_proposal + FROM public.gov_action_proposal AS gap + INNER JOIN public.tx ON gap.tx_id = tx.id + INNER JOIN public.block AS b ON tx.block_id = b.id + INNER JOIN public.stake_address AS sa ON gap.return_address = sa.id + LEFT JOIN public.treasury_withdrawal AS tw ON gap.id = tw.gov_action_proposal_id + LEFT JOIN public.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 + LEFT JOIN public.off_chain_vote_data AS ocvd ON va.id = ocvd.voting_anchor_id + ORDER BY + b.time DESC; +$$; + +COMMENT ON FUNCTION grest.proposal_list IS 'Get a raw listing of all governance proposals'; --noqa: LT01 diff --git a/files/grest/rpc/governance/proposal_votes.sql b/files/grest/rpc/governance/proposal_votes.sql new file mode 100644 index 00000000..c7822697 --- /dev/null +++ b/files/grest/rpc/governance/proposal_votes.sql @@ -0,0 +1,47 @@ +CREATE OR REPLACE FUNCTION grest.proposal_votes(_proposal_tx_hash text, _proposal_index integer) +RETURNS TABLE ( + block_time integer, + voter_role text, + voter text, + voter_hex text, + vote text, + meta_url text, + meta_hash text +) +LANGUAGE sql STABLE +AS $$ + SELECT z.* + FROM ( + SELECT + distinct on (COALESCE(ENCODE(ch.raw, 'hex'), dh.view, ph.view)) + 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.vote, + va.url, + ENCODE(va.data_hash, 'hex') + FROM public.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 + 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.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? + 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), + block_time DESC + ) z ORDER BY block_time desc; +$$; + +COMMENT ON FUNCTION grest.proposal_votes IS 'Get all 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 new file mode 100644 index 00000000..14810f9a --- /dev/null +++ b/files/grest/rpc/governance/voter_proposal_list.sql @@ -0,0 +1,110 @@ +CREATE OR REPLACE FUNCTION grest.voter_proposal_list(_credential text) +RETURNS TABLE ( + block_time integer, + proposal_tx_hash text, + proposal_index bigint, + proposal_type govactiontype, + proposal_description jsonb, + deposit text, + return_address character varying, + proposed_epoch word31type, + ratified_epoch word31type, + enacted_epoch word31type, + dropped_epoch word31type, + expired_epoch word31type, + expiration word31type, + meta_url character varying, + meta_hash text, + meta_json jsonb, + meta_comment character varying, + meta_language character varying, + meta_is_valid boolean, + withdrawal jsonb, + param_proposal jsonb +) +LANGUAGE plpgsql +AS $$ +DECLARE + _drep_id bigint; + _spo_id bigint; + _committee_member_id bigint; + _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'); + END IF; + + SELECT INTO _gap_id_list ARRAY_AGG(gov_action_proposal_id) + FROM ( + SELECT DISTINCT gov_action_proposal_id + FROM public.voting_procedure + WHERE + CASE + WHEN _drep_id IS NOT NULL THEN drep_voter = _drep_id + WHEN _spo_id IS NOT NULL THEN pool_voter = _spo_id + WHEN _committee_member_id IS NOT NULL THEN committee_voter = _committee_member_id + ELSE + FALSE + END + ) AS tmp; + + RETURN QUERY ( + SELECT + 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 + JSONB_BUILD_OBJECT( + 'stake_address', ( + SELECT sa2.view + FROM stake_address AS sa2 + WHERE sa2.id = tw.stake_address_id + ), + 'amount', tw.amount::text + ) + END AS withdrawal, + 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 param_proposal + FROM public.gov_action_proposal AS gap + INNER JOIN public.tx ON gap.tx_id = tx.id + INNER JOIN public.block AS b ON tx.block_id = b.id + INNER JOIN public.stake_address AS sa ON gap.return_address = sa.id + LEFT JOIN public.treasury_withdrawal AS tw ON gap.id = tw.gov_action_proposal_id + LEFT JOIN public.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 + LEFT JOIN public.off_chain_vote_data AS ocvd ON va.id = ocvd.voting_anchor_id + WHERE + gap.id = ANY(_gap_id_list) + ORDER BY + b.time DESC + ); + +END; +$$; + +COMMENT ON FUNCTION grest.voter_proposal_list IS 'Get a raw listing of all governance proposals for specified DRep, SPO or Committee credential'; --noqa: LT01 diff --git a/files/grest/rpc/pool/pool_blocks.sql b/files/grest/rpc/pool/pool_blocks.sql index 80ac6cee..e1299b89 100644 --- a/files/grest/rpc/pool/pool_blocks.sql +++ b/files/grest/rpc/pool/pool_blocks.sql @@ -18,7 +18,7 @@ AS $$ EXTRACT(EPOCH FROM b.time)::integer FROM public.block AS b INNER JOIN public.slot_leader AS sl ON b.slot_leader_id = sl.id - WHERE sl.pool_hash_id = (SELECT pool_hash_id FROM grest.pool_info_cache WHERE pool_id_bech32 = _pool_bech32 ORDER BY tx_id DESC LIMIT 1) + WHERE sl.pool_hash_id = (SELECT id FROM public.pool_hash WHERE view = _pool_bech32) AND (_epoch_no IS NULL OR b.epoch_no = _epoch_no); $$; diff --git a/files/grest/rpc/pool/pool_history.sql b/files/grest/rpc/pool/pool_history.sql index 1b7c6943..c3c1b8fb 100644 --- a/files/grest/rpc/pool/pool_history.sql +++ b/files/grest/rpc/pool/pool_history.sql @@ -4,8 +4,8 @@ RETURNS TABLE ( active_stake text, active_stake_pct numeric, saturation_pct numeric, - block_cnt bigint, - delegator_cnt bigint, + block_cnt numeric, + delegator_cnt numeric, margin double precision, fixed_cost text, pool_fees text, diff --git a/files/grest/rpc/pool/pool_info.sql b/files/grest/rpc/pool/pool_info.sql index e3792668..c5ac76fd 100644 --- a/files/grest/rpc/pool/pool_info.sql +++ b/files/grest/rpc/pool/pool_info.sql @@ -7,6 +7,7 @@ RETURNS TABLE ( margin double precision, fixed_cost text, pledge text, + deposit text, reward_addr character varying, owners character varying [], relays jsonb [], @@ -41,29 +42,52 @@ BEGIN RETURN QUERY WITH _all_pool_info AS ( - SELECT DISTINCT ON (pic.pool_id_bech32) - * + SELECT DISTINCT ON (pic.pool_hash_id) + pic.pool_hash_id, + pic.active_epoch_no, + pic.update_id, + pic.pool_status, + pic.retiring_epoch, + pic.meta_id, + ph.view, + ph.hash_raw FROM grest.pool_info_cache AS pic - WHERE pic.pool_id_bech32 = ANY(SELECT UNNEST(_pool_bech32_ids)) + INNER JOIN public.pool_hash AS ph ON ph.id = pic.pool_hash_id + WHERE ph.view = ANY(SELECT UNNEST(_pool_bech32_ids)) ORDER BY - pic.pool_id_bech32, + pic.pool_hash_id, pic.tx_id DESC ) - SELECT - api.pool_id_bech32, - api.pool_id_hex, - api.active_epoch_no, - api.vrf_key_hash, - api.margin, - api.fixed_cost::text, - api.pledge::text, - api.reward_addr, - api.owners, - api.relays, - api.meta_url, - api.meta_hash, - offline_data.json, + ph.view AS pool_id_bech32, + ENCODE(ph.hash_raw::bytea, 'hex') AS pool_id_hex, + pu.active_epoch_no, + ENCODE(pu.vrf_key_hash, 'hex') AS vrf_key_hash, + pu.margin, + pu.fixed_cost::text, + pu.pledge::text, + pu.deposit::text, + sa.view AS reward_addr, + ARRAY( + SELECT sa.view + FROM public.pool_owner AS po + INNER JOIN public.stake_address AS sa ON sa.id = po.addr_id + WHERE po.pool_update_id = api.update_id + ) AS owners, + ARRAY( + SELECT JSONB_BUILD_OBJECT( + 'ipv4', pr.ipv4, + 'ipv6', pr.ipv6, + 'dns', pr.dns_name, + 'srv', pr.dns_srv_name, + 'port', pr.port + ) relay + FROM public.pool_relay AS pr + WHERE pr.update_id = api.update_id + ) AS relays, + pmr.url AS meta_url, + ENCODE(pmr.hash,'hex') AS meta_hash, + ocpd.json, api.pool_status, api.retiring_epoch, ENCODE(block_data.op_cert::bytea, 'hex'), @@ -76,14 +100,11 @@ BEGIN live.delegators, ROUND((live.stake / _saturation_limit) * 100, 2) FROM _all_pool_info AS api - LEFT JOIN LATERAL ( - SELECT ocpd.json - FROM public.off_chain_pool_data AS ocpd - WHERE ocpd.pool_id = api.pool_hash_id - AND ocpd.pmr_id = api.meta_id - ORDER BY ocpd.pmr_id DESC - LIMIT 1 - ) AS offline_data ON TRUE + LEFT JOIN public.pool_hash AS ph ON ph.id = api.pool_hash_id + LEFT JOIN public.pool_update AS pu ON pu.id = api.update_id + LEFT JOIN public.stake_address AS sa ON pu.reward_addr_id = sa.id + LEFT JOIN public.pool_metadata_ref AS pmr ON pmr.id = api.meta_id + LEFT JOIN public.off_chain_pool_data AS ocpd ON api.meta_id = ocpd.pmr_id LEFT JOIN LATERAL ( SELECT SUM(COUNT(b.id)) OVER () AS cnt, @@ -101,7 +122,7 @@ BEGIN LEFT JOIN LATERAL( SELECT amount::lovelace AS as_sum FROM grest.pool_active_stake_cache AS pasc - WHERE pasc.pool_id = api.pool_id_bech32 + WHERE pasc.pool_id = api.view AND pasc.epoch_no = _epoch_no ) AS active_stake ON TRUE LEFT JOIN LATERAL( @@ -125,9 +146,17 @@ BEGIN CASE WHEN api.pool_status = 'retired' THEN NULL ELSE - SUM(CASE WHEN pool_delegs.stake_address = ANY(api.owners) THEN amount::numeric ELSE 0 END)::lovelace + SUM(CASE + WHEN pool_delegs.stake_address IN ( + SELECT sa.view + FROM public.pool_owner AS po + INNER JOIN public.stake_address AS sa ON sa.id = po.addr_id + WHERE po.pool_update_id = api.update_id + ) THEN amount::numeric + ELSE 0 + END)::lovelace END AS pledge - FROM grest.pool_delegators_list(api.pool_id_bech32) AS pool_delegs + FROM grest.pool_delegators_list(api.view) AS pool_delegs ) AS live ON TRUE; END; $$; diff --git a/files/grest/rpc/pool/pool_list.sql b/files/grest/rpc/pool/pool_list.sql index 9c0dbfb5..94a15b39 100644 --- a/files/grest/rpc/pool/pool_list.sql +++ b/files/grest/rpc/pool/pool_list.sql @@ -6,6 +6,7 @@ RETURNS TABLE ( margin double precision, fixed_cost text, pledge text, + deposit text, reward_addr character varying, owners character varying [], relays jsonb [], @@ -15,58 +16,47 @@ RETURNS TABLE ( pool_status text, retiring_epoch word31type ) -LANGUAGE plpgsql +LANGUAGE sql STABLE AS $$ -# variable_conflict use_column -BEGIN - RETURN QUERY ( - WITH - -- Get last pool update for each pool - _pool_list AS ( - SELECT - ph.view as pool_id_bech32, - ph.hash_raw as pool_id_hex - FROM pool_hash AS ph - ), - - _pool_meta AS ( - SELECT DISTINCT ON (pic.pool_id_bech32) - pic.pool_id_bech32, - pic.active_epoch_no, - pic.margin, - pic.fixed_cost, - pic.pledge, - pic.reward_addr, - pic.owners, - pic.relays, - ocpd.ticker_name, - pic.meta_url, - pic.meta_hash, - pic.pool_status, - pic.retiring_epoch - FROM grest.pool_info_cache AS pic - LEFT JOIN public.off_chain_pool_data AS ocpd ON ocpd.pmr_id = pic.meta_id - ORDER BY - pic.pool_id_bech32, - pic.tx_id DESC - ) - SELECT - pl.pool_id_bech32, - encode(pl.pool_id_hex,'hex') as pool_id_hex, - pm.active_epoch_no, - pm.margin, - pm.fixed_cost::text, - pm.pledge::text, - pm.reward_addr, - pm.owners, - pm.relays, - pm.ticker_name, - pm.meta_url, - pm.meta_hash, - pm.pool_status, - pm.retiring_epoch - FROM _pool_list AS pl - LEFT JOIN _pool_meta AS pm ON pl.pool_id_bech32 = pm.pool_id_bech32 - ); -END; + SELECT DISTINCT ON (pic.pool_hash_id) + ph.view AS pool_id_bech32, + ENCODE(ph.hash_raw,'hex') as pool_id_hex, + pu.active_epoch_no, + pu.margin, + pu.fixed_cost::text, + pu.pledge::text, + pu.deposit::text, + sa.view AS reward_addr, + ARRAY( + SELECT sa.view + FROM public.pool_owner AS po + INNER JOIN public.stake_address AS sa ON sa.id = po.addr_id + WHERE po.pool_update_id = pic.update_id + ) AS owners, + ARRAY( + SELECT JSONB_BUILD_OBJECT( + 'ipv4', pr.ipv4, + 'ipv6', pr.ipv6, + 'dns', pr.dns_name, + 'srv', pr.dns_srv_name, + 'port', pr.port + ) relay + FROM public.pool_relay AS pr + WHERE pr.update_id = pic.update_id + ) AS relays, + ocpd.ticker_name, + pmr.url AS meta_url, + pmr.hash AS meta_hash, + pic.pool_status, + pic.retiring_epoch + FROM grest.pool_info_cache AS pic + LEFT JOIN public.pool_hash AS ph ON ph.id = pic.pool_hash_id + LEFT JOIN public.pool_update AS pu ON pu.id = pic.update_id + LEFT JOIN public.stake_address AS sa ON pu.reward_addr_id = sa.id + LEFT JOIN public.pool_metadata_ref AS pmr ON pmr.id = pic.meta_id + LEFT JOIN public.off_chain_pool_data AS ocpd ON ocpd.pmr_id = pic.meta_id + ORDER BY + pic.pool_hash_id, + pic.tx_id DESC + ; $$; diff --git a/files/grest/rpc/pool/pool_metadata.sql b/files/grest/rpc/pool/pool_metadata.sql index 100268ec..e2fcf732 100644 --- a/files/grest/rpc/pool/pool_metadata.sql +++ b/files/grest/rpc/pool/pool_metadata.sql @@ -3,31 +3,29 @@ RETURNS TABLE ( pool_id_bech32 character varying, meta_url character varying, meta_hash text, - meta_json jsonb, - pool_status text + meta_json jsonb ) LANGUAGE plpgsql AS $$ #variable_conflict use_column BEGIN RETURN QUERY - SELECT DISTINCT ON (pic.pool_id_bech32) + SELECT DISTINCT ON (ph.view) ph.view AS pool_id_bech32, - pic.meta_url, - pic.meta_hash, - ocpd.json, - pic.pool_status + pmr.url AS meta_url, + ENCODE(pmr.hash, 'hex') AS meta_hash, + ocpd.json AS meta_json FROM public.pool_hash AS ph - LEFT JOIN grest.pool_info_cache AS pic ON ph.view = pic.pool_id_bech32 - LEFT JOIN public.off_chain_pool_data AS ocpd ON ocpd.pmr_id = pic.meta_id + LEFT JOIN public.off_chain_pool_data AS ocpd ON ocpd.pool_id = ph.id + LEFT JOIN public.pool_metadata_ref AS pmr ON pmr.id = ocpd.pmr_id WHERE CASE WHEN _pool_bech32_ids IS NULL THEN TRUE - WHEN _pool_bech32_ids IS NOT NULL THEN pic.pool_id_bech32 = ANY(SELECT UNNEST(_pool_bech32_ids)) + WHEN _pool_bech32_ids IS NOT NULL THEN ph.view = ANY(SELECT UNNEST(_pool_bech32_ids)) END ORDER BY - pic.pool_id_bech32, - pic.tx_id DESC; + ph.view, + pmr.registered_tx_id DESC; END; $$; diff --git a/files/grest/rpc/pool/pool_relays.sql b/files/grest/rpc/pool/pool_relays.sql index 2b3e2c09..e821bb9a 100644 --- a/files/grest/rpc/pool/pool_relays.sql +++ b/files/grest/rpc/pool/pool_relays.sql @@ -1,23 +1,27 @@ CREATE OR REPLACE FUNCTION grest.pool_relays() RETURNS TABLE ( pool_id_bech32 character varying, - relays jsonb [], - pool_status text + relays jsonb ) -LANGUAGE plpgsql +LANGUAGE sql STABLE AS $$ -#variable_conflict use_column -BEGIN - RETURN QUERY - SELECT DISTINCT ON (pool_id_bech32) - pool_id_bech32, - relays, - pool_status - FROM grest.pool_info_cache + SELECT DISTINCT ON (ph.view) + ph.view AS pool_id_bech32, + JSONB_AGG(JSONB_BUILD_OBJECT ( + 'ipv4', pr.ipv4, + 'ipv6', pr.ipv6, + 'dns', pr.dns_name, + 'srv', pr.dns_srv_name, + 'port', pr.port + )) AS relays + FROM public.pool_hash AS ph + LEFT JOIN public.pool_update AS pu ON pu.hash_id = ph.id + LEFT JOIN public.pool_relay AS pr ON pu.id = pr.update_id + GROUP BY ph.view,pu.registered_tx_id ORDER BY - pool_id_bech32, - tx_id DESC; -END; + ph.view, + pu.registered_tx_id DESC + ; $$; COMMENT ON FUNCTION grest.pool_relays IS 'A list of registered relays for all pools'; --noqa: LT01 diff --git a/files/grest/rpc/pool/pool_updates.sql b/files/grest/rpc/pool/pool_updates.sql index 490f4878..3fe1f631 100644 --- a/files/grest/rpc/pool/pool_updates.sql +++ b/files/grest/rpc/pool/pool_updates.sql @@ -10,8 +10,8 @@ RETURNS TABLE ( fixed_cost text, pledge text, reward_addr character varying, - owners character varying [], - relays jsonb [], + owners jsonb, + relays jsonb, meta_url character varying, meta_hash text, meta_json jsonb, @@ -28,29 +28,45 @@ BEGIN WITH pool_reg AS ( SELECT - pic.tx_hash, - pic.block_time::integer, - pic.pool_id_bech32, - pic.pool_id_hex, - pic.active_epoch_no, - pic.vrf_key_hash, - pic.margin, - pic.fixed_cost::text, - pic.pledge::text, - pic.reward_addr, - pic.owners, - pic.relays, - pic.meta_url, - pic.meta_hash, + ENCODE(tx.hash::bytea, 'hex') AS tx_hash, + EXTRACT(EPOCH FROM b.time)::integer AS block_time, + ph.view AS pool_id_bech32, + ENCODE(ph.hash_raw::bytea, 'hex') AS pool_id_hex, + pu.active_epoch_no, + ENCODE(pu.vrf_key_hash, 'hex') AS vrf_key_hash, + pu.margin, + pu.fixed_cost::text, + pu.pledge::text, + sa.view AS reward_addr, + JSONB_AGG(po.view) AS owners, + JSONB_AGG(JSONB_BUILD_OBJECT ( + 'ipv4', pr.ipv4, + 'ipv6', pr.ipv6, + 'dns', pr.dns_name, + 'srv', pr.dns_srv_name, + 'port', pr.port + )) AS relays, + pmr.url AS meta_url, + ENCODE(pmr.hash, 'hex') AS meta_hash, ocpd.json, 'registration' AS update_type, NULL::word31type AS retiring_epoch - FROM - grest.pool_info_cache AS pic - LEFT JOIN public.off_chain_pool_data AS ocpd ON ocpd.pmr_id = pic.meta_id - LEFT JOIN public.pool_retire AS pr ON pic.pool_hash_id = pr.hash_id + FROM public.pool_hash AS ph + LEFT JOIN public.pool_update AS pu ON pu.hash_id = ph.id + INNER JOIN public.tx ON pu.registered_tx_id = tx.id + INNER JOIN public.block AS b ON b.id = tx.block_id + LEFT JOIN public.stake_address AS sa ON pu.reward_addr_id = sa.id + LEFT JOIN ( + SELECT po1.pool_update_id, sa1.view + FROM public.pool_owner AS po1 + LEFT JOIN public.stake_address AS sa1 ON sa1.id = po1.addr_id + ) AS po ON pu.id = po.pool_update_id + LEFT JOIN public.pool_relay AS pr ON pu.id = pr.update_id + LEFT JOIN public.pool_metadata_ref AS pmr ON pu.meta_id = pmr.id + LEFT JOIN public.off_chain_pool_data AS ocpd ON pu.meta_id = ocpd.pmr_id WHERE _pool_bech32 IS NULL - OR pic.pool_id_bech32 = _pool_bech32), + OR ph.view = _pool_bech32 + GROUP BY tx.hash, b.time, ph.view, ph.hash_raw, pu.active_epoch_no, pu.vrf_key_hash, pu.margin, pu.fixed_cost, pu.pledge, sa.view, pmr.url, pmr.hash, ocpd.json), pool_dereg AS ( SELECT ENCODE(tx.hash::bytea, 'hex') AS tx_hash, @@ -63,15 +79,12 @@ BEGIN NULL as fixed_cost, NULL AS pledge, NULL AS reward_addr, - NULL::text[] AS owners, - NULL::jsonb[] AS relays, + NULL::jsonb AS owners, + NULL::jsonb AS relays, NULL AS meta_url, NULL AS meta_hash, NULL::jsonb AS json, - CASE - WHEN pr.retiring_epoch IS NULL THEN 'registration' - ELSE 'deregistration' - END AS update_type, + 'deregistration' AS update_type, pr.retiring_epoch::word31type FROM public.pool_hash AS ph LEFT JOIN pool_retire AS pr ON pr.hash_id = ph.id diff --git a/files/grest/rpc/pool/pool_votes.sql b/files/grest/rpc/pool/pool_votes.sql new file mode 100644 index 00000000..d61e1c50 --- /dev/null +++ b/files/grest/rpc/pool/pool_votes.sql @@ -0,0 +1,33 @@ +CREATE OR REPLACE FUNCTION grest.pool_votes(_pool_bech32 text) +RETURNS TABLE ( + proposal_tx_hash text, + proposal_index integer, + vote_tx_hash text, + block_time integer, + vote text, + meta_url text, + meta_hash text +) +LANGUAGE sql STABLE +AS $$ + SELECT + ENCODE(prop_tx.hash, 'hex'), + gap.index, + ENCODE(vote_tx.hash, 'hex'), + EXTRACT(EPOCH FROM b.time)::integer, + vp.vote, + va.url, + ENCODE(va.data_hash, 'hex') + FROM public.pool_hash ph + INNER JOIN public.voting_procedure AS vp ON ph.id = vp.pool_voter + INNER JOIN public.gov_action_proposal AS gap ON vp.gov_action_proposal_id = gap.id + INNER JOIN public.tx prop_tx ON gap.tx_id = prop_tx.id + INNER JOIN public.tx vote_tx on vp.tx_id = vote_tx.id + INNER JOIN public.block AS b ON vote_tx.block_id = b.id + LEFT JOIN public.voting_anchor AS va ON vp.voting_anchor_id = va.id + WHERE ph.view = _pool_bech32 + ORDER BY + vote_tx.id DESC; +$$; + +COMMENT ON FUNCTION grest.pool_votes IS 'Get all SPO votes cast for a given pool'; -- noqa: LT01 diff --git a/files/grest/rpc/transactions/tx_cbor.sql b/files/grest/rpc/transactions/tx_cbor.sql new file mode 100644 index 00000000..33f86e9d --- /dev/null +++ b/files/grest/rpc/transactions/tx_cbor.sql @@ -0,0 +1,22 @@ +CREATE OR REPLACE FUNCTION grest.tx_cbor(_tx_hashes text []) +RETURNS TABLE ( + tx_hash text, + cbor text +) +LANGUAGE sql STABLE +AS $$ + SELECT + ENCODE(tx.hash::bytea, 'hex') AS tx_hash, + ENCODE(tx_cbor.bytes::bytea, 'hex') AS tx_cbor + FROM public.tx + LEFT JOIN public.tx_cbor ON tx.id = tx_cbor.tx_id + WHERE tx.hash::bytea = ANY( + SELECT + DECODE(hashes, 'hex') + FROM + UNNEST(_tx_hashes) AS hashes + ) + ORDER BY tx.id; +$$; + +COMMENT ON FUNCTION grest.tx_cbor IS 'Get raw transaction(s) in CBOR format'; -- noqa: LT01 diff --git a/files/grest/rpc/transactions/tx_info.sql b/files/grest/rpc/transactions/tx_info.sql index cf363350..fd598d23 100644 --- a/files/grest/rpc/transactions/tx_info.sql +++ b/files/grest/rpc/transactions/tx_info.sql @@ -1,4 +1,14 @@ -CREATE OR REPLACE FUNCTION grest.tx_info(_tx_hashes text []) +CREATE OR REPLACE FUNCTION grest.tx_info( + _tx_hashes text [], + _inputs boolean DEFAULT false, + _metadata boolean DEFAULT false, + _assets boolean DEFAULT false, + _withdrawals boolean DEFAULT false, + _certs boolean DEFAULT false, + _scripts boolean DEFAULT false, + _bytecode boolean DEFAULT false, + _governance boolean DEFAULT false +) RETURNS TABLE ( tx_hash text, block_hash text, @@ -11,6 +21,7 @@ RETURNS TABLE ( tx_size word31type, total_output text, fee text, + treasury_donation text, deposit text, invalid_before text, invalid_after text, @@ -24,13 +35,15 @@ RETURNS TABLE ( metadata jsonb, certificates jsonb, native_scripts jsonb, - plutus_contracts jsonb + plutus_contracts jsonb, + voting_procedures jsonb, + proposal_procedures jsonb ) LANGUAGE plpgsql AS $$ DECLARE - _tx_hashes_bytea bytea[]; - _tx_id_list bigint[]; + _tx_hashes_bytea bytea[]; + _tx_id_list bigint[]; BEGIN -- convert input _tx_hashes array into bytea array SELECT INTO _tx_hashes_bytea ARRAY_AGG(hashes_bytea) @@ -52,36 +65,36 @@ BEGIN _all_tx AS ( SELECT tx.id, - tx.hash AS tx_hash, - b.hash AS block_hash, - b.block_no AS block_height, - b.epoch_no AS epoch_no, - b.epoch_slot_no AS epoch_slot, - b.slot_no AS absolute_slot, - b.time AS tx_timestamp, - tx.block_index AS tx_block_index, - tx.size AS tx_size, - tx.out_sum AS total_output, + tx.hash AS tx_hash, + b.hash AS block_hash, + b.block_no AS block_height, + b.epoch_no AS epoch_no, + b.epoch_slot_no AS epoch_slot, + b.slot_no AS absolute_slot, + b.time AS tx_timestamp, + tx.block_index AS tx_block_index, + tx.size AS tx_size, + tx.out_sum AS total_output, tx.fee, + tx.treasury_donation, tx.deposit, tx.invalid_before, - tx.invalid_hereafter AS invalid_after - FROM - tx + tx.invalid_hereafter AS invalid_after + FROM tx INNER JOIN block AS b ON tx.block_id = b.id WHERE tx.id = ANY(_tx_id_list) ), _all_collateral_inputs AS ( SELECT - collateral_tx_in.tx_in_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, + collateral_tx_in.tx_in_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, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -112,31 +125,31 @@ BEGIN ) END ) AS reference_script - FROM - collateral_tx_in + FROM collateral_tx_in INNER JOIN tx_out ON tx_out.tx_id = collateral_tx_in.tx_out_id AND tx_out.index = collateral_tx_in.tx_out_index INNER JOIN tx ON tx_out.tx_id = tx.id LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - LEFT JOIN datum ON datum.id = tx_out.inline_datum_id - LEFT JOIN script ON script.id = tx_out.reference_script_id + LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id + LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident + LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id + LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id + LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id WHERE - collateral_tx_in.tx_in_id = ANY(_tx_id_list) + (_inputs IS TRUE AND _scripts IS TRUE) + AND collateral_tx_in.tx_in_id = ANY(_tx_id_list) ), _all_reference_inputs AS ( SELECT - reference_tx_in.tx_in_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, + reference_tx_in.tx_in_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, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -167,31 +180,31 @@ BEGIN ) END ) AS reference_script - FROM - reference_tx_in + FROM reference_tx_in INNER JOIN tx_out ON tx_out.tx_id = reference_tx_in.tx_out_id AND tx_out.index = reference_tx_in.tx_out_index INNER JOIN tx ON tx_out.tx_id = tx.id LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - LEFT JOIN datum ON datum.id = tx_out.inline_datum_id - LEFT JOIN script ON script.id = tx_out.reference_script_id + LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id + LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident + LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id + LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id + LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id WHERE - reference_tx_in.tx_in_id = ANY(_tx_id_list) + (_inputs IS TRUE AND _scripts IS TRUE) + AND reference_tx_in.tx_in_id = ANY(_tx_id_list) ), _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, - tx_out.data_hash 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( @@ -225,24 +238,25 @@ BEGIN FROM tx_out INNER JOIN tx ON tx_out.tx_id = tx.id LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - LEFT JOIN datum ON datum.id = tx_out.inline_datum_id - LEFT JOIN script ON script.id = tx_out.reference_script_id - WHERE tx_out.consumed_by_tx_id = ANY(_tx_id_list) + LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id + LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident + LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id + LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id + LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id + WHERE _inputs IS TRUE + AND tx_out.consumed_by_tx_id = ANY(_tx_id_list) ), _all_collateral_outputs AS ( SELECT tx_out.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, + 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, + tx_out.data_hash AS datum_hash, (CASE WHEN tx_out.inline_datum_id IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -267,22 +281,22 @@ BEGIN collateral_tx_out AS tx_out INNER JOIN tx ON tx_out.tx_id = tx.id LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN datum ON datum.id = tx_out.inline_datum_id - LEFT JOIN script ON script.id = tx_out.reference_script_id - WHERE - tx_out.tx_id = ANY(_tx_id_list) + LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id + LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id + WHERE _scripts IS TRUE + AND tx_out.tx_id = ANY(_tx_id_list) ), _all_outputs AS ( SELECT tx_out.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, + 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, + tx_out.data_hash AS datum_hash, (CASE WHEN ma.policy IS NULL THEN NULL ELSE JSONB_BUILD_OBJECT( @@ -313,17 +327,15 @@ BEGIN ) END ) AS reference_script - FROM - tx_out + FROM tx_out INNER JOIN tx ON tx_out.tx_id = tx.id LEFT JOIN stake_address AS sa ON tx_out.stake_address_id = sa.id - LEFT JOIN ma_tx_out AS mto ON mto.tx_out_id = tx_out.id - LEFT JOIN multi_asset AS ma ON ma.id = mto.ident - LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - LEFT JOIN datum ON datum.id = tx_out.inline_datum_id - LEFT JOIN script ON script.id = tx_out.reference_script_id - WHERE - tx_out.tx_id = ANY(_tx_id_list) + LEFT JOIN ma_tx_out AS mto ON _assets IS TRUE AND mto.tx_out_id = tx_out.id + LEFT JOIN multi_asset AS ma ON _assets IS TRUE AND ma.id = mto.ident + LEFT JOIN grest.asset_info_cache AS aic ON _assets IS TRUE AND aic.asset_id = ma.id + LEFT JOIN datum ON _scripts IS TRUE AND datum.id = tx_out.inline_datum_id + LEFT JOIN script ON _scripts IS TRUE AND script.id = tx_out.reference_script_id + WHERE tx_out.tx_id = ANY(_tx_id_list) ), _all_withdrawals AS ( @@ -337,11 +349,10 @@ BEGIN 'amount', w.amount::text, 'stake_addr', sa.view ) AS data - FROM - withdrawal AS w + FROM withdrawal AS w INNER JOIN stake_address AS sa ON w.addr_id = sa.id - WHERE - w.tx_id = ANY(_tx_id_list) + WHERE _withdrawals IS TRUE + AND w.tx_id = ANY(_tx_id_list) ) AS tmp GROUP BY tx_id ), @@ -360,12 +371,11 @@ BEGIN 'decimals', COALESCE(aic.decimals, 0), 'quantity', mtm.quantity::text ) AS data - FROM - ma_tx_mint AS mtm + FROM ma_tx_mint AS mtm INNER JOIN multi_asset AS ma ON ma.id = mtm.ident LEFT JOIN grest.asset_info_cache AS aic ON aic.asset_id = ma.id - WHERE - mtm.tx_id = ANY(_tx_id_list) + WHERE _assets IS TRUE + AND mtm.tx_id = ANY(_tx_id_list) ) AS tmp GROUP BY tx_id ), @@ -377,10 +387,9 @@ BEGIN tm.key::text, tm.json ) AS list - FROM - tx_metadata AS tm - WHERE - tm.tx_id = ANY(_tx_id_list) + FROM tx_metadata AS tm + WHERE _metadata IS TRUE + AND tm.tx_id = ANY(_tx_id_list) GROUP BY tx_id ), @@ -395,14 +404,14 @@ 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 + FROM public.stake_registration AS sr INNER JOIN public.stake_address AS sa ON sa.id = sr.addr_id - WHERE - sr.tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND sr.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -415,11 +424,10 @@ BEGIN 'stake_address', sa.view ) ) AS data - FROM - public.stake_deregistration AS sd + FROM public.stake_deregistration AS sd INNER JOIN public.stake_address AS sa ON sa.id = sd.addr_id - WHERE - sd.tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND sd.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -427,19 +435,18 @@ 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, 'pool_id_hex', ENCODE(ph.hash_raw, 'hex') ) ) AS data - FROM - public.delegation AS d + FROM public.delegation AS d INNER JOIN public.stake_address AS sa ON sa.id = d.addr_id INNER JOIN public.pool_hash AS ph ON ph.id = d.pool_hash_id - WHERE - d.tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND d.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -453,11 +460,10 @@ BEGIN 'amount', t.amount::text ) ) AS data - FROM - public.treasury AS t + FROM public.treasury AS t INNER JOIN public.stake_address AS sa ON sa.id = t.addr_id - WHERE - t.tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND t.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -471,11 +477,10 @@ BEGIN 'amount', r.amount::text ) ) AS data - FROM - public.reserve AS r + FROM public.reserve AS r INNER JOIN public.stake_address AS sa ON sa.id = r.addr_id - WHERE - r.tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND r.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -489,10 +494,9 @@ BEGIN 'reserves', pt.reserves::text ) ) AS data - FROM - public.pot_transfer AS pt - WHERE - pt.tx_id = ANY(_tx_id_list) + FROM public.pot_transfer AS pt + WHERE _certs IS TRUE + AND pt.tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -502,43 +506,12 @@ 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 - )) + 'info', JSONB_STRIP_NULLS(TO_JSONB(pp.*)) - array['id','registered_tx_id','epoch_no'] ) AS data - FROM - public.param_proposal AS pp + FROM public.param_proposal AS pp INNER JOIN cost_model AS cm ON cm.id = pp.cost_model_id - WHERE - pp.registered_tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND pp.registered_tx_id = ANY(_tx_id_list) -- UNION ALL -- @@ -553,39 +526,174 @@ BEGIN 'retiring epoch', pr.retiring_epoch ) ) AS data - FROM - public.pool_retire AS pr + FROM public.pool_retire AS pr INNER JOIN public.pool_hash AS ph ON ph.id = pr.hash_id - WHERE - pr.announced_tx_id = ANY(_tx_id_list) + WHERE _certs IS TRUE + AND pr.announced_tx_id = ANY(_tx_id_list) -- UNION ALL -- SELECT - pic.tx_id, + pu.registered_tx_id AS tx_id, JSONB_BUILD_OBJECT( 'index', pu.cert_index, 'type', 'pool_update', 'info', JSONB_BUILD_OBJECT( - 'pool_id_bech32', pic.pool_id_bech32, - 'pool_id_hex', pic.pool_id_hex, - 'active_epoch_no', pic.active_epoch_no, - 'vrf_key_hash', pic.vrf_key_hash, - 'margin', pic.margin, - 'fixed_cost', pic.fixed_cost::text, - 'pledge', pic.pledge::text, - 'reward_addr', pic.reward_addr, - 'owners', pic.owners, - 'relays', pic.relays, - 'meta_url', pic.meta_url, - 'meta_hash', pic.meta_hash + 'pool_id_bech32', ph.view, + 'pool_id_hex', ENCODE(ph.hash_raw, 'hex'), + 'active_epoch_no', pu.active_epoch_no, + 'vrf_key_hash', ENCODE(pu.vrf_key_hash, 'hex'), + 'margin', pu.margin, + 'fixed_cost', pu.fixed_cost::text, + 'pledge', pu.pledge::text, + 'reward_addr', sa.view, + 'owners', JSONB_AGG(po.view), + 'relays', JSONB_AGG(JSONB_BUILD_OBJECT ( + 'ipv4', pr.ipv4, + 'ipv6', pr.ipv6, + 'dns', pr.dns_name, + 'srv', pr.dns_srv_name, + 'port', pr.port + )), + 'meta_url', pmr.url, + 'meta_hash', ENCODE(pmr.hash, 'hex') + ) + ) AS data + FROM public.pool_update AS pu + LEFT JOIN public.pool_hash AS ph ON pu.hash_id = ph.id + LEFT JOIN public.stake_address AS sa ON pu.reward_addr_id = sa.id + LEFT JOIN ( + SELECT po1.pool_update_id, sa1.view + FROM public.pool_owner AS po1 + LEFT JOIN public.stake_address AS sa1 ON sa1.id = po1.addr_id + ) AS po ON pu.id = po.pool_update_id + LEFT JOIN public.pool_relay AS pr ON pu.id = pr.update_id + LEFT JOIN public.pool_metadata_ref AS pmr ON pu.meta_id = pmr.id + WHERE _certs IS TRUE + AND pu.registered_tx_id = ANY(_tx_id_list) + GROUP BY pu.registered_tx_id, pu.cert_index, ph.view, ph.hash_raw, pu.active_epoch_no, pu.vrf_key_hash, pu.margin, pu.fixed_cost, pu.pledge, sa.view, pmr.url, pmr.hash + -- + 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 - grest.pool_info_cache AS pic - INNER JOIN public.pool_update AS pu ON pu.registered_tx_id = pic.tx_id - WHERE - pic.tx_id = ANY(_tx_id_list) + 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 ), @@ -601,14 +709,11 @@ BEGIN 'script_hash', ENCODE(script.hash, 'hex'), 'script_json', script.json ) AS data - FROM - script - WHERE - script.tx_id = ANY(_tx_id_list) - AND - script.type = 'timelock' + FROM script + WHERE _scripts IS TRUE + AND script.tx_id = ANY(_tx_id_list) + AND script.type = 'timelock' ) AS tmp - GROUP BY tx_id ), @@ -629,14 +734,17 @@ BEGIN rd.hash AS rd_hash, rd.value AS rd_value, script.hash AS script_hash, - script.bytes AS script_bytes, + CASE WHEN _bytecode IS TRUE THEN + script.bytes + END AS script_bytes, script.serialised_size AS script_serialised_size, tx.valid_contract FROM redeemer INNER JOIN tx ON redeemer.tx_id = tx.id INNER JOIN redeemer_data AS rd ON rd.id = redeemer.redeemer_data_id INNER JOIN script ON redeemer.script_hash = script.hash - WHERE redeemer.tx_id = ANY(_tx_id_list) + WHERE _scripts IS TRUE + AND redeemer.tx_id = ANY(_tx_id_list) ), _all_inputs_sorted AS ( @@ -668,7 +776,8 @@ BEGIN FROM redeemer INNER JOIN _all_inputs_sorted AS ais ON ais.tx_id = redeemer.tx_id AND ais.sorted_index = redeemer.index INNER JOIN datum AS ind ON ind.hash = ais.datum_hash - WHERE redeemer.tx_id = ANY(_tx_id_list) + WHERE _scripts IS TRUE + AND redeemer.tx_id = ANY(_tx_id_list) AND redeemer.purpose = 'spend' ) @@ -693,7 +802,11 @@ BEGIN ) END, 'script_hash', ENCODE(ar.script_hash, 'hex'), - 'bytecode', ENCODE(ar.script_bytes, 'hex'), + 'bytecode', + CASE + WHEN _bytecode IS TRUE THEN + ENCODE(ar.script_bytes, 'hex') + END, 'size', ar.script_serialised_size, 'valid_contract', ar.valid_contract, 'input', JSONB_BUILD_OBJECT( @@ -719,8 +832,80 @@ BEGIN ) ) AS data FROM all_redeemers AS ar + 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 ) @@ -736,6 +921,7 @@ BEGIN atx.tx_size, atx.total_output::text, atx.fee::text, + atx.treasury_donation::text, atx.deposit::text, atx.invalid_before::text, atx.invalid_after::text, @@ -752,13 +938,13 @@ BEGIN 'tx_hash', aci.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()) ) AS tx_collateral_inputs FROM _all_collateral_inputs AS aci - WHERE aci.tx_id = atx.id + WHERE (_inputs IS TRUE AND _scripts IS TRUE) AND aci.tx_id = atx.id GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, aci.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script ) AS tmp ), JSONB_BUILD_ARRAY()), @@ -773,13 +959,13 @@ BEGIN 'tx_hash', aco.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', asset_descr ) AS tx_collateral_outputs FROM _all_collateral_outputs AS aco - WHERE aco.tx_id = atx.id + WHERE _scripts IS TRUE AND aco.tx_id = atx.id GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, aco.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script, asset_descr LIMIT 1 -- there can only be one collateral output ), @@ -796,13 +982,13 @@ BEGIN 'tx_hash', ari.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()) ) AS tx_reference_inputs FROM _all_reference_inputs AS ari - WHERE ari.tx_id = atx.id + WHERE (_inputs IS TRUE AND _scripts IS TRUE) AND ari.tx_id = atx.id GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ari.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script ) AS tmp ), JSONB_BUILD_ARRAY()), @@ -825,7 +1011,7 @@ BEGIN 'asset_list', COALESCE(JSONB_AGG(asset_list) FILTER (WHERE asset_list IS NOT NULL), JSONB_BUILD_ARRAY()) ) AS tx_inputs FROM _all_inputs AS ai - WHERE ai.tx_id = atx.id + WHERE _inputs IS TRUE AND ai.tx_id = atx.id GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ai.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script ) AS tmp ), JSONB_BUILD_ARRAY()), @@ -842,7 +1028,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()) @@ -852,12 +1038,14 @@ BEGIN GROUP BY payment_addr_bech32, payment_addr_cred, stake_addr, ao.tx_hash, tx_index, value, datum_hash, inline_datum, reference_script ) AS tmp ), JSONB_BUILD_ARRAY()), - COALESCE((SELECT aw.list FROM _all_withdrawals AS aw WHERE aw.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT ami.list FROM _all_mints AS ami WHERE ami.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT ame.list FROM _all_metadata AS ame WHERE ame.tx_id = atx.id), NULL), - COALESCE((SELECT ac.list FROM _all_certs AS ac WHERE ac.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT ans.list FROM _all_native_scripts AS ans WHERE ans.tx_id = atx.id), JSONB_BUILD_ARRAY()), - COALESCE((SELECT apc.list FROM _all_plutus_contracts AS apc WHERE apc.tx_id = atx.id), JSONB_BUILD_ARRAY()) + COALESCE((SELECT aw.list FROM _all_withdrawals AS aw WHERE _withdrawals IS TRUE AND aw.tx_id = atx.id), JSONB_BUILD_ARRAY()), + COALESCE((SELECT ami.list FROM _all_mints AS ami WHERE _assets IS TRUE AND ami.tx_id = atx.id), JSONB_BUILD_ARRAY()), + 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 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 236fd132..971c02dc 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.1.3 + version: v1.2.0a 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. @@ -486,12 +486,34 @@ paths: summary: UTxO Info description: Get UTxO set for requested UTxO references operationId: utxo_info - /tx_info: #RPC + /tx_cbor: #RPC post: tags: - Transactions requestBody: $ref: "#/components/requestBodies/tx_ids" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/tx_cbor" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Raw Transaction (CBOR) + description: Get raw transaction(s) in CBOR format + operationId: tx_cbor + /tx_info: #RPC + post: + tags: + - Transactions + requestBody: + $ref: "#/components/requestBodies/tx_info" responses: "200": description: Success!! @@ -1278,6 +1300,268 @@ paths: summary: Asset Transactions 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: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps List + description: List of all active delegated representatives (DReps) + operationId: drep_list + /drep_info: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Info + description: Get detailed information about requested delegated representatives (DReps) + operationId: drep_info + /drep_metadata: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_metadata" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Metadata + description: List metadata for requested delegated representatives (DReps) + operationId: drep_metadata + /drep_updates: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id_optional" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_updates" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Updates + description: List of updates for requested (or all) delegated representatives (DReps) + operationId: drep_updates + /drep_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Votes + description: List of all votes casted by requested delegated representative (DRep) + operationId: drep_votes + /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: + - Governance + parameters: + - $ref: "#/components/parameters/_committee_hash" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Votes + description: List of all votes casted by given committee member or collective + operationId: committee_votes + /proposal_list: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposals List + description: List of all governance proposals + operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + + /proposal_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_tx_hash" + - $ref: "#/components/parameters/_proposal_index" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Votes + description: List of all votes cast on specified governance action + operationId: proposal_votes + /pool_list: #RPC get: tags: @@ -1523,6 +1807,28 @@ paths: summary: Pool Relays description: A list of registered relays for all pools operationId: pool_relays + /pool_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_pool_bech32" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/pool_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Pool Votes + description: List of all votes casted by a pool + operationId: pool_votes /pool_metadata: #RPC post: tags: @@ -1675,6 +1981,7 @@ paths: summary: Datum Information description: List of datum information for given datum hashes operationId: datum_info + /ogmios: #ogmios-api post: tags: @@ -1732,6 +2039,16 @@ components: in: query required: true allowEmptyValue: false + _tx_hash: + deprecated: false + name: _tx_hash + description: Transaction Hash in hexadecimal format (hex) + example: "bf04578d452dd3acb7c70fbac32dc972cb69f932f804171cfb4268f5af0228e7" + schema: + type: string + in: query + required: true + allowEmptyValue: false _asset_policy: deprecated: false name: _asset_policy @@ -1772,6 +2089,46 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r" + in: query + required: true + allowEmptyValue: false + _drep_id: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r" + in: query + required: true + allowEmptyValue: false + _drep_id_optional: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r" + in: query + required: false + allowEmptyValue: true + _committee_hash: + deprecated: false + name: _committee_hash + description: Committee hash in hexadecimal format (hex) + schema: + type: string + example: "65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472" + in: query + required: false + allowEmptyValue: true _extended: deprecated: false name: _extended @@ -1842,6 +2199,26 @@ components: in: query required: true allowEmptyValue: false + _proposal_tx_hash: + deprecated: false + name: _proposal_tx_hash + description: Transaction Hash of government proposal in hexadecimal format (hex) + example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + 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: @@ -1899,6 +2276,10 @@ components: format: boolean type: boolean description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + format: boolean + type: boolean + description: Controls whether to include bytecode for associated reference/plutus scripts example: _block_hashes: - af2f6f7dd4e4ea6765103a1e38e023da3edd2b3c7fea2aa367222564dbe01cfd @@ -1910,6 +2291,7 @@ components: _withdrawals: false _certs: false _scripts: false + _bytecode: false description: Array of block hashes payment_addresses: content: @@ -2141,6 +2523,64 @@ components: - bf04578d452dd3acb7c70fbac32dc972cb69f932f804171cfb4268f5af0228e7 - 63b716064012f858450731cb5f960c100c6cb639ec1ec999b898c604451f116a description: Array of Cardano Transaction hashes + tx_info: + content: + application/json: + schema: + required: + - _tx_hashes + type: object + properties: + _tx_hashes: + format: text + type: array + items: + type: string + description: Array of Cardano Transaction hashes + _inputs: + format: boolean + type: boolean + description: Controls whether to include transaction inputs in the result + _metadata: + format: boolean + type: boolean + description: Controls whether to include transaction metadata in the result + _assets: + format: boolean + type: boolean + description: Controls whether to include assets involved within transaction the result + _withdrawals: + format: boolean + type: boolean + description: Controls whether to include any stake account reward withdrawals in the result + _certs: + format: boolean + type: boolean + description: Controls whether to include transaction certificates in the result + _scripts: + format: boolean + type: boolean + description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + 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 + - 63b716064012f858450731cb5f960c100c6cb639ec1ec999b898c604451f116a + _inputs: false + _metadata: false + _assets: false + _withdrawals: false + _certs: false + _scripts: false + _bytecode: false + description: Array of Cardano Transaction hashes txbin: content: application/cbor: @@ -2268,6 +2708,24 @@ components: - ['313534a537bc476c86ff7c57ec511bd7f24a9d15654091b24e9c606e','41484c636f696e'] _extended: true description: Array of array of policyID and asset names (hex) alongwith extended flag to return additional columns + drep_id_bulk: + content: + application/json: + schema: + required: + - _drep_ids + type: object + properties: + _drep_ids: + format: text + type: array + descriptions: Array of DRep IDs in bech32 format + items: + type: string + example: + _drep_ids: + - drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r + - drep13p45vxysc2s6vp6ez2ng7lynlsheh64zxexpcennn68cuc05yps utxo_refs_with_extended: content: application/json: @@ -2553,6 +3011,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/fixed_cost" pledge: $ref: "#/components/schemas/pool_info/items/properties/pledge" + deposit: + $ref: "#/components/schemas/pool_info/items/properties/deposit" reward_addr: $ref: "#/components/schemas/pool_info/items/properties/reward_addr" owners: @@ -2588,7 +3048,9 @@ components: description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) example: "31235800000" active_stake_pct: - type: number + type: + - string + - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 saturation_pct: @@ -2622,7 +3084,9 @@ components: description: Total amount of rewards earned by delegators in that epoch (in lovelaces) example: "123456789123" member_rewards: - type: string + type: + - string + - 'null' description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) example: "123456780123" epoch_ros: @@ -2669,6 +3133,12 @@ components: - 'null' description: Pool pledge in lovelace example: "64000000000000" + deposit: + type: + - string + - 'null' + description: Pool's registration deposit in lovelace + example: "500000000" reward_addr: type: - string @@ -2969,8 +3439,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32" relays: $ref: "#/components/schemas/pool_info/items/properties/relays" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" pool_metadata: description: Array of pool metadata type: array @@ -2985,8 +3453,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" meta_json: $ref: "#/components/schemas/pool_info/items/properties/meta_json" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" epoch_info: description: Array of detailed summary for each epoch type: array @@ -3188,64 +3654,196 @@ components: type: - number - 'null' - format: double - description: The per word cost of script memory usage - example: 0.0577 - price_step: + format: double + description: The per word cost of script memory usage + example: 0.0577 + price_step: + type: + - number + - 'null' + format: double + description: The cost of script execution step usage + example: 7.21e-05 + max_tx_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single transaction + example: 10000000 + max_tx_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single transaction + example: 10000000000 + max_block_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single block + example: 50000000 + max_block_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single block + example: 40000000000 + max_val_size: + type: + - number + - 'null' + description: The maximum Val size + example: 5000 + collateral_percent: + type: + - number + - 'null' + description: The percentage of the tx fee which must be provided as collateral when including non-native scripts + example: 150 + max_collateral_inputs: + type: + - number + - 'null' + description: The maximum number of collateral inputs allowed in a transaction + example: 3 + coins_per_utxo_size: + type: + - string + - 'null' + description: The cost per UTxO size + example: 34482 + pvt_motion_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for motion of no-confidence. + example: 0.6 + pvt_committee_normal: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (normal state). + example: 0.65 + pvt_committee_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (state of no-confidence). + example: 0.65 + pvt_hard_fork_initiation: + type: + - number + - 'null' + description: Pool Voting threshold for hard-fork initiation. + example: 0.51 + dvt_motion_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for motion of no-confidence. + example: 0.67 + dvt_committee_normal: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (normal state). + example: 0.67 + dvt_committee_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (state of no-confidence). + example: 0.65 + dvt_update_to_constitution: + type: + - number + - 'null' + description: DRep Vote threshold for update to the Constitution. + example: 0.75 + dvt_hard_fork_initiation: + type: + - number + - 'null' + description: DRep Vote threshold for hard-fork initiation. + example: 0.6 + dvt_p_p_network_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, network group. + example: 0.67 + dvt_p_p_economic_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, economic group. + example: 0.67 + dvt_p_p_technical_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, technical group. + example: 0.67 + dvt_p_p_gov_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, governance group. + example: 0.75 + dvt_treasury_withdrawal: type: - number - 'null' - format: double - description: The cost of script execution step usage - example: 7.21e-05 - max_tx_ex_mem: + description: DRep Vote threshold for treasury withdrawal. + example: 0.67 + committee_min_size: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single transaction - example: 10000000 - max_tx_ex_steps: + description: Minimal constitutional committee size. + example: 5 + committee_max_term_length: type: - number - 'null' - description: The maximum number of execution steps allowed to be used in a single transaction - example: 10000000000 - max_block_ex_mem: + description: Constitutional committee term limits. + example: 146 + gov_action_lifetime: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single block - example: 50000000 - max_block_ex_steps: + description: Governance action expiration. + example: 14 + gov_action_deposit: type: - - number + - string - 'null' - description: The maximum number of execution steps allowed to be used in a single block - example: 40000000000 - max_val_size: + description: Governance action deposit. + example: 100000000000 + drep_deposit: type: - - number + - string - 'null' - description: The maximum Val size - example: 5000 - collateral_percent: + description: DRep deposit amount. + example: 500000000 + drep_activity: type: - number - 'null' - description: The percentage of the tx fee which must be provided as collateral when including non-native scripts - example: 150 - max_collateral_inputs: + description: DRep activity period. + example: 20 + pvtpp_security_group: type: - number - 'null' - description: The maximum number of collateral inputs allowed in a transaction - example: 3 - coins_per_utxo_size: + description: Pool Voting threshold for protocol parameter changes, security group. + example: 0.6 + min_fee_ref_script_cost_per_byte: type: - - string + - number - 'null' - description: The cost per UTxO size - example: 34482 + description: Minimum Fee for Reference Script cost pre byte + example: 15 epoch_block_protocols: description: Array of distinct block protocol versions counts in epoch type: array @@ -3429,6 +4027,8 @@ components: $ref: "#/components/schemas/tx_info/items/properties/total_output" fee: $ref: "#/components/schemas/tx_info/items/properties/fee" + treasury_donation: + $ref: "#/components/schemas/tx_info/items/properties/treasury_donation" deposit: $ref: "#/components/schemas/tx_info/items/properties/deposit" invalid_before: @@ -3549,10 +4149,11 @@ components: description: Cardano staking address (reward account) in hex format example: e1c865f10d66a2e375242b5ef9f05abc8840d413421982f62c35ce4fbf script_hash: - type: string + type: + - 'null' + - string description: Script hash in case the stake address is locked by a script example: bf357f5de69e4aad71954bebd64357a4813ea5233df12fce4a9de582 - account_info: description: Array of stake account information type: array @@ -3566,6 +4167,12 @@ components: description: Stake address status enum: ["registered", "not registered"] example: registered + delegated_drep: + type: + - 'null' + - string + description: Account's current delegation status to DRep ID in Bech32 format + example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 delegated_pool: anyOf: - type: 'null' @@ -3588,8 +4195,12 @@ components: example: 12105104750 rewards_available: type: string - description: Total rewards available for withdawal + description: Total rewards available for withdrawal example: 44352623297 + deposit: + type: string + description: Total deposit available for withdrawal + example: 2000000 reserves: type: string description: Total reserves MIR value of the account @@ -3810,6 +4421,10 @@ components: type: string description: Total Transaction fee (in lovelaces) example: 172761 + treasury_donation: + type: string + description: Total Donation to on-chain treasury (in lovelaces) + example: 0 deposit: type: string description: Total Deposits included in transaction (for example, if it is registering a pool/key) @@ -3832,7 +4447,9 @@ components: - $ref: "#/components/schemas/tx_info/items/properties/outputs" collateral_output: description: A collateral output for change if the smart contract fails to execute and collateral inputs are spent. (CIP-40) - type: array + type: + - array + - 'null' items: properties: payment_addr: @@ -4096,6 +4713,61 @@ 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: + properties: + tx_hash: + $ref: "#/components/schemas/tx_info/items/properties/tx_hash" + cbor: + type: string + description: CBOR encoded raw transaction. tx_utxos: description: Array of inputs and outputs for given transaction(s) type: array @@ -4320,19 +4992,29 @@ components: description: Asset metadata registered on the Cardano Token Registry properties: name: - type: string + type: + - 'null' + - string example: Rackmob description: - type: string + type: + - 'null' + - string example: Metaverse Blockchain Cryptocurrency. ticker: - type: string + type: + - 'null' + - string example: MOB url: - type: string + type: + - 'null' + - string example: https://www.rackmob.com/ logo: - type: string + type: + - 'null' + - string description: A PNG image file as a byte string example: iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc decimals: @@ -4454,13 +5136,391 @@ components: $ref: "#/components/schemas/asset_info/items/properties/total_supply" decimals: $ref: "#/components/schemas/asset_info/items/properties/token_registry_metadata/properties/decimals" + drep_info: + description: Get detailed information about requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + type: string + description: DRep ID in bech32 format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + hex: + type: string + description: DRep ID in hex format + example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + has_script: + type: boolean + description: Flag which shows if this DRep credentials are a script hash + example: false + registered: + type: boolean + description: Flag to show if the DRep is currently registered + example: false + deposit: + type: + - string + - 'null' + description: DRep's registration deposit in lovelace + example: 500000000 + active: + type: boolean + description: Flag to show if the DRep is (i.e. not expired) + example: true + expires_epoch_no: + type: + - number + - 'null' + description: After which epoch DRep is considered inactive. + example: 410 + amount: + type: string + description: The total amount of voting power this DRep is delegated. + example: 599496769641 + url: + type: + - 'null' + - string + description: A URL to a JSON payload of metadata + example: "https://hornan7.github.io/Vote_Context.jsonld" + hash: + type: + - 'null' + - 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 + items: + properties: + drep_id: + $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" + registered: + $ref: "#/components/schemas/drep_info/items/properties/registered" + drep_delegators: + description: List of all delegators by requested delegated representative (DRep) + type: array + items: + properties: + stake_address: + $ref: "#/components/schemas/account_list/items/properties/stake_address" + stake_address_hex: + $ref: "#/components/schemas/account_list/items/properties/stake_address_hex" + script_hash: + $ref: "#/components/schemas/account_list/items/properties/script_hash" + epoch_no: + description: Epoch when vote delegation was made + allOf: + - $ref: "#/components/schemas/epoch_info/items/properties/epoch_no" + amount: + $ref: "#/components/schemas/account_info/items/properties/total_balance" + drep_metadata: + description: List metadata for requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + url: + $ref: "#/components/schemas/drep_info/items/properties/url" + hash: + $ref: "#/components/schemas/drep_info/items/properties/hash" + json: + type: + - 'null' + - object + description: The payload as JSON + example: + {"body": {"title": "...", "...": "...", "references": [{"uri": "...", "@type": "Other", "label": "Hardfork to PV10"}]}, "authors": [{"name": "...", "witness": {"publicKey": "...", "signature": "...", "witnessAlgorithm": "ed25519"}}], "@context": {"body": {"@id": "CIP108:body", "@context": {"title": "CIP108:title", "abstract": "CIP108:abstract", "rationale": "CIP108:rationale", "motivation": "CIP108:motivation", "references": {"@id": "CIP108:references", "@context": {"uri": "CIP100:reference-uri", "Other": "CIP100:OtherReference", "label": "CIP100:reference-label", "referenceHash": {"@id": "CIP108:referenceHash", "@context": {"hashDigest": "CIP108:hashDigest", "hashAlgorithm": "CIP100:hashAlgorithm"}}, "GovernanceMetadata": "CIP100:GovernanceMetadataReference"}, "@container": "@set"}}}, "CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#", "CIP108": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/README.md#", "authors": {"@id": "CIP100:authors", "@context": {"name": "http://xmlns.com/foaf/0.1/name", "witness": {"@id": "CIP100:witness", "@context": {"publicKey": "CIP100:publicKey", "signature": "CIP100:signature", "witnessAlgorithm": "CIP100:witnessAlgorithm"}}}, "@container": "@set"}, "@language": "en-us", "hashAlgorithm": "CIP100:hashAlgorithm"}, "hashAlgorithm": "blake2b-256"} + bytes: + type: + - 'null' + - string + description: The raw bytes of the payload + example: 7b0a20202240636f6e74657874223a207b0a2020202022406c616e6775616765223a2022656e2d7573222c0a2020202022434950313030223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130302f524541444d452e6d6423222c0a2020202022434950313038223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130382f524541444d452e6d6423222c0a202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d222c0a2020202022626f6479223a207b0a20202020202022406964223a20224349503130383a626f6479222c0a2020202020202240636f6e74657874223a207b0a2020202020202020227265666572656e636573223a207b0a2020202020202020202022406964223a20224349503130383a7265666572656e636573222c0a202020202020202020202240636f6e7461696e6572223a202240736574222c0a202020202020202020202240636f6e74657874223a207b0a20202020202020202020202022476f7665726e616e63654d65746164617461223a20224349503130303a476f7665726e616e63654d657461646174615265666572656e6365222c0a202020202020202020202020224f74686572223a20224349503130303a4f746865725265666572656e6365222c0a202020202020202020202020226c6162656c223a20224349503130303a7265666572656e63652d6c6162656c222c0a20202020202020202020202022757269223a20224349503130303a7265666572656e63652d757269222c0a202020202020202020202020227265666572656e636548617368223a207b0a202020202020202020202020202022406964223a20224349503130383a7265666572656e636548617368222c0a20202020202020202020202020202240636f6e74657874223a207b0a202020202020202020202020202020202268617368446967657374223a20224349503130383a68617368446967657374222c0a202020202020202020202020202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d220a20202020202020202020202020207d0a2020202020202020202020207d0a202020202020202020207d0a20202020202020207d2c0a2020202020202020227469746c65223a20224349503130383a7469746c65222c0a2020202020202020226162737472616374223a20224349503130383a6162737472616374222c0a2020202020202020226d6f7469766174696f6e223a20224349503130383a6d6f7469766174696f6e222c0a202020202020202022726174696f6e616c65223a20224349503130383a726174696f6e616c65220a2020202020207d0a202020207d2c0a2020202022617574686f7273223a207b0a20202020202022406964223a20224349503130303a617574686f7273222c0a2020202020202240636f6e7461696e6572223a202240736574222c0a2020202020202240636f6e74657874223a207b0a2020202020202020226e616d65223a2022687474703a2f2f786d6c6e732e636f6d2f666f61662f302e312f6e616d65222c0a2020202020202020227769746e657373223a207b0a2020202020202020202022406964223a20224349503130303a7769746e657373222c0a202020202020202020202240636f6e74657874223a207b0a202020202020202020202020227769746e657373416c676f726974686d223a20224349503130303a7769746e657373416c676f726974686d222c0a202020202020202020202020227075626c69634b6579223a20224349503130303a7075626c69634b6579222c0a202020202020202020202020227369676e6174757265223a20224349503130303a7369676e6174757265220a202020202020202020207d0a20202020202020207d0a2020202020207d0a202020207d0a20207d2c0a20202268617368416c676f726974686d223a2022626c616b6532622d323536222c0a202022626f6479223a207b0a20202020227469746c65223a202248617264666f726b20746f2050726f746f636f6c2076657273696f6e203130222c0a20202020226162737472616374223a20224c6574277320686176652073616e63686f4e657420696e2066756c6c20676f7665726e616e636520617320736f6f6e20617320706f737369626c65222c0a20202020226d6f7469766174696f6e223a2022505639206973206e6f742061732066756e2061732050563130222c0a2020202022726174696f6e616c65223a20224c65742773206b6565702074657374696e67207374756666222c0a20202020227265666572656e636573223a205b0a2020202020207b0a2020202020202020224074797065223a20224f74686572222c0a2020202020202020226c6162656c223a202248617264666f726b20746f2050563130222c0a202020202020202022757269223a2022220a2020202020207d0a202020205d0a20207d2c0a202022617574686f7273223a205b0a202020207b0a202020202020226e616d65223a20224361726c6f73222c0a202020202020227769746e657373223a207b0a2020202020202020227769746e657373416c676f726974686d223a202265643235353139222c0a2020202020202020227075626c69634b6579223a202237656130396133346165626231336339383431633731333937623163616266656335646466393530343035323933646565343936636163326634333734383061222c0a2020202020202020227369676e6174757265223a20226134373639383562346363306434353766323437373937363131373939613666366138306663386362376563396463623561383232333838386430363138653330646531363566336438363963346130643931303764386135623631326164376335653432343431393037663562393137393666306437313837643634613031220a2020202020207d0a202020207d0a20205d0a7d + warning: + type: + - 'null' + - string + description: A warning that occured while validating the metadata + language: + type: + - 'null' + - string + description: The language described in the context of the metadata as per CIP-100 + example: en-us + comment: + type: + - 'null' + - string + description: Comment attached to the metadata + is_valid: + type: boolean + description: Indicate whether data is invalid + example: true + drep_updates: + description: List of updates for requested (or all) delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + update_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + cert_index: + type: number + description: The index of this certificate within the the transaction. + example: 1 + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + action: + type: string + description: Effective action for this DRep Update certificate + enum: ["updated","registered","deregistered"] + example: registered + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + drep_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + 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" + vote_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + vote: + type: string + enum: ["Yes","No","Abstain"] + description: Actual Vote casted + example: "Yes" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + pool_votes: + description: List of all votes casted by requested pool + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + committee_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + proposal_list: + description: List of all governance action proposals + type: array + items: + properties: + 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"] + description: Proposal Action Type + example: ParameterChange + proposal_description: + type: string + description: Description for Proposal Action + example: '{"tag": "InfoAction"}' + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + type: string + description: The StakeAddress index of the reward address to receive the deposit when it is repaid. + example: stake1uy6yzwsxxc28lfms0qmpxvyz9a7y770rtcqx9y96m42cttqwvp4m5 + proposed_epoch: + type: number + description: Shows the epoch at which this governance action was proposed. + example: 660 + ratified_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been ratified at the specfied epoch. + example: 670 + enacted_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been enacted at the specfied epoch. + example: 675 + dropped_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been dropped (expired/enacted) at the specfied epoch. + example: 680 + expired_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been expired at the specfied epoch. + example: 680 + expiration: + type: + - number + - 'null' + description: Shows the epoch at which this governance action is expected to expire. + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + meta_comment: + $ref: "#/components/schemas/drep_metadata/items/properties/comment" + meta_language: + $ref: "#/components/schemas/drep_metadata/items/properties/language" + meta_is_valid: + $ref: "#/components/schemas/drep_metadata/items/properties/is_valid" + withdrawal: + type: + - object + - 'null' + description: If not null, the amount withdrawn from treasury into stake address by this this proposal + properties: + stake_address: + $ref: "#/components/schemas/account_history/items/properties/stake_address" + amount: + type: string + example: "31235800000" + param_proposal: + description: If not null, the proposed new parameter set + type: + - object + - 'null' + example: {"key_deposit": 1000000} + voter_proposal_list: + description: List of all governance action proposals where specified credential(DRep, SPO or Committee member) has cast a vote + type: array + items: + $ref: "#/components/schemas/proposal_list/items" + proposal_votes: + type: array + description: List of all votes cast on specified governance action + items: + properties: + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + voter_role: + type: string + description: The role of the voter + enum: ["ConstitutionalCommittee", "DRep", "SPO"] + example: DRep + voter: + type: string + description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + voter_hex: + type: string + description: Voter's DRep ID , pool ID or committee hash in hex format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + committee_info: + description: Current governance committee + type: object + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + quorum_numerator: + type: number + example: 67 + quorum_denominator: + type: number + example: 100 + members: + description: Array of all members part of active governance committee + type: array + items: + type: object + properties: + status: + type: string + description: Member authentication status + enum: [ "authorized", "not_authorized", "resigned" ] + example: authorized + cc_cold_hex: + type: string + description: Committee member cold key hash in hex format + example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf + cc_cold_has_script: + type: boolean + description: Flag which shows if this committee member cold credential is a script hash + example: false + cc_hot_hex: + type: + - string + - 'null' + description: Committee member key hash from last valid hot key authorization certificate in hex format + example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472 + cc_hot_has_script: + type: + - boolean + - 'null' + description: Flag which shows if this committee member hot credential is a script hash + example: false + expiration_epoch: + type: number + description: Epoch number in which the committee member vote rights expire + example: 324 script_info: type: array items: description: Array of information for scripts properties: script_hash: - type: string + type: + - 'null' + - string description: Hash of a script example: bfa7ffa9b2e164873db6ac6d0528c82e212963bc62e10fd1d81da4af creation_tx_hash: @@ -4479,7 +5539,9 @@ components: description: Data in JSON format example: 'null' bytes: - type: string + type: + - string + - 'null' description: Script bytes (cborSeq) example: 5907f4010000332323232323232323233223232323232332232323232322223232533532533533355300712001323212330012233350052200200200100235001220011233001225335002101710010142325335333573466e3cd400488008d4020880080580544ccd5cd19b873500122001350082200101601510153500122002353500122002222222222200a101413357389201115554784f206e6f7420636f6e73756d6564000133333573466e1cd55cea8012400046644246600200600464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc888888888848cccccccccc00402c02802402001c01801401000c008cd40508c8c8cccd5cd19b8735573aa0049000119910919800801801180f9aba150023019357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854028cd4050054d5d0a804999aa80bbae501635742a010666aa02eeb94058d5d0a80399a80a0109aba15006335014335502402275a6ae854014c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502575a6ae854008c098d5d09aba2500223263533573805e05c05a05826aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a04aeb4d5d0a80118131aba135744a004464c6a66ae700bc0b80b40b04d55cf280089baa001357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854010cd4051d71aba15003335014335502475c40026ae854008c070d5d09aba2500223263533573804e04c04a04826ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226aae7940044dd50009aba150023232323333573466e1d400520062321222230040053019357426aae79400c8cccd5cd19b875002480108c848888c008014c06cd5d09aab9e500423333573466e1d400d20022321222230010053015357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6a66ae7008808408007c0780740704d55cea80089baa001357426ae8940088c98d4cd5ce00d80d00c80c080c89931a99ab9c4910350543500019018135573ca00226ea8004c8004d5405888448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80b111999aab9f00125009233500830043574200460066ae880080548c8c8c8cccd5cd19b8735573aa00690001199911091998008020018011919191999ab9a3370e6aae7540092000233221233001003002301735742a00466a01c02c6ae84d5d1280111931a99ab9c01b01a019018135573ca00226ea8004d5d0a801999aa803bae500635742a00466a014eb8d5d09aba2500223263533573802e02c02a02826ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80a11191999aab9f0022500823350073355017300635573aa004600a6aae794008c010d5d100180a09aba100111220021221223300100400312232323333573466e1d4005200023212230020033005357426aae79400c8cccd5cd19b8750024800884880048c98d4cd5ce00980900880800789aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98d4cd5ce00800780700689aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a66ae7003803403002c4dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6a66ae7004404003c0380340304d55cea80089baa0012323333573466e1d40052002200523333573466e1d40092000200523263533573801a01801601401226aae74dd5000891001091000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6a66ae7004c04804404003c03803403002c0284d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263533573801801601401201026aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931a99ab9c009008007006005135573aa00226ea800444888c8c8cccd5cd19b8735573aa0049000119aa80518031aba150023005357426ae8940088c98d4cd5ce00480400380309aab9e5001137540029309000a490350543100112212330010030021123230010012233003300200200133512233002489209366f09fe40eaaeb17d3cb6b0b61e087d664174c39a48a986f86b2b0ba6e2a7b00480008848cc00400c0088005 size: @@ -4623,6 +5685,9 @@ tags: - name: Asset description: Query Asset related informations x-tag-expanded: false + - name: Governance + description: Query information about governance for network + x-tag-expanded: false - name: Pool description: Query information about specific pools x-tag-expanded: false @@ -4659,5 +5724,5 @@ tags: - [evaluateTransaction](https://ogmios.dev/mini-protocols/local-tx-submission/#evaluating-transactions) x-tag-expanded: true security: - - [] + - {} - bearerAuth: [] diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index c79bebc3..52dc9b8c 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.1.3 + version: v1.2.0a 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. @@ -486,12 +486,34 @@ paths: summary: UTxO Info description: Get UTxO set for requested UTxO references operationId: utxo_info - /tx_info: #RPC + /tx_cbor: #RPC post: tags: - Transactions requestBody: $ref: "#/components/requestBodies/tx_ids" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/tx_cbor" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Raw Transaction (CBOR) + description: Get raw transaction(s) in CBOR format + operationId: tx_cbor + /tx_info: #RPC + post: + tags: + - Transactions + requestBody: + $ref: "#/components/requestBodies/tx_info" responses: "200": description: Success!! @@ -1278,6 +1300,268 @@ paths: summary: Asset Transactions 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: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps List + description: List of all active delegated representatives (DReps) + operationId: drep_list + /drep_info: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Info + description: Get detailed information about requested delegated representatives (DReps) + operationId: drep_info + /drep_metadata: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_metadata" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Metadata + description: List metadata for requested delegated representatives (DReps) + operationId: drep_metadata + /drep_updates: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id_optional" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_updates" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Updates + description: List of updates for requested (or all) delegated representatives (DReps) + operationId: drep_updates + /drep_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Votes + description: List of all votes casted by requested delegated representative (DRep) + operationId: drep_votes + /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: + - Governance + parameters: + - $ref: "#/components/parameters/_committee_hash" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Votes + description: List of all votes casted by given committee member or collective + operationId: committee_votes + /proposal_list: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposals List + description: List of all governance proposals + operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + + /proposal_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_tx_hash" + - $ref: "#/components/parameters/_proposal_index" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Votes + description: List of all votes cast on specified governance action + operationId: proposal_votes + /pool_list: #RPC get: tags: @@ -1523,6 +1807,28 @@ paths: summary: Pool Relays description: A list of registered relays for all pools operationId: pool_relays + /pool_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_pool_bech32" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/pool_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Pool Votes + description: List of all votes casted by a pool + operationId: pool_votes /pool_metadata: #RPC post: tags: @@ -1675,6 +1981,7 @@ paths: summary: Datum Information description: List of datum information for given datum hashes operationId: datum_info + /ogmios: #ogmios-api post: tags: @@ -1732,6 +2039,16 @@ components: in: query required: true allowEmptyValue: false + _tx_hash: + deprecated: false + name: _tx_hash + description: Transaction Hash in hexadecimal format (hex) + example: "f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e" + schema: + type: string + in: query + required: true + allowEmptyValue: false _asset_policy: deprecated: false name: _asset_policy @@ -1772,6 +2089,46 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3" + in: query + required: true + allowEmptyValue: false + _drep_id: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3" + in: query + required: true + allowEmptyValue: false + _drep_id_optional: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3" + in: query + required: false + allowEmptyValue: true + _committee_hash: + deprecated: false + name: _committee_hash + description: Committee hash in hexadecimal format (hex) + schema: + type: string + example: "49fa008218cd619afe6aa8a1a93303f242440722b314f36bda2c2e23" + in: query + required: false + allowEmptyValue: true _extended: deprecated: false name: _extended @@ -1842,6 +2199,26 @@ components: in: query required: true allowEmptyValue: false + _proposal_tx_hash: + deprecated: false + name: _proposal_tx_hash + description: Transaction Hash of government proposal in hexadecimal format (hex) + example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + 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: @@ -1899,6 +2276,10 @@ components: format: boolean type: boolean description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + format: boolean + type: boolean + description: Controls whether to include bytecode for associated reference/plutus scripts example: _block_hashes: - fb9087c9f1408a7bbd7b022fd294ab565fec8dd3a8ef091567482722a1fa4e30 @@ -1910,6 +2291,7 @@ components: _withdrawals: false _certs: false _scripts: false + _bytecode: false description: Array of block hashes payment_addresses: content: @@ -2141,6 +2523,64 @@ components: - f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e - 0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94 description: Array of Cardano Transaction hashes + tx_info: + content: + application/json: + schema: + required: + - _tx_hashes + type: object + properties: + _tx_hashes: + format: text + type: array + items: + type: string + description: Array of Cardano Transaction hashes + _inputs: + format: boolean + type: boolean + description: Controls whether to include transaction inputs in the result + _metadata: + format: boolean + type: boolean + description: Controls whether to include transaction metadata in the result + _assets: + format: boolean + type: boolean + description: Controls whether to include assets involved within transaction the result + _withdrawals: + format: boolean + type: boolean + description: Controls whether to include any stake account reward withdrawals in the result + _certs: + format: boolean + type: boolean + description: Controls whether to include transaction certificates in the result + _scripts: + format: boolean + type: boolean + description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + 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 + - 0b8ba3bed976fa4913f19adc9f6dd9063138db5b4dd29cecde369456b5155e94 + _inputs: false + _metadata: false + _assets: false + _withdrawals: false + _certs: false + _scripts: false + _bytecode: false + description: Array of Cardano Transaction hashes txbin: content: application/cbor: @@ -2268,6 +2708,24 @@ components: - ['f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a','6b6f696f732e72657374'] _extended: true description: Array of array of policyID and asset names (hex) alongwith extended flag to return additional columns + drep_id_bulk: + content: + application/json: + schema: + required: + - _drep_ids + type: object + properties: + _drep_ids: + format: text + type: array + descriptions: Array of DRep IDs in bech32 format + items: + type: string + example: + _drep_ids: + - drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3 + - drep1s9q5uyddsvza4uk2n9wswy90n8wx9d2jmrq4zgcvlyv055007av utxo_refs_with_extended: content: application/json: @@ -2553,6 +3011,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/fixed_cost" pledge: $ref: "#/components/schemas/pool_info/items/properties/pledge" + deposit: + $ref: "#/components/schemas/pool_info/items/properties/deposit" reward_addr: $ref: "#/components/schemas/pool_info/items/properties/reward_addr" owners: @@ -2588,7 +3048,9 @@ components: description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) example: "31235800000" active_stake_pct: - type: number + type: + - string + - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 saturation_pct: @@ -2622,7 +3084,9 @@ components: description: Total amount of rewards earned by delegators in that epoch (in lovelaces) example: "123456789123" member_rewards: - type: string + type: + - string + - 'null' description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) example: "123456780123" epoch_ros: @@ -2669,6 +3133,12 @@ components: - 'null' description: Pool pledge in lovelace example: "64000000000000" + deposit: + type: + - string + - 'null' + description: Pool's registration deposit in lovelace + example: "500000000" reward_addr: type: - string @@ -2969,8 +3439,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32" relays: $ref: "#/components/schemas/pool_info/items/properties/relays" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" pool_metadata: description: Array of pool metadata type: array @@ -2985,8 +3453,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" meta_json: $ref: "#/components/schemas/pool_info/items/properties/meta_json" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" epoch_info: description: Array of detailed summary for each epoch type: array @@ -3188,64 +3654,196 @@ components: type: - number - 'null' - format: double - description: The per word cost of script memory usage - example: 0.0577 - price_step: + format: double + description: The per word cost of script memory usage + example: 0.0577 + price_step: + type: + - number + - 'null' + format: double + description: The cost of script execution step usage + example: 7.21e-05 + max_tx_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single transaction + example: 10000000 + max_tx_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single transaction + example: 10000000000 + max_block_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single block + example: 50000000 + max_block_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single block + example: 40000000000 + max_val_size: + type: + - number + - 'null' + description: The maximum Val size + example: 5000 + collateral_percent: + type: + - number + - 'null' + description: The percentage of the tx fee which must be provided as collateral when including non-native scripts + example: 150 + max_collateral_inputs: + type: + - number + - 'null' + description: The maximum number of collateral inputs allowed in a transaction + example: 3 + coins_per_utxo_size: + type: + - string + - 'null' + description: The cost per UTxO size + example: 34482 + pvt_motion_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for motion of no-confidence. + example: 0.6 + pvt_committee_normal: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (normal state). + example: 0.65 + pvt_committee_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (state of no-confidence). + example: 0.65 + pvt_hard_fork_initiation: + type: + - number + - 'null' + description: Pool Voting threshold for hard-fork initiation. + example: 0.51 + dvt_motion_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for motion of no-confidence. + example: 0.67 + dvt_committee_normal: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (normal state). + example: 0.67 + dvt_committee_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (state of no-confidence). + example: 0.65 + dvt_update_to_constitution: + type: + - number + - 'null' + description: DRep Vote threshold for update to the Constitution. + example: 0.75 + dvt_hard_fork_initiation: + type: + - number + - 'null' + description: DRep Vote threshold for hard-fork initiation. + example: 0.6 + dvt_p_p_network_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, network group. + example: 0.67 + dvt_p_p_economic_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, economic group. + example: 0.67 + dvt_p_p_technical_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, technical group. + example: 0.67 + dvt_p_p_gov_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, governance group. + example: 0.75 + dvt_treasury_withdrawal: type: - number - 'null' - format: double - description: The cost of script execution step usage - example: 7.21e-05 - max_tx_ex_mem: + description: DRep Vote threshold for treasury withdrawal. + example: 0.67 + committee_min_size: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single transaction - example: 10000000 - max_tx_ex_steps: + description: Minimal constitutional committee size. + example: 5 + committee_max_term_length: type: - number - 'null' - description: The maximum number of execution steps allowed to be used in a single transaction - example: 10000000000 - max_block_ex_mem: + description: Constitutional committee term limits. + example: 146 + gov_action_lifetime: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single block - example: 50000000 - max_block_ex_steps: + description: Governance action expiration. + example: 14 + gov_action_deposit: type: - - number + - string - 'null' - description: The maximum number of execution steps allowed to be used in a single block - example: 40000000000 - max_val_size: + description: Governance action deposit. + example: 100000000000 + drep_deposit: type: - - number + - string - 'null' - description: The maximum Val size - example: 5000 - collateral_percent: + description: DRep deposit amount. + example: 500000000 + drep_activity: type: - number - 'null' - description: The percentage of the tx fee which must be provided as collateral when including non-native scripts - example: 150 - max_collateral_inputs: + description: DRep activity period. + example: 20 + pvtpp_security_group: type: - number - 'null' - description: The maximum number of collateral inputs allowed in a transaction - example: 3 - coins_per_utxo_size: + description: Pool Voting threshold for protocol parameter changes, security group. + example: 0.6 + min_fee_ref_script_cost_per_byte: type: - - string + - number - 'null' - description: The cost per UTxO size - example: 34482 + description: Minimum Fee for Reference Script cost pre byte + example: 15 epoch_block_protocols: description: Array of distinct block protocol versions counts in epoch type: array @@ -3429,6 +4027,8 @@ components: $ref: "#/components/schemas/tx_info/items/properties/total_output" fee: $ref: "#/components/schemas/tx_info/items/properties/fee" + treasury_donation: + $ref: "#/components/schemas/tx_info/items/properties/treasury_donation" deposit: $ref: "#/components/schemas/tx_info/items/properties/deposit" invalid_before: @@ -3549,10 +4149,11 @@ components: description: Cardano staking address (reward account) in hex format example: e1c865f10d66a2e375242b5ef9f05abc8840d413421982f62c35ce4fbf script_hash: - type: string + type: + - 'null' + - string description: Script hash in case the stake address is locked by a script example: bf357f5de69e4aad71954bebd64357a4813ea5233df12fce4a9de582 - account_info: description: Array of stake account information type: array @@ -3566,6 +4167,12 @@ components: description: Stake address status enum: ["registered", "not registered"] example: registered + delegated_drep: + type: + - 'null' + - string + description: Account's current delegation status to DRep ID in Bech32 format + example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 delegated_pool: anyOf: - type: 'null' @@ -3588,8 +4195,12 @@ components: example: 12105104750 rewards_available: type: string - description: Total rewards available for withdawal + description: Total rewards available for withdrawal example: 44352623297 + deposit: + type: string + description: Total deposit available for withdrawal + example: 2000000 reserves: type: string description: Total reserves MIR value of the account @@ -3810,6 +4421,10 @@ components: type: string description: Total Transaction fee (in lovelaces) example: 172761 + treasury_donation: + type: string + description: Total Donation to on-chain treasury (in lovelaces) + example: 0 deposit: type: string description: Total Deposits included in transaction (for example, if it is registering a pool/key) @@ -3832,7 +4447,9 @@ components: - $ref: "#/components/schemas/tx_info/items/properties/outputs" collateral_output: description: A collateral output for change if the smart contract fails to execute and collateral inputs are spent. (CIP-40) - type: array + type: + - array + - 'null' items: properties: payment_addr: @@ -4096,6 +4713,61 @@ 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: + properties: + tx_hash: + $ref: "#/components/schemas/tx_info/items/properties/tx_hash" + cbor: + type: string + description: CBOR encoded raw transaction. tx_utxos: description: Array of inputs and outputs for given transaction(s) type: array @@ -4320,19 +4992,29 @@ components: description: Asset metadata registered on the Cardano Token Registry properties: name: - type: string + type: + - 'null' + - string example: Rackmob description: - type: string + type: + - 'null' + - string example: Metaverse Blockchain Cryptocurrency. ticker: - type: string + type: + - 'null' + - string example: MOB url: - type: string + type: + - 'null' + - string example: https://www.rackmob.com/ logo: - type: string + type: + - 'null' + - string description: A PNG image file as a byte string example: iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc decimals: @@ -4454,13 +5136,391 @@ components: $ref: "#/components/schemas/asset_info/items/properties/total_supply" decimals: $ref: "#/components/schemas/asset_info/items/properties/token_registry_metadata/properties/decimals" + drep_info: + description: Get detailed information about requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + type: string + description: DRep ID in bech32 format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + hex: + type: string + description: DRep ID in hex format + example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + has_script: + type: boolean + description: Flag which shows if this DRep credentials are a script hash + example: false + registered: + type: boolean + description: Flag to show if the DRep is currently registered + example: false + deposit: + type: + - string + - 'null' + description: DRep's registration deposit in lovelace + example: 500000000 + active: + type: boolean + description: Flag to show if the DRep is (i.e. not expired) + example: true + expires_epoch_no: + type: + - number + - 'null' + description: After which epoch DRep is considered inactive. + example: 410 + amount: + type: string + description: The total amount of voting power this DRep is delegated. + example: 599496769641 + url: + type: + - 'null' + - string + description: A URL to a JSON payload of metadata + example: "https://hornan7.github.io/Vote_Context.jsonld" + hash: + type: + - 'null' + - 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 + items: + properties: + drep_id: + $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" + registered: + $ref: "#/components/schemas/drep_info/items/properties/registered" + drep_delegators: + description: List of all delegators by requested delegated representative (DRep) + type: array + items: + properties: + stake_address: + $ref: "#/components/schemas/account_list/items/properties/stake_address" + stake_address_hex: + $ref: "#/components/schemas/account_list/items/properties/stake_address_hex" + script_hash: + $ref: "#/components/schemas/account_list/items/properties/script_hash" + epoch_no: + description: Epoch when vote delegation was made + allOf: + - $ref: "#/components/schemas/epoch_info/items/properties/epoch_no" + amount: + $ref: "#/components/schemas/account_info/items/properties/total_balance" + drep_metadata: + description: List metadata for requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + url: + $ref: "#/components/schemas/drep_info/items/properties/url" + hash: + $ref: "#/components/schemas/drep_info/items/properties/hash" + json: + type: + - 'null' + - object + description: The payload as JSON + example: + {"body": {"title": "...", "...": "...", "references": [{"uri": "...", "@type": "Other", "label": "Hardfork to PV10"}]}, "authors": [{"name": "...", "witness": {"publicKey": "...", "signature": "...", "witnessAlgorithm": "ed25519"}}], "@context": {"body": {"@id": "CIP108:body", "@context": {"title": "CIP108:title", "abstract": "CIP108:abstract", "rationale": "CIP108:rationale", "motivation": "CIP108:motivation", "references": {"@id": "CIP108:references", "@context": {"uri": "CIP100:reference-uri", "Other": "CIP100:OtherReference", "label": "CIP100:reference-label", "referenceHash": {"@id": "CIP108:referenceHash", "@context": {"hashDigest": "CIP108:hashDigest", "hashAlgorithm": "CIP100:hashAlgorithm"}}, "GovernanceMetadata": "CIP100:GovernanceMetadataReference"}, "@container": "@set"}}}, "CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#", "CIP108": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/README.md#", "authors": {"@id": "CIP100:authors", "@context": {"name": "http://xmlns.com/foaf/0.1/name", "witness": {"@id": "CIP100:witness", "@context": {"publicKey": "CIP100:publicKey", "signature": "CIP100:signature", "witnessAlgorithm": "CIP100:witnessAlgorithm"}}}, "@container": "@set"}, "@language": "en-us", "hashAlgorithm": "CIP100:hashAlgorithm"}, "hashAlgorithm": "blake2b-256"} + bytes: + type: + - 'null' + - string + description: The raw bytes of the payload + example: 7b0a20202240636f6e74657874223a207b0a2020202022406c616e6775616765223a2022656e2d7573222c0a2020202022434950313030223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130302f524541444d452e6d6423222c0a2020202022434950313038223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130382f524541444d452e6d6423222c0a202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d222c0a2020202022626f6479223a207b0a20202020202022406964223a20224349503130383a626f6479222c0a2020202020202240636f6e74657874223a207b0a2020202020202020227265666572656e636573223a207b0a2020202020202020202022406964223a20224349503130383a7265666572656e636573222c0a202020202020202020202240636f6e7461696e6572223a202240736574222c0a202020202020202020202240636f6e74657874223a207b0a20202020202020202020202022476f7665726e616e63654d65746164617461223a20224349503130303a476f7665726e616e63654d657461646174615265666572656e6365222c0a202020202020202020202020224f74686572223a20224349503130303a4f746865725265666572656e6365222c0a202020202020202020202020226c6162656c223a20224349503130303a7265666572656e63652d6c6162656c222c0a20202020202020202020202022757269223a20224349503130303a7265666572656e63652d757269222c0a202020202020202020202020227265666572656e636548617368223a207b0a202020202020202020202020202022406964223a20224349503130383a7265666572656e636548617368222c0a20202020202020202020202020202240636f6e74657874223a207b0a202020202020202020202020202020202268617368446967657374223a20224349503130383a68617368446967657374222c0a202020202020202020202020202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d220a20202020202020202020202020207d0a2020202020202020202020207d0a202020202020202020207d0a20202020202020207d2c0a2020202020202020227469746c65223a20224349503130383a7469746c65222c0a2020202020202020226162737472616374223a20224349503130383a6162737472616374222c0a2020202020202020226d6f7469766174696f6e223a20224349503130383a6d6f7469766174696f6e222c0a202020202020202022726174696f6e616c65223a20224349503130383a726174696f6e616c65220a2020202020207d0a202020207d2c0a2020202022617574686f7273223a207b0a20202020202022406964223a20224349503130303a617574686f7273222c0a2020202020202240636f6e7461696e6572223a202240736574222c0a2020202020202240636f6e74657874223a207b0a2020202020202020226e616d65223a2022687474703a2f2f786d6c6e732e636f6d2f666f61662f302e312f6e616d65222c0a2020202020202020227769746e657373223a207b0a2020202020202020202022406964223a20224349503130303a7769746e657373222c0a202020202020202020202240636f6e74657874223a207b0a202020202020202020202020227769746e657373416c676f726974686d223a20224349503130303a7769746e657373416c676f726974686d222c0a202020202020202020202020227075626c69634b6579223a20224349503130303a7075626c69634b6579222c0a202020202020202020202020227369676e6174757265223a20224349503130303a7369676e6174757265220a202020202020202020207d0a20202020202020207d0a2020202020207d0a202020207d0a20207d2c0a20202268617368416c676f726974686d223a2022626c616b6532622d323536222c0a202022626f6479223a207b0a20202020227469746c65223a202248617264666f726b20746f2050726f746f636f6c2076657273696f6e203130222c0a20202020226162737472616374223a20224c6574277320686176652073616e63686f4e657420696e2066756c6c20676f7665726e616e636520617320736f6f6e20617320706f737369626c65222c0a20202020226d6f7469766174696f6e223a2022505639206973206e6f742061732066756e2061732050563130222c0a2020202022726174696f6e616c65223a20224c65742773206b6565702074657374696e67207374756666222c0a20202020227265666572656e636573223a205b0a2020202020207b0a2020202020202020224074797065223a20224f74686572222c0a2020202020202020226c6162656c223a202248617264666f726b20746f2050563130222c0a202020202020202022757269223a2022220a2020202020207d0a202020205d0a20207d2c0a202022617574686f7273223a205b0a202020207b0a202020202020226e616d65223a20224361726c6f73222c0a202020202020227769746e657373223a207b0a2020202020202020227769746e657373416c676f726974686d223a202265643235353139222c0a2020202020202020227075626c69634b6579223a202237656130396133346165626231336339383431633731333937623163616266656335646466393530343035323933646565343936636163326634333734383061222c0a2020202020202020227369676e6174757265223a20226134373639383562346363306434353766323437373937363131373939613666366138306663386362376563396463623561383232333838386430363138653330646531363566336438363963346130643931303764386135623631326164376335653432343431393037663562393137393666306437313837643634613031220a2020202020207d0a202020207d0a20205d0a7d + warning: + type: + - 'null' + - string + description: A warning that occured while validating the metadata + language: + type: + - 'null' + - string + description: The language described in the context of the metadata as per CIP-100 + example: en-us + comment: + type: + - 'null' + - string + description: Comment attached to the metadata + is_valid: + type: boolean + description: Indicate whether data is invalid + example: true + drep_updates: + description: List of updates for requested (or all) delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + update_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + cert_index: + type: number + description: The index of this certificate within the the transaction. + example: 1 + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + action: + type: string + description: Effective action for this DRep Update certificate + enum: ["updated","registered","deregistered"] + example: registered + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + drep_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + 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" + vote_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + vote: + type: string + enum: ["Yes","No","Abstain"] + description: Actual Vote casted + example: "Yes" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + pool_votes: + description: List of all votes casted by requested pool + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + committee_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + proposal_list: + description: List of all governance action proposals + type: array + items: + properties: + 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"] + description: Proposal Action Type + example: ParameterChange + proposal_description: + type: string + description: Description for Proposal Action + example: '{"tag": "InfoAction"}' + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + type: string + description: The StakeAddress index of the reward address to receive the deposit when it is repaid. + example: stake1uy6yzwsxxc28lfms0qmpxvyz9a7y770rtcqx9y96m42cttqwvp4m5 + proposed_epoch: + type: number + description: Shows the epoch at which this governance action was proposed. + example: 660 + ratified_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been ratified at the specfied epoch. + example: 670 + enacted_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been enacted at the specfied epoch. + example: 675 + dropped_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been dropped (expired/enacted) at the specfied epoch. + example: 680 + expired_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been expired at the specfied epoch. + example: 680 + expiration: + type: + - number + - 'null' + description: Shows the epoch at which this governance action is expected to expire. + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + meta_comment: + $ref: "#/components/schemas/drep_metadata/items/properties/comment" + meta_language: + $ref: "#/components/schemas/drep_metadata/items/properties/language" + meta_is_valid: + $ref: "#/components/schemas/drep_metadata/items/properties/is_valid" + withdrawal: + type: + - object + - 'null' + description: If not null, the amount withdrawn from treasury into stake address by this this proposal + properties: + stake_address: + $ref: "#/components/schemas/account_history/items/properties/stake_address" + amount: + type: string + example: "31235800000" + param_proposal: + description: If not null, the proposed new parameter set + type: + - object + - 'null' + example: {"key_deposit": 1000000} + voter_proposal_list: + description: List of all governance action proposals where specified credential(DRep, SPO or Committee member) has cast a vote + type: array + items: + $ref: "#/components/schemas/proposal_list/items" + proposal_votes: + type: array + description: List of all votes cast on specified governance action + items: + properties: + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + voter_role: + type: string + description: The role of the voter + enum: ["ConstitutionalCommittee", "DRep", "SPO"] + example: DRep + voter: + type: string + description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + voter_hex: + type: string + description: Voter's DRep ID , pool ID or committee hash in hex format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + committee_info: + description: Current governance committee + type: object + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + quorum_numerator: + type: number + example: 67 + quorum_denominator: + type: number + example: 100 + members: + description: Array of all members part of active governance committee + type: array + items: + type: object + properties: + status: + type: string + description: Member authentication status + enum: [ "authorized", "not_authorized", "resigned" ] + example: authorized + cc_cold_hex: + type: string + description: Committee member cold key hash in hex format + example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf + cc_cold_has_script: + type: boolean + description: Flag which shows if this committee member cold credential is a script hash + example: false + cc_hot_hex: + type: + - string + - 'null' + description: Committee member key hash from last valid hot key authorization certificate in hex format + example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472 + cc_hot_has_script: + type: + - boolean + - 'null' + description: Flag which shows if this committee member hot credential is a script hash + example: false + expiration_epoch: + type: number + description: Epoch number in which the committee member vote rights expire + example: 324 script_info: type: array items: description: Array of information for scripts properties: script_hash: - type: string + type: + - 'null' + - string description: Hash of a script example: bfa7ffa9b2e164873db6ac6d0528c82e212963bc62e10fd1d81da4af creation_tx_hash: @@ -4479,7 +5539,9 @@ components: description: Data in JSON format example: 'null' bytes: - type: string + type: + - string + - 'null' description: Script bytes (cborSeq) example: 5907f4010000332323232323232323233223232323232332232323232322223232533532533533355300712001323212330012233350052200200200100235001220011233001225335002101710010142325335333573466e3cd400488008d4020880080580544ccd5cd19b873500122001350082200101601510153500122002353500122002222222222200a101413357389201115554784f206e6f7420636f6e73756d6564000133333573466e1cd55cea8012400046644246600200600464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc888888888848cccccccccc00402c02802402001c01801401000c008cd40508c8c8cccd5cd19b8735573aa0049000119910919800801801180f9aba150023019357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854028cd4050054d5d0a804999aa80bbae501635742a010666aa02eeb94058d5d0a80399a80a0109aba15006335014335502402275a6ae854014c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502575a6ae854008c098d5d09aba2500223263533573805e05c05a05826aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a04aeb4d5d0a80118131aba135744a004464c6a66ae700bc0b80b40b04d55cf280089baa001357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854010cd4051d71aba15003335014335502475c40026ae854008c070d5d09aba2500223263533573804e04c04a04826ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226aae7940044dd50009aba150023232323333573466e1d400520062321222230040053019357426aae79400c8cccd5cd19b875002480108c848888c008014c06cd5d09aab9e500423333573466e1d400d20022321222230010053015357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6a66ae7008808408007c0780740704d55cea80089baa001357426ae8940088c98d4cd5ce00d80d00c80c080c89931a99ab9c4910350543500019018135573ca00226ea8004c8004d5405888448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80b111999aab9f00125009233500830043574200460066ae880080548c8c8c8cccd5cd19b8735573aa00690001199911091998008020018011919191999ab9a3370e6aae7540092000233221233001003002301735742a00466a01c02c6ae84d5d1280111931a99ab9c01b01a019018135573ca00226ea8004d5d0a801999aa803bae500635742a00466a014eb8d5d09aba2500223263533573802e02c02a02826ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80a11191999aab9f0022500823350073355017300635573aa004600a6aae794008c010d5d100180a09aba100111220021221223300100400312232323333573466e1d4005200023212230020033005357426aae79400c8cccd5cd19b8750024800884880048c98d4cd5ce00980900880800789aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98d4cd5ce00800780700689aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a66ae7003803403002c4dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6a66ae7004404003c0380340304d55cea80089baa0012323333573466e1d40052002200523333573466e1d40092000200523263533573801a01801601401226aae74dd5000891001091000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6a66ae7004c04804404003c03803403002c0284d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263533573801801601401201026aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931a99ab9c009008007006005135573aa00226ea800444888c8c8cccd5cd19b8735573aa0049000119aa80518031aba150023005357426ae8940088c98d4cd5ce00480400380309aab9e5001137540029309000a490350543100112212330010030021123230010012233003300200200133512233002489209366f09fe40eaaeb17d3cb6b0b61e087d664174c39a48a986f86b2b0ba6e2a7b00480008848cc00400c0088005 size: @@ -4623,6 +5685,9 @@ tags: - name: Asset description: Query Asset related informations x-tag-expanded: false + - name: Governance + description: Query information about governance for network + x-tag-expanded: false - name: Pool description: Query information about specific pools x-tag-expanded: false @@ -4659,5 +5724,5 @@ tags: - [evaluateTransaction](https://ogmios.dev/mini-protocols/local-tx-submission/#evaluating-transactions) x-tag-expanded: true security: - - [] + - {} - bearerAuth: [] diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index 1ffce60e..ed6454ca 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.1.3 + version: v1.2.0a 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. @@ -486,12 +486,34 @@ paths: summary: UTxO Info description: Get UTxO set for requested UTxO references operationId: utxo_info - /tx_info: #RPC + /tx_cbor: #RPC post: tags: - Transactions requestBody: $ref: "#/components/requestBodies/tx_ids" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/tx_cbor" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Raw Transaction (CBOR) + description: Get raw transaction(s) in CBOR format + operationId: tx_cbor + /tx_info: #RPC + post: + tags: + - Transactions + requestBody: + $ref: "#/components/requestBodies/tx_info" responses: "200": description: Success!! @@ -1278,6 +1300,268 @@ paths: summary: Asset Transactions 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: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps List + description: List of all active delegated representatives (DReps) + operationId: drep_list + /drep_info: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Info + description: Get detailed information about requested delegated representatives (DReps) + operationId: drep_info + /drep_metadata: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_metadata" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Metadata + description: List metadata for requested delegated representatives (DReps) + operationId: drep_metadata + /drep_updates: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id_optional" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_updates" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Updates + description: List of updates for requested (or all) delegated representatives (DReps) + operationId: drep_updates + /drep_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Votes + description: List of all votes casted by requested delegated representative (DRep) + operationId: drep_votes + /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: + - Governance + parameters: + - $ref: "#/components/parameters/_committee_hash" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Votes + description: List of all votes casted by given committee member or collective + operationId: committee_votes + /proposal_list: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposals List + description: List of all governance proposals + operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + + /proposal_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_tx_hash" + - $ref: "#/components/parameters/_proposal_index" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Votes + description: List of all votes cast on specified governance action + operationId: proposal_votes + /pool_list: #RPC get: tags: @@ -1523,6 +1807,28 @@ paths: summary: Pool Relays description: A list of registered relays for all pools operationId: pool_relays + /pool_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_pool_bech32" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/pool_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Pool Votes + description: List of all votes casted by a pool + operationId: pool_votes /pool_metadata: #RPC post: tags: @@ -1675,6 +1981,7 @@ paths: summary: Datum Information description: List of datum information for given datum hashes operationId: datum_info + /ogmios: #ogmios-api post: tags: @@ -1732,6 +2039,16 @@ components: in: query required: true allowEmptyValue: false + _tx_hash: + deprecated: false + name: _tx_hash + description: Transaction Hash in hexadecimal format (hex) + example: "d10133964da9e443b303917fd0b7644ae3d01c133deff85b4f59416c2d00f530" + schema: + type: string + in: query + required: true + allowEmptyValue: false _asset_policy: deprecated: false name: _asset_policy @@ -1772,6 +2089,46 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + in: query + required: true + allowEmptyValue: false + _drep_id: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + in: query + required: true + allowEmptyValue: false + _drep_id_optional: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + in: query + required: false + allowEmptyValue: true + _committee_hash: + deprecated: false + name: _committee_hash + description: Committee hash in hexadecimal format (hex) + schema: + type: string + example: "f8f56120e1ec00feb088ece39ef14f07339afeb37b4e949ff12b89ff" + in: query + required: false + allowEmptyValue: true _extended: deprecated: false name: _extended @@ -1842,6 +2199,26 @@ components: in: query required: true allowEmptyValue: false + _proposal_tx_hash: + deprecated: false + name: _proposal_tx_hash + description: Transaction Hash of government proposal in hexadecimal format (hex) + example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + 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: @@ -1899,6 +2276,10 @@ components: format: boolean type: boolean description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + format: boolean + type: boolean + description: Controls whether to include bytecode for associated reference/plutus scripts example: _block_hashes: - 2abeb8d1c1227139763be30ddb7a2fd79abd7d44195fca87a7c836a510b2802d @@ -1910,6 +2291,7 @@ components: _withdrawals: false _certs: false _scripts: false + _bytecode: false description: Array of block hashes payment_addresses: content: @@ -2141,6 +2523,64 @@ components: - d10133964da9e443b303917fd0b7644ae3d01c133deff85b4f59416c2d00f530 - 145688d3619e7524510ea64c0ec6363b77a9b8da179ef9bb0273a0940d57d576 description: Array of Cardano Transaction hashes + tx_info: + content: + application/json: + schema: + required: + - _tx_hashes + type: object + properties: + _tx_hashes: + format: text + type: array + items: + type: string + description: Array of Cardano Transaction hashes + _inputs: + format: boolean + type: boolean + description: Controls whether to include transaction inputs in the result + _metadata: + format: boolean + type: boolean + description: Controls whether to include transaction metadata in the result + _assets: + format: boolean + type: boolean + description: Controls whether to include assets involved within transaction the result + _withdrawals: + format: boolean + type: boolean + description: Controls whether to include any stake account reward withdrawals in the result + _certs: + format: boolean + type: boolean + description: Controls whether to include transaction certificates in the result + _scripts: + format: boolean + type: boolean + description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + 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 + - 145688d3619e7524510ea64c0ec6363b77a9b8da179ef9bb0273a0940d57d576 + _inputs: false + _metadata: false + _assets: false + _withdrawals: false + _certs: false + _scripts: false + _bytecode: false + description: Array of Cardano Transaction hashes txbin: content: application/cbor: @@ -2268,6 +2708,24 @@ components: - ['777e6b4903dab74963ae581d39875c5dac16c09bb1f511c0af1ddda8','6141414441'] _extended: true description: Array of array of policyID and asset names (hex) alongwith extended flag to return additional columns + drep_id_bulk: + content: + application/json: + schema: + required: + - _drep_ids + type: object + properties: + _drep_ids: + format: text + type: array + descriptions: Array of DRep IDs in bech32 format + items: + type: string + example: + _drep_ids: + - drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd + - drep14x62vyme8l8dkhvxg6rauc6vpcd2va9fquz8k3jstsqczwlvqqh utxo_refs_with_extended: content: application/json: @@ -2553,6 +3011,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/fixed_cost" pledge: $ref: "#/components/schemas/pool_info/items/properties/pledge" + deposit: + $ref: "#/components/schemas/pool_info/items/properties/deposit" reward_addr: $ref: "#/components/schemas/pool_info/items/properties/reward_addr" owners: @@ -2588,7 +3048,9 @@ components: description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) example: "31235800000" active_stake_pct: - type: number + type: + - string + - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 saturation_pct: @@ -2622,7 +3084,9 @@ components: description: Total amount of rewards earned by delegators in that epoch (in lovelaces) example: "123456789123" member_rewards: - type: string + type: + - string + - 'null' description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) example: "123456780123" epoch_ros: @@ -2669,6 +3133,12 @@ components: - 'null' description: Pool pledge in lovelace example: "64000000000000" + deposit: + type: + - string + - 'null' + description: Pool's registration deposit in lovelace + example: "500000000" reward_addr: type: - string @@ -2969,8 +3439,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32" relays: $ref: "#/components/schemas/pool_info/items/properties/relays" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" pool_metadata: description: Array of pool metadata type: array @@ -2985,8 +3453,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" meta_json: $ref: "#/components/schemas/pool_info/items/properties/meta_json" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" epoch_info: description: Array of detailed summary for each epoch type: array @@ -3188,64 +3654,196 @@ components: type: - number - 'null' - format: double - description: The per word cost of script memory usage - example: 0.0577 - price_step: + format: double + description: The per word cost of script memory usage + example: 0.0577 + price_step: + type: + - number + - 'null' + format: double + description: The cost of script execution step usage + example: 7.21e-05 + max_tx_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single transaction + example: 10000000 + max_tx_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single transaction + example: 10000000000 + max_block_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single block + example: 50000000 + max_block_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single block + example: 40000000000 + max_val_size: + type: + - number + - 'null' + description: The maximum Val size + example: 5000 + collateral_percent: + type: + - number + - 'null' + description: The percentage of the tx fee which must be provided as collateral when including non-native scripts + example: 150 + max_collateral_inputs: + type: + - number + - 'null' + description: The maximum number of collateral inputs allowed in a transaction + example: 3 + coins_per_utxo_size: + type: + - string + - 'null' + description: The cost per UTxO size + example: 34482 + pvt_motion_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for motion of no-confidence. + example: 0.6 + pvt_committee_normal: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (normal state). + example: 0.65 + pvt_committee_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (state of no-confidence). + example: 0.65 + pvt_hard_fork_initiation: + type: + - number + - 'null' + description: Pool Voting threshold for hard-fork initiation. + example: 0.51 + dvt_motion_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for motion of no-confidence. + example: 0.67 + dvt_committee_normal: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (normal state). + example: 0.67 + dvt_committee_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (state of no-confidence). + example: 0.65 + dvt_update_to_constitution: + type: + - number + - 'null' + description: DRep Vote threshold for update to the Constitution. + example: 0.75 + dvt_hard_fork_initiation: + type: + - number + - 'null' + description: DRep Vote threshold for hard-fork initiation. + example: 0.6 + dvt_p_p_network_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, network group. + example: 0.67 + dvt_p_p_economic_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, economic group. + example: 0.67 + dvt_p_p_technical_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, technical group. + example: 0.67 + dvt_p_p_gov_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, governance group. + example: 0.75 + dvt_treasury_withdrawal: type: - number - 'null' - format: double - description: The cost of script execution step usage - example: 7.21e-05 - max_tx_ex_mem: + description: DRep Vote threshold for treasury withdrawal. + example: 0.67 + committee_min_size: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single transaction - example: 10000000 - max_tx_ex_steps: + description: Minimal constitutional committee size. + example: 5 + committee_max_term_length: type: - number - 'null' - description: The maximum number of execution steps allowed to be used in a single transaction - example: 10000000000 - max_block_ex_mem: + description: Constitutional committee term limits. + example: 146 + gov_action_lifetime: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single block - example: 50000000 - max_block_ex_steps: + description: Governance action expiration. + example: 14 + gov_action_deposit: type: - - number + - string - 'null' - description: The maximum number of execution steps allowed to be used in a single block - example: 40000000000 - max_val_size: + description: Governance action deposit. + example: 100000000000 + drep_deposit: type: - - number + - string - 'null' - description: The maximum Val size - example: 5000 - collateral_percent: + description: DRep deposit amount. + example: 500000000 + drep_activity: type: - number - 'null' - description: The percentage of the tx fee which must be provided as collateral when including non-native scripts - example: 150 - max_collateral_inputs: + description: DRep activity period. + example: 20 + pvtpp_security_group: type: - number - 'null' - description: The maximum number of collateral inputs allowed in a transaction - example: 3 - coins_per_utxo_size: + description: Pool Voting threshold for protocol parameter changes, security group. + example: 0.6 + min_fee_ref_script_cost_per_byte: type: - - string + - number - 'null' - description: The cost per UTxO size - example: 34482 + description: Minimum Fee for Reference Script cost pre byte + example: 15 epoch_block_protocols: description: Array of distinct block protocol versions counts in epoch type: array @@ -3429,6 +4027,8 @@ components: $ref: "#/components/schemas/tx_info/items/properties/total_output" fee: $ref: "#/components/schemas/tx_info/items/properties/fee" + treasury_donation: + $ref: "#/components/schemas/tx_info/items/properties/treasury_donation" deposit: $ref: "#/components/schemas/tx_info/items/properties/deposit" invalid_before: @@ -3549,10 +4149,11 @@ components: description: Cardano staking address (reward account) in hex format example: e1c865f10d66a2e375242b5ef9f05abc8840d413421982f62c35ce4fbf script_hash: - type: string + type: + - 'null' + - string description: Script hash in case the stake address is locked by a script example: bf357f5de69e4aad71954bebd64357a4813ea5233df12fce4a9de582 - account_info: description: Array of stake account information type: array @@ -3566,6 +4167,12 @@ components: description: Stake address status enum: ["registered", "not registered"] example: registered + delegated_drep: + type: + - 'null' + - string + description: Account's current delegation status to DRep ID in Bech32 format + example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 delegated_pool: anyOf: - type: 'null' @@ -3588,8 +4195,12 @@ components: example: 12105104750 rewards_available: type: string - description: Total rewards available for withdawal + description: Total rewards available for withdrawal example: 44352623297 + deposit: + type: string + description: Total deposit available for withdrawal + example: 2000000 reserves: type: string description: Total reserves MIR value of the account @@ -3810,6 +4421,10 @@ components: type: string description: Total Transaction fee (in lovelaces) example: 172761 + treasury_donation: + type: string + description: Total Donation to on-chain treasury (in lovelaces) + example: 0 deposit: type: string description: Total Deposits included in transaction (for example, if it is registering a pool/key) @@ -3832,7 +4447,9 @@ components: - $ref: "#/components/schemas/tx_info/items/properties/outputs" collateral_output: description: A collateral output for change if the smart contract fails to execute and collateral inputs are spent. (CIP-40) - type: array + type: + - array + - 'null' items: properties: payment_addr: @@ -4096,6 +4713,61 @@ 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: + properties: + tx_hash: + $ref: "#/components/schemas/tx_info/items/properties/tx_hash" + cbor: + type: string + description: CBOR encoded raw transaction. tx_utxos: description: Array of inputs and outputs for given transaction(s) type: array @@ -4320,19 +4992,29 @@ components: description: Asset metadata registered on the Cardano Token Registry properties: name: - type: string + type: + - 'null' + - string example: Rackmob description: - type: string + type: + - 'null' + - string example: Metaverse Blockchain Cryptocurrency. ticker: - type: string + type: + - 'null' + - string example: MOB url: - type: string + type: + - 'null' + - string example: https://www.rackmob.com/ logo: - type: string + type: + - 'null' + - string description: A PNG image file as a byte string example: iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc decimals: @@ -4454,13 +5136,391 @@ components: $ref: "#/components/schemas/asset_info/items/properties/total_supply" decimals: $ref: "#/components/schemas/asset_info/items/properties/token_registry_metadata/properties/decimals" + drep_info: + description: Get detailed information about requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + type: string + description: DRep ID in bech32 format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + hex: + type: string + description: DRep ID in hex format + example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + has_script: + type: boolean + description: Flag which shows if this DRep credentials are a script hash + example: false + registered: + type: boolean + description: Flag to show if the DRep is currently registered + example: false + deposit: + type: + - string + - 'null' + description: DRep's registration deposit in lovelace + example: 500000000 + active: + type: boolean + description: Flag to show if the DRep is (i.e. not expired) + example: true + expires_epoch_no: + type: + - number + - 'null' + description: After which epoch DRep is considered inactive. + example: 410 + amount: + type: string + description: The total amount of voting power this DRep is delegated. + example: 599496769641 + url: + type: + - 'null' + - string + description: A URL to a JSON payload of metadata + example: "https://hornan7.github.io/Vote_Context.jsonld" + hash: + type: + - 'null' + - 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 + items: + properties: + drep_id: + $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" + registered: + $ref: "#/components/schemas/drep_info/items/properties/registered" + drep_delegators: + description: List of all delegators by requested delegated representative (DRep) + type: array + items: + properties: + stake_address: + $ref: "#/components/schemas/account_list/items/properties/stake_address" + stake_address_hex: + $ref: "#/components/schemas/account_list/items/properties/stake_address_hex" + script_hash: + $ref: "#/components/schemas/account_list/items/properties/script_hash" + epoch_no: + description: Epoch when vote delegation was made + allOf: + - $ref: "#/components/schemas/epoch_info/items/properties/epoch_no" + amount: + $ref: "#/components/schemas/account_info/items/properties/total_balance" + drep_metadata: + description: List metadata for requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + url: + $ref: "#/components/schemas/drep_info/items/properties/url" + hash: + $ref: "#/components/schemas/drep_info/items/properties/hash" + json: + type: + - 'null' + - object + description: The payload as JSON + example: + {"body": {"title": "...", "...": "...", "references": [{"uri": "...", "@type": "Other", "label": "Hardfork to PV10"}]}, "authors": [{"name": "...", "witness": {"publicKey": "...", "signature": "...", "witnessAlgorithm": "ed25519"}}], "@context": {"body": {"@id": "CIP108:body", "@context": {"title": "CIP108:title", "abstract": "CIP108:abstract", "rationale": "CIP108:rationale", "motivation": "CIP108:motivation", "references": {"@id": "CIP108:references", "@context": {"uri": "CIP100:reference-uri", "Other": "CIP100:OtherReference", "label": "CIP100:reference-label", "referenceHash": {"@id": "CIP108:referenceHash", "@context": {"hashDigest": "CIP108:hashDigest", "hashAlgorithm": "CIP100:hashAlgorithm"}}, "GovernanceMetadata": "CIP100:GovernanceMetadataReference"}, "@container": "@set"}}}, "CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#", "CIP108": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/README.md#", "authors": {"@id": "CIP100:authors", "@context": {"name": "http://xmlns.com/foaf/0.1/name", "witness": {"@id": "CIP100:witness", "@context": {"publicKey": "CIP100:publicKey", "signature": "CIP100:signature", "witnessAlgorithm": "CIP100:witnessAlgorithm"}}}, "@container": "@set"}, "@language": "en-us", "hashAlgorithm": "CIP100:hashAlgorithm"}, "hashAlgorithm": "blake2b-256"} + bytes: + type: + - 'null' + - string + description: The raw bytes of the payload + example: 7b0a20202240636f6e74657874223a207b0a2020202022406c616e6775616765223a2022656e2d7573222c0a2020202022434950313030223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130302f524541444d452e6d6423222c0a2020202022434950313038223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130382f524541444d452e6d6423222c0a202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d222c0a2020202022626f6479223a207b0a20202020202022406964223a20224349503130383a626f6479222c0a2020202020202240636f6e74657874223a207b0a2020202020202020227265666572656e636573223a207b0a2020202020202020202022406964223a20224349503130383a7265666572656e636573222c0a202020202020202020202240636f6e7461696e6572223a202240736574222c0a202020202020202020202240636f6e74657874223a207b0a20202020202020202020202022476f7665726e616e63654d65746164617461223a20224349503130303a476f7665726e616e63654d657461646174615265666572656e6365222c0a202020202020202020202020224f74686572223a20224349503130303a4f746865725265666572656e6365222c0a202020202020202020202020226c6162656c223a20224349503130303a7265666572656e63652d6c6162656c222c0a20202020202020202020202022757269223a20224349503130303a7265666572656e63652d757269222c0a202020202020202020202020227265666572656e636548617368223a207b0a202020202020202020202020202022406964223a20224349503130383a7265666572656e636548617368222c0a20202020202020202020202020202240636f6e74657874223a207b0a202020202020202020202020202020202268617368446967657374223a20224349503130383a68617368446967657374222c0a202020202020202020202020202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d220a20202020202020202020202020207d0a2020202020202020202020207d0a202020202020202020207d0a20202020202020207d2c0a2020202020202020227469746c65223a20224349503130383a7469746c65222c0a2020202020202020226162737472616374223a20224349503130383a6162737472616374222c0a2020202020202020226d6f7469766174696f6e223a20224349503130383a6d6f7469766174696f6e222c0a202020202020202022726174696f6e616c65223a20224349503130383a726174696f6e616c65220a2020202020207d0a202020207d2c0a2020202022617574686f7273223a207b0a20202020202022406964223a20224349503130303a617574686f7273222c0a2020202020202240636f6e7461696e6572223a202240736574222c0a2020202020202240636f6e74657874223a207b0a2020202020202020226e616d65223a2022687474703a2f2f786d6c6e732e636f6d2f666f61662f302e312f6e616d65222c0a2020202020202020227769746e657373223a207b0a2020202020202020202022406964223a20224349503130303a7769746e657373222c0a202020202020202020202240636f6e74657874223a207b0a202020202020202020202020227769746e657373416c676f726974686d223a20224349503130303a7769746e657373416c676f726974686d222c0a202020202020202020202020227075626c69634b6579223a20224349503130303a7075626c69634b6579222c0a202020202020202020202020227369676e6174757265223a20224349503130303a7369676e6174757265220a202020202020202020207d0a20202020202020207d0a2020202020207d0a202020207d0a20207d2c0a20202268617368416c676f726974686d223a2022626c616b6532622d323536222c0a202022626f6479223a207b0a20202020227469746c65223a202248617264666f726b20746f2050726f746f636f6c2076657273696f6e203130222c0a20202020226162737472616374223a20224c6574277320686176652073616e63686f4e657420696e2066756c6c20676f7665726e616e636520617320736f6f6e20617320706f737369626c65222c0a20202020226d6f7469766174696f6e223a2022505639206973206e6f742061732066756e2061732050563130222c0a2020202022726174696f6e616c65223a20224c65742773206b6565702074657374696e67207374756666222c0a20202020227265666572656e636573223a205b0a2020202020207b0a2020202020202020224074797065223a20224f74686572222c0a2020202020202020226c6162656c223a202248617264666f726b20746f2050563130222c0a202020202020202022757269223a2022220a2020202020207d0a202020205d0a20207d2c0a202022617574686f7273223a205b0a202020207b0a202020202020226e616d65223a20224361726c6f73222c0a202020202020227769746e657373223a207b0a2020202020202020227769746e657373416c676f726974686d223a202265643235353139222c0a2020202020202020227075626c69634b6579223a202237656130396133346165626231336339383431633731333937623163616266656335646466393530343035323933646565343936636163326634333734383061222c0a2020202020202020227369676e6174757265223a20226134373639383562346363306434353766323437373937363131373939613666366138306663386362376563396463623561383232333838386430363138653330646531363566336438363963346130643931303764386135623631326164376335653432343431393037663562393137393666306437313837643634613031220a2020202020207d0a202020207d0a20205d0a7d + warning: + type: + - 'null' + - string + description: A warning that occured while validating the metadata + language: + type: + - 'null' + - string + description: The language described in the context of the metadata as per CIP-100 + example: en-us + comment: + type: + - 'null' + - string + description: Comment attached to the metadata + is_valid: + type: boolean + description: Indicate whether data is invalid + example: true + drep_updates: + description: List of updates for requested (or all) delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + update_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + cert_index: + type: number + description: The index of this certificate within the the transaction. + example: 1 + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + action: + type: string + description: Effective action for this DRep Update certificate + enum: ["updated","registered","deregistered"] + example: registered + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + drep_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + 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" + vote_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + vote: + type: string + enum: ["Yes","No","Abstain"] + description: Actual Vote casted + example: "Yes" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + pool_votes: + description: List of all votes casted by requested pool + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + committee_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + proposal_list: + description: List of all governance action proposals + type: array + items: + properties: + 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"] + description: Proposal Action Type + example: ParameterChange + proposal_description: + type: string + description: Description for Proposal Action + example: '{"tag": "InfoAction"}' + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + type: string + description: The StakeAddress index of the reward address to receive the deposit when it is repaid. + example: stake1uy6yzwsxxc28lfms0qmpxvyz9a7y770rtcqx9y96m42cttqwvp4m5 + proposed_epoch: + type: number + description: Shows the epoch at which this governance action was proposed. + example: 660 + ratified_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been ratified at the specfied epoch. + example: 670 + enacted_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been enacted at the specfied epoch. + example: 675 + dropped_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been dropped (expired/enacted) at the specfied epoch. + example: 680 + expired_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been expired at the specfied epoch. + example: 680 + expiration: + type: + - number + - 'null' + description: Shows the epoch at which this governance action is expected to expire. + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + meta_comment: + $ref: "#/components/schemas/drep_metadata/items/properties/comment" + meta_language: + $ref: "#/components/schemas/drep_metadata/items/properties/language" + meta_is_valid: + $ref: "#/components/schemas/drep_metadata/items/properties/is_valid" + withdrawal: + type: + - object + - 'null' + description: If not null, the amount withdrawn from treasury into stake address by this this proposal + properties: + stake_address: + $ref: "#/components/schemas/account_history/items/properties/stake_address" + amount: + type: string + example: "31235800000" + param_proposal: + description: If not null, the proposed new parameter set + type: + - object + - 'null' + example: {"key_deposit": 1000000} + voter_proposal_list: + description: List of all governance action proposals where specified credential(DRep, SPO or Committee member) has cast a vote + type: array + items: + $ref: "#/components/schemas/proposal_list/items" + proposal_votes: + type: array + description: List of all votes cast on specified governance action + items: + properties: + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + voter_role: + type: string + description: The role of the voter + enum: ["ConstitutionalCommittee", "DRep", "SPO"] + example: DRep + voter: + type: string + description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + voter_hex: + type: string + description: Voter's DRep ID , pool ID or committee hash in hex format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + committee_info: + description: Current governance committee + type: object + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + quorum_numerator: + type: number + example: 67 + quorum_denominator: + type: number + example: 100 + members: + description: Array of all members part of active governance committee + type: array + items: + type: object + properties: + status: + type: string + description: Member authentication status + enum: [ "authorized", "not_authorized", "resigned" ] + example: authorized + cc_cold_hex: + type: string + description: Committee member cold key hash in hex format + example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf + cc_cold_has_script: + type: boolean + description: Flag which shows if this committee member cold credential is a script hash + example: false + cc_hot_hex: + type: + - string + - 'null' + description: Committee member key hash from last valid hot key authorization certificate in hex format + example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472 + cc_hot_has_script: + type: + - boolean + - 'null' + description: Flag which shows if this committee member hot credential is a script hash + example: false + expiration_epoch: + type: number + description: Epoch number in which the committee member vote rights expire + example: 324 script_info: type: array items: description: Array of information for scripts properties: script_hash: - type: string + type: + - 'null' + - string description: Hash of a script example: bfa7ffa9b2e164873db6ac6d0528c82e212963bc62e10fd1d81da4af creation_tx_hash: @@ -4479,7 +5539,9 @@ components: description: Data in JSON format example: 'null' bytes: - type: string + type: + - string + - 'null' description: Script bytes (cborSeq) example: 5907f4010000332323232323232323233223232323232332232323232322223232533532533533355300712001323212330012233350052200200200100235001220011233001225335002101710010142325335333573466e3cd400488008d4020880080580544ccd5cd19b873500122001350082200101601510153500122002353500122002222222222200a101413357389201115554784f206e6f7420636f6e73756d6564000133333573466e1cd55cea8012400046644246600200600464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc888888888848cccccccccc00402c02802402001c01801401000c008cd40508c8c8cccd5cd19b8735573aa0049000119910919800801801180f9aba150023019357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854028cd4050054d5d0a804999aa80bbae501635742a010666aa02eeb94058d5d0a80399a80a0109aba15006335014335502402275a6ae854014c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502575a6ae854008c098d5d09aba2500223263533573805e05c05a05826aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a04aeb4d5d0a80118131aba135744a004464c6a66ae700bc0b80b40b04d55cf280089baa001357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854010cd4051d71aba15003335014335502475c40026ae854008c070d5d09aba2500223263533573804e04c04a04826ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226aae7940044dd50009aba150023232323333573466e1d400520062321222230040053019357426aae79400c8cccd5cd19b875002480108c848888c008014c06cd5d09aab9e500423333573466e1d400d20022321222230010053015357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6a66ae7008808408007c0780740704d55cea80089baa001357426ae8940088c98d4cd5ce00d80d00c80c080c89931a99ab9c4910350543500019018135573ca00226ea8004c8004d5405888448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80b111999aab9f00125009233500830043574200460066ae880080548c8c8c8cccd5cd19b8735573aa00690001199911091998008020018011919191999ab9a3370e6aae7540092000233221233001003002301735742a00466a01c02c6ae84d5d1280111931a99ab9c01b01a019018135573ca00226ea8004d5d0a801999aa803bae500635742a00466a014eb8d5d09aba2500223263533573802e02c02a02826ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80a11191999aab9f0022500823350073355017300635573aa004600a6aae794008c010d5d100180a09aba100111220021221223300100400312232323333573466e1d4005200023212230020033005357426aae79400c8cccd5cd19b8750024800884880048c98d4cd5ce00980900880800789aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98d4cd5ce00800780700689aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a66ae7003803403002c4dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6a66ae7004404003c0380340304d55cea80089baa0012323333573466e1d40052002200523333573466e1d40092000200523263533573801a01801601401226aae74dd5000891001091000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6a66ae7004c04804404003c03803403002c0284d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263533573801801601401201026aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931a99ab9c009008007006005135573aa00226ea800444888c8c8cccd5cd19b8735573aa0049000119aa80518031aba150023005357426ae8940088c98d4cd5ce00480400380309aab9e5001137540029309000a490350543100112212330010030021123230010012233003300200200133512233002489209366f09fe40eaaeb17d3cb6b0b61e087d664174c39a48a986f86b2b0ba6e2a7b00480008848cc00400c0088005 size: @@ -4623,6 +5685,9 @@ tags: - name: Asset description: Query Asset related informations x-tag-expanded: false + - name: Governance + description: Query information about governance for network + x-tag-expanded: false - name: Pool description: Query information about specific pools x-tag-expanded: false @@ -4659,5 +5724,5 @@ tags: - [evaluateTransaction](https://ogmios.dev/mini-protocols/local-tx-submission/#evaluating-transactions) x-tag-expanded: true security: - - [] + - {} - bearerAuth: [] diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index da51a28f..8d3d3bff 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.1.3 + version: v1.2.0a 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. @@ -486,12 +486,34 @@ paths: summary: UTxO Info description: Get UTxO set for requested UTxO references operationId: utxo_info - /tx_info: #RPC + /tx_cbor: #RPC post: tags: - Transactions requestBody: $ref: "#/components/requestBodies/tx_ids" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/tx_cbor" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Raw Transaction (CBOR) + description: Get raw transaction(s) in CBOR format + operationId: tx_cbor + /tx_info: #RPC + post: + tags: + - Transactions + requestBody: + $ref: "#/components/requestBodies/tx_info" responses: "200": description: Success!! @@ -1278,6 +1300,268 @@ paths: summary: Asset Transactions 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: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps List + description: List of all active delegated representatives (DReps) + operationId: drep_list + /drep_info: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Info + description: Get detailed information about requested delegated representatives (DReps) + operationId: drep_info + /drep_metadata: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_metadata" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Metadata + description: List metadata for requested delegated representatives (DReps) + operationId: drep_metadata + /drep_updates: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id_optional" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_updates" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Updates + description: List of updates for requested (or all) delegated representatives (DReps) + operationId: drep_updates + /drep_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Votes + description: List of all votes casted by requested delegated representative (DRep) + operationId: drep_votes + /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: + - Governance + parameters: + - $ref: "#/components/parameters/_committee_hash" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Votes + description: List of all votes casted by given committee member or collective + operationId: committee_votes + /proposal_list: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposals List + description: List of all governance proposals + operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + + /proposal_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_tx_hash" + - $ref: "#/components/parameters/_proposal_index" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Votes + description: List of all votes cast on specified governance action + operationId: proposal_votes + /pool_list: #RPC get: tags: @@ -1523,6 +1807,28 @@ paths: summary: Pool Relays description: A list of registered relays for all pools operationId: pool_relays + /pool_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_pool_bech32" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/pool_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Pool Votes + description: List of all votes casted by a pool + operationId: pool_votes /pool_metadata: #RPC post: tags: @@ -1675,6 +1981,7 @@ paths: summary: Datum Information description: List of datum information for given datum hashes operationId: datum_info + /ogmios: #ogmios-api post: tags: @@ -1732,6 +2039,16 @@ components: in: query required: true allowEmptyValue: false + _tx_hash: + deprecated: false + name: _tx_hash + description: Transaction Hash in hexadecimal format (hex) + example: "f1592b29b79ae85d753913dd25644c60925a4a0683979faa33832fead4b4bd9c" + schema: + type: string + in: query + required: true + allowEmptyValue: false _asset_policy: deprecated: false name: _asset_policy @@ -1772,6 +2089,46 @@ components: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + in: query + required: true + allowEmptyValue: false + _drep_id: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + in: query + required: true + allowEmptyValue: false + _drep_id_optional: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts" + in: query + required: false + allowEmptyValue: true + _committee_hash: + deprecated: false + name: _committee_hash + description: Committee hash in hexadecimal format (hex) + schema: + type: string + example: "7ceede7d6a89e006408e6b7c6acb3dd094b3f6817e43b4a36d01535b" + in: query + required: false + allowEmptyValue: true _extended: deprecated: false name: _extended @@ -1842,6 +2199,26 @@ components: in: query required: true allowEmptyValue: false + _proposal_tx_hash: + deprecated: false + name: _proposal_tx_hash + description: Transaction Hash of government proposal in hexadecimal format (hex) + example: "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + 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: @@ -1899,6 +2276,10 @@ components: format: boolean type: boolean description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + format: boolean + type: boolean + description: Controls whether to include bytecode for associated reference/plutus scripts example: _block_hashes: - a4504e2495ed03b48be36676f430c54dca0769d29f72ebf18d493abf42d2167b @@ -1910,6 +2291,7 @@ components: _withdrawals: false _certs: false _scripts: false + _bytecode: false description: Array of block hashes payment_addresses: content: @@ -2141,6 +2523,64 @@ components: - f1592b29b79ae85d753913dd25644c60925a4a0683979faa33832fead4b4bd9c - 206f6da5b0b0de45605a95f5ce7e172be9674550f7dde3838c45cbf24bab8b00 description: Array of Cardano Transaction hashes + tx_info: + content: + application/json: + schema: + required: + - _tx_hashes + type: object + properties: + _tx_hashes: + format: text + type: array + items: + type: string + description: Array of Cardano Transaction hashes + _inputs: + format: boolean + type: boolean + description: Controls whether to include transaction inputs in the result + _metadata: + format: boolean + type: boolean + description: Controls whether to include transaction metadata in the result + _assets: + format: boolean + type: boolean + description: Controls whether to include assets involved within transaction the result + _withdrawals: + format: boolean + type: boolean + description: Controls whether to include any stake account reward withdrawals in the result + _certs: + format: boolean + type: boolean + description: Controls whether to include transaction certificates in the result + _scripts: + format: boolean + type: boolean + description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + 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 + - 206f6da5b0b0de45605a95f5ce7e172be9674550f7dde3838c45cbf24bab8b00 + _inputs: false + _metadata: false + _assets: false + _withdrawals: false + _certs: false + _scripts: false + _bytecode: false + description: Array of Cardano Transaction hashes txbin: content: application/cbor: @@ -2268,6 +2708,24 @@ components: - ['189e2c53985411addb8df0f3e09f70e343da69f06746c408aba672a8','15fc257714a51769e192761d674db2ee2e80137428e522f9b914debb5f785301'] _extended: true description: Array of array of policyID and asset names (hex) alongwith extended flag to return additional columns + drep_id_bulk: + content: + application/json: + schema: + required: + - _drep_ids + type: object + properties: + _drep_ids: + format: text + type: array + descriptions: Array of DRep IDs in bech32 format + items: + type: string + example: + _drep_ids: + - drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts + - drep1g5vl99xcpv8uce5hhh50xe3fh68tl9f8hcprleekw0c6jhhr45f utxo_refs_with_extended: content: application/json: @@ -2553,6 +3011,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/fixed_cost" pledge: $ref: "#/components/schemas/pool_info/items/properties/pledge" + deposit: + $ref: "#/components/schemas/pool_info/items/properties/deposit" reward_addr: $ref: "#/components/schemas/pool_info/items/properties/reward_addr" owners: @@ -2588,7 +3048,9 @@ components: description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) example: "31235800000" active_stake_pct: - type: number + type: + - string + - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 saturation_pct: @@ -2622,7 +3084,9 @@ components: description: Total amount of rewards earned by delegators in that epoch (in lovelaces) example: "123456789123" member_rewards: - type: string + type: + - string + - 'null' description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) example: "123456780123" epoch_ros: @@ -2669,6 +3133,12 @@ components: - 'null' description: Pool pledge in lovelace example: "64000000000000" + deposit: + type: + - string + - 'null' + description: Pool's registration deposit in lovelace + example: "500000000" reward_addr: type: - string @@ -2969,8 +3439,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32" relays: $ref: "#/components/schemas/pool_info/items/properties/relays" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" pool_metadata: description: Array of pool metadata type: array @@ -2985,8 +3453,6 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" meta_json: $ref: "#/components/schemas/pool_info/items/properties/meta_json" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" epoch_info: description: Array of detailed summary for each epoch type: array @@ -3188,64 +3654,196 @@ components: type: - number - 'null' - format: double - description: The per word cost of script memory usage - example: 0.0577 - price_step: + format: double + description: The per word cost of script memory usage + example: 0.0577 + price_step: + type: + - number + - 'null' + format: double + description: The cost of script execution step usage + example: 7.21e-05 + max_tx_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single transaction + example: 10000000 + max_tx_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single transaction + example: 10000000000 + max_block_ex_mem: + type: + - number + - 'null' + description: The maximum number of execution memory allowed to be used in a single block + example: 50000000 + max_block_ex_steps: + type: + - number + - 'null' + description: The maximum number of execution steps allowed to be used in a single block + example: 40000000000 + max_val_size: + type: + - number + - 'null' + description: The maximum Val size + example: 5000 + collateral_percent: + type: + - number + - 'null' + description: The percentage of the tx fee which must be provided as collateral when including non-native scripts + example: 150 + max_collateral_inputs: + type: + - number + - 'null' + description: The maximum number of collateral inputs allowed in a transaction + example: 3 + coins_per_utxo_size: + type: + - string + - 'null' + description: The cost per UTxO size + example: 34482 + pvt_motion_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for motion of no-confidence. + example: 0.6 + pvt_committee_normal: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (normal state). + example: 0.65 + pvt_committee_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (state of no-confidence). + example: 0.65 + pvt_hard_fork_initiation: + type: + - number + - 'null' + description: Pool Voting threshold for hard-fork initiation. + example: 0.51 + dvt_motion_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for motion of no-confidence. + example: 0.67 + dvt_committee_normal: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (normal state). + example: 0.67 + dvt_committee_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (state of no-confidence). + example: 0.65 + dvt_update_to_constitution: + type: + - number + - 'null' + description: DRep Vote threshold for update to the Constitution. + example: 0.75 + dvt_hard_fork_initiation: + type: + - number + - 'null' + description: DRep Vote threshold for hard-fork initiation. + example: 0.6 + dvt_p_p_network_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, network group. + example: 0.67 + dvt_p_p_economic_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, economic group. + example: 0.67 + dvt_p_p_technical_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, technical group. + example: 0.67 + dvt_p_p_gov_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, governance group. + example: 0.75 + dvt_treasury_withdrawal: type: - number - 'null' - format: double - description: The cost of script execution step usage - example: 7.21e-05 - max_tx_ex_mem: + description: DRep Vote threshold for treasury withdrawal. + example: 0.67 + committee_min_size: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single transaction - example: 10000000 - max_tx_ex_steps: + description: Minimal constitutional committee size. + example: 5 + committee_max_term_length: type: - number - 'null' - description: The maximum number of execution steps allowed to be used in a single transaction - example: 10000000000 - max_block_ex_mem: + description: Constitutional committee term limits. + example: 146 + gov_action_lifetime: type: - number - 'null' - description: The maximum number of execution memory allowed to be used in a single block - example: 50000000 - max_block_ex_steps: + description: Governance action expiration. + example: 14 + gov_action_deposit: type: - - number + - string - 'null' - description: The maximum number of execution steps allowed to be used in a single block - example: 40000000000 - max_val_size: + description: Governance action deposit. + example: 100000000000 + drep_deposit: type: - - number + - string - 'null' - description: The maximum Val size - example: 5000 - collateral_percent: + description: DRep deposit amount. + example: 500000000 + drep_activity: type: - number - 'null' - description: The percentage of the tx fee which must be provided as collateral when including non-native scripts - example: 150 - max_collateral_inputs: + description: DRep activity period. + example: 20 + pvtpp_security_group: type: - number - 'null' - description: The maximum number of collateral inputs allowed in a transaction - example: 3 - coins_per_utxo_size: + description: Pool Voting threshold for protocol parameter changes, security group. + example: 0.6 + min_fee_ref_script_cost_per_byte: type: - - string + - number - 'null' - description: The cost per UTxO size - example: 34482 + description: Minimum Fee for Reference Script cost pre byte + example: 15 epoch_block_protocols: description: Array of distinct block protocol versions counts in epoch type: array @@ -3429,6 +4027,8 @@ components: $ref: "#/components/schemas/tx_info/items/properties/total_output" fee: $ref: "#/components/schemas/tx_info/items/properties/fee" + treasury_donation: + $ref: "#/components/schemas/tx_info/items/properties/treasury_donation" deposit: $ref: "#/components/schemas/tx_info/items/properties/deposit" invalid_before: @@ -3549,10 +4149,11 @@ components: description: Cardano staking address (reward account) in hex format example: e1c865f10d66a2e375242b5ef9f05abc8840d413421982f62c35ce4fbf script_hash: - type: string + type: + - 'null' + - string description: Script hash in case the stake address is locked by a script example: bf357f5de69e4aad71954bebd64357a4813ea5233df12fce4a9de582 - account_info: description: Array of stake account information type: array @@ -3566,6 +4167,12 @@ components: description: Stake address status enum: ["registered", "not registered"] example: registered + delegated_drep: + type: + - 'null' + - string + description: Account's current delegation status to DRep ID in Bech32 format + example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 delegated_pool: anyOf: - type: 'null' @@ -3588,8 +4195,12 @@ components: example: 12105104750 rewards_available: type: string - description: Total rewards available for withdawal + description: Total rewards available for withdrawal example: 44352623297 + deposit: + type: string + description: Total deposit available for withdrawal + example: 2000000 reserves: type: string description: Total reserves MIR value of the account @@ -3810,6 +4421,10 @@ components: type: string description: Total Transaction fee (in lovelaces) example: 172761 + treasury_donation: + type: string + description: Total Donation to on-chain treasury (in lovelaces) + example: 0 deposit: type: string description: Total Deposits included in transaction (for example, if it is registering a pool/key) @@ -3832,7 +4447,9 @@ components: - $ref: "#/components/schemas/tx_info/items/properties/outputs" collateral_output: description: A collateral output for change if the smart contract fails to execute and collateral inputs are spent. (CIP-40) - type: array + type: + - array + - 'null' items: properties: payment_addr: @@ -4096,6 +4713,61 @@ 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: + properties: + tx_hash: + $ref: "#/components/schemas/tx_info/items/properties/tx_hash" + cbor: + type: string + description: CBOR encoded raw transaction. tx_utxos: description: Array of inputs and outputs for given transaction(s) type: array @@ -4320,19 +4992,29 @@ components: description: Asset metadata registered on the Cardano Token Registry properties: name: - type: string + type: + - 'null' + - string example: Rackmob description: - type: string + type: + - 'null' + - string example: Metaverse Blockchain Cryptocurrency. ticker: - type: string + type: + - 'null' + - string example: MOB url: - type: string + type: + - 'null' + - string example: https://www.rackmob.com/ logo: - type: string + type: + - 'null' + - string description: A PNG image file as a byte string example: iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc decimals: @@ -4454,13 +5136,391 @@ components: $ref: "#/components/schemas/asset_info/items/properties/total_supply" decimals: $ref: "#/components/schemas/asset_info/items/properties/token_registry_metadata/properties/decimals" + drep_info: + description: Get detailed information about requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + type: string + description: DRep ID in bech32 format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + hex: + type: string + description: DRep ID in hex format + example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + has_script: + type: boolean + description: Flag which shows if this DRep credentials are a script hash + example: false + registered: + type: boolean + description: Flag to show if the DRep is currently registered + example: false + deposit: + type: + - string + - 'null' + description: DRep's registration deposit in lovelace + example: 500000000 + active: + type: boolean + description: Flag to show if the DRep is (i.e. not expired) + example: true + expires_epoch_no: + type: + - number + - 'null' + description: After which epoch DRep is considered inactive. + example: 410 + amount: + type: string + description: The total amount of voting power this DRep is delegated. + example: 599496769641 + url: + type: + - 'null' + - string + description: A URL to a JSON payload of metadata + example: "https://hornan7.github.io/Vote_Context.jsonld" + hash: + type: + - 'null' + - 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 + items: + properties: + drep_id: + $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" + registered: + $ref: "#/components/schemas/drep_info/items/properties/registered" + drep_delegators: + description: List of all delegators by requested delegated representative (DRep) + type: array + items: + properties: + stake_address: + $ref: "#/components/schemas/account_list/items/properties/stake_address" + stake_address_hex: + $ref: "#/components/schemas/account_list/items/properties/stake_address_hex" + script_hash: + $ref: "#/components/schemas/account_list/items/properties/script_hash" + epoch_no: + description: Epoch when vote delegation was made + allOf: + - $ref: "#/components/schemas/epoch_info/items/properties/epoch_no" + amount: + $ref: "#/components/schemas/account_info/items/properties/total_balance" + drep_metadata: + description: List metadata for requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + url: + $ref: "#/components/schemas/drep_info/items/properties/url" + hash: + $ref: "#/components/schemas/drep_info/items/properties/hash" + json: + type: + - 'null' + - object + description: The payload as JSON + example: + {"body": {"title": "...", "...": "...", "references": [{"uri": "...", "@type": "Other", "label": "Hardfork to PV10"}]}, "authors": [{"name": "...", "witness": {"publicKey": "...", "signature": "...", "witnessAlgorithm": "ed25519"}}], "@context": {"body": {"@id": "CIP108:body", "@context": {"title": "CIP108:title", "abstract": "CIP108:abstract", "rationale": "CIP108:rationale", "motivation": "CIP108:motivation", "references": {"@id": "CIP108:references", "@context": {"uri": "CIP100:reference-uri", "Other": "CIP100:OtherReference", "label": "CIP100:reference-label", "referenceHash": {"@id": "CIP108:referenceHash", "@context": {"hashDigest": "CIP108:hashDigest", "hashAlgorithm": "CIP100:hashAlgorithm"}}, "GovernanceMetadata": "CIP100:GovernanceMetadataReference"}, "@container": "@set"}}}, "CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#", "CIP108": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/README.md#", "authors": {"@id": "CIP100:authors", "@context": {"name": "http://xmlns.com/foaf/0.1/name", "witness": {"@id": "CIP100:witness", "@context": {"publicKey": "CIP100:publicKey", "signature": "CIP100:signature", "witnessAlgorithm": "CIP100:witnessAlgorithm"}}}, "@container": "@set"}, "@language": "en-us", "hashAlgorithm": "CIP100:hashAlgorithm"}, "hashAlgorithm": "blake2b-256"} + bytes: + type: + - 'null' + - string + description: The raw bytes of the payload + example: 7b0a20202240636f6e74657874223a207b0a2020202022406c616e6775616765223a2022656e2d7573222c0a2020202022434950313030223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130302f524541444d452e6d6423222c0a2020202022434950313038223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130382f524541444d452e6d6423222c0a202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d222c0a2020202022626f6479223a207b0a20202020202022406964223a20224349503130383a626f6479222c0a2020202020202240636f6e74657874223a207b0a2020202020202020227265666572656e636573223a207b0a2020202020202020202022406964223a20224349503130383a7265666572656e636573222c0a202020202020202020202240636f6e7461696e6572223a202240736574222c0a202020202020202020202240636f6e74657874223a207b0a20202020202020202020202022476f7665726e616e63654d65746164617461223a20224349503130303a476f7665726e616e63654d657461646174615265666572656e6365222c0a202020202020202020202020224f74686572223a20224349503130303a4f746865725265666572656e6365222c0a202020202020202020202020226c6162656c223a20224349503130303a7265666572656e63652d6c6162656c222c0a20202020202020202020202022757269223a20224349503130303a7265666572656e63652d757269222c0a202020202020202020202020227265666572656e636548617368223a207b0a202020202020202020202020202022406964223a20224349503130383a7265666572656e636548617368222c0a20202020202020202020202020202240636f6e74657874223a207b0a202020202020202020202020202020202268617368446967657374223a20224349503130383a68617368446967657374222c0a202020202020202020202020202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d220a20202020202020202020202020207d0a2020202020202020202020207d0a202020202020202020207d0a20202020202020207d2c0a2020202020202020227469746c65223a20224349503130383a7469746c65222c0a2020202020202020226162737472616374223a20224349503130383a6162737472616374222c0a2020202020202020226d6f7469766174696f6e223a20224349503130383a6d6f7469766174696f6e222c0a202020202020202022726174696f6e616c65223a20224349503130383a726174696f6e616c65220a2020202020207d0a202020207d2c0a2020202022617574686f7273223a207b0a20202020202022406964223a20224349503130303a617574686f7273222c0a2020202020202240636f6e7461696e6572223a202240736574222c0a2020202020202240636f6e74657874223a207b0a2020202020202020226e616d65223a2022687474703a2f2f786d6c6e732e636f6d2f666f61662f302e312f6e616d65222c0a2020202020202020227769746e657373223a207b0a2020202020202020202022406964223a20224349503130303a7769746e657373222c0a202020202020202020202240636f6e74657874223a207b0a202020202020202020202020227769746e657373416c676f726974686d223a20224349503130303a7769746e657373416c676f726974686d222c0a202020202020202020202020227075626c69634b6579223a20224349503130303a7075626c69634b6579222c0a202020202020202020202020227369676e6174757265223a20224349503130303a7369676e6174757265220a202020202020202020207d0a20202020202020207d0a2020202020207d0a202020207d0a20207d2c0a20202268617368416c676f726974686d223a2022626c616b6532622d323536222c0a202022626f6479223a207b0a20202020227469746c65223a202248617264666f726b20746f2050726f746f636f6c2076657273696f6e203130222c0a20202020226162737472616374223a20224c6574277320686176652073616e63686f4e657420696e2066756c6c20676f7665726e616e636520617320736f6f6e20617320706f737369626c65222c0a20202020226d6f7469766174696f6e223a2022505639206973206e6f742061732066756e2061732050563130222c0a2020202022726174696f6e616c65223a20224c65742773206b6565702074657374696e67207374756666222c0a20202020227265666572656e636573223a205b0a2020202020207b0a2020202020202020224074797065223a20224f74686572222c0a2020202020202020226c6162656c223a202248617264666f726b20746f2050563130222c0a202020202020202022757269223a2022220a2020202020207d0a202020205d0a20207d2c0a202022617574686f7273223a205b0a202020207b0a202020202020226e616d65223a20224361726c6f73222c0a202020202020227769746e657373223a207b0a2020202020202020227769746e657373416c676f726974686d223a202265643235353139222c0a2020202020202020227075626c69634b6579223a202237656130396133346165626231336339383431633731333937623163616266656335646466393530343035323933646565343936636163326634333734383061222c0a2020202020202020227369676e6174757265223a20226134373639383562346363306434353766323437373937363131373939613666366138306663386362376563396463623561383232333838386430363138653330646531363566336438363963346130643931303764386135623631326164376335653432343431393037663562393137393666306437313837643634613031220a2020202020207d0a202020207d0a20205d0a7d + warning: + type: + - 'null' + - string + description: A warning that occured while validating the metadata + language: + type: + - 'null' + - string + description: The language described in the context of the metadata as per CIP-100 + example: en-us + comment: + type: + - 'null' + - string + description: Comment attached to the metadata + is_valid: + type: boolean + description: Indicate whether data is invalid + example: true + drep_updates: + description: List of updates for requested (or all) delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + update_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + cert_index: + type: number + description: The index of this certificate within the the transaction. + example: 1 + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + action: + type: string + description: Effective action for this DRep Update certificate + enum: ["updated","registered","deregistered"] + example: registered + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + drep_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + 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" + vote_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + vote: + type: string + enum: ["Yes","No","Abstain"] + description: Actual Vote casted + example: "Yes" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + pool_votes: + description: List of all votes casted by requested pool + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + committee_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + proposal_list: + description: List of all governance action proposals + type: array + items: + properties: + 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"] + description: Proposal Action Type + example: ParameterChange + proposal_description: + type: string + description: Description for Proposal Action + example: '{"tag": "InfoAction"}' + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + type: string + description: The StakeAddress index of the reward address to receive the deposit when it is repaid. + example: stake1uy6yzwsxxc28lfms0qmpxvyz9a7y770rtcqx9y96m42cttqwvp4m5 + proposed_epoch: + type: number + description: Shows the epoch at which this governance action was proposed. + example: 660 + ratified_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been ratified at the specfied epoch. + example: 670 + enacted_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been enacted at the specfied epoch. + example: 675 + dropped_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been dropped (expired/enacted) at the specfied epoch. + example: 680 + expired_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been expired at the specfied epoch. + example: 680 + expiration: + type: + - number + - 'null' + description: Shows the epoch at which this governance action is expected to expire. + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + meta_comment: + $ref: "#/components/schemas/drep_metadata/items/properties/comment" + meta_language: + $ref: "#/components/schemas/drep_metadata/items/properties/language" + meta_is_valid: + $ref: "#/components/schemas/drep_metadata/items/properties/is_valid" + withdrawal: + type: + - object + - 'null' + description: If not null, the amount withdrawn from treasury into stake address by this this proposal + properties: + stake_address: + $ref: "#/components/schemas/account_history/items/properties/stake_address" + amount: + type: string + example: "31235800000" + param_proposal: + description: If not null, the proposed new parameter set + type: + - object + - 'null' + example: {"key_deposit": 1000000} + voter_proposal_list: + description: List of all governance action proposals where specified credential(DRep, SPO or Committee member) has cast a vote + type: array + items: + $ref: "#/components/schemas/proposal_list/items" + proposal_votes: + type: array + description: List of all votes cast on specified governance action + items: + properties: + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + voter_role: + type: string + description: The role of the voter + enum: ["ConstitutionalCommittee", "DRep", "SPO"] + example: DRep + voter: + type: string + description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + voter_hex: + type: string + description: Voter's DRep ID , pool ID or committee hash in hex format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + committee_info: + description: Current governance committee + type: object + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + quorum_numerator: + type: number + example: 67 + quorum_denominator: + type: number + example: 100 + members: + description: Array of all members part of active governance committee + type: array + items: + type: object + properties: + status: + type: string + description: Member authentication status + enum: [ "authorized", "not_authorized", "resigned" ] + example: authorized + cc_cold_hex: + type: string + description: Committee member cold key hash in hex format + example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf + cc_cold_has_script: + type: boolean + description: Flag which shows if this committee member cold credential is a script hash + example: false + cc_hot_hex: + type: + - string + - 'null' + description: Committee member key hash from last valid hot key authorization certificate in hex format + example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472 + cc_hot_has_script: + type: + - boolean + - 'null' + description: Flag which shows if this committee member hot credential is a script hash + example: false + expiration_epoch: + type: number + description: Epoch number in which the committee member vote rights expire + example: 324 script_info: type: array items: description: Array of information for scripts properties: script_hash: - type: string + type: + - 'null' + - string description: Hash of a script example: bfa7ffa9b2e164873db6ac6d0528c82e212963bc62e10fd1d81da4af creation_tx_hash: @@ -4479,7 +5539,9 @@ components: description: Data in JSON format example: 'null' bytes: - type: string + type: + - string + - 'null' description: Script bytes (cborSeq) example: 5907f4010000332323232323232323233223232323232332232323232322223232533532533533355300712001323212330012233350052200200200100235001220011233001225335002101710010142325335333573466e3cd400488008d4020880080580544ccd5cd19b873500122001350082200101601510153500122002353500122002222222222200a101413357389201115554784f206e6f7420636f6e73756d6564000133333573466e1cd55cea8012400046644246600200600464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc888888888848cccccccccc00402c02802402001c01801401000c008cd40508c8c8cccd5cd19b8735573aa0049000119910919800801801180f9aba150023019357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854028cd4050054d5d0a804999aa80bbae501635742a010666aa02eeb94058d5d0a80399a80a0109aba15006335014335502402275a6ae854014c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502575a6ae854008c098d5d09aba2500223263533573805e05c05a05826aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a04aeb4d5d0a80118131aba135744a004464c6a66ae700bc0b80b40b04d55cf280089baa001357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854010cd4051d71aba15003335014335502475c40026ae854008c070d5d09aba2500223263533573804e04c04a04826ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226aae7940044dd50009aba150023232323333573466e1d400520062321222230040053019357426aae79400c8cccd5cd19b875002480108c848888c008014c06cd5d09aab9e500423333573466e1d400d20022321222230010053015357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6a66ae7008808408007c0780740704d55cea80089baa001357426ae8940088c98d4cd5ce00d80d00c80c080c89931a99ab9c4910350543500019018135573ca00226ea8004c8004d5405888448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80b111999aab9f00125009233500830043574200460066ae880080548c8c8c8cccd5cd19b8735573aa00690001199911091998008020018011919191999ab9a3370e6aae7540092000233221233001003002301735742a00466a01c02c6ae84d5d1280111931a99ab9c01b01a019018135573ca00226ea8004d5d0a801999aa803bae500635742a00466a014eb8d5d09aba2500223263533573802e02c02a02826ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80a11191999aab9f0022500823350073355017300635573aa004600a6aae794008c010d5d100180a09aba100111220021221223300100400312232323333573466e1d4005200023212230020033005357426aae79400c8cccd5cd19b8750024800884880048c98d4cd5ce00980900880800789aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98d4cd5ce00800780700689aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a66ae7003803403002c4dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6a66ae7004404003c0380340304d55cea80089baa0012323333573466e1d40052002200523333573466e1d40092000200523263533573801a01801601401226aae74dd5000891001091000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6a66ae7004c04804404003c03803403002c0284d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263533573801801601401201026aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931a99ab9c009008007006005135573aa00226ea800444888c8c8cccd5cd19b8735573aa0049000119aa80518031aba150023005357426ae8940088c98d4cd5ce00480400380309aab9e5001137540029309000a490350543100112212330010030021123230010012233003300200200133512233002489209366f09fe40eaaeb17d3cb6b0b61e087d664174c39a48a986f86b2b0ba6e2a7b00480008848cc00400c0088005 size: @@ -4623,6 +5685,9 @@ tags: - name: Asset description: Query Asset related informations x-tag-expanded: false + - name: Governance + description: Query information about governance for network + x-tag-expanded: false - name: Pool description: Query information about specific pools x-tag-expanded: false @@ -4659,5 +5724,5 @@ tags: - [evaluateTransaction](https://ogmios.dev/mini-protocols/local-tx-submission/#evaluating-transactions) x-tag-expanded: true security: - - [] + - {} - bearerAuth: [] diff --git a/specs/templates/1-api-info.yaml b/specs/templates/1-api-info.yaml index 7f1afd42..0620905d 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.1.3 + version: v1.2.0a 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 7fb1ec23..d26b348e 100644 --- a/specs/templates/2-api-params.yaml +++ b/specs/templates/2-api-params.yaml @@ -29,6 +29,16 @@ parameters: in: query required: true allowEmptyValue: false + _tx_hash: + deprecated: false + name: _tx_hash + description: Transaction Hash in hexadecimal format (hex) + example: "##_tx_hash_param##" + schema: + type: string + in: query + required: true + allowEmptyValue: false _asset_policy: deprecated: false name: _asset_policy @@ -69,6 +79,46 @@ parameters: in: query required: false allowEmptyValue: true + _credential: + deprecated: false + name: _credential + description: Voter (Drep, SPO, Committee Member) in Hex format + schema: + type: string + example: "##_drep_id_param##" + in: query + required: true + allowEmptyValue: false + _drep_id: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "##_drep_id_param##" + in: query + required: true + allowEmptyValue: false + _drep_id_optional: + deprecated: false + name: _drep_id + description: DRep ID in bech32 format + schema: + type: string + example: "##_drep_id_param##" + in: query + required: false + allowEmptyValue: true + _committee_hash: + deprecated: false + name: _committee_hash + description: Committee hash in hexadecimal format (hex) + schema: + type: string + example: "##_committee_hash_param##" + in: query + required: false + allowEmptyValue: true _extended: deprecated: false name: _extended @@ -139,3 +189,23 @@ parameters: in: query required: true allowEmptyValue: false + _proposal_tx_hash: + deprecated: false + name: _proposal_tx_hash + description: Transaction Hash of government proposal in hexadecimal format (hex) + example: "##_proposal_tx_hash_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/3-api-requestBodies.yaml b/specs/templates/3-api-requestBodies.yaml index ae372fb1..394a15da 100644 --- a/specs/templates/3-api-requestBodies.yaml +++ b/specs/templates/3-api-requestBodies.yaml @@ -55,6 +55,10 @@ requestBodies: format: boolean type: boolean description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + format: boolean + type: boolean + description: Controls whether to include bytecode for associated reference/plutus scripts example: _block_hashes: - ##block_info1_rb## @@ -66,6 +70,7 @@ requestBodies: _withdrawals: false _certs: false _scripts: false + _bytecode: false description: Array of block hashes payment_addresses: content: @@ -297,6 +302,64 @@ requestBodies: - ##tx_ids_tx_hashes1_rb## - ##tx_ids_tx_hashes2_rb## description: Array of Cardano Transaction hashes + tx_info: + content: + application/json: + schema: + required: + - _tx_hashes + type: object + properties: + _tx_hashes: + format: text + type: array + items: + type: string + description: Array of Cardano Transaction hashes + _inputs: + format: boolean + type: boolean + description: Controls whether to include transaction inputs in the result + _metadata: + format: boolean + type: boolean + description: Controls whether to include transaction metadata in the result + _assets: + format: boolean + type: boolean + description: Controls whether to include assets involved within transaction the result + _withdrawals: + format: boolean + type: boolean + description: Controls whether to include any stake account reward withdrawals in the result + _certs: + format: boolean + type: boolean + description: Controls whether to include transaction certificates in the result + _scripts: + format: boolean + type: boolean + description: Controls whether to include any details regarding collateral/reference/datum/script objects in the result + _bytecode: + 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## + - ##tx_ids_tx_hashes2_rb## + _inputs: false + _metadata: false + _assets: false + _withdrawals: false + _certs: false + _scripts: false + _bytecode: false + description: Array of Cardano Transaction hashes txbin: content: application/cbor: @@ -424,6 +487,24 @@ requestBodies: - ##asset2_rb## _extended: true description: Array of array of policyID and asset names (hex) alongwith extended flag to return additional columns + drep_id_bulk: + content: + application/json: + schema: + required: + - _drep_ids + type: object + properties: + _drep_ids: + format: text + type: array + descriptions: Array of DRep IDs in bech32 format + items: + type: string + example: + _drep_ids: + - ##drep_ids1_rb## + - ##drep_ids2_rb## utxo_refs_with_extended: content: application/json: diff --git a/specs/templates/4-api-schemas.yaml b/specs/templates/4-api-schemas.yaml index 707dcd6c..df537706 100644 --- a/specs/templates/4-api-schemas.yaml +++ b/specs/templates/4-api-schemas.yaml @@ -188,6 +188,8 @@ schemas: $ref: "#/components/schemas/pool_info/items/properties/fixed_cost" pledge: $ref: "#/components/schemas/pool_info/items/properties/pledge" + deposit: + $ref: "#/components/schemas/pool_info/items/properties/deposit" reward_addr: $ref: "#/components/schemas/pool_info/items/properties/reward_addr" owners: @@ -223,7 +225,9 @@ schemas: description: Amount of delegated stake to this pool at the time of epoch snapshot (in lovelaces) example: "31235800000" active_stake_pct: - type: number + type: + - string + - 'null' description: Active stake for the pool, expressed as a percentage of total active stake on network example: 13.512182543475783 saturation_pct: @@ -257,7 +261,9 @@ schemas: description: Total amount of rewards earned by delegators in that epoch (in lovelaces) example: "123456789123" member_rewards: - type: string + type: + - string + - 'null' description: Total amount of rewards earned by members (delegator - owner) in that epoch (in lovelaces) example: "123456780123" epoch_ros: @@ -304,6 +310,12 @@ schemas: - 'null' description: Pool pledge in lovelace example: "64000000000000" + deposit: + type: + - string + - 'null' + description: Pool's registration deposit in lovelace + example: "500000000" reward_addr: type: - string @@ -604,8 +616,6 @@ schemas: $ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32" relays: $ref: "#/components/schemas/pool_info/items/properties/relays" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" pool_metadata: description: Array of pool metadata type: array @@ -620,8 +630,6 @@ schemas: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" meta_json: $ref: "#/components/schemas/pool_info/items/properties/meta_json" - pool_status: - $ref: "#/components/schemas/pool_info/items/properties/pool_status" epoch_info: description: Array of detailed summary for each epoch type: array @@ -881,6 +889,138 @@ schemas: - 'null' description: The cost per UTxO size example: 34482 + pvt_motion_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for motion of no-confidence. + example: 0.6 + pvt_committee_normal: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (normal state). + example: 0.65 + pvt_committee_no_confidence: + type: + - number + - 'null' + description: Pool Voting threshold for new committee/threshold (state of no-confidence). + example: 0.65 + pvt_hard_fork_initiation: + type: + - number + - 'null' + description: Pool Voting threshold for hard-fork initiation. + example: 0.51 + dvt_motion_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for motion of no-confidence. + example: 0.67 + dvt_committee_normal: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (normal state). + example: 0.67 + dvt_committee_no_confidence: + type: + - number + - 'null' + description: DRep Vote threshold for new committee/threshold (state of no-confidence). + example: 0.65 + dvt_update_to_constitution: + type: + - number + - 'null' + description: DRep Vote threshold for update to the Constitution. + example: 0.75 + dvt_hard_fork_initiation: + type: + - number + - 'null' + description: DRep Vote threshold for hard-fork initiation. + example: 0.6 + dvt_p_p_network_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, network group. + example: 0.67 + dvt_p_p_economic_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, economic group. + example: 0.67 + dvt_p_p_technical_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, technical group. + example: 0.67 + dvt_p_p_gov_group: + type: + - number + - 'null' + description: DRep Vote threshold for protocol parameter changes, governance group. + example: 0.75 + dvt_treasury_withdrawal: + type: + - number + - 'null' + description: DRep Vote threshold for treasury withdrawal. + example: 0.67 + committee_min_size: + type: + - number + - 'null' + description: Minimal constitutional committee size. + example: 5 + committee_max_term_length: + type: + - number + - 'null' + description: Constitutional committee term limits. + example: 146 + gov_action_lifetime: + type: + - number + - 'null' + description: Governance action expiration. + example: 14 + gov_action_deposit: + type: + - string + - 'null' + description: Governance action deposit. + example: 100000000000 + drep_deposit: + type: + - string + - 'null' + description: DRep deposit amount. + example: 500000000 + drep_activity: + type: + - number + - 'null' + description: DRep activity period. + example: 20 + pvtpp_security_group: + type: + - number + - 'null' + description: Pool Voting threshold for protocol parameter changes, security group. + example: 0.6 + min_fee_ref_script_cost_per_byte: + type: + - number + - 'null' + description: Minimum Fee for Reference Script cost pre byte + example: 15 epoch_block_protocols: description: Array of distinct block protocol versions counts in epoch type: array @@ -1064,6 +1204,8 @@ schemas: $ref: "#/components/schemas/tx_info/items/properties/total_output" fee: $ref: "#/components/schemas/tx_info/items/properties/fee" + treasury_donation: + $ref: "#/components/schemas/tx_info/items/properties/treasury_donation" deposit: $ref: "#/components/schemas/tx_info/items/properties/deposit" invalid_before: @@ -1184,10 +1326,11 @@ schemas: description: Cardano staking address (reward account) in hex format example: e1c865f10d66a2e375242b5ef9f05abc8840d413421982f62c35ce4fbf script_hash: - type: string + type: + - 'null' + - string description: Script hash in case the stake address is locked by a script example: bf357f5de69e4aad71954bebd64357a4813ea5233df12fce4a9de582 - account_info: description: Array of stake account information type: array @@ -1201,6 +1344,12 @@ schemas: description: Stake address status enum: ["registered", "not registered"] example: registered + delegated_drep: + type: + - 'null' + - string + description: Account's current delegation status to DRep ID in Bech32 format + example: drep1gj49xmfcg6ev89ur2yad9c5p7z0pgfxggyakz9pua06vqh5vnp0 delegated_pool: anyOf: - type: 'null' @@ -1223,8 +1372,12 @@ schemas: example: 12105104750 rewards_available: type: string - description: Total rewards available for withdawal + description: Total rewards available for withdrawal example: 44352623297 + deposit: + type: string + description: Total deposit available for withdrawal + example: 2000000 reserves: type: string description: Total reserves MIR value of the account @@ -1445,6 +1598,10 @@ schemas: type: string description: Total Transaction fee (in lovelaces) example: 172761 + treasury_donation: + type: string + description: Total Donation to on-chain treasury (in lovelaces) + example: 0 deposit: type: string description: Total Deposits included in transaction (for example, if it is registering a pool/key) @@ -1467,7 +1624,9 @@ schemas: - $ref: "#/components/schemas/tx_info/items/properties/outputs" collateral_output: description: A collateral output for change if the smart contract fails to execute and collateral inputs are spent. (CIP-40) - type: array + type: + - array + - 'null' items: properties: payment_addr: @@ -1731,6 +1890,61 @@ 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: + properties: + tx_hash: + $ref: "#/components/schemas/tx_info/items/properties/tx_hash" + cbor: + type: string + description: CBOR encoded raw transaction. tx_utxos: description: Array of inputs and outputs for given transaction(s) type: array @@ -1955,19 +2169,29 @@ schemas: description: Asset metadata registered on the Cardano Token Registry properties: name: - type: string + type: + - 'null' + - string example: Rackmob description: - type: string + type: + - 'null' + - string example: Metaverse Blockchain Cryptocurrency. ticker: - type: string + type: + - 'null' + - string example: MOB url: - type: string + type: + - 'null' + - string example: https://www.rackmob.com/ logo: - type: string + type: + - 'null' + - string description: A PNG image file as a byte string example: iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADnmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc decimals: @@ -2089,13 +2313,391 @@ schemas: $ref: "#/components/schemas/asset_info/items/properties/total_supply" decimals: $ref: "#/components/schemas/asset_info/items/properties/token_registry_metadata/properties/decimals" + drep_info: + description: Get detailed information about requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + type: string + description: DRep ID in bech32 format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + hex: + type: string + description: DRep ID in hex format + example: f948a9f7a863d8062565809aba3925aa41334e976c11c837fe1a74c0 + has_script: + type: boolean + description: Flag which shows if this DRep credentials are a script hash + example: false + registered: + type: boolean + description: Flag to show if the DRep is currently registered + example: false + deposit: + type: + - string + - 'null' + description: DRep's registration deposit in lovelace + example: 500000000 + active: + type: boolean + description: Flag to show if the DRep is (i.e. not expired) + example: true + expires_epoch_no: + type: + - number + - 'null' + description: After which epoch DRep is considered inactive. + example: 410 + amount: + type: string + description: The total amount of voting power this DRep is delegated. + example: 599496769641 + url: + type: + - 'null' + - string + description: A URL to a JSON payload of metadata + example: "https://hornan7.github.io/Vote_Context.jsonld" + hash: + type: + - 'null' + - 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 + items: + properties: + drep_id: + $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" + registered: + $ref: "#/components/schemas/drep_info/items/properties/registered" + drep_delegators: + description: List of all delegators by requested delegated representative (DRep) + type: array + items: + properties: + stake_address: + $ref: "#/components/schemas/account_list/items/properties/stake_address" + stake_address_hex: + $ref: "#/components/schemas/account_list/items/properties/stake_address_hex" + script_hash: + $ref: "#/components/schemas/account_list/items/properties/script_hash" + epoch_no: + description: Epoch when vote delegation was made + allOf: + - $ref: "#/components/schemas/epoch_info/items/properties/epoch_no" + amount: + $ref: "#/components/schemas/account_info/items/properties/total_balance" + drep_metadata: + description: List metadata for requested delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + url: + $ref: "#/components/schemas/drep_info/items/properties/url" + hash: + $ref: "#/components/schemas/drep_info/items/properties/hash" + json: + type: + - 'null' + - object + description: The payload as JSON + example: + {"body": {"title": "...", "...": "...", "references": [{"uri": "...", "@type": "Other", "label": "Hardfork to PV10"}]}, "authors": [{"name": "...", "witness": {"publicKey": "...", "signature": "...", "witnessAlgorithm": "ed25519"}}], "@context": {"body": {"@id": "CIP108:body", "@context": {"title": "CIP108:title", "abstract": "CIP108:abstract", "rationale": "CIP108:rationale", "motivation": "CIP108:motivation", "references": {"@id": "CIP108:references", "@context": {"uri": "CIP100:reference-uri", "Other": "CIP100:OtherReference", "label": "CIP100:reference-label", "referenceHash": {"@id": "CIP108:referenceHash", "@context": {"hashDigest": "CIP108:hashDigest", "hashAlgorithm": "CIP100:hashAlgorithm"}}, "GovernanceMetadata": "CIP100:GovernanceMetadataReference"}, "@container": "@set"}}}, "CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#", "CIP108": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/README.md#", "authors": {"@id": "CIP100:authors", "@context": {"name": "http://xmlns.com/foaf/0.1/name", "witness": {"@id": "CIP100:witness", "@context": {"publicKey": "CIP100:publicKey", "signature": "CIP100:signature", "witnessAlgorithm": "CIP100:witnessAlgorithm"}}}, "@container": "@set"}, "@language": "en-us", "hashAlgorithm": "CIP100:hashAlgorithm"}, "hashAlgorithm": "blake2b-256"} + bytes: + type: + - 'null' + - string + description: The raw bytes of the payload + example: 7b0a20202240636f6e74657874223a207b0a2020202022406c616e6775616765223a2022656e2d7573222c0a2020202022434950313030223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130302f524541444d452e6d6423222c0a2020202022434950313038223a202268747470733a2f2f6769746875622e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f626c6f622f6d61737465722f4349502d303130382f524541444d452e6d6423222c0a202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d222c0a2020202022626f6479223a207b0a20202020202022406964223a20224349503130383a626f6479222c0a2020202020202240636f6e74657874223a207b0a2020202020202020227265666572656e636573223a207b0a2020202020202020202022406964223a20224349503130383a7265666572656e636573222c0a202020202020202020202240636f6e7461696e6572223a202240736574222c0a202020202020202020202240636f6e74657874223a207b0a20202020202020202020202022476f7665726e616e63654d65746164617461223a20224349503130303a476f7665726e616e63654d657461646174615265666572656e6365222c0a202020202020202020202020224f74686572223a20224349503130303a4f746865725265666572656e6365222c0a202020202020202020202020226c6162656c223a20224349503130303a7265666572656e63652d6c6162656c222c0a20202020202020202020202022757269223a20224349503130303a7265666572656e63652d757269222c0a202020202020202020202020227265666572656e636548617368223a207b0a202020202020202020202020202022406964223a20224349503130383a7265666572656e636548617368222c0a20202020202020202020202020202240636f6e74657874223a207b0a202020202020202020202020202020202268617368446967657374223a20224349503130383a68617368446967657374222c0a202020202020202020202020202020202268617368416c676f726974686d223a20224349503130303a68617368416c676f726974686d220a20202020202020202020202020207d0a2020202020202020202020207d0a202020202020202020207d0a20202020202020207d2c0a2020202020202020227469746c65223a20224349503130383a7469746c65222c0a2020202020202020226162737472616374223a20224349503130383a6162737472616374222c0a2020202020202020226d6f7469766174696f6e223a20224349503130383a6d6f7469766174696f6e222c0a202020202020202022726174696f6e616c65223a20224349503130383a726174696f6e616c65220a2020202020207d0a202020207d2c0a2020202022617574686f7273223a207b0a20202020202022406964223a20224349503130303a617574686f7273222c0a2020202020202240636f6e7461696e6572223a202240736574222c0a2020202020202240636f6e74657874223a207b0a2020202020202020226e616d65223a2022687474703a2f2f786d6c6e732e636f6d2f666f61662f302e312f6e616d65222c0a2020202020202020227769746e657373223a207b0a2020202020202020202022406964223a20224349503130303a7769746e657373222c0a202020202020202020202240636f6e74657874223a207b0a202020202020202020202020227769746e657373416c676f726974686d223a20224349503130303a7769746e657373416c676f726974686d222c0a202020202020202020202020227075626c69634b6579223a20224349503130303a7075626c69634b6579222c0a202020202020202020202020227369676e6174757265223a20224349503130303a7369676e6174757265220a202020202020202020207d0a20202020202020207d0a2020202020207d0a202020207d0a20207d2c0a20202268617368416c676f726974686d223a2022626c616b6532622d323536222c0a202022626f6479223a207b0a20202020227469746c65223a202248617264666f726b20746f2050726f746f636f6c2076657273696f6e203130222c0a20202020226162737472616374223a20224c6574277320686176652073616e63686f4e657420696e2066756c6c20676f7665726e616e636520617320736f6f6e20617320706f737369626c65222c0a20202020226d6f7469766174696f6e223a2022505639206973206e6f742061732066756e2061732050563130222c0a2020202022726174696f6e616c65223a20224c65742773206b6565702074657374696e67207374756666222c0a20202020227265666572656e636573223a205b0a2020202020207b0a2020202020202020224074797065223a20224f74686572222c0a2020202020202020226c6162656c223a202248617264666f726b20746f2050563130222c0a202020202020202022757269223a2022220a2020202020207d0a202020205d0a20207d2c0a202022617574686f7273223a205b0a202020207b0a202020202020226e616d65223a20224361726c6f73222c0a202020202020227769746e657373223a207b0a2020202020202020227769746e657373416c676f726974686d223a202265643235353139222c0a2020202020202020227075626c69634b6579223a202237656130396133346165626231336339383431633731333937623163616266656335646466393530343035323933646565343936636163326634333734383061222c0a2020202020202020227369676e6174757265223a20226134373639383562346363306434353766323437373937363131373939613666366138306663386362376563396463623561383232333838386430363138653330646531363566336438363963346130643931303764386135623631326164376335653432343431393037663562393137393666306437313837643634613031220a2020202020207d0a202020207d0a20205d0a7d + warning: + type: + - 'null' + - string + description: A warning that occured while validating the metadata + language: + type: + - 'null' + - string + description: The language described in the context of the metadata as per CIP-100 + example: en-us + comment: + type: + - 'null' + - string + description: Comment attached to the metadata + is_valid: + type: boolean + description: Indicate whether data is invalid + example: true + drep_updates: + description: List of updates for requested (or all) delegated representatives (DReps) + type: array + items: + properties: + drep_id: + $ref: "#/components/schemas/drep_info/items/properties/drep_id" + hex: + $ref: "#/components/schemas/drep_info/items/properties/hex" + update_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + cert_index: + type: number + description: The index of this certificate within the the transaction. + example: 1 + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + action: + type: string + description: Effective action for this DRep Update certificate + enum: ["updated","registered","deregistered"] + example: registered + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + drep_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + 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" + vote_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + vote: + type: string + enum: ["Yes","No","Abstain"] + description: Actual Vote casted + example: "Yes" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + pool_votes: + description: List of all votes casted by requested pool + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + committee_votes: + description: List of all votes casted by requested delegated representative (DRep) + type: array + items: + $ref: "#/components/schemas/drep_votes/items" + proposal_list: + description: List of all governance action proposals + type: array + items: + properties: + 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"] + description: Proposal Action Type + example: ParameterChange + proposal_description: + type: string + description: Description for Proposal Action + example: '{"tag": "InfoAction"}' + deposit: + $ref: "#/components/schemas/drep_info/items/properties/deposit" + return_address: + type: string + description: The StakeAddress index of the reward address to receive the deposit when it is repaid. + example: stake1uy6yzwsxxc28lfms0qmpxvyz9a7y770rtcqx9y96m42cttqwvp4m5 + proposed_epoch: + type: number + description: Shows the epoch at which this governance action was proposed. + example: 660 + ratified_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been ratified at the specfied epoch. + example: 670 + enacted_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been enacted at the specfied epoch. + example: 675 + dropped_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been dropped (expired/enacted) at the specfied epoch. + example: 680 + expired_epoch: + type: + - number + - 'null' + description: If not null, then this proposal has been expired at the specfied epoch. + example: 680 + expiration: + type: + - number + - 'null' + description: Shows the epoch at which this governance action is expected to expire. + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + meta_json: + $ref: "#/components/schemas/drep_metadata/items/properties/json" + meta_comment: + $ref: "#/components/schemas/drep_metadata/items/properties/comment" + meta_language: + $ref: "#/components/schemas/drep_metadata/items/properties/language" + meta_is_valid: + $ref: "#/components/schemas/drep_metadata/items/properties/is_valid" + withdrawal: + type: + - object + - 'null' + description: If not null, the amount withdrawn from treasury into stake address by this this proposal + properties: + stake_address: + $ref: "#/components/schemas/account_history/items/properties/stake_address" + amount: + type: string + example: "31235800000" + param_proposal: + description: If not null, the proposed new parameter set + type: + - object + - 'null' + example: {"key_deposit": 1000000} + voter_proposal_list: + description: List of all governance action proposals where specified credential(DRep, SPO or Committee member) has cast a vote + type: array + items: + $ref: "#/components/schemas/proposal_list/items" + proposal_votes: + type: array + description: List of all votes cast on specified governance action + items: + properties: + block_time: + $ref: "#/components/schemas/blocks/items/properties/block_time" + voter_role: + type: string + description: The role of the voter + enum: ["ConstitutionalCommittee", "DRep", "SPO"] + example: DRep + voter: + type: string + description: Voter's DRep ID (bech32 format), pool ID (bech32 format) or committee hash (hex format) + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + voter_hex: + type: string + description: Voter's DRep ID , pool ID or committee hash in hex format + example: drep1l9y2naagv0vqvft9szdt5wf94fqnxn5hdsgusdl7rf6vq4djqck + vote: + $ref: "#/components/schemas/drep_votes/items/properties/vote" + meta_url: + $ref: "#/components/schemas/drep_metadata/items/properties/url" + meta_hash: + $ref: "#/components/schemas/drep_metadata/items/properties/hash" + committee_info: + description: Current governance committee + type: object + properties: + proposal_tx_hash: + $ref: "#/components/schemas/utxo_infos/items/properties/tx_hash" + proposal_index: + $ref: "#/components/schemas/proposal_list/items/properties/proposal_index" + quorum_numerator: + type: number + example: 67 + quorum_denominator: + type: number + example: 100 + members: + description: Array of all members part of active governance committee + type: array + items: + type: object + properties: + status: + type: string + description: Member authentication status + enum: [ "authorized", "not_authorized", "resigned" ] + example: authorized + cc_cold_hex: + type: string + description: Committee member cold key hash in hex format + example: 6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf + cc_cold_has_script: + type: boolean + description: Flag which shows if this committee member cold credential is a script hash + example: false + cc_hot_hex: + type: + - string + - 'null' + description: Committee member key hash from last valid hot key authorization certificate in hex format + example: 65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472 + cc_hot_has_script: + type: + - boolean + - 'null' + description: Flag which shows if this committee member hot credential is a script hash + example: false + expiration_epoch: + type: number + description: Epoch number in which the committee member vote rights expire + example: 324 script_info: type: array items: description: Array of information for scripts properties: script_hash: - type: string + type: + - 'null' + - string description: Hash of a script example: bfa7ffa9b2e164873db6ac6d0528c82e212963bc62e10fd1d81da4af creation_tx_hash: @@ -2114,7 +2716,9 @@ schemas: description: Data in JSON format example: 'null' bytes: - type: string + type: + - string + - 'null' description: Script bytes (cborSeq) example: 5907f4010000332323232323232323233223232323232332232323232322223232533532533533355300712001323212330012233350052200200200100235001220011233001225335002101710010142325335333573466e3cd400488008d4020880080580544ccd5cd19b873500122001350082200101601510153500122002353500122002222222222200a101413357389201115554784f206e6f7420636f6e73756d6564000133333573466e1cd55cea8012400046644246600200600464646464646464646464646666ae68cdc39aab9d500a480008cccccccccc888888888848cccccccccc00402c02802402001c01801401000c008cd40508c8c8cccd5cd19b8735573aa0049000119910919800801801180f9aba150023019357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854028cd4050054d5d0a804999aa80bbae501635742a010666aa02eeb94058d5d0a80399a80a0109aba15006335014335502402275a6ae854014c8c8c8cccd5cd19b8735573aa00490001199109198008018011919191999ab9a3370e6aae754009200023322123300100300233502575a6ae854008c098d5d09aba2500223263533573805e05c05a05826aae7940044dd50009aba150023232323333573466e1cd55cea8012400046644246600200600466a04aeb4d5d0a80118131aba135744a004464c6a66ae700bc0b80b40b04d55cf280089baa001357426ae8940088c98d4cd5ce01581501481409aab9e5001137540026ae854010cd4051d71aba15003335014335502475c40026ae854008c070d5d09aba2500223263533573804e04c04a04826ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135744a00226aae7940044dd50009aba150023232323333573466e1d400520062321222230040053019357426aae79400c8cccd5cd19b875002480108c848888c008014c06cd5d09aab9e500423333573466e1d400d20022321222230010053015357426aae7940148cccd5cd19b875004480008c848888c00c014dd71aba135573ca00c464c6a66ae7008808408007c0780740704d55cea80089baa001357426ae8940088c98d4cd5ce00d80d00c80c080c89931a99ab9c4910350543500019018135573ca00226ea8004c8004d5405888448894cd40044d400c88004884ccd401488008c010008ccd54c01c4800401401000448c88c008dd6000990009aa80b111999aab9f00125009233500830043574200460066ae880080548c8c8c8cccd5cd19b8735573aa00690001199911091998008020018011919191999ab9a3370e6aae7540092000233221233001003002301735742a00466a01c02c6ae84d5d1280111931a99ab9c01b01a019018135573ca00226ea8004d5d0a801999aa803bae500635742a00466a014eb8d5d09aba2500223263533573802e02c02a02826ae8940044d55cf280089baa0011335500175ceb44488c88c008dd5800990009aa80a11191999aab9f0022500823350073355017300635573aa004600a6aae794008c010d5d100180a09aba100111220021221223300100400312232323333573466e1d4005200023212230020033005357426aae79400c8cccd5cd19b8750024800884880048c98d4cd5ce00980900880800789aab9d500113754002464646666ae68cdc39aab9d5002480008cc8848cc00400c008c014d5d0a8011bad357426ae8940088c98d4cd5ce00800780700689aab9e5001137540024646666ae68cdc39aab9d5001480008dd71aba135573ca004464c6a66ae7003803403002c4dd500089119191999ab9a3370ea00290021091100091999ab9a3370ea00490011190911180180218031aba135573ca00846666ae68cdc3a801a400042444004464c6a66ae7004404003c0380340304d55cea80089baa0012323333573466e1d40052002200523333573466e1d40092000200523263533573801a01801601401226aae74dd5000891001091000919191919191999ab9a3370ea002900610911111100191999ab9a3370ea004900510911111100211999ab9a3370ea00690041199109111111198008048041bae35742a00a6eb4d5d09aba2500523333573466e1d40112006233221222222233002009008375c6ae85401cdd71aba135744a00e46666ae68cdc3a802a400846644244444446600c01201060186ae854024dd71aba135744a01246666ae68cdc3a8032400446424444444600e010601a6ae84d55cf280591999ab9a3370ea00e900011909111111180280418071aba135573ca018464c6a66ae7004c04804404003c03803403002c0284d55cea80209aab9e5003135573ca00426aae7940044dd50009191919191999ab9a3370ea002900111999110911998008028020019bad35742a0086eb4d5d0a8019bad357426ae89400c8cccd5cd19b875002480008c8488c00800cc020d5d09aab9e500623263533573801801601401201026aae75400c4d5d1280089aab9e500113754002464646666ae68cdc3a800a400446424460020066eb8d5d09aab9e500323333573466e1d400920002321223002003375c6ae84d55cf280211931a99ab9c009008007006005135573aa00226ea800444888c8c8cccd5cd19b8735573aa0049000119aa80518031aba150023005357426ae8940088c98d4cd5ce00480400380309aab9e5001137540029309000a490350543100112212330010030021123230010012233003300200200133512233002489209366f09fe40eaaeb17d3cb6b0b61e087d664174c39a48a986f86b2b0ba6e2a7b00480008848cc00400c0088005 size: @@ -2227,4 +2831,4 @@ schemas: type: string description: Block Hash (Blake2b 32-byte hash digest, encoded in base16) example: "df5678c9774b7bc8c60a4c83b63c3676e618640ad05f7d1ee775b68939cf77d1" - example: {"slot": 59886800, "id": "df5678c9774b7bc8c60a4c83b63c3676e618640ad05f7d1ee775b68939cf77d1"} \ No newline at end of file + example: {"slot": 59886800, "id": "df5678c9774b7bc8c60a4c83b63c3676e618640ad05f7d1ee775b68939cf77d1"} diff --git a/specs/templates/api-main.yaml b/specs/templates/api-main.yaml index caadb6e5..c42901a1 100644 --- a/specs/templates/api-main.yaml +++ b/specs/templates/api-main.yaml @@ -341,12 +341,34 @@ paths: summary: UTxO Info description: Get UTxO set for requested UTxO references operationId: utxo_info - /tx_info: #RPC + /tx_cbor: #RPC post: tags: - Transactions requestBody: $ref: "#/components/requestBodies/tx_ids" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/tx_cbor" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Raw Transaction (CBOR) + description: Get raw transaction(s) in CBOR format + operationId: tx_cbor + /tx_info: #RPC + post: + tags: + - Transactions + requestBody: + $ref: "#/components/requestBodies/tx_info" responses: "200": description: Success!! @@ -1133,6 +1155,268 @@ paths: summary: Asset Transactions 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: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps List + description: List of all active delegated representatives (DReps) + operationId: drep_list + /drep_info: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_info" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Info + description: Get detailed information about requested delegated representatives (DReps) + operationId: drep_info + /drep_metadata: #RPC + post: + tags: + - Governance + requestBody: + $ref: "#/components/requestBodies/drep_id_bulk" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_metadata" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Metadata + description: List metadata for requested delegated representatives (DReps) + operationId: drep_metadata + /drep_updates: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id_optional" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_updates" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Updates + description: List of updates for requested (or all) delegated representatives (DReps) + operationId: drep_updates + /drep_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_drep_id" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/drep_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: DReps Votes + description: List of all votes casted by requested delegated representative (DRep) + operationId: drep_votes + /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: + - Governance + parameters: + - $ref: "#/components/parameters/_committee_hash" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Committee Votes + description: List of all votes casted by given committee member or collective + operationId: committee_votes + /proposal_list: #RPC + get: + tags: + - Governance + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposals List + description: List of all governance proposals + operationId: proposal_list + /voter_proposal_list: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_credential" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/proposal_list" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Voter's Proposal List + description: List of all governance proposals for specified DRep, SPO or Committee credential + operationId: proposal_votes + + /proposal_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_proposal_tx_hash" + - $ref: "#/components/parameters/_proposal_index" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/committee_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Proposal Votes + description: List of all votes cast on specified governance action + operationId: proposal_votes + /pool_list: #RPC get: tags: @@ -1378,6 +1662,28 @@ paths: summary: Pool Relays description: A list of registered relays for all pools operationId: pool_relays + /pool_votes: #RPC + get: + tags: + - Governance + parameters: + - $ref: "#/components/parameters/_pool_bech32" + responses: + "200": + description: Success!! + content: + application/json: + schema: + $ref: "#/components/schemas/pool_votes" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" + summary: Pool Votes + description: List of all votes casted by a pool + operationId: pool_votes /pool_metadata: #RPC post: tags: @@ -1530,6 +1836,7 @@ paths: summary: Datum Information description: List of datum information for given datum hashes operationId: datum_info + /ogmios: #ogmios-api post: tags: @@ -1595,6 +1902,9 @@ tags: - name: Asset description: Query Asset related informations x-tag-expanded: false + - name: Governance + description: Query information about governance for network + x-tag-expanded: false - name: Pool description: Query information about specific pools x-tag-expanded: false @@ -1631,5 +1941,5 @@ tags: - [evaluateTransaction](https://ogmios.dev/mini-protocols/local-tx-submission/#evaluating-transactions) x-tag-expanded: true security: - - [] + - {} - bearerAuth: [] diff --git a/specs/templates/example-map.json b/specs/templates/example-map.json index 9b65f6db..fd9a16de 100644 --- a/specs/templates/example-map.json +++ b/specs/templates/example-map.json @@ -42,6 +42,12 @@ "pv": "stake_test1uzs5rxys8qy5jnr9g0mkj860ms5n92nrykmrgyumpf2ytmsejj4m6", "pp": "stake_test1urkzeud48zxwnjc54emzmmc3gkg2r6d6tm2sd799jxjnqxqlfzmvk" }, + "_tx_hash": { + "m": "f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e", + "g": "bf04578d452dd3acb7c70fbac32dc972cb69f932f804171cfb4268f5af0228e7", + "pv": "f1592b29b79ae85d753913dd25644c60925a4a0683979faa33832fead4b4bd9c", + "pp": "d10133964da9e443b303917fd0b7644ae3d01c133deff85b4f59416c2d00f530" + }, "_asset_policy": { "m": "750900e4999ebe0d58f19b634768ba25e525aaf12403bfe8fe130501", "g": "313534a537bc476c86ff7c57ec511bd7f24a9d15654091b24e9c606e", @@ -66,6 +72,24 @@ "pv": "4d43", "pp": "74657374" }, + "_drep_id": { + "m": "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3", + "g": "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r", + "pv": "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts", + "pp": "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + }, + "_committee_hash": { + "m": "49fa008218cd619afe6aa8a1a93303f242440722b314f36bda2c2e23", + "g": "65d497b875c56ab213586a4006d4f6658970573ea8e2398893857472", + "pv": "7ceede7d6a89e006408e6b7c6acb3dd094b3f6817e43b4a36d01535b", + "pp": "f8f56120e1ec00feb088ece39ef14f07339afeb37b4e949ff12b89ff" + }, + "_proposal_tx_hash": { + "m": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", + "g": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", + "pv": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133", + "pp": "e61f151fcef9e99dff5c705f8d5de18891f8d1d92d69fef5ff608d2c29a7c133" + }, "_pool_bech32": { "m": "pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc", "g": "pool1xc9eywck4e20tydz4yvh5vfe0ep8whawvwz8wqkc9k046a2ypp4", @@ -170,6 +194,18 @@ "pv": "52e63f22c5107ed776b70f7b92248b02552fd08f3e747bc745099441", "pp": "82e016828989cd9d809b50d6976d9efa9bc5b2c1a78d4b3bfa1bb83b" }, + "drep_ids1": { + "m": "drep17l6sywnwqu9aedd6aumev42w39ln5zfl9nw7j4ak6u8swyrwvz3", + "g": "drep1s9qaseg7qyum807fcv0hdky9gv0c89tn98t4urjn5ewz57dml0r", + "pv": "drep13a87lnegq9a90dq4z7n864h0fsxuqsvp5ywn29ud65l5cwxlhts", + "pp": "drep1kxtwaqtayj6vklc57u93xayjvkwgvefh8drscqp5a5y6jz7m6rd" + }, + "drep_ids2": { + "m": "drep1s9q5uyddsvza4uk2n9wswy90n8wx9d2jmrq4zgcvlyv055007av", + "g": "drep13p45vxysc2s6vp6ez2ng7lynlsheh64zxexpcennn68cuc05yps", + "pv": "drep1g5vl99xcpv8uce5hhh50xe3fh68tl9f8hcprleekw0c6jhhr45f", + "pp": "drep14x62vyme8l8dkhvxg6rauc6vpcd2va9fquz8k3jstsqczwlvqqh" + }, "tx_ids_tx_hashes1": { "m": "f144a8264acf4bdfe2e1241170969c930d64ab6b0996a4a45237b623f1dd670e", "g": "bf04578d452dd3acb7c70fbac32dc972cb69f932f804171cfb4268f5af0228e7",