Skip to main content

Work with PropertyMap Off-Chain

The Aptos token standard uses the PropertyMap module to store on-chain properties of tokens. PropertyMap maps a string key to a property value on-chain, which stores the value in Binary Canonical Serialization (BCS) format and its type. Currently, only primitive types (bool, u8, u64, u128, address and String) are supported in PropertyMap.

With both the value and typing, PropertyMap can be used to read and write values of heterogeneous types in a map data structure on-chain.

Read and write property map using TS SDK

Our TypeScript SDK supports reading and writing to PropertyMap from TypeScript directly. This saves you from knowing the details of BCS serialization.

To generate the BCS data for creating tokens on-chain, use getPropertyValueRaw. This method handles the serialization of TypeScript data into BCS format.

To read property maps returned by the API, use deserializePropertyMap; it deserializes the data from API and creates the TypeScript class property map.