Skip to content

createCollection(________________________________)

MarcoDotIO edited this page Jun 26, 2023 · 2 revisions

createCollection(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)

Creates a new token collection using the given parameters.

public func createCollection(
        _ creator: Account,
        _ description: String,
        _ maxSupply: Int,
        _ name: String,
        _ uri: String,
        _ mutableDescription: Bool,
        _ mutableRoyalty: Bool,
        _ mutableUri: Bool,
        _ mutableTokenDescription: Bool,
        _ mutableTokenName: Bool,
        _ mutableTokenProperties: Bool,
        _ mutableTokenUri: Bool,
        _ tokensBurnableByCreator: Bool,
        _ tokensFreezableByCreator: Bool,
        _ royaltyNumerator: Int,
        _ royaltyDenominator: Int
    )

The function generates a transaction payload using the createCollectionPayload method with the provided parameters. It then submits this payload to a client to create a new token collection. The function operates asynchronously and returns the result of the transaction submission.

Note: This function is marked with the async keyword, which means it returns a future that represents a result that is produced at some point in the future. When you call a function that’s marked with the async keyword, you need to use the await keyword.

Parameters

  • creator: The account to be used to create the collection.
  • description: The description of the new token collection.
  • maxSupply: The maximum supply of tokens in the collection.
  • name: The name of the new token collection.
  • uri: The URI for the token collection.
  • mutableDescription: A boolean flag indicating whether the description of the token collection can be changed after creation.
  • mutableRoyalty: A boolean flag indicating whether the royalty of the token collection can be changed after creation.
  • mutableUri: A boolean flag indicating whether the URI of the token collection can be changed after creation.
  • mutableTokenDescription: A boolean flag indicating whether the description of a token in the collection can be changed after creation.
  • mutableTokenName: A boolean flag indicating whether the name of a token in the collection can be changed after creation.
  • mutableTokenProperties: A boolean flag indicating whether the properties of a token in the collection can be changed after creation.
  • mutableTokenUri: A boolean flag indicating whether the URI of a token in the collection can be changed after creation.
  • tokensBurnableByCreator: A boolean flag indicating whether tokens in the collection can be burned by the creator.
  • tokensFreezableByCreator: A boolean flag indicating whether tokens in the collection can be frozen by the creator.
  • royaltyNumerator: The numerator of the royalty fraction.
  • royaltyDenominator: The denominator of the royalty fraction.

Throws

This function throws an error if creating the payload, signing the transaction, or submitting the transaction fails.

Returns

A String that represents the response from the transaction submission to create a new token collection.

Types
Protocols
Global Variables
Global Functions
Extensions
Clone this wiki locally