Burn a single NFT
Rest
...args: [tokenId: BigNumberish]const result = await contract.burnToken(tokenId);
Rest
...args: [tokenId: BigNumberish]Protected
contractMint a unique NFT
Rest
...args: [metadata: string | objectInputType<{ Mint a unique NFT to a specified wallet.
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const tx = await contract.mint(metadata);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT
Rest
...args: [metadata: string | objectInputType<{ Mint Many unique NFTs
Rest
...args: [metadata: (string | objectInputType<{ Mint many unique NFTs at once to the connected wallet
// Custom metadata of the NFTs you want to mint.
const metadatas = [{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/other/image.png"),
}];
const tx = await contract.mintBatch(metadatas);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
Rest
...args: [metadata: (string | objectInputType<{ Mint Many unique NFTs
Rest
...args: [walletAddress: string, metadata: (string | objectInputType<{ Mint many unique NFTs at once to a specified wallet.
// Address of the wallet you want to mint the NFT to
const walletAddress = "{{wallet_address}}";
// Custom metadata of the NFTs you want to mint.
const metadatas = [{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/other/image.png"),
}];
const tx = await contract.mintBatchTo(walletAddress, metadatas);
const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
const firstTokenId = tx[0].id; // token id of the first minted NFT
const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
Rest
...args: [walletAddress: string, metadata: (string | objectInputType<{ Mint a unique NFT
Rest
...args: [walletAddress: string, metadata: string | objectInputType<{ Mint a unique NFT to a specified wallet.
// Address of the wallet you want to mint the NFT to
const walletAddress = "{{wallet_address}}";
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadata = {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
};
const tx = await contract.mintTo(walletAddress, metadata);
const receipt = tx.receipt; // the transaction receipt
const tokenId = tx.id; // the id of the NFT minted
const nft = await tx.data(); // (optional) fetch details of minted NFT
Rest
...args: [walletAddress: string, metadata: string | objectInputType<{ Configure royalties
Set your own royalties for the entire contract or per token
// royalties on the whole contract
contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalties.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});
Signature Minting
Generate dynamic NFTs with your own signature, and let others mint them using that signature.
// see how to craft a payload to sign in the `contract.signature.generate()` documentation
const signedPayload = contract.signature().generate(payload);
// now anyone can mint the NFT
const tx = contract.signature.mint(signedPayload);
const receipt = tx.receipt; // the mint transaction receipt
const mintedId = tx.id; // the id of the NFT minted
Protected
storageTransfer an NFT
Rest
...args: [to: string, tokenId: BigNumberish]Transfer an NFT from the connected wallet to another wallet.
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.transfer(walletAddress, tokenId);
Rest
...args: [to: string, tokenId: BigNumberish]Static
contractGet NFT Balance
Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).
const walletAddress = "{{wallet_address}}";
const balance = await contract.balanceOf(walletAddress);
console.log(balance);
Get all NFTs
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata for all NFTs queried.
Get all the data associated with every NFT in this contract.
By default, returns the first 100 NFTs, use queryParams to fetch more.
const nfts = await contract.getAll();
console.log(nfts);
Construct a mint transaction without executing it. This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.
Address you want to send the token to
The metadata of the NFT you want to mint
Use contract.mint.prepare(...args)
instead
Get all NFTs owned by a specific wallet
Optional
walletAddress: stringthe wallet address to query, defaults to the connected wallet
Optional
queryParams: { optional filtering to only fetch a subset of results.
Optional
count?: numberOptional
start?: numberThe NFT metadata for all NFTs in the contract.
Get all the data associated with the NFTs owned by a specific wallet.
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
console.log(nfts);
Generated using TypeDoc
Create a collection of one-of-one NFTs.
Example