Exemple #1
0
    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")
Exemple #2
0
    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")
Exemple #3
0
    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
Exemple #4
0
 def test_validate_2(self):
     Network.use("mainnet")
     self.assertFalse(Address.validate("totally not valid address"))
Exemple #5
0
 def test_validate_1(self):
     Network.use("mainnet")
     self.assertTrue(Address.validate("AQSqYnjmwj1GBL5twD4K9EBXDaTHZognox"))
Exemple #6
0
    def test_from_secret_1(self):
        Network.use("mainnet")
        address = Address.from_secret("secret")

        self.assertTrue(isinstance(address, bytes))
        self.assertEqual(address, b"AJWRd23HNEhPLkK1ymMnwnDBX2a7QBZqff")