Skip to main content

NFTAdmin

The NFTAdmin contract serves as the foundational administrative layer for NFT collections on the Mina Protocol. It provides essential functionalities such as contract upgrades, pausing and resuming operations, and ownership management. This contract can be extended by custom admin contracts to implement specific administrative logic, ensuring flexibility while maintaining a standardized interface.

Hierarchy

  • unknown
    • NFTAdmin

Implements

Index

Constructors

constructor

  • Returns NFTAdmin

Properties

admin

admin: any = ...

The public key of the contract's administrator. This account has the authority to perform administrative actions such as pausing the contract or upgrading the verification key.

allowChangeRoyalty

allowChangeRoyalty: any = ...

A boolean flag indicating whether the contract has the ability to change the royalty fee.

allowChangeTransferFee

allowChangeTransferFee: any = ...

A boolean flag indicating whether the contract has the ability to change the transfer fee.

canBePaused

canBePaused: any = ...

A boolean flag indicating whether the contract has the ability to be paused. This allows for disabling the pause functionality if desired.

events

events: { ownershipChange: typeof OwnershipChangeEvent; pause: typeof PauseEvent; resume: typeof PauseEvent; upgradeVerificationKey: any } = ...

Contract events emitted during various operations.


Type declaration

  • ownershipChange: typeof OwnershipChangeEvent

    Emitted when ownership of the contract changes.

  • pause: typeof PauseEvent

    Emitted when the contract is paused.

  • resume: typeof PauseEvent

    Emitted when the contract is resumed.

  • upgradeVerificationKey: any

    Emitted when the verification key is upgraded.

isPaused

isPaused: any = ...

A boolean flag indicating whether the contract is currently paused. When true, certain operations are disabled.

Methods

canChangeBaseUri

  • canChangeBaseUri(baseUri: Field): Promise<Bool>
  • Determines if the base URI can be changed for a Collection.


    Parameters

    • baseUri: Field

    Returns Promise<Bool>

canChangeCreator

  • canChangeCreator(creator: PublicKey): Promise<Bool>
  • Determines if the creator can be changed for a Collection.


    Parameters

    • creator: PublicKey

    Returns Promise<Bool>

canChangeName

  • canChangeName(name: Field): Promise<Bool>
  • Determines if the name can be changed for a Collection.


    Parameters

    • name: Field

    Returns Promise<Bool>

canChangeRoyalty

  • canChangeRoyalty(royaltyFee: UInt32): Promise<Bool>
  • Determines if the royalty fee can be changed for a Collection.


    Parameters

    • royaltyFee: UInt32

    Returns Promise<Bool>

canChangeTransferFee

  • canChangeTransferFee(transferFee: UInt64): Promise<Bool>
  • Determines if the transfer fee can be changed for a Collection.


    Parameters

    • transferFee: UInt64

    Returns Promise<Bool>

canChangeVerificationKey

  • canChangeVerificationKey(vk: VerificationKey, address: PublicKey, tokenId: Field): Promise<Bool>
  • Parameters

    • vk: VerificationKey
    • address: PublicKey
    • tokenId: Field

    Returns Promise<Bool>

canMint

  • Determines whether minting is allowed for the given request. Returns mint parameters if allowed, or none if not allowed.


    Parameters

    Returns Promise<MintParamsOption>

    A MintParamsOption indicating if minting is permitted.

canPause

  • canPause(): Promise<Bool>
  • Determines if the collection can be paused.


    Returns Promise<Bool>

canResume

  • canResume(): Promise<Bool>
  • Determines if the collection can be resumed.


    Returns Promise<Bool>

canSetAdmin

  • canSetAdmin(admin: PublicKey): Promise<Bool>
  • Determines if the admin contract can be changed for a Collection.


    Parameters

    • admin: PublicKey

    Returns Promise<Bool>

canTransfer

  • Determines whether a transfer between the specified addresses is permitted.


    Parameters

    Returns Promise<Bool>

    A Bool indicating whether the transfer is allowed.

canUpdate

  • Checks whether the NFT state can be updated. Typically returns true if the contract is not paused.


    Parameters

    • input: NFTState

      The current state of the NFT.

    • output: NFTState

      The desired new state of the NFT.

    Returns Promise<Bool>

    A Bool indicating whether the update is allowed.

deploy

  • Deploys the contract with initial settings.


    Parameters

    • props: NFTAdminDeployProps

      Deployment properties including admin, upgradeAuthority, uri, canPause, and isPaused.

    Returns Promise<void>

ensureOwnerSignature

  • ensureOwnerSignature(): Promise<AccountUpdate>
  • Ensures that the transaction is authorized by the contract owner.


    Returns Promise<AccountUpdate>

    A signed AccountUpdate from the admin.

pause

  • pause(): Promise<void>
  • Pauses the contract, disabling certain administrative actions. Can only be called by the admin if canPause is true.


    Returns Promise<void>

resume

  • resume(): Promise<void>
  • Resumes the contract, re-enabling administrative actions. Can only be called by the admin if canPause is true.


    Returns Promise<void>

transferOwnership

  • transferOwnership(to: PublicKey): Promise<PublicKey>
  • Transfers ownership of the contract to a new admin.


    Parameters

    • to: PublicKey

      The public key of the new owner.

    Returns Promise<PublicKey>

    The public key of the previous owner.

upgradeVerificationKey

  • upgradeVerificationKey(vk: VerificationKey): Promise<void>
  • Upgrades the contract's verification key after validating with the upgrade authority.


    Parameters

    • vk: VerificationKey

      The new verification key to upgrade to.

    Returns Promise<void>