Skip to main content

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

ConstructorModifiersDescription
(constructor)(network, address, storage, options, contractWrapper)Constructs a new instance of the Pack class

Properties

PropertyModifiersTypeDescription
contractAbistaticany
contractRolesstaticreadonly ["admin", "minter", "pauser", "transfer"]
contractTypestatic"pack"
encoderContractEncoder<PackContract>
estimatorGasCostEstimator<PackContract>
eventsContractEvents<PackContract>
metadataContractMetadata<PackContract, typeof Pack.schema>
rolesContractRoles<PackContract, typeof Pack.contractRoles[number]>
royaltiesContractRoyalty<PackContract, typeof Pack.schema>Configure royalties

Methods

MethodModifiersDescription
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