Gatekeeper1155
Utilities for ERC1155 token operations on Gatekeeper1155 contracts.
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'Token Operations
prepareSetupNewTier
Creates a new ticket tier with metadata and supply configuration. Requires admin permissions (see Role Management).
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
account,
chain: base,
transport: http(),
})
const { to, data } = Gatekeeper1155.prepareSetupNewTier({
contract: '0x1234567890123456789012345678901234567890',
tokenURI: 'ipfs://QmTokenMetadata...',
stubURI: 'ipfs://QmStubMetadata...',
maxSupply: 1000n, // 0n for unlimited
})
await walletClient.sendTransaction({ to, data })Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
tokenURI | string | Metadata URI for the ticket tier |
stubURI | string | Metadata URI for stubbed (used) tickets |
maxSupply | bigint | Maximum supply (0 for unlimited) |
as | 'data' | 'args' | Output format |
prepareAdminMint
Mints tickets to a recipient. Requires minting permissions (see Role Management).
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
account,
chain: base,
transport: http(),
})
const { to, data } = Gatekeeper1155.prepareAdminMint({
contract: '0x1234567890123456789012345678901234567890',
recipient: '0x2345678901234567890123456789012345678901',
tokenId: 1n,
quantity: 2n,
})
await walletClient.sendTransaction({ to, data })Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
recipient | Address | Address to receive the tickets |
tokenId | bigint | Token tier ID |
quantity | bigint | Number of tickets to mint |
data | Hex | Optional data to pass to receiver |
as | 'data' | 'args' | Output format |
prepareAdminStubTickets
Checks in an attendee by converting their tickets to stubs. Requires check-in permissions (see Role Management).
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
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 })Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
attendee | Address | Attendee address to check-in |
tierId | bigint | Token tier ID |
amount | bigint | Number of tickets to stub |
as | 'data' | 'args' | Output format |
prepareVoidTickets
Burns tickets from an attendee. Requires void permissions (see Role Management).
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
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 })Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
attendee | Address | Attendee address |
tierId | bigint | Token tier ID |
amount | bigint | Number of tickets to void |
as | 'data' | 'args' | Output format |
prepareUpdateToken
Updates tier metadata. Requires admin permissions (see Role Management).
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { base } from 'viem/chains'
import { Gatekeeper1155 } from '@sceneinfrastructure/sdk'
const account = privateKeyToAccount('0x...' as `0x${string}`)
const walletClient = createWalletClient({
account,
chain: base,
transport: http(),
})
const { to, data } = Gatekeeper1155.prepareUpdateToken({
contract: '0x1234567890123456789012345678901234567890',
tokenId: 1n,
uri: 'ipfs://new-metadata-uri',
maxSupply: 500n,
})
await walletClient.sendTransaction({ to, data })Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
tokenId | bigint | Token tier ID to update |
uri | string | New metadata URI |
maxSupply | bigint | New max supply (0 for unlimited) |
as | 'data' | 'args' | Output format |
Role Management
prepareGrantRoles
Grants roles to an address. Requires admin permissions (see Role Management).
import { Gatekeeper1155, MINTER_ROLE, DOOR_ROLE } from '@sceneinfrastructure/sdk'
// Grant single role
const { to, data } = Gatekeeper1155.prepareGrantRoles({
contract: '0x1234567890123456789012345678901234567890',
user: '0x2345678901234567890123456789012345678901',
roles: MINTER_ROLE,
})
// Grant multiple roles with bitwise OR
const { to: to2, data: data2 } = Gatekeeper1155.prepareGrantRoles({
contract: '0x1234567890123456789012345678901234567890',
user: '0x2345678901234567890123456789012345678901',
roles: MINTER_ROLE | DOOR_ROLE,
})Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
user | Address | Address to grant roles to |
roles | bigint | Role bitmask (combine with |) |
as | 'data' | 'args' | Output format |
prepareRevokeRoles
Revokes roles from an address. Requires admin permissions (see Role Management).
import { Gatekeeper1155, MINTER_ROLE } from '@sceneinfrastructure/sdk'
const { to, data } = Gatekeeper1155.prepareRevokeRoles({
contract: '0x1234567890123456789012345678901234567890',
user: '0x2345678901234567890123456789012345678901',
roles: MINTER_ROLE,
})Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
user | Address | Address to revoke roles from |
roles | bigint | Role bitmask to revoke |
as | 'data' | 'args' | Output format |
View Functions
prepareContractURI
Gets the contract-level metadata URI.
import { Gatekeeper1155, gatekeeper1155Abi } from '@sceneinfrastructure/sdk'
import { createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
const publicClient = createPublicClient({
chain: base,
transport: http(),
})
const { to, functionName, args } = Gatekeeper1155.prepareContractURI({
contract: '0x1234567890123456789012345678901234567890',
as: 'args',
})
const uri = await publicClient.readContract({
address: to,
abi: gatekeeper1155Abi,
functionName,
args,
})prepareGetTierInfo
Gets tier metadata including URI, max supply, and total minted.
import { Gatekeeper1155, gatekeeper1155Abi } from '@sceneinfrastructure/sdk'
import { createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
const publicClient = createPublicClient({
chain: base,
transport: http(),
})
const { to, functionName, args } = Gatekeeper1155.prepareGetTierInfo({
contract: '0x1234567890123456789012345678901234567890',
tokenId: 1n,
as: 'args',
})
const result = await publicClient.readContract({
address: to,
abi: gatekeeper1155Abi,
functionName,
args,
})
console.log('Tier info:', result)Parameters
| Parameter | Type | Description |
|---|---|---|
contract | Address | Gatekeeper1155 contract address |
tokenId | bigint | Token tier ID |
as | 'data' | 'args' | Output format |