TVM value types
Telegram Open Network Virtual Machine has 7 value types:
- Integer
- Cell
- Tuple
- Null
- Slice
- Builder
- Continuation
This library is collection of utilits for handling those types.
Cell and Slice
tvm_valuetypes.cell has class Cell and functions to work with cells:
deserialize_boc, cell.serialize_boc, cell.serialize_to_object, cell.serialize_to_json, deserialize_cell_from_json
from tvm_valuertypes.cell import Cell, deserialize_boc
serialized_cell = bytes.fromhex("B5EE9C72410102010007000102000100024995C5FE15")
cell1 = deserialize_boc(serialized_c1)
cell1
serialization_with_index = cell1.serialize_boc(has_idx=True, hash_crc32=True, has_cache_bits=False, flags=0 )
serialization_with_index
cell2 = deserialize_boc(serialized_c2)
cell2 == cell1
cell2.serialize_to_object()
HashMaps (Dictionaries)
Cell may represent special 'virtual' value type, HashMap, which can be used for storing key-value container in the Cell.
tvm_valuetypes.dict_utils has special method parse_hashmap for dealing with hashmaps. Note the difference between Hashmap and HashmapE.
from tvm_valuertypes.cell import Cell
from tvm_valuertypes.dict_utils import parse_hashmap
test_dict = bytes.fromhex("B5EE9C7241010A01002D00020120010202014803040003FC0202014805060003F5FE02014807080003DB24020120090900035FF800030020CB8CA892")
dict_cell = deserialize_boc(test_dict)
parsed_dict = {}
parse_hashmap(dict_cell, 8, parsed_dict)
parsed_dict
Metadata
Release files for tvm-valuetypes 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tvm_valuetypes-0.0.12.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tvm_valuetypes-0.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / tvm_valuetypes-0.0.12.tar.gz
| Download URL | tvm_valuetypes-0.0.12.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f9304126be99e30ecb827e68e6e36e1620b8dc6a781dca1b0fdcc1e31d70983
|
|
BLAKE2b-256 checksum How to use checksums |
968c6e856cf86ab94363333d3e3e1a3754f0c56694fab7a7c8b328493eaef00d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / tvm_valuetypes-0.0.12-py3-none-any.whl
| Download URL | tvm_valuetypes-0.0.12-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4af62baebdcc8864a1f4aac40082f3221f1e4232f79b8dfb7411d7c78856880
|
|
BLAKE2b-256 checksum How to use checksums |
0c58d98de1ffd588dcf5cda8c9d105b5949aa66c69cb3af7d0a25bae679536c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|