Represents a contiguous sequence of already serialized BCS bytes.

This class differs from most other Serializable classes in that its internal byte buffer is serialized to BCS bytes exactly as-is, without prepending the length of the bytes. It is ideal for scenarios where custom serialization is required, such as passing serialized bytes as transaction arguments. Additionally, it serves as a representation of type-agnostic BCS bytes, akin to a vector.

An example use case includes handling bytes resulting from entry function arguments that have been serialized for an entry function.

const yourCustomSerializedBytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
const fixedBytes = new FixedBytes(yourCustomSerializedBytes);
const payload = await generateTransactionPayload({
function: "0xbeefcafe::your_module::your_function_that_requires_custom_serialization",
functionArguments: [yourCustomBytes],
});

This class is particularly useful when you want to handle a fixed-size byte array without the overhead of
length prepending, such as when dealing with 32-byte addresses stored as U8 in a MoveVector<U8>.

For example, if you store each of the 32 bytes for an address as a U8 in a MoveVector<U8>, when you
serialize that MoveVector<U8>, it will be serialized to 33 bytes. If you solely want to pass around
the 32 bytes as a Serializable class that *does not* prepend the length to the BCS-serialized representation,
use this class.*

HexInput representing a sequence of Uint8 bytes.

A Serializable FixedBytes instance, which when serialized, does not prepend the length of the bytes.

EntryFunctionBytes

Hierarchy (view full)

Implements

Constructors

Methods

  • Converts the BCS-serialized bytes of a value into a Hex instance. This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.

    Returns Hex

    A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.

  • Returns the hex string representation of the Serializable value with the 0x prefix.

    Returns string

    the hex formatas a string prefixed by 0x.

  • Deserializes a fixed-length byte array from the provided deserializer. This function helps in reconstructing a FixedBytes object from the serialized data.

    Parameters

    • deserializer: Deserializer

      The deserializer instance used to read the byte data.

    • length: number

      The length of the byte array to be deserialized.

    Returns FixedBytes

Properties

value: Uint8Array