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

Stub

Query stubbing events (check-ins where tickets are exchanged for stubs).

import { Client } from '@sceneinfrastructure/sdk'
 
const client = Client.create({ url: '...' })

Try It

Stub Namespace Demo
Query stubbing events (check-ins). Stubbing occurs when tickets are exchanged for stubs at event entry.
List stubs (check-ins) for a specific contract.
await client.stub.listByContract({
  contractAddress,
  limit: 10,
})
Browser requests require CORS to be enabled.

Overview

When an attendee checks in, their ticket tokens (odd IDs like 1, 3, 5) are exchanged for stub tokens (even IDs like 2, 4, 6). This is called "stubbing" - the ticket is consumed and a stub is minted as proof of attendance.

The stub namespace queries these exchange events.

Methods

listByContract

List all stubbing events for a contract.

import { Client } from '@sceneinfrastructure/sdk'
 
const client = Client.create({ url: 'https://ponder.mesh.xyz' })
 
const stubs = await client.stub.listByContract({
  contractAddress: '0x1234567890123456789012345678901234567890',
  limit: 50
})
 
for (const stub of stubs) {
  console.log(`${stub.fromAddress} stubbed ${stub.amount} tickets`)
  console.log(`  Ticket ID: ${stub.burnTokenId} -> Stub ID: ${stub.mintTokenId}`)
}

Parameters

ParameterTypeDefaultDescription
contractAddressAddressrequiredThe contract address
limitnumber50Maximum results to return
offsetnumber0Number of results to skip

Returns

Stub[] - Array of stubbing events.


listByHolder

List stubbing events for a specific holder.

import { Client } from '@sceneinfrastructure/sdk'
 
const client = Client.create({ url: 'https://ponder.mesh.xyz' })
 
const stubs = await client.stub.listByHolder({
  holderAddress: '0x2345678901234567890123456789012345678901',
  limit: 50
})
 
for (const stub of stubs) {
  console.log(`Checked in ${stub.amount} tickets at ${stub.contractAddress}`)
}
 
// Filter by contract
const contractStubs = await client.stub.listByHolder({
  holderAddress: '0x2345678901234567890123456789012345678901',
  contractAddress: '0x1234567890123456789012345678901234567890'
})

Parameters

ParameterTypeDefaultDescription
holderAddressAddressrequiredThe holder address
contractAddressAddress-Filter to specific contract
limitnumber50Maximum results to return
offsetnumber0Number of results to skip

Returns

Stub[] - Array of stubbing events.


listByTier

List stubbing events for a specific tier.

import { Client } from '@sceneinfrastructure/sdk'
 
const client = Client.create({ url: 'https://ponder.mesh.xyz' })
 
const stubs = await client.stub.listByTier({
  contractAddress: '0x1234567890123456789012345678901234567890',
  tierId: 1n,  // The ticket token ID
  limit: 50
})
 
console.log(`${stubs.length} check-ins for tier 1`)
 
let totalStubbed = 0n
for (const stub of stubs) {
  totalStubbed += stub.amount
}
console.log(`Total stubbed: ${totalStubbed}`)

Parameters

ParameterTypeDefaultDescription
contractAddressAddressrequiredThe contract address
tierIdbigintrequiredThe tier ID (ticket token ID)
limitnumber50Maximum results to return
offsetnumber0Number of results to skip

Returns

Stub[] - Array of stubbing events for the tier.


Types

Stub

import type { Address, Hex } from 'viem'
 
type Stub = {
  id: string
  contractAddress: Address
  fromAddress: Address
  burnTokenId: bigint   // Ticket token ID (odd: 1, 3, 5...)
  mintTokenId: bigint   // Stub token ID (even: 2, 4, 6...)
  amount: bigint        // Number of tokens stubbed
  createdAt: bigint
  createdAtBlock: bigint
  createdAtLogIndex: number
  creationTxHash: Hex
  updatedAt: bigint
  updatedAtBlock: bigint
  updatedAtLogIndex: number
  updatedTxHash: Hex | null
}
FieldTypeDescription
idstringUnique event identifier
contractAddressAddressThe contract address
fromAddressAddressThe holder who checked in
burnTokenIdbigintThe ticket token ID burned
mintTokenIdbigintThe stub token ID minted
amountbigintNumber of tokens exchanged
creationTxHashHexTransaction hash

Token ID Relationship

Tickets and stubs have a predictable ID relationship:

import { Client } from '@sceneinfrastructure/sdk'
 
const client = Client.create({ url: 'https://ponder.mesh.xyz' })
 
// Ticket IDs are odd: 1, 3, 5, 7...
// Stub IDs are even: 2, 4, 6, 8...
// Stub ID = Ticket ID + 1
 
const ticketId = 1n
const stubId = ticketId + 1n  // 2n
 
// Or from a stub event:
const stubs = await client.stub.listByContract({
  contractAddress: '0x1234567890123456789012345678901234567890',
  limit: 1
})
 
if (stubs.length > 0) {
  const stub = stubs[0]
  const tierId = stub.burnTokenId  // The original ticket tier
}

Schema

Zod Validation

import { Stub } from '@sceneinfrastructure/sdk'
 
const data = {
  id: 'stub_123',
  contractAddress: '0x1234567890123456789012345678901234567890',
  fromAddress: '0x2345678901234567890123456789012345678901',
  burnTokenId: 1n,
  mintTokenId: 2n,
  amount: 1n,
  createdAt: 1700000000n,
  createdAtBlock: 100000n,
  createdAtLogIndex: 0,
  creationTxHash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
  updatedAt: 1700000000n,
  updatedAtBlock: 100000n,
  updatedAtLogIndex: 0,
  updatedTxHash: null,
}
 
const result = Stub.schema.safeParse(data)
 
if (result.success) {
  console.log('Valid stub event:', result.data)
}

Related

  • Balance - Check if users have stubs via getTokenStatus() or isStubbed()
  • Tier - Get stub counts via getStats()
  • Void - For burns without stub conversion