Skip to main content

@silvana-one/nft

Index

Classes

Functions

Interfaces

Type Aliases

Variables

Type Aliases

DefineApprovalFactory

DefineApprovalFactory: (params: { collectionContract: () => NFTCollectionContractConstructor }) => NFTApprovalContractConstructor

Type declaration

DefineCollectionFactory

DefineCollectionFactory: (params: { adminContract: () => NFTAdminContractConstructor; approvalContract: () => NFTApprovalContractConstructor; ownerContract: () => NFTOwnerContractConstructor; updateContract: () => NFTUpdateContractConstructor }) => NFTCollectionContractConstructor

Type declaration

DefineNFTSharesFactory

DefineNFTSharesFactory: (params: { auctionContract: () => ReturnType<typeof AuctionFactory> }) => ReturnType<typeof NFTSharesFactory>

Type declaration

DefineOwnerFactory

DefineOwnerFactory: (params: { collectionContract: () => NFTCollectionContractConstructor }) => NFTOwnerContractConstructor

Type declaration

DefineUpdateFactory

DefineUpdateFactory: (params: { collectionContract: () => NFTCollectionContractConstructor }) => NFTUpdateContractConstructor

Type declaration

MetadataFieldType

MetadataFieldType: string | text | image | url | field | number | address | map | tree

The possible types for metadata fields.

NFTAdminBase

NFTAdminBase: SmartContract & { canChangeBaseUri: any; canChangeCreator: any; canChangeName: any; canChangeRoyalty: any; canChangeTransferFee: any; canChangeVerificationKey: any; canMint: any; canPause: any; canResume: any; canSetAdmin: any; canTransfer: any; canUpdate: any }

The NFTAdminBase interface defines the administrative functionalities required for managing an NFT collection on the Mina Protocol. It extends the SmartContract class and specifies methods that enforce permissions and validations for various NFT operations.

NFTAdminContractConstructor

NFTAdminContractConstructor: new (address: PublicKey) => NFTAdminBase

Defines a constructor for contracts implementing NFTAdminBase, accepting an address public key and returning an instance of NFTAdminBase.

@returns

An instance of NFTAdminBase.


Type declaration

NFTApprovalBase

NFTApprovalBase: SmartContract & { canTransfer: any }

The NFTApprovalBase interface defines the administrative functionalities required for managing an NFT transfer approval on the Mina Protocol.

NFTApprovalContractConstructor

NFTApprovalContractConstructor: new (address: PublicKey) => NFTApprovalBase

Defines a constructor for contracts implementing NFTApprovalBase, accepting an address public key and returning an instance of NFTApprovalBase.

@returns

An instance of NFTApprovalBase.


Type declaration

NFTCollectionBase

NFTCollectionBase: TokenContract & { approvedTransferByProof: any; approvedTransferBySignature: any; getNFTState: any; transferByProof: any; transferBySignature: any }

The NFTCollectionBase interface defines the functionalities required for managing an NFT collection on the Mina Protocol. It extends the SmartContract class and specifies methods that enforce permissions and validations for various NFT operations.

NFTCollectionContractConstructor

NFTCollectionContractConstructor: new (address: PublicKey) => NFTCollectionBase

Defines a constructor for contracts implementing NFTCollectionBase, accepting an address public key and returning an instance of NFTCollectionBase.

@returns

An instance of NFTCollectionBase.


Type declaration

NFTOwnerBase

NFTOwnerBase: SmartContract & { canApproveAddress: any; canChangeVerificationKey: any; canPause: any; canResume: any; canTransfer: any }

The NFTOwnerBase interface defines the administrative functionalities required for managing an NFT collection on the Mina Protocol. It extends the SmartContract class and specifies methods that enforce permissions and validations for various NFT operations.

NFTOwnerContractConstructor

NFTOwnerContractConstructor: new (address: PublicKey) => NFTOwnerBase

Defines a constructor for contracts implementing NFTOwnerBase, accepting an address public key and returning an instance of NFTOwnerBase.

@returns

An instance of NFTOwnerBase.


Type declaration

    • Parameters

      • address: PublicKey

        The public key of the contract's owner.

      Returns NFTOwnerBase

NFTUpdateBase

NFTUpdateBase: SmartContract & { canUpdate: any }

The NFTUpdateBase interface defines the update functionalities required for managing an NFT update

NFTUpdateContractConstructor

NFTUpdateContractConstructor: new (address: PublicKey) => NFTUpdateBase

Defines a constructor for contracts implementing NFTUpdateBase, accepting an address public key and returning an instance of NFTUpdateBase.

@returns

An instance of NFTUpdateBase.


Type declaration

NonFungibleTokenContracts

NonFungibleTokenContracts: { Admin: NFTAdminContractConstructor; Approval: NFTApprovalContractConstructor; Collection: ReturnType<typeof CollectionFactory>; Owner: NFTOwnerContractConstructor; Update: NFTUpdateContractConstructor }

PausableContract

PausableContract: SmartContract & { pause: any; resume: any }

The PausableContract interface provides a mechanism to dynamically enable or disable certain functionalities within smart contracts. It extends the SmartContract class and introduces methods that allow a contract to be paused and resumed, which is crucial for managing emergencies, upgrades, or maintenance periods.

By implementing the PausableContract interface, contracts gain greater control over their operational states, enhancing security and flexibility in response to various scenarios.

SupportedNetworkId

SupportedNetworkId: devnet | mainnet

Type representing the supported network IDs for the Mina Protocol.

Currently supports:

  • "devnet": The Mina local blockchain and devnet
  • "mainnet": The Mina mainnet

Variables

Admin

AdvancedAdmin

AdvancedApproval

AdvancedCollection

AdvancedCollection: typeof Collection

constAdvancedOffer

