Skip to content

Release v4.22.0

Compare
Choose a tag to compare
@akord-service akord-service released this 09 Nov 13:29

minting Atomic NFTs

The new NFT module enables the creation of atomic NFTs compliant with the Atomic Asset standard.

The atomic asset can be minted with the option to attach the Universal Data License (UDL), and can be listed on the Universal Content Marketplace (UCM).

akord.nft.mint(vaultId, asset, metadata, options)

  • vaultId (string, required)
  • asset ([FileLike][file-like], required) - asset data
  • metadata (NFTMetadata, required) - NFT metadata: name, ticker, description, owner, creator, etc.
  • options (FileUploadOptions, optional) - ex: UDL terms
  • returns Promise<{ nftId, transactionId }> - Promise with new nft id & corresponding transaction id
// Mint an atomic NFT with the UDL attached

// First, let's define our NFT metadata
const nftMetadata = {
  name: "Golden Orchid - Flora Fantasy #1",
  creator: "xxxx", // should be a valid Arweave address
  owner: "yyyy", // should be a valid Arweave address
  collection: "Flora Fantasy",
  description: "A rare digital representation of the mythical Golden Orchid",
  type: "image",
  topics: ["floral", "nature"]
};

// Then, let's define UDL terms
const udlTerms = {
  licenseFee: {
    type: "One-Time",
    value: 10
  },
  derivations: [{ type: "Allowed-With-Credit" }]
};

// Finally, let's mint the NFT by passing the path to the asset data, NFT metadata, and UDL terms
const { nftId } = await akord.nft.mint(vaultId, "path to your asset", nftMetadata, { udl: udlTerms });

// Let's retrieve the transaction uri containing the NFT
import { StorageType } from "@akord/akord-js";
const nft = await akord.nft.get(nftId);
const nftUri = nft.asset.getUri(StorageType.ARWEAVE);
// After few minutes, you should be able to view your NFT on: https://viewblock.io/arweave/tx/{nftUri}