Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvorogme committed Oct 20, 2024
1 parent 9bb8fee commit 17fd214
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def finalize_options(self):

setup(
name="tonpy" if not IS_DEV else "tonpy-dev",
version="0.0.0.1.2c0" if not IS_DEV else "0.0.0.5.1a1",
version="0.0.0.1.2c0" if not IS_DEV else "0.0.0.5.1b1",
author="Disintar LLP",
author_email="andrey@head-labs.com",
description="Types / API for TON blockchain",
Expand Down
15 changes: 15 additions & 0 deletions src/tonpy/abi/getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, instance):
self.dton_type = 'String'
elif self.dton_type == 'Null':
self.dton_type = 'UInt8'
elif self.type == 'Bool':
self.dton_type = 'UInt8'

if self.dton_type != 'Tuple':
assert self.dton_type in supported_types, f'Unsupported ABI type {self.dton_type}'
Expand All @@ -58,6 +60,11 @@ def __init__(self, instance):
self.dton_parse_prefix = self.labels['dton_parse_prefix']

def get_columns(self):
if self.labels.get('skipLive', False):
return {}
elif self.required is not None:
return {}

if self.dton_type == 'Address':
return {
f'{self.dton_parse_prefix}{self.name}_workchain': 'Int16',
Expand Down Expand Up @@ -169,6 +176,8 @@ def parse_stack_item(self, stack_entry: StackEntry, tlb_sources) -> dict:

return {f"{self.dton_parse_prefix}{self.name}": stack_entry.get().to_boc()}
elif self.dton_type in ['UInt8', 'UInt16', 'UInt32', 'UInt64', 'UInt128', 'UInt256']:
if self.type == 'Bool':
return {f"{self.dton_parse_prefix}{self.name}": stack_entry.get() == -1}
return {
f"{self.dton_parse_prefix}{self.name}":
stack_entry.as_uint(int(self.dton_type.replace('UInt', '')))}
Expand Down Expand Up @@ -206,6 +215,8 @@ def __init__(self, instance):
def get_columns(self):
if self.method_args and len(self.method_args) > 0:
return {}
elif self.labels.get('skipLive', False):
return {}

tmp = {}

Expand Down Expand Up @@ -234,6 +245,10 @@ def parse_getters(self, tvm: TVM, tlb_sources) -> dict:
tmp = {}

for getter, stack_entry in zip(self.method_result, stack):
if getter.required is not None:
# todo: check before go
continue

try:
tmp.update(getter.parse_stack_item(stack_entry, tlb_sources))
except Exception as e:
Expand Down

0 comments on commit 17fd214

Please sign in to comment.