From 006a8ed7a3419a93ab81c2e8fe21b94065c5e445 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Wed, 12 Mar 2025 12:35:11 +0100 Subject: [PATCH] feat(transaction): add governance action deposit handling - Added retrieval of governance action deposit in TransactionGroup. - Updated deposit calculation to include governance proposal files. --- cardano_clusterlib/transaction_group.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cardano_clusterlib/transaction_group.py b/cardano_clusterlib/transaction_group.py index 5eb3fb3..4c77ef2 100644 --- a/cardano_clusterlib/transaction_group.py +++ b/cardano_clusterlib/transaction_group.py @@ -152,8 +152,10 @@ def get_tx_deposit(self, tx_files: structs.TxFiles) -> int: 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) + action_deposit = self._clusterlib_obj.g_query.get_gov_action_deposit(pparams=pparams) deposit = 0 + for cert in tx_files.certificate_files: with open(cert, encoding="utf-8") as in_json: content = json.load(in_json) @@ -172,6 +174,13 @@ def get_tx_deposit(self, tx_files: structs.TxFiles) -> int: elif "DRep Retirement" in description: deposit -= drep_deposit + for prop in tx_files.proposal_files: + with open(prop, encoding="utf-8") as in_json: + content = json.load(in_json) + ptype = content.get("type", "") + if "Governance proposal" in ptype: + deposit += action_deposit + return deposit def build_raw_tx_bare( # noqa: C901