Sui Framework

Sui Framework is a default dependency set in the Package Manifest. It depends on the Standard Library and provides Sui-specific features, including the interaction with the storage, and Sui-specific native types and modules.

For convenience, we grouped the modules in the Sui Framework into multiple categories. But they're still part of the same framework.

Core

ModuleDescriptionChapter
sui::addressAdds conversion methods to the address typeAddress
sui::transferImplements the storage operations for ObjectsIt starts with an Object
sui::tx_contextContains the TxContext struct and methods to read itTransaction Context
sui::objectDefines the UID and ID type, required for creating objectsIt starts with an Object
sui::clockDefines the Clock type and its methodsEpoch and Time
sui::dynamic_fieldImplements methods to add, use and remove dynamic fieldsDynamic Fields
sui::dynamic_object_fieldImplements methods to add, use and remove dynamic object fieldsDynamic Object Fields
sui::eventAllows emitting events for off-chain listenersEvents
sui::packageDefines the Publisher type and package upgrade methodsPublisher, Package Upgrades
sui::displayImplements the Display object and ways to create and update itDisplay

Collections

ModuleDescriptionChapter
sui::vec_setImplements a set typeCollections
sui::vec_mapImplements a map with vector keysCollections
sui::tableImplements the Table type and methods to interact with itDynamic Collections
sui::linked_tableImplements the LinkedTable type and methods to interact with itDynamic Collections
sui::bagImplements the Bag type and methods to interact with itDynamic Collections
sui::object_tableImplements the ObjectTable type and methods to interact with itDynamic Collections
sui::object_bagImplements the ObjectBag type and methods to interact with itDynamic Collections

Utilities

ModuleDescriptionChapter
sui::bcsImplements the BCS encoding and decoding functionsBinary Canonical Serialization
sui::borrowImplements the borrowing mechanic for borrowing by valueHot Potato
sui::hexImplements the hex encoding and decoding functions-
sui::typesProvides a way to check if the type is a One-Time-WitnessOne Time Witness

Exported Addresses

Sui Framework exports two named addresses: sui = 0x2 and std = 0x1 from the std dependency.

[addresses]
sui = "0x2"

# Exported from the MoveStdlib dependency
std = "0x1"

Implicit Imports

Just like with Standard Library, some of the modules and types are imported implicitly in the Sui Framework. This is the list of modules and types that are available without explicit use import:

  • sui::object
  • sui::object::ID
  • sui::object::UID
  • sui::tx_context
  • sui::tx_context::TxContext
  • sui::transfer

Source Code

The source code of the Sui Framework is available in the Sui repository.