From c75f4947e08476bc25f35e1a9e50f03bc7d1515e Mon Sep 17 00:00:00 2001 From: rdlrt <3169068+rdlrt@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:42:08 +1100 Subject: [PATCH] Add active_stake to pool_list --- files/grest/rpc/pool/pool_list.sql | 8 ++++++-- specs/results/koiosapi-guild.yaml | 8 ++++---- specs/results/koiosapi-mainnet.yaml | 8 ++++---- specs/results/koiosapi-preprod.yaml | 8 ++++---- specs/results/koiosapi-preview.yaml | 8 ++++---- specs/templates/4-api-schemas.yaml | 8 ++++---- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/files/grest/rpc/pool/pool_list.sql b/files/grest/rpc/pool/pool_list.sql index 9d267681..d7e920b1 100644 --- a/files/grest/rpc/pool/pool_list.sql +++ b/files/grest/rpc/pool/pool_list.sql @@ -14,6 +14,7 @@ RETURNS TABLE ( meta_url varchar, meta_hash text, pool_status text, + active_stake text, retiring_epoch word31type ) LANGUAGE sql STABLE @@ -48,15 +49,18 @@ AS $$ pmr.url AS meta_url, pmr.hash AS meta_hash, pic.pool_status, + pasc.amount::text AS active_stake, pic.retiring_epoch FROM grest.pool_info_cache AS pic - LEFT JOIN public.pool_hash AS ph ON ph.id = pic.pool_hash_id + INNER JOIN public.pool_hash AS ph ON ph.id = pic.pool_hash_id + LEFT JOIN grest.pool_active_stake_cache AS pasc ON pasc.pool_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 + pic.tx_id DESC, + pasc.epoch_no DESC ; $$; diff --git a/specs/results/koiosapi-guild.yaml b/specs/results/koiosapi-guild.yaml index 075252b5..bf762849 100644 --- a/specs/results/koiosapi-guild.yaml +++ b/specs/results/koiosapi-guild.yaml @@ -3043,6 +3043,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" pool_status: $ref: "#/components/schemas/pool_info/items/properties/pool_status" + active_stake: + $ref: "#/components/schemas/pool_info/items/properties/active_stake" retiring_epoch: $ref: "#/components/schemas/pool_info/items/properties/retiring_epoch" pool_history_info: @@ -3056,9 +3058,7 @@ components: description: Epoch for which the pool history data is shown example: 312 active_stake: - type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) - example: "31235800000" + $ref: "#/components/schemas/pool_info/items/properties/active_stake" active_stake_pct: type: - number @@ -3266,7 +3266,7 @@ components: type: - string - 'null' - description: Pool active stake (will be null post epoch transition until dbsync calculation is complete) + description: Amount of delegated stake to this pool at the time of epoch snapshot example: "64328627680963" sigma: type: diff --git a/specs/results/koiosapi-mainnet.yaml b/specs/results/koiosapi-mainnet.yaml index bc318a68..5d622b4e 100644 --- a/specs/results/koiosapi-mainnet.yaml +++ b/specs/results/koiosapi-mainnet.yaml @@ -3043,6 +3043,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" pool_status: $ref: "#/components/schemas/pool_info/items/properties/pool_status" + active_stake: + $ref: "#/components/schemas/pool_info/items/properties/active_stake" retiring_epoch: $ref: "#/components/schemas/pool_info/items/properties/retiring_epoch" pool_history_info: @@ -3056,9 +3058,7 @@ components: description: Epoch for which the pool history data is shown example: 312 active_stake: - type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) - example: "31235800000" + $ref: "#/components/schemas/pool_info/items/properties/active_stake" active_stake_pct: type: - number @@ -3266,7 +3266,7 @@ components: type: - string - 'null' - description: Pool active stake (will be null post epoch transition until dbsync calculation is complete) + description: Amount of delegated stake to this pool at the time of epoch snapshot example: "64328627680963" sigma: type: diff --git a/specs/results/koiosapi-preprod.yaml b/specs/results/koiosapi-preprod.yaml index c54efb05..76cd5079 100644 --- a/specs/results/koiosapi-preprod.yaml +++ b/specs/results/koiosapi-preprod.yaml @@ -3043,6 +3043,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" pool_status: $ref: "#/components/schemas/pool_info/items/properties/pool_status" + active_stake: + $ref: "#/components/schemas/pool_info/items/properties/active_stake" retiring_epoch: $ref: "#/components/schemas/pool_info/items/properties/retiring_epoch" pool_history_info: @@ -3056,9 +3058,7 @@ components: description: Epoch for which the pool history data is shown example: 312 active_stake: - type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) - example: "31235800000" + $ref: "#/components/schemas/pool_info/items/properties/active_stake" active_stake_pct: type: - number @@ -3266,7 +3266,7 @@ components: type: - string - 'null' - description: Pool active stake (will be null post epoch transition until dbsync calculation is complete) + description: Amount of delegated stake to this pool at the time of epoch snapshot example: "64328627680963" sigma: type: diff --git a/specs/results/koiosapi-preview.yaml b/specs/results/koiosapi-preview.yaml index 3f9dcd1b..b706cd4f 100644 --- a/specs/results/koiosapi-preview.yaml +++ b/specs/results/koiosapi-preview.yaml @@ -3043,6 +3043,8 @@ components: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" pool_status: $ref: "#/components/schemas/pool_info/items/properties/pool_status" + active_stake: + $ref: "#/components/schemas/pool_info/items/properties/active_stake" retiring_epoch: $ref: "#/components/schemas/pool_info/items/properties/retiring_epoch" pool_history_info: @@ -3056,9 +3058,7 @@ components: description: Epoch for which the pool history data is shown example: 312 active_stake: - type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) - example: "31235800000" + $ref: "#/components/schemas/pool_info/items/properties/active_stake" active_stake_pct: type: - number @@ -3266,7 +3266,7 @@ components: type: - string - 'null' - description: Pool active stake (will be null post epoch transition until dbsync calculation is complete) + description: Amount of delegated stake to this pool at the time of epoch snapshot example: "64328627680963" sigma: type: diff --git a/specs/templates/4-api-schemas.yaml b/specs/templates/4-api-schemas.yaml index d2f6fa97..2f7348ba 100644 --- a/specs/templates/4-api-schemas.yaml +++ b/specs/templates/4-api-schemas.yaml @@ -208,6 +208,8 @@ schemas: $ref: "#/components/schemas/pool_info/items/properties/meta_hash" pool_status: $ref: "#/components/schemas/pool_info/items/properties/pool_status" + active_stake: + $ref: "#/components/schemas/pool_info/items/properties/active_stake" retiring_epoch: $ref: "#/components/schemas/pool_info/items/properties/retiring_epoch" pool_history_info: @@ -221,9 +223,7 @@ schemas: description: Epoch for which the pool history data is shown example: 312 active_stake: - type: string - description: Amount of delegated stake to this pool at the time of epoch snapshot (in numbers) - example: "31235800000" + $ref: "#/components/schemas/pool_info/items/properties/active_stake" active_stake_pct: type: - number @@ -431,7 +431,7 @@ schemas: type: - string - 'null' - description: Pool active stake (will be null post epoch transition until dbsync calculation is complete) + description: Amount of delegated stake to this pool at the time of epoch snapshot example: "64328627680963" sigma: type: