DOCS

usePack

Hook for getting an instance of a Pack contract. This contract supports the creation of on-chain luck-based lootboxes.

Example

import { useContract } from '@thirdweb-dev/react'

export default function Component() {
  const { contract } = usePack("<YOUR-CONTRACT-ADDRESS>", "pack")

  // Now you can use the pack contract in the rest of the component

  // For example, this function will get all the packs on this contract
  async function getPacks() {
    const packs = await contract.getAll()
    return packs
  }

  ...
}

Parameters

Returns