Mint a series of NFTs with metadata. After each mint you increase a counter id to ensure that previous minted NFTs stay unique forever. Optionally you can set a maximum supply.
import { Contract } from "./mod.ts";
import {
Blockfrost,
Lucid,
} from "https://deno.land/x/[email protected]/mod.ts";
const lucid = await Lucid.new(
new Blockfrost(
"https://cardano-preprod.blockfrost.io/api/v0",
"<project_id>",
),
"Preprod",
);
lucid.selectWalletFromSeed(
"<seed_phrase>",
);
const maxSupply = 100;
const { instanceId } = await new Contract(lucid)
.deploy("MyNFT", maxSupply);
// ... wait for confirmation
const contract = new Contract(
lucid,
instanceId,
);
// counter id: 0
await contract.mint({ name: "MyNFT #0", image: "ipfs://<hash>" });
// ... wait for confirmation
// counter id: 1
await contract.mint({ name: "MyNFT #1", image: "ipfs://<hash>" });
// ... wait for confirmation
console.log(await contract.getMetadata(1));
// Burn NFT with id 0
await contract.burn(0);
deploy(name: string): Promise<{ txHash: string; instanceId: string; }>
getMetadata(): Promise<Metadata>
mint(metadata: Metadata): Promise<string>
burn(): Promise<string>
getMaxSupply(): number | null
getNextId(): Promise<number>
transferOwnership(address: string, datum?: string | undefined): Promise<string>
renounceOwnership(): Promise<string>