Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --drep-script-hash option for drep retirement and drep state query #243

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cardano_clusterlib/conway_gov_drep_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def gen_retirement_cert(
self,
cert_name: str,
deposit_amt: int,
drep_script_hash: str = "",
drep_vkey: str = "",
drep_vkey_file: tp.Optional[itp.FileType] = None,
drep_key_hash: str = "",
Expand All @@ -252,6 +253,7 @@ def gen_retirement_cert(
Args:
cert_name: A name of the cert.
deposit_amt: A key registration deposit amount.
drep_script_hash: DRep script hash (hex-encoded, optional).
drep_vkey: DRep verification key (Bech32 or hex-encoded, optional).
drep_vkey_file: Filepath of the DRep verification key (optional).
drep_key_hash: DRep verification key hash
Expand All @@ -266,6 +268,7 @@ def gen_retirement_cert(
clusterlib_helpers._check_files_exist(out_file, clusterlib_obj=self._clusterlib_obj)

cred_args = self._get_cred_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
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
Loading