tuple_type

class TupleType(arg_types: List[Any])

Bases: algosdk.abi.base_type.ABIType

Represents a Tuple ABI Type for encoding.

Parameters

arg_types (list) – list of types in the tuple.

child_types
Type

list

byte_len()int

Return the length in bytes of the ABI type.

is_dynamic()bool

Return whether the ABI type is dynamic.

encode(values: Union[List[Any], bytes, bytearray])bytes

Encodes a list of values into a TupleType ABI bytestring.

Parameters
  • values (list | bytes | bytearray) – list of values to be encoded.

  • length of the list cannot exceed a uint16. (The) –

  • the child types are ByteType (If) –

  • bytes or bytearray can be (then) –

  • in to be encoded as well. (passed) –

Returns

encoded bytes of the tuple

Return type

bytes

decode(bytestring: Union[bytes, bytearray])list

Decodes a bytestring to a tuple list.

Parameters

bytestring (bytes | bytearray) – bytestring to be decoded

Returns

values from the encoded bytestring

Return type

list