Source code for multiversx_sdk.abi.typesystem

from typing import Any, Sequence

from multiversx_sdk.abi.interface import ISingleValue
from multiversx_sdk.abi.multi_value import MultiValue
from multiversx_sdk.abi.optional_value import OptionalValue
from multiversx_sdk.abi.variadic_values import VariadicValues


[docs] def is_list_of_bytes(values: Sequence[Any]) -> bool: return all(is_bytes(value) for value in values)
[docs] def is_bytes(value: Any) -> bool: return isinstance(value, bytes)
[docs] def is_list_of_typed_values(values: Sequence[Any]) -> bool: return all(is_typed_value(value) for value in values)
[docs] def is_typed_value(value: Any) -> bool: return is_multi_value(value) or is_single_value(value)
[docs] def is_single_value(value: Any) -> bool: return isinstance(value, ISingleValue)
[docs] def is_multi_value(value: Any) -> bool: return isinstance(value, MultiValue) or isinstance(value, VariadicValues) or isinstance(value, OptionalValue)