TL

Serialization

The library has implementation of automatic serialization/deserialization of TL - Type Language Schemes. To serialize some data provide Scheme and dict with arguments:

schemas = TlGenerator(tl_schemas_path).generate()
data = {'id': {'workchain': -1, 'shard': -9223372036854775808, 'seqno': 31345573, 'root_hash': 'b5e0693a6c3f344098941376bd2709e656252bda21699ff39c4de3953469bc8e', 'file_hash': 'a1e1154fb86bd6e4db623c6bbf902cbe6e2a8e6c126062b6b6911f5585c9c17a'}}
serialized_data_bytes = schemas.serialize(schemas.get_by_name('liteServer.getBlock'), data)

BlockId

For convenience there are 2 TL schemes wrappers: BlockId and BlockIdExt

They have to_dict and from_dict methods. BlockIdExt also has to_bytes and from_bytes methods, __repr__, __eq__ and __hash__ magic methods.

Last updated