llms.txt
Skip to main content

Sui Framework

Sui Framework is a default dependency set in the Package Manifest. It depends on the Standard Library and provides the Sui-specific functionality: storage operations, native types, and the modules the rest of this chapter is built on.

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 ObjectsStorage Functions
sui::tx_contextContains the TxContext struct and methods to read itTransaction Context
sui::objectDefines the UID and ID type, required for creating objectsUID and ID
sui::derived_objectAllows UID generation through key derivationUID Derivation
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 offchain listenersEvents
sui::packageDefines the Publisher type and package upgrade methodsPublisher
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

Coins and Assets

ModuleDescriptionChapter
sui::balanceThe Balance type - the underlying store of valueBalance and Coin
sui::coinThe Coin type - a transferable fungible assetBalance and Coin
sui::suiThe SUI coin typeBalance and Coin
sui::payHelper functions for splitting and merging coins-
sui::deny_listDeny list for regulated coin types-
sui::tokenThe closed-loop token standard-

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::randomThe Random object and secure onchain randomnessRandomness
sui::typesProvides a way to check if the type is a One-Time-WitnessOne Time Witness

The framework also contains modules not covered in this book: the commerce primitives (sui::kiosk, sui::transfer_policy), a set of cryptographic functions (sui::hash, sui::ed25519, sui::bls12381, and others), and assorted utilities such as sui::url and sui::versioned. Refer to the framework documentation for the full list.

Exported Addresses

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

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.

llms.txt