applications.abi | Algorand Developer Portal

applications.abi

Attributes

ABIValue
ABIStruct
Arc56ReturnValueType
ABIType
ABIArgumentType

Classes

ABIReturn Represents the return value from an ABI method call.
BoxABIValue Represents an ABI value stored in a box.

Functions

get_arc56_value(→ Arc56ReturnValueType) Gets the ARC-56 formatted return value from an ABI return.
get_abi_encoded_value(→ bytes) Encodes a value according to its ABI type.
get_abi_decoded_value(→ ABIValue) Decodes a value according to its ABI type.
get_abi_tuple_from_abi_struct(→ list[Any]) Converts an ABI struct to a tuple representation.
get_abi_tuple_type_from_abi_struct_definition(…) Creates a TupleType from a struct definition.
get_abi_struct_from_abi_tuple(→ dict[str, Any]) Converts a decoded tuple to an ABI struct.

Module Contents

type algokit*utils.applications.abi.ABIValue = bool | int | str | bytes | bytearray | list['ABIValue'] | tuple['ABIValue'] | dict[str, 'ABIValue']_

type algokit*utils.applications.abi.ABIStruct = dict[str, list[dict[str, 'ABIValue']]]_

type algokit*utils.applications.abi.Arc56ReturnValueType = ABIValue | ABIStruct | None_

type algokit*utils.applications.abi.ABIType = algosdk.abi.ABIType_

type algokit*utils.applications.abi.ABIArgumentType = algosdk.abi.ABIType | algosdk.abi.ABITransactionType | algosdk.abi.ABIReferenceType_

class algokit_utils.applications.abi.ABIReturn(result: algosdk.atomic_transaction_composer.ABIResult)

Represents the return value from an ABI method call.

Wraps the raw return value and decoded value along with any decode errors.

raw_value: bytes | None_ = None_

The raw return value from the method call

value: ABIValue | None_ = None_

The decoded return value from the method call

method: algosdk.abi.method.Method | None_ = None_

The ABI method definition

decode_error: Exception | None_ = None_

The exception that occurred during decoding, if any

tx_info: dict[str, Any] | None_ = None_

The transaction info for the method call from raw algosdk ABIResult

property is_success: bool_

Returns True if the ABI call was successful (no decode error)

get_arc56_value(method: algokit_utils.applications.app_spec.arc56.Method | algosdk.abi.method.Method, structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField ]) → Arc56ReturnValueType

Gets the ARC-56 formatted return value.

algokit_utils.applications.abi.get_arc56_value(abi_return: ABIReturn, method: algokit_utils.applications.app_spec.arc56.Method | algosdk.abi.method.Method, structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField ]) → Arc56ReturnValueType

Gets the ARC-56 formatted return value from an ABI return.

algokit_utils.applications.abi.get_abi_encoded_value(value: Any, type_str: str, structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField ]) → bytes

Encodes a value according to its ABI type.

algokit_utils.applications.abi.get_abi_decoded_value(value: bytes | int | str, type_str: str | ABIArgumentType, structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField ]) → ABIValue

Decodes a value according to its ABI type.

algokit_utils.applications.abi.get_abi_tuple_from_abi_struct(struct_value: dict[str, Any], struct_fields: list[ algokit_utils.applications.app_spec.arc56.StructField], structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField]) → list[Any]

Converts an ABI struct to a tuple representation.

algokit_utils.applications.abi.get_abi_tuple_type_from_abi_struct_definition(struct_def: list[ algokit_utils.applications.app_spec.arc56.StructField], structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField]) → algosdk.abi.TupleType

Creates a TupleType from a struct definition.

algokit_utils.applications.abi.get_abi_struct_from_abi_tuple(decoded_tuple: Any, struct_fields: list[ algokit_utils.applications.app_spec.arc56.StructField], structs: dict[str, list[ algokit_utils.applications.app_spec.arc56.StructField]) → dict[str, Any]

Converts a decoded tuple to an ABI struct.

class algokit_utils.applications.abi.BoxABIValue

Represents an ABI value stored in a box.

name: algokit_utils.models.state.BoxName_

The name of the box

value: ABIValue_

The ABI value stored in the box