All files / src/interfaces collection.ts

100% Statements 68/68
100% Branches 0/0
100% Functions 0/0
100% Lines 68/68

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 691x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { PublicKey, TokenContract } from "o1js";
import { TransferParams, NFTStateStruct } from "./types.js";
import { NFTOwnerContractConstructor } from "./owner.js";
import { NFTApprovalContractConstructor } from "./approval.js";
import { NFTUpdateContractConstructor } from "./update.js";
import { NFTAdminContractConstructor } from "./admin.js";
export {
  NFTCollectionBase,
  NFTCollectionContractConstructor,
  DefineCollectionFactory,
};
 
/**
 * 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.
 */
type NFTCollectionBase = TokenContract & {
  /**
   * Transfers ownership of an NFT from contract without admin approval using a proof.
   *
   * @param params - The transfer details.
   */
  transferByProof(params: TransferParams): Promise<void>;
  /**
   * Transfers ownership of an NFT from contract without admin approval.
   *
   * @param params - The transfer details.
   */
  transferBySignature(params: TransferParams): Promise<void>;
 
  /**
   * Transfers ownership of an NFT from contract without admin approval using a proof.
   *
   * @param params - The transfer details.
   */
  approvedTransferByProof(params: TransferParams): Promise<void>;
  /**
   * Transfers ownership of an NFT from contract without admin approval.
   *
   * @param params - The transfer details.
   */
  approvedTransferBySignature(params: TransferParams): Promise<void>;
 
  /**
   * Returns the state of an NFT.
   *
   * @param address - The address of the NFT.
   * @returns The state of the NFT.
   */
  getNFTState(address: PublicKey): Promise<NFTStateStruct>;
};
 
/**
 * Defines a constructor for contracts implementing `NFTCollectionBase`, accepting an `address` public key and returning an instance of `NFTCollectionBase`.
 *
 * @param address - The contract's address.
 * @returns An instance of `NFTCollectionBase`.
 */
type NFTCollectionContractConstructor = new (
  address: PublicKey
) => NFTCollectionBase;
 
type DefineCollectionFactory = (params: {
  adminContract: () => NFTAdminContractConstructor;
  ownerContract: () => NFTOwnerContractConstructor;
  approvalContract: () => NFTApprovalContractConstructor;
  updateContract: () => NFTUpdateContractConstructor;
}) => NFTCollectionContractConstructor;