MinaNFT
Hierarchy
- BaseMinaNFT
- MinaNFT
Index
Constructors
Properties
- address
- creator
- escrow
- isMinted
- metadata
- name
- nameService
- owner
- storage
- tokenId
- version
- badgeVerificationKey
- badgeVerifierVerificationKey
- cache
- escrowVerificationKey
- namesVerificationKey
- redactedMapVerificationKey
- transferVerificationKey
- updateVerificationKey
- updaterVerificationKey
- verificationKey
- verifierVerificationKey
Methods
- approve
- checkState
- commit
- getMetadata
- getMetadataRootAndMap
- loadMetadata
- mint
- prepareCommitData
- toJSON
- transfer
- update
- updateField
- updateFile
- updateFileData
- updateImage
- updateMap
- updateMetadata
- updateText
- commitPreparedData
- compile
- compileBadge
- compileEscrow
- compileRedactedMap
- compileVerifier
- fee
- fromJSON
- mapFromJSON
- minaInit
- setCache
- setCacheFolder
- stringFromField
- stringFromFields
- stringToField
- stringToFields
- transactionInfo
- urlFromStorage
- urlFromStorageString
- verify
- wait
Constructors
constructor
Create MinaNFT object
Parameters
params: { address: PublicKey; creator?: string; escrow?: Field; name: string; nameService?: PublicKey; owner?: Field; storage?: string }
arguments
Returns MinaNFT
Properties
address
Public key of the deployed NFT zkApp
creator
Creator of the NFT
escrow
Escrow of the NFT - Poseidon hash of three escrow's public keys
isMinted
True if the NFT is minted
metadata
name
Name of the NFT
nameService
Public key of the NFT Name Service
owner
Owner of the NFT - Poseidon hash of owner's public key
storage
Storage of the NFT - IPFS (i:...) or Arweave (a:...) hash string
tokenId
Token ID of the NFT Name Service
version
Version of the NFT, increases by one with the changing of the metadata or owner
staticbadgeVerificationKey
staticbadgeVerifierVerificationKey
staticcache
staticescrowVerificationKey
staticnamesVerificationKey
staticredactedMapVerificationKey
statictransferVerificationKey
staticupdateVerificationKey
staticupdaterVerificationKey
staticverificationKey
staticverifierVerificationKey
Methods
publicapprove
Approve the escrow for the NFT. Compiles the contract if needed.
Parameters
approvalData: MinaNFTApproval
MinaNFTApproval approval data
Returns Promise<undefined | PendingTransaction>
publiccheckState
Checks that on-chain state is equal to off-chain state
Parameters
info: string = ""
additional info for logging
Returns Promise<boolean>
true if on-chain state is equal to off-chain state
publiccommit
Commit updates of the MinaNFT to blockchain Generates recursive proofs for all updates, than verify the proof locally and send the transaction to the blockchain
Parameters
commitData: MinaNFTCommit
MinaNFTCommit commit data
Returns Promise<undefined | PendingTransaction>
publicgetMetadata
Gets public attribute
Parameters
key: string
key of the attribute
Returns undefined | PrivateMetadata
value of the attribute
publicgetMetadataRootAndMap
Calculates a root and MerkleMap of the publicAttributes
Returns { map: MetadataMap; root: Metadata }
Root and MerkleMap of the publicAttributes
map: MetadataMap
root: Metadata
publicloadMetadata
Load metadata from blockchain and IPFS/Arweave
Parameters
metadataURI: undefined | string = undefined
URI of the metadata. Obligatorily in case there is private metadata as private metadata cannot be fetched from IPFS/Arweave
skipCalculatingMetadataRoot: boolean = false
Skip calculating metadata root in case metadataURI is not provided and NFT contains private data
Returns Promise<void>
publicmint
Mints an NFT. Deploys and compiles the MinaNFT contract if needed.
Parameters
minaData: MinaNFTMint
MinaNFTMint mint data
skipCalculatingMetadataRoot: boolean = false
skip calculating metadata root in case the NFT is imported from the JSON that do not contains private metadata and therefore the root cannot be calculated
Returns Promise<undefined | PendingTransaction>
publicprepareCommitData
Prepare commit updates of the MinaNFT to blockchain
Parameters
commitData: MinaNFTPrepareCommit
MinaNFTPrepareCommit commit data
Returns Promise<undefined | MinaNFTCommitData>
publictoJSON
Converts to JSON
Parameters
params: { includePrivateData?: boolean; increaseVersion?: boolean } = {}
parameters
Returns object
JSON object
publictransfer
Transfer the NFT. Compiles the contract if needed.
Parameters
transferData: MinaNFTTransfer
MinaNFTTransfer transfer data
Returns Promise<undefined | PendingTransaction>
publicupdate
updates PrivateMetadata
Parameters
data: MinaNFTStringUpdate
MinaNFTStringUpdate update data
Returns void
publicupdateField
updates PrivateMetadata
Parameters
data: MinaNFTFieldUpdate
MinaNFTFieldUpdate update data
Returns void
publicupdateFile
updates PrivateMetadata
Parameters
data: MinaNFTFileUpdate
MinaNFTFileUpdate update data
Returns Promise<void>
publicupdateFileData
updates PrivateMetadata
Parameters
params: { data: FileData; isPrivate?: boolean; key: string; type?: string }
arguments
Returns void
publicupdateImage
updates PrivateMetadata
Parameters
data: MinaNFTImageUpdate
MinaNFTImageUpdate update data
Returns Promise<void>
publicupdateMap
updates PrivateMetadata
Parameters
data: MinaNFTMapUpdate
MinaNFTTextUpdate update data
Returns void
publicupdateMetadata
updates Metadata
Parameters
key: string
key to update
value: PrivateMetadata
value to update
Returns void
publicupdateText
updates PrivateMetadata
Parameters
data: MinaNFTTextUpdate
MinaNFTTextUpdate update data
Returns void
publicstaticcommitPreparedData
Commit updates of the MinaNFT to blockchain using prepared data Generates recursive proofs for all updates, than verify the proof locally and send the transaction to the blockchain
Parameters
commitData: { deployer: PrivateKey; nameService: MinaNFTNameService; nonce?: number; ownerPublicKey: string; preparedCommitData: MinaNFTCommitData }
MinaNFTCommit commit data
Returns Promise<undefined | PendingTransaction>
publicstaticcompile
Compiles MinaNFT contract
Parameters
rollup: boolean = false
Returns Promise<VerificationKey>
verification key
publicstaticcompileBadge
Compiles MinaNFTVerifierBadge contract
Returns Promise<VerificationKey>
verification key
publicstaticcompileEscrow
Compiles Escrow contract
Returns Promise<VerificationKey>
verification key
publicstaticcompileRedactedMap
Compiles RedactedMinaNFTMapCalculation contract
Returns Promise<VerificationKey>
verification key
publicstaticcompileVerifier
Compiles MinaNFTVerifier contract
Returns Promise<VerificationKey>
verification key
publicstaticfee
Get current Mina network fee
Returns Promise<UInt64>
current Mina network fee
publicstaticfromJSON
Load metadata from blockchain and IPFS/Arweave
Parameters
params: { metadataURI: string; nameServiceAddress: PublicKey; skipCalculatingMetadataRoot?: boolean }
arguments
Returns MinaNFT
MinaNFT object
publicstaticmapFromJSON
Creates a Map from JSON
Parameters
json: object
json with map data
Returns Map<string, string>
map as JSON object
publicstaticminaInit
Initialize Mina o1js library
Parameters
chain: blockchain
blockchain to initialize
Returns Promise<MinaNetworkInstance>
publicstaticsetCache
Sets a cache for prover keys
Parameters
cache: Cache
Returns void
publicstaticsetCacheFolder
Sets a cache folder for prover keys
Parameters
folder: string = "./cache"
folder for prover keys default is "./cache"
Returns void
publicstaticstringFromField
Converts a Field to a string
Parameters
field: Field
Field to convert
Returns string
string
publicstaticstringFromFields
Converts a Field[] to a string
Parameters
fields: Field[]
Fields to convert
Returns string
string
publicstaticstringToField
Converts a string to a Field
Parameters
item: string
string to convert
Returns Field
string as a Field
publicstaticstringToFields
Converts a string to a Fields
Parameters
item: string
string to convert
Returns Field[]
string as a Field[]
publicstatictransactionInfo
Logs transaction info
Parameters
tx: PendingTransaction
transaction
description: string = ""
description
wait: boolean = true
wait for transaction to be included in the block
Returns Promise<void>
publicstaticurlFromStorage
Converts a Storage to a storage url string
Parameters
storage: Storage
Storage to convert
Returns string
string
publicstaticurlFromStorageString
Converts a string "i:..." or "a:..." to a storage url string
Parameters
storageStr: string
string to convert
Returns string
string
publicstaticverify
Verify Redacted MinaNFT proof
Parameters
params: { deployer: PrivateKey; nameServiceAddress: PublicKey; nft: PublicKey; proof: RedactedMinaNFTMapStateProof; verifier: PublicKey }
arguments
Returns Promise<PendingTransaction>
publicstaticwait
Parameters
tx: PendingTransaction
Returns Promise<boolean>
MinaNFT is the class for the NFT, wrapper around the MinaNFTContract