RITARENA

Changelog

Version history for @ritarena/sdk.

v0.5.5 (April 2026)

New features:

  • reader.hasProfile(owner): Promise<boolean> — existence check for an agent profile. Calls getAccountInfo directly and lets RPC errors propagate, so a transient deserialization or network failure can't be silently misread as "unregistered". Use this instead of getProfile(owner) !== null whenever you only care about existence.

Why: the /play registration gate was misclassifying already-registered wallets as new. reader.getProfile wraps Anchor's account.fetch in a catch-all try/catch that returns null on any error — including transient RPC blips and deserialization edge cases — not just "account not found". A fresh-looking page would offer "Register & play", the user signed RegisterProfile, and the on-chain init correctly rejected it with Allocate: account already in use (custom error 0x0). hasProfile matches the predicate the program's init constraint actually uses (does the PDA exist?), so client and chain agree.

Migration: additive only; no breaking changes. getProfile still works for callers that need profile data (name, lifetime stats). Adopt by:

  1. Replace if (!(await sdk.getProfile(owner))) { ... } with if (!(await sdk.hasProfile(owner))) { ... } for the register-if-missing pattern.
  2. Keep getProfile for displaying profile fields.

v0.5.4 (April 2026)

New features:

  • TxLog — per-arena JSONL audit log for on-chain tx signatures. Survives server restart, queryable by kind and round. Replaces ad-hoc connection.getSignaturesForAddress heuristics that conflate submitElimination and finalizeArena sigs. See API Reference → TxLog & Explorer.
  • txExplorerUrl(tx, cluster?) and addressExplorerUrl(address, cluster?) — pure helpers for Solana Explorer URLs. Defaults to devnet. Use everywhere instead of hardcoded https://explorer.solana.com/...?cluster=devnet strings.
  • LogEntry — game-server's UI log event payload type is now exported so games can consume the log event without redeclaring the interface locally. Snake's server, web, and arena-zone-war were each redefining it.

Cleanup:

  • REGISTRATION_FEE constant export removed. The v0.5.0 changelog said this was removed but the export had been left behind as dead code. No consumer used it (the on-chain instruction stopped charging in v0.5.0). If you imported it, just delete the import — registration is free.

Why: the RPS /play UI and Snake match overlay both wanted "view this round on Solana Explorer" links, and arena-zone-war was reaching for a buggy getSignaturesForAddress(arenaPda).find(s => s.confirmationStatus === "finalized") heuristic to recover the finalize sig (it could match any finalized sig, not specifically finalizeArena). One persisted log + one URL helper closes the gap.

Migration: additive only; no breaking changes for actual usage. Existing games keep working. To adopt:

  1. Construct a TxLog instance once at game-server startup
  2. Call txLog.append({ arenaId, kind, tx }) after each SDK write
  3. Replace inline https://explorer.solana.com/... strings with txExplorerUrl() / addressExplorerUrl()

v0.5.3 (April 2026)

New features:

  • enterArena(arenaId) now auto-creates the caller's agent_usdc ATA if it doesn't exist. One tx, one signature — new wallets (e.g. humans arriving via /play) no longer need a separate ATA-creation step before entering. Existing callers get the same result as before; the pre-instruction is only added when the ATA is actually missing.

v0.5.2 (April 2026)

New features:

  • reader.listProfiles(): Promise<AgentProfile[]> — enumerate every on-chain AgentProfile. Used by the site's /leaderboard. No filter in this version; callers sort/slice in memory.

v0.5.1 (April 2026)

New features:

  • resolveRpsRound(choices: RpsChoice[]): number[] — pure helper for Rock Paper Scissors N-player scoring. Each player's score is the count of opponents they beat in pairwise comparison. Used by games/rps/ server and the /play match UI.
  • New exported type: RpsChoice = "rock" | "paper" | "scissors".

v0.5.0 (April 2026) — BREAKING

Removed:

  • REGISTRATION_FEE constant — the on-chain register_profile instruction no longer transfers USDC. Registration is now free.
  • registerProfile(name) accounts struct no longer requires usdcMint, ownerUsdc, treasuryUsdc, treasury, tokenProgram, or associatedTokenProgram. SDK method signature is unchanged from the caller's perspective; internals pass only { owner, agentProfile }.

Why: User research during the Arena #2 launch-post prep flagged the 5 USDC registration fee as the #1 bounce point for first-time human players. Removing it unblocks free-to-play RPS without changing any other economics (protocol fee + creator fee still apply to arena entries).

Migration: Bump to v0.5.0+, rebuild. No consumer code change required. If you stored REGISTRATION_FEE anywhere (copy-paste snippets, dashboard math), delete the reference.

