0x0::url

Module of the UrlDomain

Used to associate a URL with Collection or Nft.add

Interoperability functions are delegated to the display_ext module.

Structs

url::UrlDomain has store

Fields:

Name Type Description
url url::Url

Domain for storing an associated URL

Changes are replicated to ComposableUrl domain as URL base for NFTs.

url::Witness has drop

Witness used to authenticate witness protected endpoints

Methods

public fun new(url: url::Url): url::UrlDomain

Creates new UrlDomain with a URL

public fun set_url<C>(
    witness: witness::Witness<C>,
    nft: &mut nft::Nft<C>,
    url: url::Url,
)

Sets URL of UrlDomain

Need to ensure that UrlDomain is updated with attributes if they exist therefore function cannot be public.

Panics

Panics if UrlDomain does not exist on Nft

public fun set_collection_url<C>(
    _witness: witness::Witness<C>,
    collection: &mut collection::Collection<C>,
    url: url::Url,
)

Sets URL of UrlDomain

Panics

Panics if UrlDomain does not exist on Collection

public fun has_url<C>(nft: &nft::Nft<C>): bool

Returns whether UrlDomain is registered on Nft

public fun has_collection_url<C>(
    collection: &collection::Collection<C>,
): bool

Returns whether UrlDomain is registered on Collection

public fun borrow_url<C>(nft: &nft::Nft<C>): 
    &url::Url

Borrows UrlDomain from Nft

Panics

Panics if UrlDomain is not registered on the Nft

public fun borrow_collection_url<C>(
    collection: &collection::Collection<C>,
): &url::Url

Borrows UrlDomain from Collection

Panics

Panics if UrlDomain is not registered on the Collection

public fun add_url_domain<C, W>(
    witness: &W,
    nft: &mut nft::Nft<C>,
    url: url::Url,
)

Adds UrlDomain to Nft

Need to ensure that UrlDomain is updated with attributes if they exist therefore function cannot be public.

Panics

Panics if UrlDomain domain already exists

public fun add_url_domain_delegated<C>(
    witness: witness::Witness<C>,
    nft: &mut nft::Nft<C>,
    url: url::Url,
)

Adds UrlDomain to Nft

Need to ensure that UrlDomain is updated with attributes if they exist therefore function cannot be public.

Panics

Panics if UrlDomain domain already exists

public fun add_collection_url_domain<C, W>(
    witness: &W,
    collection: &mut collection::Collection<C>,
    url: url::Url,
)

Adds UrlDomain to Collection

Panics

Panics if UrlDomain domain already exists

public fun add_collection_url_domain_delegated<C>(
    witness: witness::Witness<C>,
    collection: &mut collection::Collection<C>,
    url: url::Url,
)

Adds UrlDomain to Collection

Panics

Panics if UrlDomain domain already exists

public fun assert_url<C>(nft: &nft::Nft<C>)

Asserts that UrlDomain is registered on Nft

Panics

Panics if UrlDomain is not registered

public fun assert_collection_url<C>(
    collection: &collection::Collection<C>,
)

Asserts that UrlDomain is registered on Nft

Panics

Panics if UrlDomain is not registered