_algopy_testing.state.box

Module Contents

Classes

Box

Box abstracts the reading and writing of a single value to a single box.

BoxRef

BoxRef abstracts the reading and writing of boxes containing raw binary data.

BoxMap

BoxMap abstracts the reading and writing of a set of boxes using a common key and content type.

API

class Box(
type_: type[_algopy_testing.state.box._TValue],
/,
*,
key: bytes | str | algopy.Bytes | algopy.String = '',
)

Bases: typing.Generic[_algopy_testing.state.box._TValue]

Box abstracts the reading and writing of a single value to a single box.

The box size will be reconfigured dynamically to fit the size of the value being assigned to it.

Initialization

class BoxRef(/, *, key: bytes | str | algopy.Bytes | algopy.String = '')

BoxRef abstracts the reading and writing of boxes containing raw binary data.

The size is configured manually, and can be set to values larger than what the AVM can handle in a single value.

Initialization

class BoxMap(
key_type: type[_algopy_testing.state.box._TKey],
value_type: type[_algopy_testing.state.box._TValue],
/,
*,
key_prefix: bytes | str | algopy.Bytes | algopy.String | None = None,
)

Bases: typing.Generic[_algopy_testing.state.box._TKey, _algopy_testing.state.box._TValue]

BoxMap abstracts the reading and writing of a set of boxes using a common key and content type.

Each composite key (prefix + key) still needs to be made available to the application via the boxes property of the Transaction.

Initialization