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.

Example

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.

Params

value: HexInput representing a sequence of Uint8 bytes

Returns

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

See

EntryFunctionBytes

Hierarchy (view full)

Implements

Constructors

Properties

value: Uint8Array

Methods

Generated using TypeDoc