Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Ticket Management

Minting Tickets

Admin mint tickets to recipients. Requires MINTER_ROLE, HOST_ROLE, or ADMIN_ROLE (the owner is also permitted).

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
 
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
})
 
const contractAddress = '0x1234567890123456789012345678901234567890'
const recipientAddress = '0x2345678901234567890123456789012345678901'
 
const { to, data } = Gatekeeper1155.prepareAdminMint({
  contract: contractAddress,
  recipient: recipientAddress,
  tokenId: 1n, // Tier ID
  quantity: 2n,
})
 
// Execute with your wallet client
// await walletClient.sendTransaction({ to, data })

Mint with Custom Data

Pass custom data to the recipient's onERC1155Received hook:

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
 
const { to, data } = Gatekeeper1155.prepareAdminMint({
  contract: '0x1234567890123456789012345678901234567890',
  recipient: '0x2345678901234567890123456789012345678901',
  tokenId: 1n,
  quantity: 1n,
  data: '0xdeadbeef', // Custom data
})

Check-in (Stubbing Tickets)

Convert tickets to stubs when attendees check in. Requires DOOR_ROLE, HOST_ROLE, or ADMIN_ROLE (the owner is also permitted).

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
 
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
})
 
const { to, data } = Gatekeeper1155.prepareAdminStubTickets({
  contract: '0x1234567890123456789012345678901234567890',
  attendee: '0x2345678901234567890123456789012345678901',
  tierId: 1n,
  amount: 1n,
})
 
// await walletClient.sendTransaction({ to, data })

The stub process:

  1. Burns the ticket token (ID = tierId)
  2. Mints a stub token (ID = tierId + 1)
  3. Updates the stub URI metadata

Voiding Tickets

Burn tickets without creating stubs. Requires ADMIN_ROLE, HOST_ROLE, or MINTER_ROLE (the owner is also permitted).

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
 
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
})
 
const { to, data } = Gatekeeper1155.prepareVoidTickets({
  contract: '0x1234567890123456789012345678901234567890',
  attendee: '0x2345678901234567890123456789012345678901',
  tierId: 1n,
  amount: 1n,
})
 
// await walletClient.sendTransaction({ to, data })

Creating Token Tiers

Set up new ticket tiers with metadata and supply limits:

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
 
// Limited supply tier
const { to, data } = Gatekeeper1155.prepareSetupNewTier({
  contract: '0x1234567890123456789012345678901234567890',
  tokenURI: 'ipfs://QmTokenMetadata...',
  stubURI: 'ipfs://QmStubMetadata...',
  maxSupply: 500n,
})
 
// Unlimited supply tier (maxSupply = 0)
const unlimitedTier = Gatekeeper1155.prepareSetupNewTier({
  contract: '0x1234567890123456789012345678901234567890',
  tokenURI: 'ipfs://QmTokenMetadata...',
  stubURI: 'ipfs://QmStubMetadata...',
  maxSupply: 0n,
})

Updating Token Metadata

Update tier metadata after creation. Requires ADMIN_ROLE (the owner is also permitted).

import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
 
const { to, data } = Gatekeeper1155.prepareUpdateToken({
  contract: '0x1234567890123456789012345678901234567890',
  tokenId: 1n,
  uri: 'ipfs://QmNewMetadata...',
  maxSupply: 1000n, // Can increase, but not decrease below minted
})

Reading Tier Information

Query tier metadata and supply info:

import { Gatekeeper1155, gatekeeper1155Abi } from '@sceneinfrastructure/sdk'
 
const { to, functionName, args } = Gatekeeper1155.prepareGetTierInfo({
  contract: '0x1234567890123456789012345678901234567890',
  tokenId: 1n,
  as: 'args',
})
 
// const [uri, maxSupply, totalMinted] = await publicClient.readContract({
//   address: to,
//   abi: gatekeeper1155Abi,
//   functionName,
//   args,
// })

Token ID Structure

Gatekeeper1155 uses a specific token ID scheme:

Token IDTypeDescription
1, 3, 5, ...TicketOdd IDs are active tickets
2, 4, 6, ...StubEven IDs are stubs (tierId + 1)

When you call setupNewTier, it creates a tier with the next odd ID. Stubbing burns the ticket and mints the next ID (stub).

Next Steps