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, abi, contractWrapper)Constructs a new instance of the Pack class

Properties

PropertyModifiersTypeDescription
abitypeof ABI
contractRolesstaticreadonly ["admin", "minter", "asset", "transfer"]
encoderContractEncoder<PackContract>
erc1155Erc1155<PackContract>
estimatorGasCostEstimator<PackContract>
eventsContractEvents<PackContract>
metadataContractMetadata<PackContract, typeof PackContractSchema>
rolesContractRoles<PackContract, typeof Pack.contractRoles[number]>
royaltiesContractRoyalty<PackContract, typeof PackContractSchema>Configure royalties

Methods

MethodModifiersDescription
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>