Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

🔑owner_cap

Struct CloneableOwnerCap

When you want to prove you own something.

The pattern of usage: Authorize with what_for UID value of the resource and assert what_for from the resource's module. In this case [clone] is useful to allow multiple addresses or multiple concurrent txs.

Important

The generic parameter T is a phantom type that is used to distinguish between different things that can be owned.

a. T has drop then [CloneableOwnerCap] can be created only by giving T b. T has store then [CloneableOwnerCap] can be created by giving &T and associated [UID].

Fields

id: sui::object::UIDwhat_for: sui::object::IDID of the resource controlled by this capability.inner: nexus_primitives::owner_cap::OwnerCap<T>Some packages might not care about the what_for field, so they accept [OwnerCap]. This allows us to emulate Rust's AsRef trait. Similar pattern for [sui::coin] and [sui::balance].

Struct OwnerCap

When you want to prove you own something.

The pattern of usage: Store the [OwnerCap] ID in a resource and assert from the resource's module that the sender has the right [OwnerCap]'s ID.

Important

The generic parameter T is a phantom type that is used to distinguish between different things that can be owned. Anyone with a reference to [T] can create an [OwnerCap] with its generic.

Fields

unique: sui::object::ID

Constants

Function new_uncloneable

Creates a non-cloneable ownership capability with a fresh unique ID. Anyone holding a reference to T can mint one.

Function new_cloneable_drop

Creates cloneable authority over what_for from a consumable role witness.

Function new_cloneable_key

Creates cloneable authority over an object after verifying its UID.

Function clone

Creates a new [CloneableOwnerCap] with the same what_for.

Function clone_n

Creates N new [CloneableOwnerCap]s with the same what_for.

Function clone_for_receiver

Creates a new [CloneableOwnerCap] with the same what_for and transfers it to the given address.

Function destroy

Destroys a cloneable capability and drops its inner authority token.

Function id

The capability's unique ID.

Function what_for

The ID of the resource this capability owns.

Function is_for

Whether this capability owns the given object.

Function is_for_id

Whether this capability owns the resource with the given ID.

Function as_ref

Borrows the inner non-cloneable OwnerCap for APIs that care about authority identity but not resource binding. This provides the same view-style pattern used to expose narrower coin or balance capabilities.

Last updated