0x0::svg

Module of the SvgDomain

Used to associate SVG data with Collection or Nft.

Composable NFTs with children registering SvgDomain can declare them with ComposableSvgDomain to compose all SVG data into one definition.

Structs

svg::SvgDomain has store

Fields:

Name Type Description
svg vector<u8>

Domain for storing an associated SVG data

svg::Witness has drop

Witness used to authenticate witness protected endpoints

Methods

public fun new(svg: vector<u8>): svg::SvgDomain

Creates new SvgDomain

public fun set_svg<C>(
    _witness: witness::Witness<C>,
    nft: &mut nft::Nft<C>,
    svg: vector<u8>,
)

Sets SVG data of SvgDomain

ComposableSvgDomain will not be automatically updated and composable_svg::regenerate must be called

Panics

Panics if SvgDomain does not exist on Nft

public fun set_collection_svg<C>(
    _witness: witness::Witness<C>,
    collection: &mut collection::Collection<C>,
    svg: vector<u8>,
)

Sets SVG data of SvgDomain

Panics

Panics if SvgDomain does not exist on Collection

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

Returns whether SvgDomain is registered on Nft

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

Returns whether SvgDomain is registered on Collection

public fun borrow_svg<C>(nft: &nft::Nft<C>): 
    &vector<u8>

Borrows SVG data from Nft

Panics

Panics if SvgDomain is not registered on the Nft

public fun borrow_collection_svg<C>(
    collection: &collection::Collection<C>,
): &vector<u8>

Borrows SVG data from Collection

Panics

Panics if SvgDomain is not registered on the Collection

public fun add_domain<C>(
    _witness: witness::Witness<C>,
    nft: &mut nft::Nft<C>,
    svg: vector<u8>,
)

Adds SvgDomain to Nft

ComposableSvgDomain will not be automatically updated so composable_svg::compose and composable_svg::regenerate must be called.

Panics

Panics if SvgDomain domain already exists

public fun add_domain_collection<C>(
    _witness: witness::Witness<C>,
    collection: &mut collection::Collection<C>,
    svg: vector<u8>,
)

Adds SvgDomain to Collection

Panics

Panics if SvgDomain domain already exists

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

Asserts that SvgDomain is registered on Nft

Panics

Panics if SvgDomain is not registered

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

Asserts that SvgDomain is registered on Nft

Panics

Panics if SvgDomain is not registered