def test_from_public_key_1(self): Network.use("mainnet") public_key = Keys("secret").get_public_key() address = Address.from_public_key(public_key) self.assertTrue(isinstance(address, bytes)) self.assertEqual(address, b"AJWRd23HNEhPLkK1ymMnwnDBX2a7QBZqff")
def test_from_secret_2(self): Network.use("mainnet") address = Address.from_secret( "secret second test to be sure it works correctly") self.assertTrue(isinstance(address, bytes)) self.assertEqual(address, b"AQSqYnjmwj1GBL5twD4K9EBXDaTHZognox")
def generate(cls, votes, secret, second_secret=None, fee=None): """ Creates a vote transaction :param votes: votes (list) :param secret: secret passphrase (string or bytes) :param second_secret: second secret passphrase (string or bytes) :param fee: fee for transaction :return: (Vote) """ self = cls(fee, _error_use_class_method=False) self._sender_public_key = Keys(secret).get_public_key() self._recipient_id = Address.from_secret(secret) self._asset["votes"] = votes self.sign(secret, second_secret) return self
def test_validate_2(self): Network.use("mainnet") self.assertFalse(Address.validate("totally not valid address"))
def test_validate_1(self): Network.use("mainnet") self.assertTrue(Address.validate("AQSqYnjmwj1GBL5twD4K9EBXDaTHZognox"))
def test_from_secret_1(self): Network.use("mainnet") address = Address.from_secret("secret") self.assertTrue(isinstance(address, bytes)) self.assertEqual(address, b"AJWRd23HNEhPLkK1ymMnwnDBX2a7QBZqff")