Skip to main content

Edition

Learn how to interact with your Edition contract in the SDK.

Create an Edition Contract

Deploys a new Edition contract
const sdk = useSDK();

const contractAddress = await sdk.deployer.deployEdition({
name: "My Edition",
primary_sale_recipient: "your-address",
});
View in React SDK Documentation

Getting the contract in your application

To start using your Edition contract inside your application, you'll need to use its contract address. You can get the contract address from the dashboard.

This feature is missing a code snippet or might not be supported yet.

Check the React SDK Reference for more information.

Reach out on Discord for further assistance!

Setting Royalty Fees

Configure royalties
// 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..."
});
View in React SDK Documentation

Minting NFTs

Mint One NFT

Mint an NFT with a limited supply
// Address of the wallet you want to mint the NFT to
const toAddress = "{{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 metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
}

const tx = await contract.mintTo(toAddress, metadataWithSupply);
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
View in React SDK Documentation

Mint Many NFTs (Batch Mint)

Mint Many NFTs with limited supplies
// Address of the wallet you want to mint the NFT to
const toAddress = "{{wallet_address}}"

// Custom metadata and supplies of your NFTs
const metadataWithSupply = [{
supply: 50, // The number of this NFT you want to mint
metadata: {
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
},
}, {
supply: 100,
metadata: {
name: "Cool NFT #2",
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.mintBatchTo(toAddress, metadataWithSupply);
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
View in React SDK Documentation

Airdrop NFTs

Airdrop multiple NFTs
// The token ID of the NFT you want to airdrop
const tokenId = "0";
// Array of objects of addresses and quantities to airdrop NFTs to
const addresses = [
{
address: "0x...",
quantity: 2,
},
{
address: "0x...",
quantity: 3,
},
];
await contract.airdrop(tokenId, addresses);

// You can also pass an array of addresses, it will airdrop 1 NFT per address
const tokenId = "0";
const addresses = [
"0x...", "0x...", "0x...",
]
await contract.airdrop(tokenId, addresses);
View in React SDK Documentation

Viewing NFTs

One NFT

Get a single NFT Metadata
const nft = await contract.get("0");
View in React SDK Documentation

All NFTs

Get All Minted NFTs
const nfts = await contract.getAll();
View in React SDK Documentation

NFTs owned by a specific wallet

Get Owned NFTs
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
View in React SDK Documentation

Amount of tokens owned by a specific wallet

Get NFT Balance
// Address of the wallet to check NFT balance
const walletAddress = "{{wallet_address}}";
const tokenId = 0; // Id of the NFT to check
const balance = await contract.balanceOf(walletAddress, tokenId);
View in React SDK Documentation

Transferring NFTs

Transfer a single NFT
// Address of the wallet you want to send the NFT to
const toAddress = "{{wallet_address}}";
const tokenId = "0"; // The token ID of the NFT you want to send
const amount = 3; // How many copies of the NFTs to transfer
await contract.transfer(toAddress, tokenId, amount);
View in React SDK Documentation

Burning NFTs

Burn a specified amount of a NFT
const result = await contract.burnTokens(tokenId, amount);
View in React SDK Documentation