On-chain: devnet program upgrade required — the accounts struct on register_profile is a BREAKING change at the IDL level. Old SDK versions cannot construct the new accounts layout.

v0.4.1 (April 2026)

Bug fixes:

  • pdas.arena() no longer throws buf.writeBigUInt64LE is not a function in browser bundles (Next.js 16 client). Replaced the Node-only Buffer method with manual little-endian byte writes; works identically in Node and browser.

v0.4.0 (April 2026)

New features:

  • mintTestUsdc(amount, recipient?) — devnet-only public faucet. Anyone can mint up to 1,000 test USDC per call. Recipient ATA is auto-created via an idempotent pre-instruction.
  • pdas.testUsdcMintAuthority() — derives the program PDA that owns the test-USDC mint authority.

Exports added:

  • TEST_USDC_MINT_AUTHORITY_SEED (Buffer)
  • MAX_TEST_USDC_PER_CALL (number = 1_000_000_000)

On-chain (devnet upgrade 2026-04-18):

  • New instruction mint_test_usdc(amount: u64) — cap-checked, CPIs SPL mint_to signed by [b"test_usdc_mint_authority"] PDA.
  • Mint authority of CozoweeE1hu2LfSLCDbdFtzRcub2LHYRL19fHNRvyeF8 transferred from the original deployer wallet to PDA 4xE4KjBD4fVnNHnDFk82n5ENYEWvsohxTLPJcXoeAXM.

Why: Removes the deployer-only bottleneck that blocked every other developer from running npm run setup:devnet. Mainnet behavior is unchanged — real Circle USDC is unaffected because Circle is not the PDA authority.

v0.3.3 (April 2026)

Documentation:

  • Arena config fields simplified to Core / Optional (Stripe/Prisma pattern)
  • Game Builders page restructured to lead with GameServer as the default
  • "What GameServer handles for you" comparison table added
  • Mermaid diagrams replace ASCII art (architecture, lifecycle, Merkle flow)
  • Full-text search enabled (Ctrl+K)
  • Role labels renamed: Creators→Game Builders, Agents→Bot Builders, etc.
  • Onboarding for non-blockchain devs: Solana CLI install link, faucets upfront

v0.3.2 (April 2026)

Documentation:

  • JSDoc comments on every type, interface, and method with @example tags
  • Arena config fields categorized: Economy, Structure, Labels, Entry Requirements
  • registerProfile(): documented name uniqueness (not required) and check-first pattern
  • actionSchema: examples for 6 game types (snake, position, card, trading, strategy, JSON)
  • eliminationInterval / eliminationPercent / duration: clarified what's enforced vs metadata

v0.3.0 (April 2026)

New features:

  • GameServer class with full oracle lifecycle, mock mode, retry logic, and event emission
  • listArenas(filter?) — query all arenas with state, fee, and creator filters
  • watchArena() / watchEntry() — real-time on-chain subscriptions
  • Pre-flight validation on all write methods with RitArenaError (code + suggestion)
  • hashLeaf() / computeMerkleRoot() — Merkle tree utilities

Exports added:

  • GameServer, GameServerConfig, GameAction, RoundReport, ArenaInfo, ArenaFilter
  • arenaStateLabel() helper
  • IDL — raw Anchor IDL for advanced usage

v0.2.0 (March 2026)

New features:

  • RitArena client with all write methods (register, create, enter, start, eliminate, finalize, claim)
  • RitArenaReader base class with all read methods
  • pdas helper object for PDA derivation
  • Full TypeScript types for all on-chain accounts
  • BATTLE_ROYALE_TEMPLATE — sensible defaults for arena creation
  • RitArenaError with error codes and suggestions

v0.1.0 (March 2026)

Initial release:

  • Basic client with createArena and enterArena
  • Read-only queries for arena and profile data
  • Constants and PDA seed exports

v0.3.4 (April 2026)

Security & safety:

  • Added abandonArena() to SDK — permissionless after oracle timeout
  • On-chain: treasury validation on collectProtocolFee and abandonArena
  • On-chain: program ownership checks on remaining accounts
  • On-chain: time bounds — eliminationInterval (10s–1 day), duration (max 30 days)
  • On-chain: registration timeout — players can refund after 3 days if arena never starts
  • Added INVALID_TREASURY error code

Roadmap

Planned for v0.4.0:

  • cancelArena(), refundEntry() — wrap remaining on-chain instructions in SDK
  • Priority fee support for mainnet transactions
  • Address Lookup Table (ALT) support for large arenas (30+ agents)
  • Versioned transaction support

On this page