Skip to main content

Module sui::display_registry

Struct DisplayRegistry

The root of display, to enable derivation of addresses.
The address is system-generated at 0xd

public struct DisplayRegistry has key
Click to open
Fields

Struct SystemMigrationCap

A singleton capability object to enable migrating all V1 displays into V2.

public struct SystemMigrationCap has key
Click to open
Fields

Struct Display

This is the struct that holds the display values for a type T.

public struct Display<phantom T> has key
Click to open
Fields
id: sui::object::UID
fields: sui::vec_map::VecMap<std::string::String, std::string::String>
All the (key,value) entries for a given display object.
cap_id: std::option::Option<sui::object::ID>
The capability object ID. It's Option because legacy Displays will need claiming.

Struct DisplayCap

The capability object that is used to manage the display.

public struct DisplayCap<phantom T> has key, store
Click to open
Fields

Struct DisplayKey

The key used for deriving the instance of Display.

public struct DisplayKey<phantom T> has copy, drop, store

Constants

This is a multi-sig address responsible for the migration of V1 displays into V2.

const SYSTEM_MIGRATION_ADDRESS: address = 0x80e8249451c1a94b0d4ec317d9dd040f11344dcce6f917218086caf2bb1d7bdd;
#[error]
const ENotSystemAddress: vector<u8> = b"This is only callable from system address.";
#[error]
const EDisplayAlreadyExists: vector<u8> = b"Display for the supplied type already exists.";
#[error]
const ECapAlreadyClaimed: vector<u8> = b"Cap for this display object has already been claimed.";
#[error]
const ENotValidPublisher: vector<u8> = b"The publisher is not valid for the supplied type.";
#[error]
const EFieldDoesNotExist: vector<u8> = b"Field does not exist in the display.";
#[error]
const ECapNotClaimed: vector<u8> = b"Cap for this display object has not been claimed so you cannot delete the legacy display yet.";

Function new

Create a new Display object for a given type T using internal::Permit to prove type ownership.

Function new_with_publisher

Create a new display object using the Publisher object.

Function unset

Unset a key from display.

Function set

Set a value for the specified key, replaces existing value if it exists.

Function clear

Clear the display vec_map, allowing a fresh re-creation of fields

Function share

Share the Display object to finalize the creation.

Function claim

Allow a legacy Display holder to claim the capability object.

Function claim_with_publisher

Allow claiming a new display using Publisher as proof of ownership.

Function system_migration

Allow the SystemMigrationCap holder to create display objects with supplied values. The migration is performed once on launch of the DisplayRegistry, further migrations will have to be performed for each object, and will only be possible until legacy display methods are finally deprecated.

Function migrate_v1_to_v2

Enables migrating legacy display into the new one, if a new one has not yet been created.

Function destroy_system_migration_cap

Destroy the SystemMigrationCap after successfully migrating all V1 instances.

Function transfer_migration_cap

Function delete_legacy

Allow deleting legacy display objects, as long as the cap has been claimed first.

Function fields

Get a reference to the fields of display.

Function cap_id

Get the cap ID for the display.

Function migration_cap_receiver

public(package) fun migration_cap_receiver(): address

Function new_display

Function create

Create a new display registry object callable only from 0x0 (end of epoch)