Skip to content

Commit

Permalink
Add drep script hash option for drep query group
Browse files Browse the repository at this point in the history
  • Loading branch information
nabinpkl committed Jun 17, 2024
1 parent dfc2dfd commit 11dde38
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cardano_clusterlib/conway_gov_query_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ def __init__(self, clusterlib_obj: "itp.ClusterLib") -> None:

def _get_key_args(
self,
drep_script_hash: str = "",
drep_vkey: str = "",
drep_vkey_file: tp.Optional[itp.FileType] = None,
drep_key_hash: str = "",
) -> tp.List[str]:
"""Get arguments for verification key."""
if drep_vkey:
"""Get arguments for script or verification key."""
if drep_script_hash:
key_args = ["--drep-script-hash", str(drep_script_hash)]
elif drep_vkey:
key_args = ["--drep-verification-key", str(drep_vkey)]
elif drep_vkey_file:
key_args = ["--drep-verification-key-file", str(drep_vkey_file)]
Expand Down Expand Up @@ -60,6 +63,7 @@ def gov_state(self) -> tp.Dict[str, tp.Any]:

def drep_state(
self,
drep_script_hash: str = "",
drep_vkey: str = "",
drep_vkey_file: tp.Optional[itp.FileType] = None,
drep_key_hash: str = "",
Expand All @@ -69,6 +73,7 @@ def drep_state(
When no key is provided, query all DReps.
Args:
drep_script_hash: DRep script hash (hex-encoded, optional).
drep_vkey: DRep verification key (Bech32 or hex-encoded).
drep_vkey_file: Filepath of the DRep verification key.
drep_key_hash: DRep verification key hash (either Bech32-encoded or hex-encoded).
Expand All @@ -77,6 +82,7 @@ def drep_state(
List[List[Dict[str, Any]]]: DRep state.
"""
key_args = self._get_key_args(
drep_script_hash=drep_script_hash,
drep_vkey=drep_vkey,
drep_vkey_file=drep_vkey_file,
drep_key_hash=drep_key_hash,
Expand All @@ -91,6 +97,7 @@ def drep_state(

def drep_stake_distribution(
self,
drep_script_hash: str = "",
drep_vkey: str = "",
drep_vkey_file: tp.Optional[itp.FileType] = None,
drep_key_hash: str = "",
Expand All @@ -100,6 +107,7 @@ def drep_stake_distribution(
When no key is provided, query all DReps.
Args:
drep_script_hash: DRep script hash (hex-encoded, optional).
drep_vkey: DRep verification key (Bech32 or hex-encoded).
drep_vkey_file: Filepath of the DRep verification key.
drep_key_hash: DRep verification key hash (either Bech32-encoded or hex-encoded).
Expand All @@ -108,6 +116,7 @@ def drep_stake_distribution(
List[List[Dict[str, Any]]]: DRep stake distribution.
"""
key_args = self._get_key_args(
drep_script_hash=drep_script_hash,
drep_vkey=drep_vkey,
drep_vkey_file=drep_vkey_file,
drep_key_hash=drep_key_hash,
Expand Down

0 comments on commit 11dde38

Please sign in to comment.