ton-http-api 2.0.59__py3-none-any.whl → 2.0.61__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyTON/main.py CHANGED
@@ -182,6 +182,20 @@ def prepare_address(address):
182
182
  except:
183
183
  raise HTTPException(status_code=416, detail="Incorrect address")
184
184
 
185
+ def prepare_hash(value):
186
+ if value is None:
187
+ return None
188
+ if len(value) == 44:
189
+ value = value.replace('_', '/').replace('-', '+')
190
+ data = codecs.decode(codecs.encode(value, 'utf-8'), 'base64')
191
+ b64 = codecs.encode(data, 'base64').decode('utf-8')
192
+ return b64.strip()
193
+ if len(value) == 64:
194
+ data = codecs.decode(codecs.encode(value, 'utf-8'), 'hex')
195
+ b64 = codecs.encode(data, 'base64').decode('utf-8')
196
+ return b64.strip()
197
+ raise ValueError('Invalid hash')
198
+
185
199
  def address_state(account_info):
186
200
  if isinstance(account_info.get("code", ""), int) or len(account_info.get("code", "")) == 0:
187
201
  if len(account_info.get("frozen_hash", "")) == 0:
@@ -453,6 +467,9 @@ async def get_block_transactions(
453
467
  """
454
468
  Get transactions of the given block.
455
469
  """
470
+ root_hash = prepare_hash(root_hash)
471
+ file_hash = prepare_hash(file_hash)
472
+ after_hash = prepare_hash(after_hash)
456
473
  return await tonlib.getBlockTransactions(workchain, shard, seqno, count, root_hash, file_hash, after_lt, after_hash)
457
474
 
458
475
  @app.get('/getBlockTransactionsExt', response_model=TonResponse, response_model_exclude_none=True, tags=['blocks','transactions'])
@@ -471,6 +488,9 @@ async def get_block_transactions_ext(
471
488
  """
472
489
  Get transactions of the given block.
473
490
  """
491
+ root_hash = prepare_hash(root_hash)
492
+ file_hash = prepare_hash(file_hash)
493
+ after_hash = prepare_hash(after_hash)
474
494
  return await tonlib.getBlockTransactionsExt(workchain, shard, seqno, count, root_hash, file_hash, after_lt, after_hash)
475
495
 
476
496
  @app.get('/getBlockHeader', response_model=TonResponse, response_model_exclude_none=True, tags=['blocks'])
@@ -486,6 +506,8 @@ async def get_block_header(
486
506
  """
487
507
  Get metadata of a given block.
488
508
  """
509
+ root_hash = prepare_hash(root_hash)
510
+ file_hash = prepare_hash(file_hash)
489
511
  return await tonlib.getBlockHeader(workchain, shard, seqno, root_hash, file_hash)
490
512
 
491
513
  @app.get('/getConfigParam', response_model=TonResponse, response_model_exclude_none=True, tags=['get config'])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ton-http-api
3
- Version: 2.0.59
3
+ Version: 2.0.61
4
4
  Summary: HTTP API for TON (The Open Network)
5
5
  Home-page: https://github.com/toncenter/ton-http-api
6
6
  Author: K-Dimentional Tree
@@ -23,7 +23,7 @@ Requires-Dist: requests==2.28.0
23
23
  Requires-Dist: ring==0.10.1
24
24
  Requires-Dist: uvicorn==0.17.6
25
25
  Requires-Dist: gunicorn==20.1.0
26
- Requires-Dist: pytonlib==0.0.64
26
+ Requires-Dist: pytonlib==0.0.67
27
27
  Requires-Dist: inject==4.3.1
28
28
  Dynamic: author
29
29
  Dynamic: author-email
@@ -1,14 +1,14 @@
1
1
  pyTON/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  pyTON/__main__.py,sha256=s38Hio4NMli_rdk4BMFsvFVjRvjn6-ue8BmrEpVAxHI,3425
3
3
  pyTON/cache.py,sha256=EmOG2sZtbQno4p40ugf9XagdmWfdCopW4eTIGCpsO9Y,1219
4
- pyTON/main.py,sha256=qYTxcSLF696ND7uHHD0IJYL5wRjXM6JHITiC_ZhGKEg,32657
4
+ pyTON/main.py,sha256=xETi_Xt41N8H0TyqPrYp-uh31N2fYV7z4qcLfHYokN8,33505
5
5
  pyTON/manager.py,sha256=1Trd_DzPs8-iXa2yxzbP529vtcqmNv60BgZWpPp5EZE,22862
6
6
  pyTON/models.py,sha256=y0qc3OLCxKCp4kcnphAQG6ytbWdz_VuqcmbbDfv8Qdk,958
7
7
  pyTON/settings.py,sha256=1_ni1WfiDDFoGLkxyMriuMJiEzSrxi8lDOt06QyeuxE,4217
8
8
  pyTON/worker.py,sha256=R6IK4ANuJowq8NfUmd8oTOxMLmJGoU9SdRu5iMl8wms,7937
9
- ton_http_api-2.0.59.dist-info/METADATA,sha256=zNK9PwCulCK_yh0uV3RBl5Fdw8Jo9y5YspfSP3NTomI,7703
10
- ton_http_api-2.0.59.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- ton_http_api-2.0.59.dist-info/entry_points.txt,sha256=SXjqOmzFEXVLM3twuvRooW5-o2F9qxuz_ReR8DR3-Ho,53
12
- ton_http_api-2.0.59.dist-info/top_level.txt,sha256=3YNL3CNQpsgajYJ8rlVECgL2taXsBxUgXSA5rJSF2RQ,6
13
- ton_http_api-2.0.59.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
14
- ton_http_api-2.0.59.dist-info/RECORD,,
9
+ ton_http_api-2.0.61.dist-info/METADATA,sha256=juOxJjsVT8Z0Gf4RRSsY5bE7FTJl2bezVXVNfThXuuE,7703
10
+ ton_http_api-2.0.61.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ ton_http_api-2.0.61.dist-info/entry_points.txt,sha256=SXjqOmzFEXVLM3twuvRooW5-o2F9qxuz_ReR8DR3-Ho,53
12
+ ton_http_api-2.0.61.dist-info/top_level.txt,sha256=3YNL3CNQpsgajYJ8rlVECgL2taXsBxUgXSA5rJSF2RQ,6
13
+ ton_http_api-2.0.61.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
14
+ ton_http_api-2.0.61.dist-info/RECORD,,