// Addresses the setup script created (addresses/.json), typed and checked once on load. // The app, the server and the scripts all read this one file, so on launch day the only new address // anywhere is the $GLITCH mint in card.config.ts. import type { Cluster, TierId } from '../card.config.ts' import devnet from '../addresses/devnet.json' with { type: 'json' } import mainnet from '../addresses/mainnet.json' with { type: 'json' } import localnet from '../addresses/localnet.json' with { type: 'json' } export interface MachineAddresses { /** The Core Candy Machine. */ readonly machine: string /** Its Candy Guard (the machine's mint authority), a PDA of the machine. */ readonly guard: string } export interface Uris { readonly blankCollection: string readonly cardCollection: string readonly blank: string readonly tiers: Readonly> } export interface CardAddresses { readonly cluster: Cluster readonly blankCollection: string | null readonly cardCollection: string | null readonly blank: MachineAddresses | null readonly tiers: Readonly>> /** Public key of the co-signing service; every guard (blank and tiers) requires its signature. */ readonly cosigner: string | null /** The key that ran setup; it holds every authority until the lock. Recorded so verify needs no key file. */ readonly deployer?: string | null /** Metadata JSON each collection and machine points to. */ readonly uris: Uris | null /** True once machine and collection authorities were handed to the dead address (plan ยง6.4). */ readonly locked: boolean /** * The slot of the CLI's last landed write. Every CLI read asks for at least this slot, so a node a * few slots behind can't show a guard as it was before that write (and a command writing it back * whole would undo it). */ readonly minSlot?: number /** Set by halt, cleared by the next sync-waves: verify then expects every wave shut. */ readonly halted?: boolean } const ALL: Readonly> = { devnet: devnet as CardAddresses, mainnet: mainnet as CardAddresses, localnet: localnet as CardAddresses, } export function addressesFor(cluster: Cluster): CardAddresses { const a = ALL[cluster] if (a.cluster !== cluster) throw new Error(`addresses/${cluster}.json says it is ${a.cluster}`) return a }