Skip to content

Commit

Permalink
Merge pull request #173 from saratomaz/update_get_stake_vkey_hash
Browse files Browse the repository at this point in the history
update get_stake_vkey_hash to accept stake vkey as input
  • Loading branch information
mkoura committed Apr 4, 2023
2 parents 4f93fea + 8bcf8f7 commit ed33f5f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cardano_clusterlib/stake_address_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,27 @@ def gen_stake_addr_and_keys(

def get_stake_vkey_hash(
self,
stake_vkey_file: FileType,
stake_vkey_file: Optional[FileType] = None,
stake_vkey: Optional[str] = None,
) -> str:
"""Return the hash of a stake address key.
Args:
stake_vkey_file: A path to stake vkey file.
stake_vkey_file: A path to stake vkey file (optional).
stake_vkey: A stake vkey (Bech32, optional).
Returns:
str: A generated hash.
"""
if stake_vkey:
cli_args = ["--stake-verification-key", stake_vkey]
elif stake_vkey_file:
cli_args = ["--stake-verification-key-file", str(stake_vkey_file)]
else:
raise AssertionError("Either `stake_vkey` or `stake_vkey_file` is needed.")

return (
self._clusterlib_obj.cli(
["stake-address", "key-hash", "--stake-verification-key-file", str(stake_vkey_file)]
)
self._clusterlib_obj.cli(["stake-address", "key-hash", *cli_args])
.stdout.rstrip()
.decode("ascii")
)
Expand Down

0 comments on commit ed33f5f

Please sign in to comment.