mirror of https://github.com/nucypher/nucypher.git
parent
9ae408056d
commit
5ca663ef3f
|
@ -1390,7 +1390,6 @@ class StakeHolder(Staker):
|
||||||
self.__get_accounts()
|
self.__get_accounts()
|
||||||
if checksum_address not in self:
|
if checksum_address not in self:
|
||||||
raise self.UnknownAccount
|
raise self.UnknownAccount
|
||||||
# TODO: What if cached TransactingPower is wrongly initialized? See issue #1385
|
|
||||||
try:
|
try:
|
||||||
transacting_power = self.__transacting_powers[checksum_address]
|
transacting_power = self.__transacting_powers[checksum_address]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
|
@ -166,11 +166,10 @@ def stake(click_config,
|
||||||
allocation_registry = None
|
allocation_registry = None
|
||||||
initial_address = staking_address
|
initial_address = staking_address
|
||||||
|
|
||||||
dummy_password = "Look Away, I'm Hideous" # TODO: See #1385
|
|
||||||
STAKEHOLDER = stakeholder_config.produce(initial_address=initial_address,
|
STAKEHOLDER = stakeholder_config.produce(initial_address=initial_address,
|
||||||
allocation_registry=allocation_registry,
|
allocation_registry=allocation_registry)
|
||||||
password=dummy_password)
|
|
||||||
blockchain = BlockchainInterfaceFactory.get_interface(provider_uri=provider_uri) # Eager connection
|
blockchain = BlockchainInterfaceFactory.get_interface(provider_uri=provider_uri) # Eager connection
|
||||||
|
|
||||||
economics = STAKEHOLDER.economics
|
economics = STAKEHOLDER.economics
|
||||||
|
|
||||||
# Dynamic click types (Economics)
|
# Dynamic click types (Economics)
|
||||||
|
|
|
@ -19,6 +19,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||||
import inspect
|
import inspect
|
||||||
from typing import List, Tuple, Optional
|
from typing import List, Tuple, Optional
|
||||||
|
|
||||||
|
from eth_utils import to_checksum_address
|
||||||
from constant_sorrow.constants import NO_BLOCKCHAIN_CONNECTION
|
from constant_sorrow.constants import NO_BLOCKCHAIN_CONNECTION
|
||||||
from hexbytes import HexBytes
|
from hexbytes import HexBytes
|
||||||
from umbral import pre
|
from umbral import pre
|
||||||
|
@ -123,8 +124,19 @@ class TransactingPower(CryptoPowerUp):
|
||||||
self.blockchain = BlockchainInterfaceFactory.get_or_create_interface(provider_uri=provider_uri)
|
self.blockchain = BlockchainInterfaceFactory.get_or_create_interface(provider_uri=provider_uri)
|
||||||
self.__account = account
|
self.__account = account
|
||||||
|
|
||||||
# TODO: Is there a better way to design this Flag? See #1385
|
# TODO: Temporary fix for #1128 and #1385. It's ugly af, but it works. Move somewhere else?
|
||||||
self.device = True if not password else False
|
try:
|
||||||
|
wallets = self.blockchain.client.wallets
|
||||||
|
except AttributeError:
|
||||||
|
is_from_hw_wallet = False
|
||||||
|
else:
|
||||||
|
HW_WALLET_URL_PREFIXES = ('trezor', 'ledger')
|
||||||
|
hw_accounts = [w['accounts'] for w in wallets if w['url'].startswith(HW_WALLET_URL_PREFIXES)]
|
||||||
|
hw_addresses = [to_checksum_address(account['address']) for sublist in hw_accounts for account in sublist]
|
||||||
|
is_from_hw_wallet = account in hw_addresses
|
||||||
|
|
||||||
|
self.device = is_from_hw_wallet
|
||||||
|
|
||||||
|
|
||||||
self.__password = password
|
self.__password = password
|
||||||
self.__unlocked = False
|
self.__unlocked = False
|
||||||
|
|
Loading…
Reference in New Issue