Serializes a Serializable
value to its BCS representation.
This function is the TypeScript SDK equivalent of bcs::to_bytes
in Move.
the BCS representation of the Serializable instance as a byte buffer.
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.
A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.
Check if the MoveOption has a value.
Returns true if there is exactly one value in the MoveOption.
Retrieves the inner value of the MoveOption.
This method is inspired by Rust's Option<T>.unwrap()
, where attempting to unwrap a None
value results in a panic.
This method will throw an error if the value is not present.
The contained value if present.
Static
BoolFactory method to generate a MoveOptionboolean
or undefined
.
Optional
value: null | booleanthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
MoveFactory method to generate a MoveOptionstring
or undefined
.
Optional
value: null | stringthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U128Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U16Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U256Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U32Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U64Factory method to generate a MoveOptionnumber
or a bigint
or undefined
.
Optional
value: null | AnyNumberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Static
U8Factory method to generate a MoveOptionnumber
or undefined
.
Optional
value: null | numberthe value used to fill the MoveOption. If value
is undefined
the resulting MoveOption's .isSome() method will return false.
a MoveOptionvalue
Serialize an argument to BCS-serialized bytes.
The serializer instance used for serialization.
Serialize an argument to BCS-serialized bytes. 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.
The serializer used to convert the argument.
Optional
value: null | TReturns the hex string representation of the Serializable
value with the 0x prefix.
the hex formatas a string prefixed by 0x
.
Returns the hex string representation of the Serializable
value without the 0x prefix.
the hex format as a string without 0x
prefix.
Static
deserialize
Represents an argument for entry functions, providing methods to serialize the argument to BCS-serialized bytes and convert it to different formats.