From 812bfebaab0e30ec4fb00e886f8c5d23aff8d7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Tue, 12 Nov 2019 00:51:21 +0100 Subject: [PATCH] Provide a potential explanation to StakingWallet.UnknownAccount exception --- nucypher/blockchain/eth/actors.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nucypher/blockchain/eth/actors.py b/nucypher/blockchain/eth/actors.py index affab0868..b0ea21a41 100644 --- a/nucypher/blockchain/eth/actors.py +++ b/nucypher/blockchain/eth/actors.py @@ -1138,7 +1138,7 @@ class StakeHolder(Staker): def balances(self) -> Dict[str, int]: balances = dict() for account in self.accounts: - funds = {'ETH': self.blockchain.client.get_balance(account), # TODO: EthAgent or something? #1509 + funds = {'ETH': self.blockchain.client.get_balance(account), 'NU': self.token_agent.get_balance(account)} balances.update({account: funds}) return balances @@ -1165,7 +1165,9 @@ class StakeHolder(Staker): # If an initial address was passed, # it is safe to understand that it has already been used at a higher level. if initial_address not in self.wallet: - raise self.StakingWallet.UnknownAccount + message = f"Account {initial_address} is not known by this Ethereum client. Is it a HW account? " \ + f"If so, make sure that your device is plugged in and you use the --hw-wallet flag." + raise self.StakingWallet.UnknownAccount(message) self.assimilate(checksum_address=initial_address, password=password) @validate_checksum_address @@ -1218,4 +1220,4 @@ class StakeHolder(Staker): """ stake = sum(self.staking_agent.owned_tokens(staker_address=account) for account in self.wallet.accounts) nu_stake = NU.from_nunits(stake) - return nu_stake \ No newline at end of file + return nu_stake