Pack
When using the Pack smart contract, additional top-level functionality is available to use.
To access the top-level functionality, provide the marketplace
contract type when creating the contract instance:
AddPackContents
Add additional tokens to the pool of tokens that can be opened from a pack.
Create
Mint a new pack NFT, which can be opened to receive rewards, to the connected wallet.
Each pack NFT is an ERC1155 token, which means it can have more than one quantity.
Provide the metadata for the pack NFT itself, and the rewards that can be opened from the pack.
The quantity of packs created is determined by the total number of rewards available, divided by the number of rewards per pack.
For example, if you had 20
total ERC20 rewards + 60
total ERC1155 rewards + 20
total ERC721 rewards,
and you wanted to create packs with 5
rewards each, the result would be the creation of 20
packs (100 total rewards / 5 rewards per pack = 20 packs).
CreateTo
The same as Create
, but allows you to specify the address that will receive the pack NFT(s), rather than using the connected wallet.
GetPackContents
Get all the tokens that were "wrapped up" in the pack NFTs when they were created.
Open
Open a pack NFT to receive the rewards inside.
To open a pack, the wallet that initiates this transaction must have sufficient quantity of the pack NFT to open.
Balance
Get the quantity of a specific NFT owned by the connected wallet.
BalanceOf
Get the quantity of a specific NFT owned by a wallet.
Get
Get the metadata of an NFT using it’s token ID.
Metadata is fetched from the uri
property of the NFT.
If the metadata is hosted on IPFS, the metadata is fetched and made available as an object.
The object’s image
property will be a URL that is available through the thirdweb IPFS gateway.
Transfer
Transfer an NFT from the connected wallet to another wallet.
IsApprovedForAll
Get whether this wallet has approved transfers from the given operator.
This means that the operator can transfer NFTs on behalf of this wallet.
SetApprovalForAll
Give another address approval (or remove approval) to transfer all of your NFTs from this collection.
TotalCount
Get the total number of unique NFTs in the collection.
TotalSupply
Returns the total supply of a token in the collection, including burned tokens.
GetAll
Get the metadata and current owner of all NFTs in the contract.
By default, returns the first 100
NFTs (in order of token ID). Use queryParams
to paginate the results.
GetOwned
Get all the data associated with the NFTs owned by a specific wallet.