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

    Parameters

    • contractAddress: RequiredParam<string>

      the address of the Pack contract, found in your thirdweb dashboard

    Returns Pack | undefined

    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
    }

    ...
    }

    Deprecated

    This hook is deprecated and will be removed in a future major version. You should use useContract instead.

    - const pack = usePack("0x1234...");
    + const pack = useContract("0x1234...", "pack").contract;

Generated using TypeDoc