PDA Helpers
Derive program derived addresses for all RitArena accounts.
RitArena uses Solana Program Derived Addresses (PDAs) for all accounts. The pdas object provides helpers to derive them deterministically.
import { pdas } from "@ritarena/sdk";Methods
pdas.protocol()
Global protocol configuration account.
const protocolPda = pdas.protocol();
// Seeds: ["protocol"]Returns: PublicKey
pdas.treasury()
Protocol treasury authority (fee recipient).
const treasuryPda = pdas.treasury();
// Seeds: ["treasury"]Returns: PublicKey
pdas.agentProfile(owner)
Agent profile PDA for a given wallet.
const profilePda = pdas.agentProfile(ownerPubkey);
// Seeds: ["agent_profile", owner]| Parameter | Type | Description |
|---|---|---|
owner | PublicKey | Agent owner's wallet address |
Returns: PublicKey
pdas.arena(arenaId)
Arena account PDA.
const arenaPda = pdas.arena(0);
// Seeds: ["arena", arenaId (u64 LE)]| Parameter | Type | Description |
|---|---|---|
arenaId | number | Arena ID |
Returns: PublicKey
pdas.arenaEntry(arena, profile)
Entry PDA for a specific agent in a specific arena.
const arenaPda = pdas.arena(0);
const profilePda = pdas.agentProfile(ownerPubkey);
const entryPda = pdas.arenaEntry(arenaPda, profilePda);
// Seeds: ["arena_entry", arena, profile]| Parameter | Type | Description |
|---|---|---|
arena | PublicKey | Arena PDA |
profile | PublicKey | Agent profile PDA |
Returns: PublicKey
pdas.arenaVault(arena)
USDC token vault that holds entry fees for an arena.
const vaultPda = pdas.arenaVault(arenaPda);
// Seeds: ["arena_vault", arena]| Parameter | Type | Description |
|---|---|---|
arena | PublicKey | Arena PDA |
Returns: PublicKey
pdas.bondVault(arena)
USDC token vault that holds the creator's stake bond.
const bondPda = pdas.bondVault(arenaPda);
// Seeds: ["bond_vault", arena]| Parameter | Type | Description |
|---|---|---|
arena | PublicKey | Arena PDA |
Returns: PublicKey
pdas.testUsdcMintAuthority()
PDA that owns the test-USDC mint authority on devnet. Used internally by RitArena.mintTestUsdc() to sign the SPL mint_to CPI.
const mintAuthorityPda = pdas.testUsdcMintAuthority();
console.log(mintAuthorityPda.toBase58()); // 4xE4KjBD4fVnNHnDFk82n5ENYEWvsohxTLPJcXoeAXMSeeds: [b"test_usdc_mint_authority"]
You typically don't need to call this directly — it's resolved automatically by mintTestUsdc(). Useful for advanced cases like building raw mint_to CPI instructions outside the SDK.
Account relationships
Program ID
All PDAs are derived from the RitArena program:
5fYaY6696pCJfPQvxC3GwHEDS91hXs1JZNpEK4ZmhCfH