Pytoniq

Latest version: v0.1.40

Safety actively analyzes 682387 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.1.40

What's Changed

* Fixed creation of Wallets (issue 34)


**Full Changelog**: https://github.com/yungwine/pytoniq/compare/v0.1.39...v0.1.40

0.1.39

What's Changed
* `LiteClient` now throws error and closes connection when the TCP socket is dead. Before it generated giant amount of logs `Connection reset by peer`
* `LiteBalancer` now detects and reconnects to the peer which TCP socket is dead.
* Fixed `LiteBalancer.last_mc_block`
* Fixed `IndexError: list index out of range` when starting up `LiteBalancer` with all liteservers were not working.



**Full Changelog**: https://github.com/yungwine/pytoniq/compare/v0.1.38...v0.1.39

0.1.38

What's Changed

* Add new mainnet init block, since global config [has been changed](https://ton.org/global-config.json).
* Add context managers for `LiteClient` and `LiteBalancer` so one can now do:

python
async with LiteClient.from_mainnet_config(5, 2) as client:
print(await client.get_config_params([1]))

* Update `pytoniq-core`'s version in requirements since there is fix for config params keys deserialising.

0.1.37

What's Changed

`LiteBalancer`

* `inited` now is created in constructor and changes to `True` on `start_up()` and changes to `False` on `close_all()`.
* add `last_mc_block` param which returns last masterchain block all alive peers know.
* add `peers_num`, `alive_peers_num` and `archival_peers_num` methods.

`LiteClient`

* `get_libraries` method now can accept any amount of libraries hashes and will split them into 16-element chunks by itself.

0.1.35

What's Changed

getAllShardsInfo

* add new proof checking in `get_all_shards_info` since the proof system has been changed.

Get Methods

* rename `run_get_method` to `run_get_method_remote`
* `run_get_method` now returns `run_get_method_remote` result, in future may be changed to `run_get_method_local`. Please explicitly specify `run_get_method_remote` in your code if you want to execute methods remotely.
* add `run_get_method_local` which downloads contract's state and executes tvm locally via [pytvm](https://github.com/yungwine/pytvm). Now one can run get methods which require more gas amount, providing `gas_limit` param. Executing get method locally is also critically important if you don't trust LiteServer, since result of a remote method execution is unprovable.

New LiteServer methods

* add `get_out_msg_queue_sizes` method which returns sizes of outboundary queues for specified shard or for all shards.
python
sh = await client.get_out_msg_queue_sizes()
print(len(sh['shards']) - 1, 'shards')
for i in sh['shards']:
print(f"{i['id']['workchain']}:{hex(i['id']['shard']& 0xffffffffffffffff).replace('0x', '')} - {i['size']}")

output:
4 shards
-1:8000000000000000 - 0
0:2000000000000000 - 253
0:6000000000000000 - 153
0:a000000000000000 - 61
0:e000000000000000 - 119

* add _nonfinal_ LiteServer methods `nonfinal_get_validator_groups` and `nonfinal_get_candidate`.

To use these methods one need to use LiteServer which is at the same time a validator and pass flag `--nonfinal-ls` to `ExecStart` node command. Then use `nonfinal_get_validator_groups` method to get `BlockIdExt` and then pass it to other LiteServer _raw_ methods or use `nonfinal_get_candidate` method which returns block data and collated data.




python
resp = await client.nonfinal_get_validator_groups(0, -6917529027641081856)
print(resp)
blk = BlockIdExt.from_dict(resp['groups'][0]['candidates'][0]['id']['block_id'])
print(blk)
print(await client.raw_get_block_transactions_ext(blk))
print(await client.nonfinal_raw_get_candidate(resp['groups'][0]['candidates'][0]['id']))
print(await client.nonfinal_get_candidate(resp['groups'][0]['candidates'][0]['id']))

output:
{'type': 'liteServer.nonfinal.validatorGroups', 'groups': [{'next_block_id': {'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738991, 'type': 'tonNode.blockId'}, 'cc_seqno': 253643, 'prev': [{'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738990, 'root_hash': '1424b1412ee3658190ccef95483e6e694093e721bac67fca0e7afb15fde132be', 'file_hash': 'eae1435e89c768892b4ab286e58b9723bedbb6004adcba1192d82d527aca0616'}], 'candidates': [{'id': {'block_id': {'workchain': 0, 'shard': -6917529027641081856, 'seqno': 19738991, 'root_hash': 'ea860f329c4660be305ccf5e0e94630db67f6e4396509d751dace1f11915f09d', 'file_hash': '07bee68a49a69e6145ad9693d827e11800e5c346387009f83e273a8620758eca', 'type': 'tonNode.blockIdExt'}, 'creator': '6c2b768957e1501deaaf424bd2dafb6ddbe2ecc7794659f8d4c548420261a18c', 'collated_data_hash': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'type': 'liteServer.nonfinal.candidateId'}, 'available': True, 'approved_weight': 14, 'signed_weight': 0, 'total_weight': 15}]}]}
<TL BlockIdExt [wc=0, shard=-6917529027641081856, seqno=19738991, root_hash=ea860f329c4660be305ccf5e0e94630db67f6e4396509d751dace1f11915f09d, file_hash=07bee68a49a69e6145ad9693d827e11800e5c346387009f83e273a8620758eca] >
[< Tl-B Transaction account_addr: b'\x80\xdc"\x8f\xec ....
{'type': 'liteServer.nonfinal.candidate', 'id': {'block_id': {'wor
< Tl-B Block global_id: -3 info: < Tl-B BlockInfo version: ....

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.