Skip to content

Releases: yungwine/pytoniq

pytoniq v0.1.40

08 Oct 07:57
Compare
Choose a tag to compare

What's Changed

  • Fixed creation of Wallets (issue #34)

Full Changelog: v0.1.39...v0.1.40

pytoniq v0.1.39

21 Jun 04:09
ea967cd
Compare
Choose a tag to compare

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: v0.1.38...v0.1.39

pytoniq v0.1.38

16 May 06:12
Compare
Choose a tag to compare

What's Changed

  • Add new mainnet init block, since global config has been changed.

  • Add context managers for LiteClient and LiteBalancer so one can now do:

    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.

pytoniq v0.1.37

10 May 05:29
Compare
Choose a tag to compare

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.

pytoniq v0.1.35

10 Apr 15:47
71f301f
Compare
Choose a tag to compare

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. 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.
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.

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:  ....