When using the Signature Drop 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.
balance
Get the NFT balance of the connected wallet (number of NFTs in this contract owned by the connected wallet).
const balance = await contract.erc721.balance();
Configuration
Return Value
Returns a BigNumber
representing the number of NFTs owned by the connected wallet.
balanceOf
Get a wallet’s NFT balance (number of NFTs in this contract owned by the wallet).
const walletAddress = "{{wallet_address}}";
const balance = await contract.erc721.balanceOf(walletAddress);
Configuration
walletAddress
The wallet address to check the balance for.
Must be a string
.
const balance = await contract.erc721.balanceOf(
"{{wallet_address}}",
);
Return Value
Returns a BigNumber
representing the number of NFTs owned by the wallet.
burn
Burn an NFT from the connected wallet.
const txResult = await contract.erc721.burn("{{token_id}}");
Configuration
tokenId
The token ID of the NFT to burn.
Must be a string
, number
, or BigNumber
.
const txResult = await contract.erc721.burn(
"{{token_id}}",
);
canClaim
Check if tokens are currently available for claiming, optionally specifying if a specific wallet
address can claim.
const canClaim = await contract.erc721.claimConditions.canClaim("{{quantity}}");
Configuration
quantity (required)
The amount of tokens to claim.
This checks to see if the specified amount of tokens are available for claiming. i.e.:
- There is sufficient quantity available for claiming.
- This amount of tokens can be claimed in a single transaction.
Must be a string
or number
.
addressToCheck (optional)
The wallet address to check if it can claim tokens.
This considers all aspects of the active claim phase, including allowlists, previous claims, etc.
Must be a string
.
Return Value
Returns a boolean
indicating if the specified amount of tokens can be claimed or not.
claim
Claim a specified number of tokens to the connected wallet.
const txResult = await contract.erc721.claim("{{quantity}}");
Configuration
quantity (required)
The number of tokens to claim.
Must be a string
or number
.
options (optional)
Customizable ClaimOptions
object that can be used to override the default behaviour of the claim.
There are three options available:
checkERC20Allowance
- Whether to check the ERC20 allowance of the sender, defaults to true.currencyAddress
- The currency to pay for each token claimed, defaults to NATIVE_TOKEN_ADDRESS
for native currency.pricePerToken
- The price to pay for each token claimed. Not relevant when using claim conditions.
const txResult = await contract.erc721.claim("{{token_id}}", "{{quantity}}", {
checkERC20Allowance: true,
currencyAddress: "{{currency_contract_address}}",
pricePerToken: "{{price}}",
});
claimTo
The same as claim
, but allows specifying the recipient
address rather than using the connected wallet.
const txResult = await contract.erc721.claimTo(
"{{wallet_address}}",
"{{quantity}}",
);
Configuration
recipient (required)
The wallet address to receive the claimed tokens.
Must be a string
.
quantity (required)
The number of tokens to claim.
Must be a string
or number
.
options (optional)
Customizable ClaimOptions
object that can be used to override the default behaviour of the claim.
See claim
for more details.
createDelayedRevealBatch
Create a batch of encrypted NFTs that can be revealed at a later time.
Provide an array of metadata for the NFTs you want to create, which can either be a
string
URL that points to metadata, or an object.
The metadata must conform to the metadata standards.
If you provide an object, it is uploaded and pinned to IPFS before being
lazy-minted into the contract.
const realNFTs = [
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
{
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
];
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!",
};
await contract.erc721.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
Configuration
placeholder
A single metadata object
or URL string that points to
valid metadata.
This is the metadata users will see until you reveal
the batch.
const realNFTs = [
];
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!",
image: "https://example.com/image.png",
};
const txResult = await contract.erc721.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
An array of metadata objects or URL strings that point to valid metadata.
These are the NFTs that will be revealed when you reveal
the batch.
const realNFTs = [
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
{
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
];
const placeholderNFT = {
};
const txResult = await contract.erc721.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
password
The password that will be used to reveal
the batch.
Passwords cannot be recovered or reset. If you forget your password, you will
not be able to reveal your NFTs.
const realNFTs = [
];
const placeholderNFT = {
};
const txResult = await contract.erc721.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
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 = {
to: "{{wallet_address}}",
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
currencyAddress: "{{currency_contract_address}}",
price: 0.5,
mintStartTime: new Date(),
mintEndTime: new Date(Date.now() + 60 * 60 * 24 * 1000),
primarySaleRecipient: "0x...",
quantity: 100,
};
const signedPayload = contract.erc721.signature.generate(payload);
Configuration
The mintRequest
object you provide to the generate
function outlines what the signature can be used for.
The to
, and metadata
fields are required, while the rest are optional.
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
});
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
});
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
price: "{{price}}",
});
mintStartTime (optional)
The time from which the signature can be used to mint tokens.
Defaults to Date.now()
(now).
const signature = await contract.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
mintStartTime: new Date(),
});
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
mintEndTime: new Date(Date.now() + 60 * 60 * 24 * 1000),
});
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
price: "{{price}}",
primarySaleRecipient: "{{wallet_address}}",
});
royaltyBps (optional)
The percentage fee you want to charge for secondary sales.
Defaults to the royaltyBps
of the contract.
const signature = await contract.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
price: "{{price}}",
royaltyBps: 500,
});
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.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
price: "{{price}}",
royaltyBps: 500,
royaltyRecipient: "{{wallet_address}}",
});
quantity (optional)
The number of tokens this signature can be used to mint.
const signature = await contract.erc721.signature.generate({
quantity: "{{quantity}}",
to: "{{wallet_address}}",
metadata: {
},
});
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.erc721.signature.generateBatch([
{
to: "{{wallet_address}}",
metadata: {
},
}
{
to: "{{wallet_address}}",
metadata: {
},
}
]);
Configuration
payloadsToSign
An array of objects containing the configuration options for each signature.
See generate
for the configuration options available for each signature.
get
Get the metadata for an NFT in this contract 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 tokenId = 0;
const nft = await contract.erc721.get(tokenId);
Configuration
tokenId
The token ID of the NFT to get the metadata for.
Must be a BigNumber
, number
, or string
.
const nft = await contract.erc721.get(
"{{token_id}}",
);
Return Value
Returns an NFT
object containing the NFT metadata.
{
metadata: {
id: string;
uri: string;
owner: string;
name?: string | number | undefined;
description?: string | null | undefined;
image?: string | null | undefined;
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
background_color?: string | undefined;
properties?: {
[x: string]: unknown;
} | {
[x: string]: unknown;
}[] | undefined;
};
type: "ERC721";
}
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;
description?: string;
image?: string;
symbol?: string;
external_link?: string;
seller_fee_basis_points?: number
fee_recipient?: string;
}
get - Permissions
Get a list of wallet addresses that are members of a given role.
const members = await contract.roles.get("{{role_name}}");
Configuration
role
The name of the role.
Must be a string
.
const members = await contract.roles.get(
"{{role_name}}",
);
Return Value
An array of string
s representing the wallet addresses associated with the given role.
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;
}
get - Owner
Retrieve the wallet address of the owner of the smart contract.
const owner = await contract.owner.get();
Configuration
Return Value
A string
representing the owner’s wallet address.
getActive - Claim Conditions
Retrieve the currently active claim phase, if any.
const activePhase = await contract.erc721.claimConditions.getActive();
Configuration
options (optional)
Provide an object containing a withAllowlist
property to include the allowlist in the response.
By default, the method will not include the allowlist in the returned data.
To include the allowlist in the returned data, set the withAllowlist
option to true
.
This will add a snapshot
property to the returned data, which contains the allowlist in an array.
const activePhase = contract.erc721.claimConditions.getActive({
withAllowList: true,
});
Return Value
If there is no active claim phase, returns undefined
.
If a claim condition is active, returns a ClaimCondition
object containing the following properties:
{
maxClaimableSupply: string;
startTime: Date;
price: BigNumber;
currencyAddress: string;
maxClaimablePerWallet: string;
waitInSeconds: BigNumber;
merkleRootHash: string | number[];
availableSupply: string;
currentMintSupply: string;
currencyMetadata: {
symbol: string;
value: BigNumber;
name: string;
decimals: number;
displayValue: string;
};
metadata?: {
[x: string]: unknown;
name?: string | undefined;
} | undefined;
snapshot?: {
price?: string | undefined;
currencyAddress?: string | undefined;
address: string;
maxClaimable: string;
}[] | null | undefined;
}
getAll
Get the metadata and current owner of all NFTs in the contract.
By default, returns the first 100
NFTs (in order of token ID). Use queryParams
to paginate the results.
const nfts = await contract.erc721.getAll();
Configuration
queryParams (optional)
Provide an optional object to configure the query. Useful for paginating the results.
const queryParams = {
count: 100,
start: 0,
};
const nfts = await contract.erc721.getAll(queryParams);
Return Value
Returns an array of NFT
objects.
{
metadata: {
id: string;
uri: string;
owner: string;
name?: string | number | undefined;
description?: string | null | undefined;
image?: string | null | undefined;
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
background_color?: string | undefined;
properties?: {
[x: string]: unknown;
} | {
[x: string]: unknown;
}[] | undefined;
};
type: "ERC1155" | "ERC721";
}[]
getAll - Claim Conditions
Get all the claim phases configured for the drop.
const claimPhases = await contract.erc721.claimConditions.getAll(
"{{token_id}}",
);
Configuration
options (optional)
Optionally return the allowlist with each claim phase.
See getActive
configuration for more details.
Return Value
Returns an array of ClaimCondition
objects.
{
maxClaimableSupply: string;
startTime: Date;
price: BigNumber;
currencyAddress: string;
maxClaimablePerWallet: string;
waitInSeconds: BigNumber;
merkleRootHash: string | number[];
availableSupply: string;
currentMintSupply: string;
currencyMetadata: {
symbol: string;
value: BigNumber;
name: string;
decimals: number;
displayValue: string;
};
metadata?: {
[x: string]: unknown;
name?: string | undefined;
} | undefined;
snapshot?: {
price?: string | undefined;
currencyAddress?: string | undefined;
address: string;
maxClaimable: string;
}[] | null | undefined;
}[]
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.
getAllOwners
Get all wallet addresses that own an NFT in this contract.
const owners = await contract.erc721.getAllOwners();
Configuration
Return Value
Returns an array of objects containing a tokenId
and owner
address.
tokenId
is the ID of the NFT.owner
is the wallet address of the owner that owns the NFT.
{
tokenId: number;
owner: string;
}
[];
getBatchesToReveal
Get a list of unrevealed batches.
const batches = await contract.erc721.revealer.getBatchesToReveal();
Configuration
Returns an array of BatchToReveal
objects, containing the following properties:
{
batchId: BigNumber;
batchUri: string;
placeholderMetadata: {
id: string;
uri: string;
owner: string;
name?: string | number | undefined;
description?: string | null | undefined;
image?: string | null | undefined;
external_url?: string | null | undefined;
animation_url?: string | null | undefined;
background_color?: string | undefined;
properties?: {
[x: string]: unknown;
} | {
[x: string]: unknown;
}[] | undefined;
};
type: "erc721";
};
}[];
getClaimIneligibilityReasons
Get an array of reasons why a specific wallet address is not eligible to claim tokens, if any.
const reasons =
await contract.erc721.claimConditions.getClaimIneligibilityReasons(
"{{quantity}}",
"{{wallet_address}}",
);
Configuration
quantity (required)
The amount of tokens to check if the wallet address can claim.
Must be a string
or number
.
addressToCheck (optional)
The wallet address to check if it can claim tokens.
Must be a string
.
Return Value
Returns an array of ClaimEligibility
strings, which may be empty.
For example, if the user is not in the allowlist, this hook will return ["This address is not on the allowlist."]
.
If the user is eligible to claim tokens, the hook will return an empty array.
ClaimEligibility[]
export enum ClaimEligibility {
NotEnoughSupply = "There is not enough supply to claim.",
AddressNotAllowed = "This address is not on the allowlist.",
WaitBeforeNextClaimTransaction = "Not enough time since last claim transaction. Please wait.",
AlreadyClaimed = "You have already claimed the token.",
NotEnoughTokens = "There are not enough tokens in the wallet to pay for the claim.",
NoActiveClaimPhase = "There is no active claim phase at the moment. Please check back in later.",
NoClaimConditionSet = "There is no claim condition set.",
NoWallet = "No wallet connected.",
Unknown = "No claim conditions found.",
}
getClaimTransaction
Construct a claim transaction without executing it.
This is useful for estimating the gas cost of a claim transaction,
overriding transaction options and having fine grained control over the transaction execution.
const claimTransaction = await contract.erc721.getClaimTransaction(
"{{wallet_address}}",
"{{quantity}}",
);
Configuration
walletAddress (required)
The wallet address to claim tokens for.
Must be a string
.
quantity (required)
The amount of tokens to claim.
Must be a string
, number
or BigNumber
.
options (optional)
See claim
configuration for more details.
Return Value
getClaimerProofs
Returns allowlist information and merkle proofs for a given wallet address.
const claimerProofs = await contract.erc721.claimConditions.getClaimerProofs(
"{{wallet_address}}",
);
Configuration
walletAddress (required)
The wallet address to get the merkle proofs for.
Must be a string
.
Return Value
{
price?: string | undefined;
currencyAddress?: string | undefined;
address: string;
proof: string[];
maxClaimable: string;
} | null | undefined
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;
}
getRecipient
Get the primary sale recipient.
const salesRecipient = await contract.sales.getRecipient();
Configuration
Return Value
Returns a string
containing the wallet address of the primary sale recipient.
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
tokenId
The token ID to get the royalty info for.
Must be a string
, number
, or BigNumber
.
Return Value
Returns an object containing the royalty recipient address and BPS (basis points) of the token.
{
seller_fee_basis_points: number;
fee_recipient: string;
}
grant - Permissions
Make a wallet a member of a given role.
const txResult = await contract.roles.grant(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
role
The name of the role to grant.
Must be a string
.
const txResult = await contract.roles.grant(
"{{role_name}}",
"{{wallet_address}}",
);
wallet
The wallet address to assign the role to.
Must be a string
.
const txResult = await contract.roles.grant(
"{{role_name}}",
"{{wallet_address}}",
);
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.erc721.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);
Configuration
owner
The wallet address that owns the NFT.
Must be a string
.
const isApproved = await contract.erc721.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.erc721.isApproved(
"{{wallet_address}}",
"{{wallet_address}}",
);
lazyMint
Define an array of metadata objects that you want to lazy-mint.
const metadatas = [
{
name: "Cool NFT #1",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
{
name: "Cool NFT #2",
description: "This is a cool NFT",
image: "https://example.com/image.png",
},
];
const txResult = await contract.erc721.lazyMint(metadatas);
Configuration
An array of metadata objects for the NFTs you want to mint.
Must be an array
of object
s that conform to the metadata standards.
Alternatively, you can provide an array of string
s that point to valid metadata objects,
to override the default behavior of uploading and pinning the metadata to IPFS (shown below).
const metadatas = [
"https://example.com/metadata1.json",
"ipfs://my-ipfs-hash",
"https://some-other-url.com/metadata2.json",
];
const txResult = await contract.erc721.lazyMint(metadatas);
mint - Signature-based
Mint tokens from a previously generated signature (see generate
).
const txResult = contract.erc721.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
.
const txResult = contract.erc721.signature.mint(
signature,
);
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.
const txResult = contract.erc721.signature.mintBatch(signatures);
Configuration
signatures (required)
An array of signatures created by the generate
or generateBatch
functions.
Must be of type SignedPayload1155[]
.
ownerOf
Get the wallet address of the owner of an NFT.
const owner = await contract.erc721.ownerOf("{{token_id}}");
Configuration
tokenId
The token ID of the NFT to get the owner of.
Must be a BigNumber
, number
, or string
.
Return Value
Returns a string
representing the wallet address of the owner of the NFT.
revoke - Permissions
Revoke a given role from a wallet.
const txResult = await contract.roles.revoke(
"{{role_name}}",
"{{wallet_address}}",
);
Configuration
role
The name of the role to revoke.
Must be a string
.
const txResult = await contract.roles.revoke(
"{{role_name}}",
"{{wallet_address}}",
);
wallet
The wallet address to remove the role from.
Must be a string
.
const txResult = await contract.roles.revoke(
"{{role_name}}",
"{{wallet_address}}",
);
set - Claim Conditions
Overwrite the claim conditions for the drop.
All properties of a phase are optional, with the default being a free, open,
unlimited claim, in the native currency, starting immediately.
const txResult = await contract.erc721.claimConditions.set(
[
{
metadata: {
name: "Phase 1",
},
currencyAddress: "0x...",
price: 1,
maxClaimablePerWallet: 1,
maxClaimableSupply: 100,
startTime: new Date(),
waitInSeconds: 60 * 60 * 24 * 7,
snapshot: [
{
address: "0x...",
currencyAddress: "0x...",
maxClaimable: 5,
price: 0.5,
},
],
merkleRootHash: "0x...",
},
],
false,
);
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
Provide an object containing the metadata of your smart contract following the
contract level metadata standards.
{
name: string;
description?: string;
image?: string;
symbol?: string;
external_link?: string;
seller_fee_basis_points?: number
fee_recipient?: string;
}
Set the platform fee recipient and basis points.
const txResult = await contract.platformFees.set({
platform_fee_basis_points: 100,
platform_fee_recipient: "0x123",
});
Configuration
The percentage fee to take, in basis points. For example, 100 basis points is 1%.
Must be a number
.
The wallet address that will receive the platform fees.
Must be a string
.
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}}",
);
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"],
minter: ["0x1234"],
},
);
setApprovalForAll
Give another address approval (or remove approval) to transfer any of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
await contract.erc721.setApprovalForAll(
"{{wallet_address}}",
true,
);
Configuration
operator
The wallet address to approve.
Must be a string
.
approved
Whether to approve (true) or remove approval (false).
Must be a boolean
.
setApprovalForToken
Give another address approval (or remove approval) to transfer a specific one of your NFTs from this collection.
Proceed with caution. Only approve addresses you trust.
await contract.erc721.setApprovalForToken(
"{{wallet_address}}",
"{{token_id}}",
);
Configuration
operator
The wallet address to approve.
Must be a string
.
tokenId
The token ID of the NFT to allow the operator to transfer.
Must be a BigNumber
, number
, or string
.
setDefaultRoyaltyInfo
Set the royalty recipient and fee for the smart contract.
await contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100,
fee_recipient: "0x...",
});
Configuration
seller_fee_basis_points
The royalty fee in BPS (basis points). 100 = 1%.
Must be a number
.
fee_recipient
The wallet address that will receive the royalty fees.
Must be a string
.
setRecipient
Set the primary sale recipient.
await contract.sales.setRecipient("{{wallet_address}}");
Configuration
recipient
The wallet address of the primary sale recipient.
Must be a string
.
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,
fee_recipient: "0x...",
});
Configuration
tokenId
The token ID to set the royalty info for.
Must be a string
, number
, or BigNumber
.
seller_fee_basis_points
The royalty fee in BPS (basis points). 100 = 1%.
Must be a number
.
fee_recipient
The wallet address that will receive the royalty fees.
Must be a string
.
transfer
Transfer an NFT from the connected wallet to another wallet.
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.erc721.transfer(walletAddress, tokenId);
Configuration
walletAddress
The wallet address to transfer the NFT to.
Must be a string
.
await contract.erc721.transfer(
"{{wallet_address}}",
"{{token_id}}",
);
tokenId
The token ID of the NFT to transfer.
Must be a BigNumber
, number
, or string
.
await contract.erc721.transfer(
"{{wallet_address}}",
"{{token_id}}",
);
totalCirculatingSupply
Get the total number of NFTs that are currently in circulation.
i.e. the number of NFTs that have been minted and not burned.
const totalSupply = await contract.erc721.totalCirculatingSupply();
Configuration
Return Value
Returns a BigNumber
.
totalClaimedSupply
Get the total number of tokens claimed from the drop so far.
const totalClaimedSupply = await contract.erc721.totalClaimedSupply();
Configuration
Return Value
Returns a BigNumber
representing the total number of tokens claimed from the drop so far.
totalUnclaimedSupply
Get the total number of tokens that are still available to be claimed from the drop.
const totalUnclaimedSupply = await contract.erc721.totalUnclaimedSupply();
Configuration
Return Value
Returns a BigNumber
representing the total number of tokens that are still available to be claimed from the drop.
Configuration
price
The price per token in the currency specified above.
The default value is 0
.
maxClaimablePerWallet
The maximum number of tokens a wallet can claim.
The default value is unlimited
.
maxClaimableSupply
The total number of tokens that can be claimed in this phase.
For example, if you lazy mint 1000 tokens and set the maxClaimableSupply
to 100,
then only 100 tokens will be claimable in this phase, leaving 900 tokens to be claimed in the next phases (if you have any).
This is useful for "early bird" use cases, where you allow users to claim a limited number of tokens at a discounted price during
the first X amount of time.
startTime
When the phase starts (i.e. when users can start claiming tokens).
The default value is immediately.
waitInSeconds
The amount of time between claims a wallet must wait before they can claim again.
The default value is 0
, meaning users can claim again immediately after claiming.
snapshot
A list of wallets that you want to override the default claim conditions for.
Wallet addresses within this list can be set to pay in a
different currency, have a different price, and have a different maximum claimable amount.
{
address: string;
currencyAddress?: string;
maxClaimable?: number;
price?: number;
}
Learn more about improved claim conditions.
merkleRootHash
If you want to provide your own merkle tree for your snapshot, provide the merkle root hash here.
This is only recommended for advanced use cases.
resetClaimEligibilityForAll
This means you reset any previous claim conditions that existed and
allow users to claim again as if the drop had just started.
A boolean value that determines whether to reset the claim conditions or to keep the existing state.
By resetting them, any previous claims that were made will be ignored by the claim condition restrictions.
For example, if you had a limit of 1 token per wallet, and a user claimed a token,
then you reset the claim conditions, that user will be able to claim another token.
Must be a boolean
.
Defaults to false
.
totalCount
Get the total number of NFTs minted in this contract.
Unlike totalCirculatingSupply
, this includes NFTs that have been burned.
const totalSupply = await contract.erc721.totalCount();
Configuration
Return Value
Returns a BigNumber
.
update - Claim Conditions
Update a single claim phase, by providing the index of the claim
phase and the new phase configuration.
The index
is the position of the phase in the list of phases you have made, starting from zero.
e.g. if you have two phases, the first phase has an index of 0
and the second phase has an index of 1
.
All properties of a phase are optional, with the default being a free, open, unlimited claim, in the native currency, starting immediately.
const txResult = await contract?.erc721.claimConditions.update(
0,
{
metadata: {
name: "Phase 1",
},
currencyAddress: "0x...",
price: 1,
maxClaimablePerWallet: 1,
maxClaimableSupply: 100,
startTime: new Date(),
waitInSeconds: 60 * 60 * 24 * 7,
snapshot: [
{
address: "0x...",
currencyAddress: "0x...",
maxClaimable: 5,
price: 0.5,
},
],
merkleRootHash: "0x...",
},
);
Configuration
See [`set`](#set) configuration for more details.
const txResult = await contract.metadata.update({
name: "My Contract",
description: "My contract description",
});
Configuration
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;
description?: string;
image?: string;
symbol?: string;
external_link?: string;
seller_fee_basis_points?: number
fee_recipient?: string;
}
## verify 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. ```javascript // Provide the generated payload to verify that it is valid const isValid = await contract.erc721.signature.verify(payload); ```
Configuration
#### payload (required) The payload to verify. Must be of type `SignedPayload1155`. ### Return Value Returns `true` if the payload is valid, `false` otherwise. ```typescript boolean; ```
## 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}}",
);
Configuration
#### roles An array of roles to check. Must be an array of `string`s.
const verifyRole = await contract.roles.verify(
["admin", "minter"],
"{{wallet_address}}",
);
wallet
The wallet address to check.
Must be a string
.
const verifyRole = await contract.roles.verify(
["admin", "minter"],
"{{wallet_address}}",
);