Skip to content

createCollectionPayload(______________________________)

MarcoDotIO edited this page Jun 26, 2023 · 2 revisions

createCollectionPayload(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)

Constructs a TransactionPayload for creating a new token collection.

public func createCollectionPayload(
        _ 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
    ) throws -> TransactionPayload 

The function accepts several parameters defining the properties of the new token collection, such as its name, description, maximum supply, and various mutability flags. These parameters are then encoded into TransactionArguments using appropriate Serializers based on their types.

An EntryFunction object is then created with the given token module address, the function name to be invoked ("create_collection"), and the constructed transaction arguments. Finally, a TransactionPayload is created with this entry function and returned.

Parameters

  • 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 EntryFunction or TransactionPayload fails.

Returns

A TransactionPayload object that represents the payload for the transaction to create a new token collection.

Types
Protocols
Global Variables
Global Functions
Extensions
Clone this wiki locally