Source code for pons.abi
# This is the whole point of this module.
# ruff: noqa: A001
"""Aliases for various Solidity types."""
from ._abi_types import AddressType, Bool, Bytes, Int, String, Struct, Type, UInt
_PyInt = int
[docs]
def uint(bits: _PyInt) -> UInt:
"""Returns the ``uint<bits>`` type."""
return UInt(bits)
[docs]
def int(bits: _PyInt) -> Int:
"""Returns the ``int<bits>`` type."""
return Int(bits)
[docs]
def bytes(size: None | _PyInt = None) -> Bytes:
"""Returns the ``bytes<size>`` type, or ``bytes`` if ``size`` is ``None``."""
return Bytes(size)
[docs]
def struct(**kwargs: Type) -> Struct:
"""Returns the structure type with given fields."""
return Struct(kwargs)
address: AddressType = AddressType()
"""
``address`` type.
"""
string: String = String()
"""``string`` type."""
bool: Bool = Bool()
"""``bool`` type."""