Class: NFTAdmin

Properties overview

  • admin: State;
  • allowChangeRoyalty: State;
  • allowChangeTransferFee: State;
  • canBePaused: State;
  • events: {
    ownershipChange: typeof OwnershipChangeEvent;
    pause: typeof PauseEvent;
    resume: typeof PauseEvent;
    upgradeVerificationKey: typeof Field & (x: string | number | bigint | Field | FieldVar | FieldConst) => Field;
    };
  • ownershipChange: typeof OwnershipChangeEvent = OwnershipChangeEvent;
  • pause: typeof PauseEvent = PauseEvent;
  • resume: typeof PauseEvent = PauseEvent;
  • upgradeVerificationKey: typeof Field & (x: string | number | bigint | Field | FieldVar | FieldConst) => Field = Field;
  • Overrides: SmartContract.events
  • isPaused: State;
  • Overrides: SmartContract.deploy

Methods overview

  • canChangeBaseUri()
  • canChangeCreator()
  • canChangeName()
  • canChangeRoyalty()
  • canChangeTransferFee()
  • canChangeVerificationKey()
  • canMint()
  • canPause()
  • canResume()
  • canSetAdmin()
  • canTransfer()
  • canUpdate()
  • deploy()
  • ensureOwnerSignature()
  • pause()
  • resume()
  • transferOwnership()
  • upgradeVerificationKey()

Defined in: packages/nft/src/contracts/admin.ts:44

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.

Extends

  • SmartContract

Implements

Constructors

new NFTAdmin()

new NFTAdmin(address: PublicKey, tokenId?: Field): NFTAdmin

Defined in: node_modules/o1js/dist/node/lib/mina/zkapp.d.ts:148

Parameters

address

PublicKey

tokenId?

Field

Returns

NFTAdmin

Inherited from

SmartContract.constructor

Properties

admin

admin: State<PublicKey>;

Defined in: packages/nft/src/contracts/admin.ts:52

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: State<Bool>;

Defined in: packages/nft/src/contracts/admin.ts:69

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


allowChangeTransferFee

allowChangeTransferFee: State<Bool>;

Defined in: packages/nft/src/contracts/admin.ts:74

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


canBePaused

canBePaused: State<Bool>;

Defined in: packages/nft/src/contracts/admin.ts:64

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: typeof Field & (x: string | number | bigint | Field | FieldVar | FieldConst) => Field;
};

Defined in: packages/nft/src/contracts/admin.ts:107

Contract events emitted during various operations.

ownershipChange

ownershipChange: typeof OwnershipChangeEvent = OwnershipChangeEvent;

Emitted when ownership of the contract changes.

pause

pause: typeof PauseEvent = PauseEvent;

Emitted when the contract is paused.

resume

resume: typeof PauseEvent = PauseEvent;

Emitted when the contract is resumed.

upgradeVerificationKey

upgradeVerificationKey: typeof Field & (x: string | number | bigint | Field | FieldVar | FieldConst) => Field = Field;

Emitted when the verification key is upgraded.

Implementation of

NFTAdminBase.events

Overrides

SmartContract.events

isPaused

isPaused: State<Bool>;

Defined in: packages/nft/src/contracts/admin.ts:58

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

Methods

canChangeBaseUri()

canChangeBaseUri(baseUri: Field): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:254

Determines if the base URI can be changed for a Collection.

Parameters

baseUri

Field

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canChangeBaseUri

canChangeCreator()

canChangeCreator(creator: PublicKey): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:246

Determines if the creator can be changed for a Collection.

Parameters

creator

PublicKey

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canChangeCreator

canChangeName()

canChangeName(name: Field): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:238

Determines if the name can be changed for a Collection.

Parameters

name

Field

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canChangeName

canChangeRoyalty()

canChangeRoyalty(royaltyFee: UInt32): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:262

Determines if the royalty fee can be changed for a Collection.

Parameters

royaltyFee

UInt32

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canChangeRoyalty

canChangeTransferFee()

canChangeTransferFee(transferFee: UInt64): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:271

Determines if the transfer fee can be changed for a Collection.

Parameters

transferFee

UInt64

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canChangeTransferFee

canChangeVerificationKey()

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

Defined in: packages/nft/src/contracts/admin.ts:225

Determines if the verification key can be changed for a specific NFT contract address and token ID.

Parameters

vk

VerificationKey

The verification key to be changed.

address

PublicKey

The public key of the NFT contract address or CollectionContract address.

tokenId

Field

The token ID of the NFT.

Returns

Promise<Bool>

A Promise resolving to a Bool indicating whether the verification key change is allowed.

Implementation of

NFTAdminBase.canChangeVerificationKey

canMint()

canMint(mintRequest: MintRequest): Promise<MintParamsOption>

Defined in: packages/nft/src/contracts/admin.ts:151

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

Parameters

mintRequest

MintRequest

The minting request details.

Returns

Promise<MintParamsOption>

A MintParamsOption indicating if minting is permitted.

Implementation of

NFTAdminBase.canMint

canPause()

canPause(): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:288

Determines if the collection can be paused.

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canPause

canResume()

canResume(): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:297

Determines if the collection can be resumed.

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canResume

canSetAdmin()

canSetAdmin(admin: PublicKey): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:280

Determines if the admin contract can be changed for a Collection.

Parameters

admin

PublicKey

Returns

Promise<Bool>

Implementation of

NFTAdminBase.canSetAdmin

canTransfer()

canTransfer(transferEvent: TransferEvent): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:174

Determines whether a transfer between the specified addresses is permitted.

Parameters

transferEvent

TransferEvent

The transfer event details.

Returns

Promise<Bool>

A Bool indicating whether the transfer is allowed.

Implementation of

NFTAdminBase.canTransfer

canUpdate()

canUpdate(input: NFTState, output: NFTState): Promise<Bool>

Defined in: packages/nft/src/contracts/admin.ts:164

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.

Implementation of

NFTAdminBase.canUpdate

deploy()

deploy(props: NFTAdminDeployProps): Promise<void>

Defined in: packages/nft/src/contracts/admin.ts:80

Deploys the contract with initial settings.

Parameters

props

NFTAdminDeployProps

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

Returns

Promise<void>

Implementation of

NFTAdminBase.deploy

Overrides

SmartContract.deploy

ensureOwnerSignature()

ensureOwnerSignature(): Promise<AccountUpdate>

Defined in: packages/nft/src/contracts/admin.ts:122

Ensures that the transaction is authorized by the contract owner.

Returns

Promise<AccountUpdate>

A signed AccountUpdate from the admin.


pause()

pause(): Promise<void>

Defined in: packages/nft/src/contracts/admin.ts:183

Pauses the contract, disabling certain administrative actions.
Can only be called by the admin if canPause is true.

Returns

Promise<void>

Implementation of

PausableContract.pause

resume()

resume(): Promise<void>

Defined in: packages/nft/src/contracts/admin.ts:195

Resumes the contract, re-enabling administrative actions.
Can only be called by the admin if canPause is true.

Returns

Promise<void>

Implementation of

PausableContract.resume

transferOwnership()

transferOwnership(to: PublicKey): Promise<PublicKey>

Defined in: packages/nft/src/contracts/admin.ts:208

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.

Implementation of

OwnableContract.transferOwnership


upgradeVerificationKey()

upgradeVerificationKey(vk: VerificationKey): Promise<void>

Defined in: packages/nft/src/contracts/admin.ts:134

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>