Methods of the NFT Module.

Hierarchy

Constructors

Properties

_config: ModuleConfig
_feeMethod: FeeMethod
_internalMethod: InternalMethod

Methods

  • Mints a new NFT. The NFT will always be native to the chain creating it.

    Example

     create(methodContext,address,collectionID,attributesArray);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • address: Buffer

      Address of the NFT owner

    • collectionID: Buffer

      ID of the collection the NFT belongs to

    • attributesArray: NFTAttributes[]

      Attributes of the NFT

    Returns Promise<void>

  • Destroys the specified NFT. The NFT will be removed from the NFT substore and cannot be retrieved, except in the case of destroying NFT on a foreign chain: the information about the NFT (e.g., the attributes) will still be available in the corresponding escrow entry of the NFT substore in the native chain.

    Example

     destroy(methodContext,address,nftID);
    

    Parameters

    • methodContext: MethodContext

      method context

    • address: Buffer

      Address of the account who initiated the destruction

    • nftID: Buffer

      ID of the NFT to be destroyed

    Returns Promise<void>

  • Gets the chain ID of an NFT.

    Example

     getChainID(nftID);
    

    Returns

    The ID of the chain the NFT belongs to.

    Parameters

    • nftID: Buffer

      Unique identifier of the NFT

    Returns Buffer

  • Gets the ID of the collection of an NFT.

    Example

     getCollectionID(nftID);
    

    Returns

    The collection ID of the NFT.

    Parameters

    • nftID: Buffer

      ID of an NFT

    Returns Buffer

  • Returns the next free index inside an NFT collection.

    Example

     getNextAvailableIndex(methodContext,collectionID);
    

    Returns

    Index of the next free slot inside an NFT collection.

    Parameters

    • methodContext: MethodContext

      method context

    • collectionID: Buffer

      ID of an NFT collection

    Returns Promise<bigint>

  • Checks whether a provided NFT is escrowed, e.g. the NFT is a native NFT that has been sent cross-chain to a foreign chain.

    Example

     isNFTEscrowed(nft);
    

    Returns

    true, if the NFT is escrowed, false if not.

    Parameters

    • nft: NFT

      The NFT to be checked

    Returns boolean

  • Checks whether a provided NFT is locked or not.

    Example

     isNFTLocked(nft);
    

    Returns

    true if the NFT is locked, false if not.

    Parameters

    • nft: NFT

      The NFT to be checked

    Returns boolean

  • Checks whether the NFT is supported by the network, or not.

    Example

     isNFTSupported(methodContext,nftID);
    

    Returns

    true if the NFT is supported, false if not.

    Parameters

    Returns Promise<boolean>

  • This function locks an NFT to a given module. A locked NFT cannot be transferred (within the chain or across chains). This can be useful, for example, when the NFT is used as a deposit for a service. Module is specified both when locking and unlocking the NFT, thus preventing NFTs being accidentally locked and unlocked by different modules. Note that an NFT can not be locked to the NFT module.

    Example

     lock(methodContext,module,nftID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • module: string

      The module locking the NFT

    • nftID: Buffer

      ID of the NFT to be locked

    Returns Promise<void>

  • This function recovers an NFT escrowed to a terminated chain. It should only be called by the module to trigger the recovery of NFTs escrowed to terminated chains.

    Example

     recover(methodContext,terminatedChainID,substorePrefix,nftID,nft);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • terminatedChainID: Buffer

      ID of the terminated chain

    • substorePrefix: Buffer

      Prefix of the NFT substore

    • nftID: Buffer

      ID of the nft to recover

    • nft: Buffer

      The NFT to recover

    Returns Promise<void>

  • This function removes support for all non-native NFTs of a specified foreign chain.

    Example

     removeSupportAllNFTsFromChain(methodContext,chainID);
    

    Parameters

    Returns Promise<void>

  • This function removes support for all non-native NFTs of a specified collection.

    Example

     removeSupportAllNFTsFromCollection(methodContext,chainID,collectionID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • chainID: Buffer

      The chain ID the NFT collection belongs to

    • collectionID: Buffer

      The NFT collection to be un-supported

    Returns Promise<void>

  • This function is used to modify the attributes of NFTs. Each custom module can define the rules surrounding modifying NFT attributes and should call this function. This function will be executed even if the NFT is locked.

    Example

     setAttributes(methodContext,module,nftID,attributes);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • module: string

      Name of the module updating the NFT attributes

    • nftID: Buffer

      ID of an NFT

    • attributes: Buffer

      Attributes to add to the NFT

    Returns Promise<void>

  • This function updates the supported NFTs substore to support all non-native NFTs of a specified foreign chain.

    Example

     supportAllNFTsFromChain(methodContext,chainID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • chainID: Buffer

      ID of a chain

    Returns Promise<void>

  • This function updates the supported NFTs substore to support all non-native NFTs of a specified collection.

    Example

     supportAllNFTsFromCollection(methodContext,chainID,collectionID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • chainID: Buffer

      The chain ID the NFT collection belongs to

    • collectionID: Buffer

      The NFT collection to be supported

    Returns Promise<void>

  • This function is used to transfer ownership of NFTs within one chain.

    Example

     transfer(methodContext,senderAddress,recipientAddress,nftID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • senderAddress: Buffer

      Address of the current owner of the NFT

    • recipientAddress: Buffer

      Address of the new owner of the NFT

    • nftID: Buffer

      ID of the NFT to be transferred

    Returns Promise<void>

  • This function is used to transfer ownership of NFTs across chains in the Lisk ecosystem.

    Example

     transferCrossChain(methodContext,senderAddress,recipientAddress,nftID,receivingChainID,messageFee,data,includeAttributes);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • senderAddress: Buffer

      Address of the current owner of the NFT

    • recipientAddress: Buffer

      Address of the new owner of the NFT

    • nftID: Buffer

      ID of the NFT to be transferred

    • receivingChainID: Buffer

      ID of the chain where the NFT is being transferred to

    • messageFee: bigint

      Fee for the CCM

    • data: string

      Message field

    • includeAttributes: boolean

      Boolean, if the attributes of the NFT should be included in the transfer

    Returns Promise<void>

  • This function is used to unlock an NFT that was locked to a module.

    Example

     unlock(methodContext,module,nftID);
    

    Parameters

    • methodContext: MethodContext

      Method context

    • module: string

      The module unlocking the NFT

    • nftID: Buffer

      ID of the NFT to be unlocked

    Returns Promise<void>

Generated using TypeDoc