Skip to content

Commit

Permalink
Fix threshold retrieve in tx-service mode (#410)
Browse files Browse the repository at this point in the history
* Fix threshold retrieve in tx-service mode

* Refresh safe info after execute transaction

* Update src/safe_cli/operators/safe_tx_service_operator.py

Co-authored-by: Uxío <Uxio0@users.noreply.github.com>

---------

Co-authored-by: Uxío <Uxio0@users.noreply.github.com>
  • Loading branch information
moisses89 and Uxio0 committed Jun 14, 2024
1 parent bebbba2 commit b405271
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/safe_cli/operators/safe_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def add_owner(self, new_owner: str, threshold: Optional[int] = None) -> bool:
).build_transaction({"from": self.address, "gas": 0, "gasPrice": 0})
if self.execute_safe_internal_transaction(transaction["data"]):
self.safe_cli_info.owners = self.safe.retrieve_owners()
self.safe_cli_info.threshold = threshold
self.safe_cli_info.threshold = self.safe.retrieve_threshold()
return True
return False

Expand All @@ -519,7 +519,7 @@ def remove_owner(self, owner_to_remove: str, threshold: Optional[int] = None):
).build_transaction({"from": self.address, "gas": 0, "gasPrice": 0})
if self.execute_safe_internal_transaction(transaction["data"]):
self.safe_cli_info.owners = self.safe.retrieve_owners()
self.safe_cli_info.threshold = threshold
self.safe_cli_info.threshold = self.safe.retrieve_threshold()
return True
return False

Expand Down Expand Up @@ -760,7 +760,7 @@ def change_threshold(self, threshold: int):
).build_transaction({"from": self.address, "gas": 0, "gasPrice": 0})

if self.execute_safe_internal_transaction(transaction["data"]):
self.safe_cli_info.threshold = threshold
self.safe_cli_info.threshold = self.safe.retrieve_threshold()

def enable_module(self, module_address: str):
if module_address in self.safe_cli_info.modules:
Expand Down
4 changes: 3 additions & 1 deletion src/safe_cli/operators/safe_tx_service_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ def execute_tx(self, safe_tx_hash: Sequence[bytes]) -> bool:
)
)
else:
return self.execute_safe_transaction(safe_tx)
if executed := self.execute_safe_transaction(safe_tx):
self.refresh_safe_cli_info()
return executed

def get_balances(self):
balances = self.safe_tx_service.get_balances(self.address)
Expand Down

0 comments on commit b405271

Please sign in to comment.