Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ABI Type names #176

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pyteal/ast/abi/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ def map(self, mapFn: Callable[[T, Expr, T], Expr]) -> Expr:
mappedArray.load(),
)

def __str__(self) -> str:
return self._valueType.__str__() + (
"[]"
if self._props.static_length is None
else "[{}]".format(self._props.static_length)
)


Array.__module__ = "pyteal"

Expand Down
3 changes: 3 additions & 0 deletions pyteal/ast/abi/tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ def length(self) -> Expr:
def __getitem__(self, index: int) -> "TupleElement":
return TupleElement(self, index)

def __str__(self) -> str:
return "({})".format(",".join(map(lambda x: x.__str__(), self.valueTypes)))


Tuple.__module__ = "pyteal"

Expand Down
4 changes: 4 additions & 0 deletions pyteal/ast/abi/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ def encode(self) -> Expr:
def decode(self, encoded: Expr, offset: Expr, length: Expr) -> Expr:
pass

@abstractmethod
def __str__(self) -> str:
pass


Type.__module__ = "pyteal"
3 changes: 3 additions & 0 deletions pyteal/ast/abi/uint.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def get(self) -> Expr:
def set(self, value: Union[int, Expr]) -> Expr:
pass

def __str__(self) -> str:
return "uint{}".format(self.bit_size)


class Uint16(Uint):
def __init__(
Expand Down