Edition
When using the Edition smart contract, there is no need to provide a contract type argument, as the functionality of the smart contract is all available through the extensions interface.
The extensions that the edition contract supports are listed below.
- ERC1155
- ERC1155Burnable
- ERC1155Enumerable
- ERC1155Mintable
- ERC1155BatchMintable
- ERC1155SignatureMintable
- Royalty
- PlatformFee
- PrimarySale
- Permissions
- ContractMetadata
- Ownable
- Gasless
airdrop
Transfer NFTs from the connected wallet to multiple different wallets at once.
const txResult = await contract.erc1155.airdrop(
// Token ID of the NFT to transfer
"{{token_id}}",
// Array of wallet addresses to transfer to
[
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 1, // Quantity of the NFT to transfer
},
{
address: "{{wallet_address}}", // Wallet address to transfer to
quantity: 2, // Quantity of the NFT to transfer
},
],
);
Configuration
tokenId
The token ID of the NFT to transfer.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.airdrop(
"{{token_id}}",
[
// ...
],
);
addresses
An array of objects containing address
and quantity
properties.
These are the recipients of the airdrop.
const txResult = await contract.erc1155.airdrop("{{token_id}}", [
{
address: "{{wallet_address}}",
quantity: 1,
},
{
address: "{{wallet_address}}",
quantity: 2,
},
]);
balance
Get the quantity of a specific NFT owned by the connected wallet.
const tokenId = 0; // Id of the NFT to check
const balance = await contract.erc1155.balanceOf(tokenId);
Configuration
balanceOf
Get the quantity of a specific NFT owned by a wallet.
// 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.erc1155.balanceOf(walletAddress, tokenId);
Configuration
address
The wallet address to check the NFT balance for.
Must be a string
.
const balance = await contract.erc1155.balanceOf(
"{{wallet_address}}",
"{{token_id}}",
);
tokenId
The token ID of the NFT to check the balance of.
const balance = await contract.erc1155.balanceOf(
"{{wallet_address}}",
"{{token_id}}",
);
Return Value
A BigNumber
representing the quantity of the NFT owned by the wallet.
BigNumber;
burn
Burn the specified NFTs from the connected wallet.
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of the NFT you want to burn
const amount = 2;
const txResult = await contract.erc1155.burn(tokenId, amount);
Configuration
tokenId
The token ID of the NFT(s) you want to burn.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.burn(
"{{token_id}}",
"{{amount}}",
);
amount
The amount of the NFT you want to burn of the specified token ID.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.burn(
"{{token_id}}",
"{{amount}}",
);
burnFrom
The same as burn
, but allows you to specify the wallet to burn NFTs from.
// The address of the wallet to burn NFTS from
const account = "0x...";
// The token ID to burn NFTs of
const tokenId = 0;
// The amount of this NFT you want to burn
const amount = 2;
const txResult = await contract.erc1155.burnFrom(account, tokenId, amount);
Configuration
account
The address of the wallet to burn NFTs from.
Must be a string
.
const txResult = await contract.erc1155.burnFrom(
"{{wallet_address}}", // Address to burn from
"{{token_id}}",
"{{amount}}",
);
tokenId
Same as tokenId
in burn
.
amount
Same as amount
in burn
.
burnBatch
Burn multiple different NFTs in the same transaction from the connected wallet.
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatch(tokenIds, amounts);
Configuration
tokenIds
An array of token IDs of the NFTs you want to burn.
Must be an array of string
, number
, or BigNumber
.
const result = await contract.erc1155.burnBatch(
[0, 1], // Burn token ID 0 and token ID 1
[2, 2],
);
amounts
An array of the amounts of each NFT you want to burn.
The index of each amount corresponds to the index of the token ID in the tokenIds
array.
For example, the first item in the tokenIds
array will have the first item in the amounts
array burned.
Must be an array of string
, number
, or BigNumber
.
const result = await contract.erc1155.burnBatch(
[0, 1],
[2, 2], // In this case, 2 of token ID 0 and 2 of token ID 1 will be burned
);
burnBatchFrom
Burn the batch NFTs from the specified wallet
// The address of the wallet to burn NFTS from
const address = "0x...";
// The token IDs to burn NFTs of
const tokenIds = [0, 1];
// The amounts of each NFT you want to burn
const amounts = [2, 2];
const result = await contract.erc1155.burnBatchFrom(address, tokenIds, amounts);
Configuration
address
The address of the wallet to burn NFTs from.
Must be a string
.
const result = await contract.erc1155.burnBatchFrom(
"{{address}}",
[0, 1],
[2, 2],
);
tokenIds
Same as tokenIds
in burnBatch
.
amounts
Same as amounts
in burnBatch
.
generate
Generate a signature that a wallet address can use to mint the specified number of NFTs.
This is typically an admin operation, where the owner of the contract generates a signature that allows another wallet to mint tokens.
const payload = {
quantity: 100, // (Required) The quantity of tokens to be minted
to: "{{wallet_address}}", // (Required) Who will receive the tokens
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
currencyAddress: "{{currency_contract_address}}", // (Optional) the currency to pay with
price: 0.5, // (Optional) the price to pay for minting those tokens (in the currency above)
mintStartTime: new Date(), // (Optional) can mint anytime from now
mintEndTime: new Date(Date.now() + 60 * 60 * 24 * 1000), // (Optional) to 24h from now,
primarySaleRecipient: "0x...", // (Optional) custom sale recipient for this token mint
};
const signedPayload = contract.erc1155.signature.generate(payload);
Configuration
The mintRequest
object you provide to the generate
function outlines what the signature can be used for.
The quantity
, to
, and metadata
fields are required, while the rest are optional.
quantity (required)
The number of tokens this signature can be used to mint.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
});
to (required)
The wallet address that can use this signature to mint tokens.
This is to prevent another wallet from intercepting the signature and using it to mint tokens for themselves.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
});
metadata (required)
The metadata of the NFT to mint.
Can either be a string
URL that points to valid metadata that conforms to the metadata standards,
or an object that conforms to the same standards.
If you provide an object, the metadata is uploaded and pinned to IPFS before the NFT(s) are minted.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
});
currencyAddress (optional)
The address of the currency to pay for minting the tokens (use the price
field to specify the price).
Defaults to NATIVE_TOKEN_ADDRESS
(the native currency of the network, e.g. Ether on Ethereum).
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
currencyAddress: "{{currency_contract_address}}",
});
price (optional)
If you want the user to pay for minting the tokens, you can specify the price per token.
Defaults to 0
(free minting).
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
price: "{{price}}", // The user will have to pay `price * quantity` for minting the tokens
});
mintStartTime (optional)
The time from which the signature can be used to mint tokens.
Defaults to Date.now()
(now).
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
mintStartTime: new Date(), // The user can mint the tokens from this time
});
mintEndTime (optional)
The time until which the signature can be used to mint tokens.
Defaults to new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 10),
(10 years from now).
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
mintEndTime: new Date(Date.now() + 60 * 60 * 24 * 1000), // The user can mint the tokens until this time
});
primarySaleRecipient (optional)
If a price
is specified, the funds will be sent to the primarySaleRecipient
address.
Defaults to the primarySaleRecipient
address of the contract.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
price: "{{price}}",
primarySaleRecipient: "{{wallet_address}}", // The funds will be sent to this address
});
royaltyBps (optional)
The percentage fee you want to charge for secondary sales.
Defaults to the royaltyBps
of the contract.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
price: "{{price}}",
royaltyBps: 500, // A 5% royalty fee.
});
royaltyRecipient (optional)
The address that will receive the royalty fees from secondary sales.
Defaults to the royaltyRecipient
address of the contract.
const signature = await contract.erc1155.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
// ... Your NFT metadata
},
price: "{{price}}",
royaltyBps: 500, // A 5% royalty fee.
royaltyRecipient: "{{wallet_address}}", // The royalty fees will be sent to this address
});
generateBatch
Generate a batch of signatures at once.
This is the same as generate
but it allows you to generate multiple signatures at once.
const signatures = await contract.erc1155.signature.generateBatch([
{
to: "{{wallet_address}}",
quantity: "{{quantity}}",
metadata: {
// ... Your NFT metadata
},
}
{
to: "{{wallet_address}}",
quantity: "{{quantity}}",
metadata: {
// ... Your NFT metadata
},
}
]);
Configuration
generateFromTokenId
Generate a signature that can be used to mint additional supply of an existing NFT in the contract.
This is the same as generate
but it allows you to specify the tokenId
of the NFT you want to mint additional supply for, rather than
providing the metadata
of the NFT. Each other configuration option is the same as generate
.
const signature = await contract.erc1155.signature.generateFromTokenId({
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
});
Configuration
The configuration options available are the same as those in generate
except for replacing metadata
with tokenId
.
tokenId
The tokenId
of the NFT you want to mint additional supply for.
const signature = await contract.erc1155.signature.generateFromTokenId({
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
});
generateBatchFromTokenIds
Generate a batch of signatures that can be used to mint additional supply of existing NFTs in the contract.
This is the same as generateBatch
but allows you to generate multiple signatures at once.
const signatures = await contract.erc1155.signature.generateBatchFromTokenIds([
{
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
},
{
to: "{{wallet_address}}",
tokenId: "{{token_id}}",
quantity: "{{quantity}}",
},
]);
Configuration
Provide an array of objects containing the configuration options for each signature.
See generateFromTokenId
for the configuration options available for each signature.
get
Get the metadata of an NFT using it’s token ID.
Metadata is fetched from the uri
property of the NFT.
If the metadata is hosted on IPFS, the metadata is fetched and made available as an object.
The object’s image
property will be a URL that is available through the thirdweb IPFS gateway.
const nft = await contract.erc1155.get(0);
Configuration
tokenId
The token ID of the NFT to get the metadata for.
Must be a string
, number
, or BigNumber
.
const nft = await contract.erc1155.get(
"{{token_id}}",
);
Return Value
Returns an NFT
object containing the following properties:
{
metadata: {
id: string;
uri: string; // The raw URI of the metadata
owner: string;
name?: string | number | undefined;
description?: string | null | undefined;
image?: string | null | undefined; // If the image is hosted on IPFS, the URL is https://gateway.ipfscdn.io/ipfs/<hash>
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
background_color?: string | undefined;
properties?: {
[x: string]: unknown;
} | {
[x: string]: unknown;
}[] | undefined;
};
owner: string;
type: "ERC1155";
supply: number;
quantityOwned?: number;
}
get - Contract Metadata
Get the metadata of a smart contract.
const metadata = await contract.metadata.get();
Configuration
Return Value
While the actual return type is any
, you can expect an object containing
properties that follow the
contract level metadata standards, outlined below:
{
name: string; // Name of your smart contract
description?: string; // Short description of your smart contract
image?: string; // Image of your smart contract (any URL, or IPFS URI)
symbol?: string; // Symbol of your smart contract (ticker, e.g. "ETH")
external_link?: string; // Link to view this smart contract on your website
seller_fee_basis_points?: number // The fee you charge on secondary sales, e.g. 100 = 1% seller fee.
fee_recipient?: string; // Wallet address that receives the seller fee
}
get - Owner
Retrieve the wallet address of the owner of the smart contract.
const owner = await contract.owner.get();
Configuration
get - Permissions
Get a list of wallet addresses that are members of a given role.
const members = await contract.roles.get("{{role_name}}");
Configuration
get - Platform Fee
Get the platform fee recipient and basis points.
const feeInfo = await contract.platformFee.get();
Configuration
Return Value
Returns an object containing the platform fee recipient and basis points.
{
platform_fee_basis_points: number;
platform_fee_recipient: string;
}
getAll - Permissions
Retrieve all of the roles and associated wallets.
const allRoles = await contract.roles.getAll();
Configuration
Return Value
An object containing role names as keys and an array of wallet addresses as the value.
<Record<any, string[]>>
getDefaultRoyaltyInfo
Gets the royalty recipient and BPS (basis points) of the smart contract.
const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
Configuration
Return Value
Returns an object containing the royalty recipient address and BPS (basis points) of the smart contract.
{
seller_fee_basis_points: number;
fee_recipient: string;
}
getMintTransaction
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.
const txResult = await contract.erc1155.getMintTransaction(
"{{wallet_address}}", // Wallet address to mint to
{
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
supply: 1000, // The number of this NFT you want to mint
},
);
Configuration
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
metadataWithSupply
See metadataWithSupply
in the mint
method.
Return Value
TransactionTask;
getRecipient
Get the primary sale recipient.
const salesRecipient = await contract.sales.getRecipient();
Configuration
getTokenRoyaltyInfo
Gets the royalty recipient and BPS (basis points) of a particular token in the contract.
const royaltyInfo = await contract.royalties.getTokenRoyaltyInfo(
"{{token_id}}",
);
Configuration
grant - Permissions
Make a wallet a member of a given role.
const txResult = await contract.roles.grant(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
isApproved
Get whether this wallet has approved transfers from the given operator.
This means that the operator can transfer NFTs on behalf of this wallet.
const isApproved = await contract.erc1155.isApproved(
// Address of the wallet to check
"{{wallet_address}}",
// Address of the operator to check
"{{wallet_address}}",
);
Configuration
owner
The wallet address that owns the NFT.
Must be a string
.
const isApproved = await contract.erc1155.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);
operator
The wallet address of the operator to check (i.e. the wallet that does/does not have approval).
Must be a string
.
const isApproved = await contract.erc1155.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);
lazyMint
Lazy mint a new batch of NFTs into the smart contract.
By default, the NFT metadata is uploaded and pinned to IPFS before minting.
You can override this default behavior by providing a string
that points to valid metadata instead of objects.
The metadata must conform to the metadata standards.
// Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
const metadataOne = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const metadataTwo = {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const txResult = await contract.erc1155.lazyMint([metadataOne, metadataTwo]);
Alternatively, you can provide a string
that points to valid metadata instead of objects.
const metadataOne = "ipfs://Qm..."; // IPFS URI
const metadataTwo = "https://my-nft-metadata.json"; // Some other URL
const txResult = await contract.erc1155.lazyMint([metadataOne, metadataTwo]);
Configuration
metadatas
Provide an array of either strings
that point to, or objects
that contain
valid metadata properties.
transfer
Transfer an NFT from the connected wallet to another wallet.
// 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.erc1155.transfer(toAddress, tokenId, amount);
Configuration
to
The wallet address to send the NFT to.
Must be a string
.
await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);
tokenId
The token ID of the NFT to transfer.
Must be a string
, number
, or BigNumber
.
await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);
amount
The quantity of the NFT to transfer.
Must be a string
, number
, or BigNumber
.
await contract.erc1155.transfer(
"{{wallet_address}}",
"{{token_id}}",
"{{amount}}",
);
mint
Mint a new NFT to the connected wallet.
const metadata = {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const tx = await contract.erc1155.mint({
metadata: metadata,
supply: 1000, // The number of this NFT you want to mint
});
Configuration
metadataWithSupply
An object containing a metadata
object and a supply
property.
The metadata object can either be a string that points to valid metadata that conforms to the metadata standards, or an object that conforms to the same standards.
If you provide an object, the metadata is uploaded and pinned to IPFS before the NFT(s) are minted.
// Below is an example of using a string rather than an object for metadata
const metadata = "https://example.com/metadata.json"; // Any URL or IPFS URI that points to metadata
const txResult = await contract.erc1155.mint({
metadata: metadata,
supply: 1000, // The number of this NFT you want to mint
});
mint - Signature-based
Mint tokens from a previously generated signature (see generate
).
// Use the signed payload to mint the tokens
const txResult = contract.erc1155.signature.mint(signature);
Configuration
signature (required)
The signature created by the generate
function.
The typical pattern is the admin generates a signature, and the user uses it to mint the tokens, under the conditions specified in the signature.
Must be of type SignedPayload1155
.
// Use the signed payload to mint the tokens
const txResult = contract.erc1155.signature.mint(
signature, // Signature generated by the `generate` function
);
mintAdditionalSupply
Mint additional quantity of an NFT that already exists on the contract.
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupply(
tokenId,
additionalSupply,
);
Configuration
tokenId
The ID of the NFT you want to mint additional supply for.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupply(
"{{token_id}}",
"{{additional_supply}}",
);
additionalSupply
How much additional supply you want to mint.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupply(
"{{token_id}}",
"{{additional_supply}}",
);
mintAdditionalSupplyTo
The same as mintAdditionalSupply
, but allows you to specify the address of the wallet rather than using the connected wallet.
const toAddress = "{{wallet_address}}";
const tokenId = 0;
const additionalSupply = 1000;
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
toAddress,
tokenId,
additionalSupply,
);
Configuration
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
);
tokenId
The ID of the NFT you want to mint additional supply for.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
);
additionalSupply
How much additional supply you want to mint.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc1155.mintAdditionalSupplyTo(
"{{wallet_address}}",
"{{token_id}}",
"{{additional_supply}}",
);
mintBatch
Mint many different NFTs with limited supplies to the connected wallet.
// 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: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
{
supply: 100, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
];
const txResult = await contract.erc1155.mintBatch(metadataWithSupply);
Configuration
metadataWithSupply
An array of objects that contain the metadata and supply of each NFT you want to mint.
The supply
property is the number of this NFT you want to mint.
Must be a string
, number
, bigint
, or BigNumber
.
The metadata
object must follow the metadata standards.
Alternatively, you can provide a string
s that points to a valid metadata object
to override the default behavior of uploading and pinning the metadata to IPFS (shown below).
const metadatas = [
{
metadata: "https://example.com/metadata1.json", // Any URI/URL that points to metadata
supply: 50,
},
{
metadata: "ipfs://my-ipfs-hash", // Any URI/URL that points to metadata
supply: 100,
},
];
const txResult = await contract.erc1155.mintBatch(metadatas);
mintBatch - Signature-based
Use multiple signatures at once to mint tokens.
This is the same as mint
but it allows you to provide multiple signatures at once.
// Use the signed payloads to mint the tokens
const txResult = contract.erc1155.signature.mintBatch(signatures);
Configuration
signatures (required)
An array of signatures created by the generate
or generateBatch
functions.
Must be of type SignedPayload1155[]
.
mintBatchTo
The same as mintBatch
, but allows you to specify the wallet, rather than using the connected one.
// 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: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
{
supply: 100, // The number of this NFT you want to mint
metadata: {
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
},
},
];
const txResult = await contract.erc1155.mintBatchTo(
toAddress,
metadataWithSupply,
);
Configuration
toAddress
The address of the wallet you want to mint the NFT to.
Must be a string
.
// Custom metadata and supplies of your NFTs
const metadataWithSupply = [
// ...
];
const txResult = await contract.erc1155.mintBatchTo(
"{{wallet_address}}",
metadataWithSupply,
);
metadataWithSupply
See mintBatch
for more details.
mintTo
The same as mint
, but allows you to specify the address of the wallet rather than using the connected wallet.
// 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 #1",
description: "This is a cool NFT",
image: "https://example.com/image.png", // URL, IPFS URI, or File object
// ... Any other metadata you want to include
};
const metadataWithSupply = {
metadata,
supply: 1000, // The number of this NFT you want to mint
};
const txResult = await contract.erc1155.mintTo(toAddress, metadataWithSupply);
Configuration
to
The address of the wallet you want to mint the NFT to.
Must be a string
.
const metadataWithSupply = {
// ...
};
const txResult = await contract.erc1155.mintTo(
"{{wallet_address}}",
metadataWithSupply,
);
metadataWithSupply
Same as metadataWithSupply
in the mint
method.
nextTokenIdToMint
Get the next token ID that will be minted on the contract.
const nextTokenId = await contract.erc1155.nextTokenIdToMint();
Configuration
Return Value
Returns a BigNumber
representing the next token ID that will be minted on the contract.
BigNumber;
revoke - Permissions
Revoke a given role from a wallet.
const txResult = await contract.roles.revoke(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
set - Contract Metadata
Overwrite the metadata of a contract, an object following the contract level metadata standards.
This operation ignores any existing metadata and replaces it with the new metadata provided.
const txResult = await contract.metadata.set({
name: "My Contract",
description: "My contract description",
});
Configuration
metadata
Provide an object containing the metadata of your smart contract following the contract level metadata standards.
{
name: string; // Name of your smart contract
description?: string; // Short description of your smart contract
image?: string; // Image of your smart contract (any URL, or IPFS URI)
symbol?: string; // Symbol of your smart contract (ticker, e.g. "ETH")
external_link?: string; // Link to view this smart contract on your website
seller_fee_basis_points?: number // The fee you charge on secondary sales, e.g. 100 = 1% seller fee.
fee_recipient?: string; // Wallet address that receives the seller fee
}
Set the primary sale recipient.
await contract.sales.setRecipient("{{wallet_address}}");
Configuration
set - Owner
Set the owner address of the contract.
const txResult = await contract.owner.set("{{wallet_address}}");
Configuration
owner
The wallet address of the new owner.
Must be a string
.
const txResult = await contract.owner.set(
"{{wallet_address}}",
);
set - Platform Fee
Set the platform fee recipient and basis points.
const txResult = await contract.platformFees.set({
platform_fee_basis_points: 100,
platform_fee_recipient: "0x123",
});
Configuration
setAll - Permissions
Overwrite all roles with new members.
This overwrites all members, INCLUDING YOUR OWN WALLET ADDRESS!
This means you can permanently remove yourself as an admin, which is non-reversible.
Please use this method with caution.
const txResult = await contract.roles.setAll({
admin: ["0x12", "0x123"],
minter: ["0x1234"],
});
Configuration
roles
An object containing role names as keys and an array of wallet addresses as the value.
const txResult = await contract.roles.setAll(
{
admin: ["0x12", "0x123"], // Grant these two wallets the admin role
minter: ["0x1234"], // Grant this wallet the minter role
},
);
setApprovalForAll
Give another address approval (or remove approval) to transfer all of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
const txResult = await contract.erc1155.setApprovalForAll(
// Address of the wallet to approve
"{{wallet_address}}",
// Whether to grant approval (true) or remove approval (false)
true,
);
Configuration
operator
The wallet address to approve.
Must be a string
.
const txResult = await contract.erc1155.setApprovalForAll(
"{{wallet_address}}",
true,
);
approved
Whether to grant approval (true) or remove approval (false).
Must be a boolean
.
const txResult = await contract.erc1155.setApprovalForAll(
"{{wallet_address}}",
true,
);
setDefaultRoyaltyInfo
Set the royalty recipient and fee for the smart contract.
await contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});
Configuration
setTokenRoyaltyInfo
Set the royalty recipient and fee for a particular token in the contract.
await contract.royalties.setTokenRoyaltyInfo("{{token_id}}", {
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});
Configuration
totalCirculatingSupply
Get the total circulating supply of a token in the collection.
Circulating supply considers NFTs that have not been burned.
const totalCirculatingSupply = await contract.erc1155.totalCirculatingSupply(
"{{token_id}}",
);
Configuration
tokenId
The token ID of the NFT to get the total circulating supply of.
Must be a string
, number
, or BigNumber
.
const totalCirculatingSupply = await contract.erc1155.totalCirculatingSupply(
"{{token_id}}",
);
Return Value
Returns a BigNumber
representing the total circulating supply of the token.
BigNumber;
totalCount
Get the total number of unique NFTs in the collection.
const totalCount = await contract.erc1155.totalCount();
Return Value
Returns a BigNumber
representing the total number of unique NFTs in the collection.
BigNumber;
totalSupply
Returns the total supply of a token in the collection, including burned tokens.
const totalSupply = await contract.erc1155.totalSupply("{{token_id}}");
Configuration
update - Contract Metadata
Update the metadata of your smart contract.
const txResult = await contract.metadata.update({
name: "My Contract",
description: "My contract description",
});
Configuration
metadata
Provide an object containing the metadata of your smart contract following the contract level metadata standards.
New properties will be added, and existing properties will be overwritten. If you do not provide a new value for a previously set property, it will remain unchanged.
Below are the properties you can define on your smart contract.
{
name: string; // Name of your smart contract
description?: string; // Short description of your smart contract
image?: string; // Image of your smart contract (any URL, or IPFS URI)
symbol?: string; // Symbol of your smart contract (ticker, e.g. "ETH")
external_link?: string; // Link to view this smart contract on your website
seller_fee_basis_points?: number // The fee you charge on secondary sales, e.g. 100 = 1% seller fee.
fee_recipient?: string; // Wallet address that receives the seller fee
}
verify - Signature-based
Verify that a payload is correctly signed.
This allows you to provide a payload, and prove that it was valid and was generated by a wallet with permission to generate signatures.
If a payload is not valid, the mint
/mintBatch
functions will fail,
but you can use this function to verify that the payload is valid before attempting to mint the tokens
if you want to show a more user-friendly error message.
// Provide the generated payload to verify that it is valid
const isValid = await contract.erc1155.signature.verify(payload);
Configuration
verify - Permissions
Check to see if a wallet has a set of roles.
Throws an error if the wallet does not have any of the given roles.
const verifyRole = await contract.roles.verify(
["admin", "minter"],
"{{wallet_address}}",
);