🔌 plug your wallet — auto-fills every snippet below
📡 READ STATE SOCKET 1
Three on-chain programs. Three state PDAs. Each holds live stats — read with one RPC call.
// Live capyslot stats from chain — no SDK needed const rpc = 'https://rpc.mainnet.x1.xyz'; const body = { jsonrpc:'2.0', id:1, method:'getAccountInfo', params:['3w4dSzx7WxpAvzTwui7iX1TGP1GzFMttbKt6AbwtFqqM', {encoding:'base64'}] }; const r = await (await fetch(rpc,{method:'POST', headers:{'Content-Type':'application/json'},body:JSON.stringify(body)})).json(); const d = Buffer.from(r.result.value.data[0],'base64').slice(8); const dv = new DataView(d.buffer, d.byteOffset, d.byteLength); console.log({ total_spins: Number(dv.getBigUint64(80,true)), total_wagered: Number(dv.getBigUint64(88,true)) / 1e9, total_paid: Number(dv.getBigUint64(96,true)) / 1e9, });
🧮 DERIVE PDA SOCKET 2
Each citizen / player / staker has a deterministic PDA. Plug a wallet in — compute their seat in the cathedral.
// Derive PlayerRewards PDA for $SPIN claim history import { PublicKey } from '@solana/web3.js'; const CAPYSPIN = new PublicKey('J4d9eeWt4DFg6QaVuHKFRLvbWRZWe8WWqh9YVGRAUQhk'); const player = new PublicKey('YOUR_WALLET_HERE'); const [pda] = PublicKey.findProgramAddressSync( [Buffer.from('player_rewards'), player.toBuffer()], CAPYSPIN ); console.log('rewards pda:', pda.toBase58()); // Same seed pattern for the others: // capyslot PlayerState: seeds = ['player', wallet] // capymence Tributary: seeds = ['tributary', wallet] // capyspin PlayerRewards: seeds = ['player_rewards', wallet]
🔌 EMBED WIDGET SOCKET 3
Drop a live portfolio, leaderboard, or oracle reading into your own citizen page. The frames update from chain on their own.
<!-- Live portfolio card for a specific wallet --> <iframe src="https://apexfaucet.xyz/portfolio/#YOUR_WALLET" title="X1 portfolio" style="width:100%;height:560px;border:0;border-radius:14px; background:#06060a;color-scheme:dark;" loading="lazy" referrerpolicy="no-referrer" sandbox="allow-scripts allow-popups allow-same-origin"></iframe> <!-- Or live leaderboard / oracle reading: --> <iframe src="https://apexfaucet.xyz/leaderboard/" ... /> <iframe src="https://apexfaucet.xyz/oracle/" ... />
🤖 AGENT MANIFEST SOCKET 4
Machine-readable spec of the whole cathedral — program IDs, PDAs, discriminators, layouts, tokens. Crawler-friendly JSON.
// Pull the agent-readable stack manifest const stack = await (await fetch( 'https://apexfaucet.xyz/api/stack.json' )).json(); console.log(stack.programs.capyslot.program_id); console.log(stack.programs.capyslot.accounts.PlayerState.layout); console.log(stack.tokens);
🏛 CITIZEN PLUG SOCKET 5
Any Citizens City page already has the citizen's wallet in localStorage. Read their cathedral state from chain — no backend.
// Inside any /citizens/* page — show the citizen's $SPIN balance const wallet = localStorage.getItem('walletAddress'); if (!wallet) return; const SPIN_MINT = '35nhBexNtfdRqDW7TWS62Ng8XcSgC8MEucWLzRvUTLcm'; const TOKEN_2022 = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'; const r = await (await fetch('https://rpc.mainnet.x1.xyz',{ method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({jsonrpc:'2.0',id:1,method:'getTokenAccountsByOwner', params:[wallet,{mint:SPIN_MINT},{encoding:'jsonParsed'}]}) })).json(); const bal = r.result.value[0]?.account.data.parsed.info.tokenAmount.uiAmount || 0; console.log('citizen has', bal, '$SPIN');
🔗 ONE-CLICK GATES SOCKET 6
For humans who just want to click. Each gate is hash-aware — link with #wallet to deep-link state.
📚 SPEC AT A GLANCE
The cathedral runs on three Anchor programs on X1 mainnet — Token-2022 + classic SPL aware, slot-hash RNG, PDA-locked authorities, zero admin override on user funds.