Пример #1
0
 def test_util_normalize_private_key(self):
     ek_pk = utils.normalize_private_key(PRIVATE_KEY_1)
     assert "0x" + ek_pk.hex() == PRIVATE_KEY_1
     assert utils.normalize_private_key(ek_pk) == ek_pk
     with pytest.raises(TypeError) as error:
         utils.normalize_private_key(0x1234)
     assert "private_key incorrect type" in str(error.value)
Пример #2
0
 def __init__(self, private_key, account_number=0, node=None):
     self.private_key = utils.normalize_private_key(private_key)
     self.account_number = account_number
     self.public_address = utils.private_key_to_address(self.private_key)
     self.session = self._init_session()
     self.eth = Eth(node=node,
                    private_key=self.private_key,
                    public_address=self.public_address,
                    account_number=self.account_number)
Пример #3
0
 def test_util_private_key_to_address(self):
     ek_pk_1 = utils.normalize_private_key(PRIVATE_KEY_1)
     ek_pk_2 = utils.normalize_private_key(PRIVATE_KEY_2)
     assert utils.private_key_to_address(ek_pk_1) == ADDRESS_1
     assert utils.private_key_to_address(ek_pk_2) == ADDRESS_2