Skip to content

Commit 72fc598

Browse files
Include get stake pool vote
1 parent 260bd8d commit 72fc598

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

cardano_clusterlib/query_group.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -723,26 +723,28 @@ def __repr__(self) -> str:
723723
return f"<{self.__class__.__name__}: clusterlib_obj={id(self._clusterlib_obj)}>"
724724

725725
def get_stake_pool_default_vote(
726-
self,
727-
spo_vkey: str = "",
728-
spo_vkey_file: itp.FileType | None = None,
729-
spo_key_hash: str = "",
730-
) -> dict[str, tp.Any]:
731-
"""Get the default governance vote setting for a stake pool.
732-
733-
Works with SPO verification key, key file, or key hash.
734-
"""
726+
self,
727+
spo_vkey: str = "",
728+
spo_vkey_file: itp.FileType | None = None,
729+
spo_key_hash: str = "",
730+
) -> str:
731+
"""Get the default governance vote setting for a stake pool."""
735732
if spo_vkey:
736733
cred_args = ["--spo-verification-key", str(spo_vkey)]
737734
elif spo_vkey_file:
738735
cred_args = ["--spo-verification-key-file", str(spo_vkey_file)]
739736
elif spo_key_hash:
740737
cred_args = ["--spo-key-hash", str(spo_key_hash)]
741738
else:
742-
msg = "One of `spo_vkey`, `spo_vkey_file`, or `spo_key_hash` must be provided."
739+
msg = "Must provide one of spo_vkey, spo_vkey_file, or spo_key_hash"
743740
raise AssertionError(msg)
744741

745-
out: dict[str, tp.Any] = (
746-
json.loads(self.query_cli(["stake-pool-default-vote", *cred_args])) or {}
747-
)
748-
return out
742+
raw_output = self.query_cli(["stake-pool-default-vote", *cred_args]).strip()
743+
744+
if raw_output.startswith('"') and raw_output.endswith('"'):
745+
try:
746+
return json.loads(raw_output)
747+
except Exception:
748+
return raw_output.strip('"')
749+
return raw_output
750+

0 commit comments

Comments
 (0)