From 11b8dacf284c24db56c0f43beab0eb3584da8fd7 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Tue, 13 Aug 2024 13:41:44 +0200 Subject: [PATCH] chore: can unstake method --- operate/services/protocol.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/operate/services/protocol.py b/operate/services/protocol.py index 78e1d4e4e..7c6c6cba0 100644 --- a/operate/services/protocol.py +++ b/operate/services/protocol.py @@ -1174,6 +1174,21 @@ def staking_status(self, service_id: int, staking_contract: str) -> StakingState staking_contract=staking_contract, ) + def can_unstake(self, service_id: int, staking_contract: str) -> bool: + """Can unstake the service?""" + try: + StakingManager( + key=self.wallet.key_path, + password=self.wallet.password, + chain_type=self.chain_type, + ).check_if_unstaking_possible( + service_id=service_id, + staking_contract=staking_contract, + ) + return True + except ValueError: + return False + def get_swap_data(self, service_id: int, multisig: str, owner_key: str) -> t.Dict: """Swap safe owner.""" # TODO: Discuss implementation