AdvancedOffer: typeof NonFungibleTokenOfferContract = ...

AdvancedOwner

Approval

Collection

Collection: typeof Collection

constCollectionErrors

CollectionErrors: { adminContractAddressNotSet: string; cannotMint: string; cannotMintMasterNFT: string; cannotUpgradeVerificationKey: string; collectionNotPaused: string; collectionPaused: string; invalidOracleAddress: string; invalidRoyaltyFee: string; noPermissionToChangeBaseUri: string; noPermissionToChangeCreator: string; noPermissionToChangeName: string; noPermissionToChangeRoyalty: string; noPermissionToChangeTransferFee: string; noPermissionToPause: string; noPermissionToResume: string; noPermissionToSetAdmin: string; onlyOwnerCanUpgradeVerificationKey: string; transferApprovalRequired: string; transferNotAllowed: string; upgradeContractAddressNotSet: string; wrongMasterNFTaddress: string } = ...

Type declaration

  • adminContractAddressNotSet: string
  • cannotMint: string
  • cannotMintMasterNFT: string
  • cannotUpgradeVerificationKey: string
  • collectionNotPaused: string
  • collectionPaused: string
  • invalidOracleAddress: string
  • invalidRoyaltyFee: string
  • noPermissionToChangeBaseUri: string
  • noPermissionToChangeCreator: string
  • noPermissionToChangeName: string
  • noPermissionToChangeRoyalty: string
  • noPermissionToChangeTransferFee: string
  • noPermissionToPause: string
  • noPermissionToResume: string
  • noPermissionToSetAdmin: string
  • onlyOwnerCanUpgradeVerificationKey: string
  • transferApprovalRequired: string
  • transferNotAllowed: string
  • upgradeContractAddressNotSet: string
  • wrongMasterNFTaddress: string

constMAX_ROYALTY_FEE

MAX_ROYALTY_FEE: 100000 = 100000

constMetadataFieldTypeValues

MetadataFieldTypeValues: { address: { code: [object Object]; inputType: any; storedType: typeof MinaAddress }; field: { code: [object Object]; inputType: any; storedType: any }; image: { code: [object Object]; inputType: string; storedType: typeof Text }; map: { code: [object Object]; inputType: typeof Metadata; storedType: typeof Metadata }; number: { code: [object Object]; inputType: any; storedType: any }; string: { code: [object Object]; inputType: string; storedType: any }; text: { code: [object Object]; inputType: string; storedType: typeof Text }; tree: { code: [object Object]; inputType: typeof MetadataTree; storedType: typeof MetadataTree }; url: { code: [object Object]; inputType: string; storedType: typeof Text } } = ...

Mapping of metadata field types to their code values and associated types.


Type declaration

  • readonlyaddress: { code: [object Object]; inputType: any; storedType: typeof MinaAddress }
    • readonlycode: [object Object]
    • readonlyinputType: any
    • readonlystoredType: typeof MinaAddress
  • readonlyfield: { code: [object Object]; inputType: any; storedType: any }
    • readonlycode: [object Object]
    • readonlyinputType: any
    • readonlystoredType: any
  • readonlyimage: { code: [object Object]; inputType: string; storedType: typeof Text }
    • readonlycode: [object Object]
    • readonlyinputType: string
    • readonlystoredType: typeof Text
  • readonlymap: { code: [object Object]; inputType: typeof Metadata; storedType: typeof Metadata }
    • readonlycode: [object Object]
    • readonlyinputType: typeof Metadata
    • readonlystoredType: typeof Metadata
  • readonlynumber: { code: [object Object]; inputType: any; storedType: any }
    • readonlycode: [object Object]
    • readonlyinputType: any
    • readonlystoredType: any
  • readonlystring: { code: [object Object]; inputType: string; storedType: any }
    • readonlycode: [object Object]
    • readonlyinputType: string
    • readonlystoredType: any
  • readonlytext: { code: [object Object]; inputType: string; storedType: typeof Text }
    • readonlycode: [object Object]
    • readonlyinputType: string
    • readonlystoredType: typeof Text
  • readonlytree: { code: [object Object]; inputType: typeof MetadataTree; storedType: typeof MetadataTree }
  • readonlyurl: { code: [object Object]; inputType: string; storedType: typeof Text }
    • readonlycode: [object Object]
    • readonlyinputType: string
    • readonlystoredType: typeof Text

constNFTAdvancedAdmin

NFTAdvancedAdmin: typeof NFTAdvancedAdmin = ...

constNFTGameProgram

NFTGameProgram: any = ...

Defines the NFTProgram ZkProgram with methods for updating NFT metadata.

constNFTProgram

NFTProgram: any = ...

Defines the NFTProgram ZkProgram with methods for updating NFT metadata.

constOffer

Offer: typeof NonFungibleTokenOfferContract = ...

Owner

constTEXT_TREE_HEIGHT

TEXT_TREE_HEIGHT: 20 = 20

The default height of the Merkle tree used to represent the text data.

Update

constnftVerificationKeys

nftVerificationKeys: { [ key in mainnet | devnet ]: { o1js: string; vk: {} } } = ...

An object containing the verification keys for the NFT Collection and NFT contracts on different networks.

@remarks

The NFTVerificationKeys object maps a SupportedNetworkId to the corresponding verification keys for the NFT Collection and NFT contracts.

Structure:

  • network: The network identifier ("devnet" or "mainnet").
    • collection:
      • hash: The hash of the verification key for the NFT Collection contract.
      • data: The verification key data for the NFT Collection contract.
    • nft:
      • hash: The hash of the verification key for the NFT contract.
      • data: The verification key data for the NFT contract.
@example

Accessing the verification key hash for the NFT Collection on testnet:

const testnetCollectionVKHash = NFTVerificationKeys["devnet"].collection.hash;