# Move Types

## TS SDK Move Types <a href="#ts-sdk-move-types" id="ts-sdk-move-types"></a>

When developing on Endless, and specifically working with the SDK, developers often need to handle Move types serialization and deserialization. Whether is to construct a transaction payload, build a raw transaction or read BCS data.

The SDK provides a convenient Move subclasses to easily interact with move types to perform serialization or deserialization operations. Each class has a `serialize`, `serializeForEntryFunction` and `serializeForScriptFunction` methods and a `deserialize` static class.

In addition, for complex types like `Vector` the SDK supports nested serialization and deserialization.

### Move primitive types <a href="#move-primitive-types" id="move-primitive-types"></a>

Classes to handle Move primitive types:

* U8
* U16
* U32
* U64
* U128
* U256
* Bool
* AccountAddress

```js
const serializer = new Serializer();

const u8 = new U8(1);
u8.serialize(serializer);
u8.serializeForEntryFunction(serializer);
u8.serializeForScriptFunction(serializer);

const deserializer = new Deserializer(new Uint8Array(u8.value));
deserializer.deserialize(U8);
```

### Move struct types <a href="#move-struct-types" id="move-struct-types"></a>

* MoveVector
* MoveString
* MoveOption

```js
const serializer = new Serializer();

const moveString = new MoveString("hello world");
moveString.serialize(serializer);
moveString.serializeForEntryFunction(serializer);
moveString.serializeForScriptFunction(serializer);

const deserializer = new Deserializer(serializer.toUint8Array());
deserializer.deserializeStr();
```
