quartz/wallet/node_modules/@3rdweb/sdk/dist/modules/bundleDrop.d.ts
2022-03-04 20:05:23 +08:00

282 lines
10 KiB
TypeScript

import { LazyMintERC1155 as BundleDrop } from "@3rdweb/contracts";
import { TransactionReceipt } from "@ethersproject/providers";
import { BigNumber, BigNumberish, BytesLike } from "ethers";
import { ModuleType, Role } from "../common";
import { NFTMetadata } from "../common/nft";
import { ModuleWithRoles } from "../core/module";
import { MetadataURIOrObject } from "../core/types";
import { ClaimEligibility } from "../enums";
import ClaimConditionFactory from "../factories/ClaimConditionFactory";
import { ITransferable } from "../interfaces/contracts/ITransferable";
import { ClaimCondition } from "../types/claim-conditions/PublicMintCondition";
/**
* @beta
*/
export interface BundleDropCreateClaimCondition {
startTimestamp?: BigNumberish;
maxClaimableSupply: BigNumberish;
quantityLimitPerTransaction?: BigNumberish;
waitTimeInSecondsBetweenClaims?: BigNumberish;
pricePerToken?: BigNumberish;
currency?: string;
merkleRoot?: BytesLike;
}
/**
* @beta
*/
export interface BundleDropMetadata {
supply: BigNumber;
metadata: NFTMetadata;
}
/**
* Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them.
*
* @example
*
* ```javascript
* import { ThirdwebSDK } from "@3rdweb/sdk";
*
* // You can switch out this provider with any wallet or provider setup you like.
* const provider = ethers.Wallet.createRandom();
* const sdk = new ThirdwebSDK(provider);
* const module = sdk.getBundleDropModule("{{module_address}}");
* ```
*
* @public
*/
export declare class BundleDropModule extends ModuleWithRoles<BundleDrop> implements ITransferable {
private _shouldCheckVersion;
private _isNewClaim;
static moduleType: ModuleType;
static roles: readonly ["admin", "minter", "transfer"];
/**
* @override
* @internal
*/
protected getModuleRoles(): readonly Role[];
/**
* @internal
*/
protected connectContract(): BundleDrop;
/**
* @internal
*/
protected getModuleType(): ModuleType;
private transformResultToClaimCondition;
private getTokenMetadata;
get(tokenId: string): Promise<BundleDropMetadata>;
/**
* Get NFT Data
*
* @remarks Get data associated with NFTs in this module.
*
* @example
* ```javascript
* // Get data associated with every NFT in the module
* const nfts = await module.getAll();
* console.log(nfts);
* ```
*
* @returns The NFT metadata for all NFTs in the module.
*/
getAll(): Promise<BundleDropMetadata[]>;
/**
* `getOwned` is a convenience method for getting all owned tokens
* for a particular wallet.
*
* @param _address - The address to check for token ownership
* @returns An array of BundleMetadata objects that are owned by the address
*/
getOwned(_address?: string): Promise<BundleDropMetadata[]>;
getActiveClaimCondition(tokenId: BigNumberish): Promise<ClaimCondition>;
getAllClaimConditions(tokenId: BigNumberish): Promise<ClaimCondition[]>;
getDefaultSaleRecipient(): Promise<string>;
getSaleRecipient(tokenId: BigNumberish): Promise<string>;
/**
* Get NFT Balance
*
* @remarks Get a wallets NFT balance (number of a specific NFT in this module owned by the wallet).
*
* @example
* ```javascript
* // Address of the wallet to check NFT balance
* const address = "{{wallet_address}}";
* // The token ID of the NFT you want to check the wallets balance of
* const tokenId = "0"
*
* const balance = await module.balanceOf(address, tokenId);
* console.log(balance);
* ```
*/
balanceOf(address: string, tokenId: BigNumberish): Promise<BigNumber>;
balance(tokenId: BigNumberish): Promise<BigNumber>;
isApproved(address: string, operator: string): Promise<boolean>;
lazyMintBatch(metadatas: MetadataURIOrObject[]): Promise<BundleDropMetadata[]>;
/**
* Create Many NFTs
*
* @remarks Create and mint NFTs.
*
* @example
* ```javascript
* // Custom metadata of the NFTs to create
* const metadatas = [{
* name: "Cool NFT",
* description: "This is a cool NFT",
* image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
* }, {
* name: "Cool NFT",
* description: "This is a cool NFT",
* image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
* }];
*
* await module.createBatch(metadatas);
* ```
*/
createBatch(metadatas: MetadataURIOrObject[]): Promise<string[]>;
setSaleRecipient(tokenId: BigNumberish, recipient: string): Promise<TransactionReceipt>;
setDefaultSaleRecipient(recipient: string): Promise<TransactionReceipt>;
setApproval(operator: string, approved?: boolean): Promise<TransactionReceipt>;
/**
* Transfer NFT
*
* @remarks Transfer an NFT from the connected wallet to another wallet.
*
* @example
* ```javascript
* // Address of the wallet you want to send the NFT to
* const toAddress = "0x...";
*
* // The token ID of the NFT you want to send
* const tokenId = "0";
*
* // The number of NFTs you want to send
* const amount = 1;
*
* await module.transfer(toAddress, tokenId, amount);
* ```
*/
transfer(to: string, tokenId: BigNumberish, amount: BigNumberish, data?: BytesLike): Promise<TransactionReceipt>;
/**
* Sets public claim conditions for the next minting using the
* claim condition factory.
*
* @param factory - The claim condition factory.
*/
setClaimCondition(tokenId: BigNumberish, factory: ClaimConditionFactory): Promise<TransactionReceipt>;
updateClaimConditions(tokenId: BigNumberish, factory: ClaimConditionFactory): Promise<TransactionReceipt>;
/**
* Creates a claim condition factory
*
* @returns - A new claim condition factory
*/
getClaimConditionFactory(): ClaimConditionFactory;
/**
* @deprecated - Use the ClaimConditionFactory instead.
*/
setPublicClaimConditions(tokenId: BigNumberish, conditions: BundleDropCreateClaimCondition[]): Promise<void>;
/**
* Returns proofs and the overrides required for the transaction.
*
* @returns - `overrides` and `proofs` as an object.
*/
private prepareClaim;
/**
* Claim a token to yourself
*
* @param tokenId - Id of the token you want to claim
* @param quantity - Quantity of the tokens you want to claim
* @param proofs - Array of proofs
*
* @returns - Receipt for the transaction
*/
claim(tokenId: BigNumberish, quantity: BigNumberish, proofs?: BytesLike[]): Promise<TransactionReceipt>;
/**
* Claim NFTs to Wallet
*
* @remarks Let the a specified wallet claim NFTs.
*
* @example
* ```javascript
* // Address of the wallet you want to claim the NFTs
* const address = "{{wallet_address}}";
*
* // The number of NFTs to claim
* const quantity = 1;
*
* // The token ID of the NFT you want to claim
* const tokenId = "0"
*
* await module.claimTo(tokenId, quantity, address);
* ```
*
* @param tokenId - Id of the token you want to claim
* @param quantity - Quantity of the tokens you want to claim
* @param addressToClaim - Address you want to send the token to
* @param proofs - Array of proofs
*
* @returns - Receipt for the transaction
*/
claimTo(tokenId: BigNumberish, quantity: BigNumberish, addressToClaim: string, proofs?: BytesLike[]): Promise<TransactionReceipt>;
burn(tokenId: BigNumberish, amount: BigNumberish): Promise<TransactionReceipt>;
transferFrom(from: string, to: string, tokenId: BigNumberish, amount: BigNumberish, data?: BytesLike): Promise<TransactionReceipt>;
setModuleMetadata(metadata: MetadataURIOrObject): Promise<TransactionReceipt>;
setRoyaltyBps(amount: number): Promise<TransactionReceipt>;
/**
* Gets the royalty BPS (basis points) of the contract
*
* @returns - The royalty BPS
*/
getRoyaltyBps(): Promise<BigNumberish>;
/**
* Gets the address of the royalty recipient
*
* @returns - The royalty BPS
*/
getRoyaltyRecipientAddress(): Promise<string>;
getClaimConditionsFactory(): ClaimConditionFactory;
/**
* Returns the total supply of a specific token
*
* @param tokenId - The token ID to get the total supply of
*/
totalSupply(tokenId: BigNumberish): Promise<BigNumber>;
/**
* Pulls the list of all addresses that have claimed a particular token
*
* @beta - This can be very slow for large numbers of token holders
*
* @param tokenId - The token id to get the claimers of
* @returns - A unique list of addresses that claimed the token
*/
getAllClaimerAddresses(tokenId: BigNumberish): Promise<string[]>;
/**
* For any claim conditions that a particular wallet is violating,
* this function returns human readable information about the
* breaks in the condition that can be used to inform the user.
*
* @param tokenId - The token id that would be claimed.
* @param quantity - The desired quantity that would be claimed.
* @param addressToCheck - The address that would be claiming the token.
*/
getClaimIneligibilityReasons(tokenId: BigNumberish, quantity: BigNumberish, addressToCheck?: string): Promise<ClaimEligibility[]>;
canClaim(tokenId: BigNumberish, quantity: BigNumberish, addressToCheck?: string): Promise<boolean>;
/**
* Fetches the proof for the current signer for a particular wallet.
*
* @param merkleRoot - The merkle root of the condition to check.
* @returns - The proof for the current signer for the specified condition.
*/
private getClaimerProofs;
isTransferRestricted(): Promise<boolean>;
setRestrictedTransfer(restricted?: boolean): Promise<TransactionReceipt>;
/**
* @internal
*/
private isNewClaim;
/**
* @internal
*/
private checkVersion;
}