Exemple #1
0
    def add_account(self, private_key, password=None):
        # TODO: validation
        self.validator.validate_inbound_private_key(private_key)
        raw_private_key = self.normalizer.normalize_inbound_private_key(private_key)
        raw_account = private_key_to_address(raw_private_key)
        account = self.normalizer.normalize_outbound_account(raw_account)
        if any((is_same_address(account, value) for value in self.get_accounts())):
            raise ValidationError("Account already present in account list")

        self.backend.add_account(raw_private_key)
        self._account_passwords[raw_account] = password
        # TODO: outbound normalization
        return account
Exemple #2
0
 def add_account(self, private_key):
     account = private_key_to_address(private_key)
     self.alloc = self.alloc + ((account, _get_default_account_data()), )
Exemple #3
0
 def add_account(self, private_key):
     account = private_key_to_address(private_key)
     self.evm.extra_accounts[account] = private_key
def test_private_key_to_address(private_key, expected):
    actual = private_key_to_address(private_key)
    assert actual == expected