from fetchai.ledger.crypto.address import Address from fetchai.ledger.crypto.entity import Entity from fetchai.ledger.crypto.identity import Identity from fetchai.ledger.serialisation import transaction, bytearray from fetchai.ledger.serialisation.sha256 import sha256_hex from fetchai.ledger.transaction import Transaction _PRIVATE_KEYS = ( '1411d53f88e736eac7872430dbe5b55ac28c17a3e648c388e0bd1b161ab04427', '3436c184890d498b25bc2b5cb0afb6bad67379ebd778eae1de40b6e0f0763825', '4a56a19355f934174f6388b3c80598abb151af79c23d5a7af45a13357fb71253', 'f9d67ec139eb7a1cb1f627357995847392035c1e633e8530de5ab5d04c6e9c33', '80f0e1c69e5f1216f32647c20d744c358e0894ebc855998159017a5acda208ba', ) ENTITIES = [Entity.from_hex(x) for x in _PRIVATE_KEYS] IDENTITIES = [Identity(x) for x in ENTITIES] def _calculate_integer_stream_size(length: int) -> int: if length < 0x80: return 1 elif length < 0x100: return 2 elif length < 0x1000: return 4 else: return 8 class TransactionSerialisation(unittest.TestCase):
def test_conversion_from_hex(self): ref = Entity() other = Entity.from_hex(ref.private_key_hex) self.assertEqual(ref.private_key, other.private_key)