Skip to content

feat: add optional pparams argument to deposit methods #291

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

Merged
merged 1 commit into from
Mar 12, 2025
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
16 changes: 8 additions & 8 deletions cardano_clusterlib/query_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,24 +277,24 @@ def get_stake_addr_info(self, stake_addr: str) -> structs.StakeAddrInfo:
vote_delegation=vote_delegation,
)

def get_address_deposit(self) -> int:
def get_address_deposit(self, pparams: dict[str, tp.Any] | None = None) -> int:
"""Return stake address deposit amount."""
pparams = self.get_protocol_params()
pparams = pparams or self.get_protocol_params()
return pparams.get("stakeAddressDeposit") or 0

def get_pool_deposit(self) -> int:
def get_pool_deposit(self, pparams: dict[str, tp.Any] | None = None) -> int:
"""Return stake pool deposit amount."""
pparams = self.get_protocol_params()
pparams = pparams or self.get_protocol_params()
return pparams.get("stakePoolDeposit") or 0

def get_drep_deposit(self) -> int:
def get_drep_deposit(self, pparams: dict[str, tp.Any] | None = None) -> int:
"""Return DRep deposit amount."""
pparams = self.get_protocol_params()
pparams = pparams or self.get_protocol_params()
return pparams.get("dRepDeposit") or 0

def get_gov_action_deposit(self) -> int:
def get_gov_action_deposit(self, pparams: dict[str, tp.Any] | None = None) -> int:
"""Return governance action deposit amount."""
pparams = self.get_protocol_params()
pparams = pparams or self.get_protocol_params()
return pparams.get("govActionDeposit") or 0

def get_stake_distribution(self) -> dict[str, float]:
Expand Down
6 changes: 3 additions & 3 deletions cardano_clusterlib/transaction_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def get_tx_deposit(self, tx_files: structs.TxFiles) -> int:
return 0

pparams = self._clusterlib_obj.g_query.get_protocol_params()
key_deposit = pparams.get("stakeAddressDeposit") or 0
pool_deposit = pparams.get("stakePoolDeposit") or 0
drep_deposit = pparams.get("dRepDeposit") or 0
key_deposit = self._clusterlib_obj.g_query.get_address_deposit(pparams=pparams)
pool_deposit = self._clusterlib_obj.g_query.get_pool_deposit(pparams=pparams)
drep_deposit = self._clusterlib_obj.g_query.get_drep_deposit(pparams=pparams)

deposit = 0
for cert in tx_files.certificate_files:
Expand Down
Loading