Home > @3rdweb/sdk > PackModule
Create lootboxes of NFTs with rarity based open mechanics.
Signature:
export declare class PackModule extends ModuleWithRoles<PackContract> implements ITransferable
Extends: ModuleWithRoles<PackContract>
Implements: ITransferable
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.getPackModule("");
| Property | Modifiers | Type | Description |
|---|---|---|---|
| moduleType | static |
ModuleType | |
| roles | static |
readonly [“admin”, “minter”, “pauser”, “transfer”] |
| Method | Modifiers | Description |
|---|---|---|
| balance(tokenId) | ||
| balanceOf(address, tokenId) | Get Pack Balance | |
| create(args) | Create Pack | |
| depositLink(amount) | ||
| get(packId) | ||
| getAll() | Get Pack Data | |
| getLinkBalance() | ||
| getNFTs(packId) | Get Pack Reward Data | |
| getOwned(_address) | getOwned is a convenience method for getting all owned tokens for a particular wallet. |
|
| getRoyaltyBps() | Gets the royalty BPS (basis points) of the contract | |
| getRoyaltyRecipientAddress() | Gets the address of the royalty recipient | |
| isApproved(address, operator) | ||
| isTransferRestricted() | ||
| open(packId) | Open Pack | |
| setApproval(operator, approved) | ||
| setModuleMetadata(metadata) | ||
| setRestrictedTransfer(restricted) | ||
| setRoyaltyBps(amount) | ||
| transfer(to, tokenId, amount) | Transfer Pack | |
| transferBatchFrom(from, to, args, data) | ||
| transferFrom(from, to, args, data) | ||
| withdrawLink(to, amount) |