Pack class
Create lootboxes of NFTs with rarity based open mechanics.
Example
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("{{chainName}}");
const contract = sdk.getPack("{{contract_address}}");
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(network, address, storage, options, contractWrapper) | Constructs a new instance of the Pack class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| contractAbi | static | any | |
| contractRoles | static | readonly ["admin", "minter", "pauser", "transfer"] | |
| contractType | static | "pack" | |
| encoder | ContractEncoder<PackContract> | ||
| estimator | GasCostEstimator<PackContract> | ||
| events | ContractEvents<PackContract> | ||
| metadata | ContractMetadata<PackContract, typeof Pack.schema> | ||
| roles | ContractRoles<PackContract, typeof Pack.contractRoles[number]> | ||
| royalties | ContractRoyalty<PackContract, typeof Pack.schema> | Configure royalties |
Methods
| Method | Modifiers | Description |
|---|---|---|
| create(metadataWithRewards) | Create Pack | |
| createTo(to, metadataWithRewards) | Create Pack To Wallet | |
| getAll(queryParams) | Get All Packs | |
| getOwned(walletAddress) | Get Owned Packs | |
| getPackContents(packId) | Get Pack Contents | |
| getTotalCount() | Get the number of packs created | |
| isTransferRestricted() | Get whether users can transfer packs from this contract | |
| open(tokenId, amount) | Open Pack |
Signature:
export declare class Pack extends Erc1155<PackContract>
Extends: Erc1155<PackContract