Skip to content

Freshmint Core v0.4.0

Compare
Choose a tag to compare
@psiemens psiemens released this 06 Dec 19:12
· 40 commits to main since this release

Installation

npm install @freshmint/[email protected]

Changelog

Standard Edition Updates

The edition template now allows developers to create either closed or open editions. Open editions are editions that have no predefined limit, whereas a closed edition must contain a fixed number of NFTs determined before minting.

Previously, an edition had two fields: size and count. Freshmint only supported closed editions. As such, every edition had to specify a fixed size.

An edition now contains the fields limit, size and burned:

pub struct Edition {

    pub let id: UInt64

    /// The maximum number of NFTs that can be minted in this edition.
    ///
    /// If nil, the edition has no size limit.
    ///
    pub let limit: UInt64?

    /// The number of NFTs minted in this edition.
    ///
    /// This field is incremented each time a new NFT is minted.
    /// It cannot exceed the limit defined above.
    ///
    pub var size: UInt64

    /// The number of NFTs in this edition that have been burned.
    ///
    /// This field is incremented each time an NFT is burned.
    ///
    pub var burned: UInt64
}

How to mint a closed edition

See the updated edition documentation for full instructions.

It is still possible to mint a closed edition like before. It requires a change when calling the createEditions function.

When creating an edition, include the limit field instead of size:

const edition = {
  // Previously this field was named `size`:
  // size: 100
  limit: 100,
  metadata: {
    name: 'Edition 1',
    description: 'This is the first edition',
    thumbnail: 'bafybeidlkqhddsjrdue7y3dy27pu5d7ydyemcls4z24szlyik3we7vqvam',
  }
};

const editions = await client.send(contract.createEditions([edition]));

Blind Edition Updates

See the updated blind edition documentation for full instructions.

The blind edition template was updated in two ways:

  1. Same as the standard edition template above, it now accepts a limit parameter instead of size (to support open editions).
  2. It now shows an NFT's edition at mint time instead of at reveal time. The serial number is still hidden. We call these "partially-blind editions".

How to mint a partially blind edition

const edition = {
  // Previously this field was named `size`:
  // size: 100
  limit: 100,
  metadata: {
    name: 'Edition 1',
    description: 'This is the first edition',
    thumbnail: 'bafybeidlkqhddsjrdue7y3dy27pu5d7ydyemcls4z24szlyik3we7vqvam',
  }
};

const editions = await client.send(contract.createEditions([edition]));

for (const edition of editions) {
  // THE OLD WAY
  //
  //  const mintedNFTs = await client.send(contract.mintNFTs(
  //    randomizedNFTs,
  //    { bucket: edition.id }
  //  ));

  const randomizedSerialNumbers = shuffle(edition.serialNumbers);

  // THE NEW WAY: specify an editionId and a list of serialNumbers.
  // 
  const mintedNFTs = await client.send(contract.mintNFTs({ 
    editionId: edition.id,
    serialNumbers: randomizedSerialNumbers,
    bucket: edition.id
  }));
}

Other Changes

  • Add optional attributes field to all NFTs (#160)
  • Support async signers, fix authorization tempId (#156)
  • Support IPFS files in directory format (#157)
  • Export the hash function for blind NFTs (ee10584)
  • Add transferNFT transaction to all contracts (#162)