This class exists to represent a contiguous sequence of already serialized BCS-bytes.

It 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.

If you want to write your own serialization function and pass the bytes as a transaction argument, you should use this class.

This class is also more generally used to represent type-agnostic BCS bytes as a vector.

An example of this is the 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],
});

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.

value: 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

Properties

value: Uint8Array

Methods

  • Serializes a Serializable value to its BCS representation. This function is the Typescript SDK equivalent of bcs::to_bytes in Move.

    Returns Uint8Array

    the BCS representation of the Serializable instance as a byte buffer

  • Helper function to get a value's BCS-serialized bytes as a Hex instance.

    Returns Hex

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

  • Serialize an argument to BCS-serialized bytes.

    Parameters

    Returns void

  • Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains the number of the following bytes followed by the BCS-serialized bytes for a typed argument.

    Parameters

    Returns void

  • Serialize an argument to BCS-serialized bytes as a type aware byte sequence. The byte sequence contains an enum variant index followed by the BCS-serialized bytes for a typed argument.

    Parameters

    Returns void

  • Parameters

    Returns FixedBytes