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 = await sdk.getContract("{{contract_address}}", "pack");
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(network, address, storage, options, abi, chainId, contractWrapper) | Constructs a new instance of the Pack class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
abi | Abi | ||
contractRoles | static | readonly ["admin", "minter", "asset", "transfer"] | |
encoder | ContractEncoder<PackContract> | ||
erc1155 | Erc1155<PackContract> | ||
estimator | GasCostEstimator<PackContract> | ||
events | ContractEvents<PackContract> | ||
metadata | ContractMetadata<PackContract, typeof PackContractSchema> | ||
owner | ContractOwner<PackContract> | ||
roles | ContractRoles<PackContract, typeof Pack.contractRoles[number]> | ||
royalties | ContractRoyalty<PackContract, typeof PackContractSchema> | Configure royalties | |
vrf | readonly | PackVRF | If enabled in the contract, use the Chainlink VRF functionality to open packs |
Methods
Method | Modifiers | Description |
---|---|---|
addPackContents(packId, packContents) | Add Pack Contents | |
create(metadataWithRewards) | Create Pack | |
createTo(to, metadataWithRewards) | Create Pack To Wallet | |
get(tokenId) | Get a single Pack | |
getAddress() | ||
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 StandardErc1155<PackContract>
Extends: StandardErc1155<PackContract>