Initializes a new instance of the class with an optional value. This constructor sets up the internal vector based on the provided value.
The initial value to be stored in the vector, or null to initialize an empty vector.
Serializes the current object using the provided serializer. This function will serialize the value if it is present.
The serializer instance used to perform the serialization.
Serializes the current instance into a byte sequence suitable for entry functions. This allows the data to be properly formatted for transmission or storage.
The serializer instance used to serialize the byte sequence.
Serialize the string as a fixed byte string without the length prefix for use in a script function.
The serializer used to convert the byte vector into a format suitable for a script function.
Static
BoolFactory method to generate a MoveVectorboolean
or undefined
.
This method allows you to create an optional boolean value that can be used in various contexts where a boolean may or may
not be present.
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome() method
will return false.
A MoveVectorvalue
.
Static
deserializeDeserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.
NOTE: This only works with a depth of one. Generics will not work.
NOTE: This will not work with types that aren't of the Serializable class.
If you're looking for a more flexible deserialization function, you can use the deserializeVector function in the Deserializer class.
the Deserializer instance to use, with bytes loaded into it already.
the class to typecast the input values to, must be a Serializable and Deserializable type.
a MoveVector of the corresponding class T
Static
MoveFactory method to generate a MoveVectorstring
or undefined
.
This function creates a MoveVector that encapsulates a MoveString if the provided value is not null or undefined.
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome() method
will return false.
A MoveVectorvalue
.
Static
U128Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined, the resulting MoveVector's .isSome()
method will return false.
A MoveVectorvalue
.
Static
U16Factory method to generate a MoveOptionnumber
or null
.
This method allows you to create a MoveVector that can either hold a U16 value or be empty.
The value used to fill the MoveVector. If value
is null or undefined, the resulting MoveVector's
.isSome()
method will return false.
A MoveVectorvalue
.
Static
U256Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined or null,
the resulting MoveVector's .isSome() method will return false.
A MoveVectorvalue
.
Static
U32Factory method to generate a MoveVectornumber
or null
.
This method allows you to create a MoveVector that can either hold a U32 value or be empty.
The value used to fill the MoveVector. If value
is null or undefined,
the resulting MoveVector's .isSome() method will return false.
A MoveVectorvalue
.
Static
U64Factory method to generate a MoveVector
The value used to fill the MoveVector. If value
is undefined or null, the resulting MoveVector's
.isSome()
method will return false.
A MoveVectorvalue
.
Static
U8Factory method to generate a MoveVectornumber
or undefined
.
This method allows you to create a MoveVector that encapsulates a U8 value, enabling you to handle optional U8 values effectively.
The values used to fill the MoveVector. If values
is undefined or null, the resulting MoveVector's
.isSome()
method will return false.
A MoveVectorvalue
.
This class is the Aptos Typescript SDK representation of a Move
vector<T>
, whereT
represents either a primitive type (bool
,u8
,u64
, ...) or a BCS-serializable struct itself.It is a BCS-serializable, array-like type that contains an array of values of type
T
, whereT
is a class that implementsSerializable
.The purpose of this class is to facilitate easy construction of BCS-serializable Move
vector<T>
types.Example
Params
values: an Array of values where T is a class that implements Serializable
Returns
a
MoveVector<T>
with the valuesvalues