Skip to content

Conversation

whankinsiv
Copy link
Collaborator

This PR adds the following 6 /governance/dreps endpoint handlers utilizing the recently expanded drep_state:

  • /governance/dreps: list all DReps
  • /governance/dreps/{drep_id}: return extended DRep info (retired/expired status, total delegation, etc.).
  • /governance/dreps/{drep_id}/delegators: list delegators and amounts.
  • /governance/dreps/{drep_id}/metadata: return metadata info (anchor URL, hash, fetched JSON metadata).
  • /governance/dreps/{drep_id}/updates: list registration, update, and deregistration history.
  • /governance/dreps/{drep_id}/votes: list votes with transaction hashes and cert indexes.

Additional changes:

  • Added TxHash type alias for [u8; 32] in /common/types.rs and replaced direct usages.

Signed-off-by: William Hankins <william@sundae.fi>
…8; 32]

Signed-off-by: William Hankins <william@sundae.fi>
Signed-off-by: William Hankins <william@sundae.fi>
}
};

let amount = (sum + response.info.deposit).to_string();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd this should include deposit but I'm going to assume you have a BF spec that says so :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a mistake on my end. Deposit removed from delegated amount in commit bbbfbfb.

&self,
stake_keys: &[Vec<u8>],
) -> Option<HashMap<Vec<u8>, u64>> {
let accounts = self.stake_addresses.lock().unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to consider whether it is the live stake or one of the snapshots here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see all StateQuery requests include a block or epoch number so that we can guarantee the returned state is consistent for aggregated REST responses. Should this be addressed in this PR or as a follow-up?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do that as a followup

@@ -35,7 +35,7 @@ references:
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
pub struct TxOutput {
/// Tx hash
pub tx_hash: Vec<u8>,
pub tx_hash: TxHash,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this tied down!

Signed-off-by: William Hankins <william@sundae.fi>
@sandtreader
Copy link
Collaborator

You've got conflicts from Eric's PR now (sorry) but ready to merge when fixed I think.

Signed-off-by: William Hankins <william@sundae.fi>
@sandtreader sandtreader merged commit a8020d0 into main Aug 29, 2025
2 checks passed
@sandtreader sandtreader deleted the whankinsiv/drep-blockfrost-endpoints branch August 29, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants