diff --git a/nucypher/blockchain/eth/agents.py b/nucypher/blockchain/eth/agents.py index 858b609ee..b3338ccd1 100644 --- a/nucypher/blockchain/eth/agents.py +++ b/nucypher/blockchain/eth/agents.py @@ -231,6 +231,9 @@ class StakingEscrowAgent(EthereumContractAgent): at_period = self.contract.functions.getCurrentPeriod().call() return self.contract.functions.lockedPerPeriod(at_period).call() + def get_staker_info(self, staker_address: str): + return self.contract.functions.stakerInfo(staker_address).call() + def get_locked_tokens(self, staker_address: str, periods: int = 0) -> int: """ Returns the amount of tokens this staker has locked @@ -241,7 +244,8 @@ class StakingEscrowAgent(EthereumContractAgent): return self.contract.functions.getLockedTokens(staker_address, periods).call() def owned_tokens(self, staker_address: str) -> int: - return self.contract.functions.getAllTokens(staker_address).call() + staker_info = self.get_staker_info(staker_address) + return staker_info[0] def get_substake_info(self, staker_address: str, stake_index: int) -> Tuple[int, int, int]: first_period, *others, locked_value = self.contract.functions.getSubStakeInfo(staker_address, stake_index).call() diff --git a/nucypher/cli/painting.py b/nucypher/cli/painting.py index 80460f0bc..41143a763 100644 --- a/nucypher/cli/painting.py +++ b/nucypher/cli/painting.py @@ -512,7 +512,7 @@ def paint_stakers(emitter, stakers: List[str], agent) -> None: nickname, _ = nickname_from_seed(staker) emitter.echo(f"{staker} {'Nickname:':10} {nickname}") tab = " " * len(staker) - info = agent.contract.functions.stakerInfo(staker).call() + info = agent.get_staker_info(staker) stake, confirmed1, confirmed2, restake, *remaining_info = info locked_restake_until_period, worker, worker_start, last_active = remaining_info last_confirmed_period = max(confirmed1, confirmed2)