npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@medievaltech/cage-calls-sdk

v0.2.9

Published

Framework-neutral TypeScript SDK for Cage Calls

Readme

Cage Calls SDK

Framework-neutral TypeScript reads and collection intelligence for Cage Calls. The SDK owns network presets, decoding, Torii-first reads, Starknet RPC fallback, IPFS metadata hydration, completeness reporting, aggregation, and optional React Query bindings.

The SDK is deliberately read-only. Wallet connection, Cartridge Controller policies, transaction construction, signing, receipt handling, and post-transaction invalidation stay in the consuming application.

The current 0.2.0-next line is a canary API used by the Cage Calls client and available for mobile integration testing.

Install

pnpm add @medievaltech/cage-calls-sdk

For React Query bindings:

pnpm add @medievaltech/cage-calls-sdk @tanstack/react-query react

Node 18+, browsers, modern edge runtimes, and Capacitor are supported. Runtimes must provide fetch, URL, AbortController, and BigInt; every HTTP transport accepts a custom fetch.

Quick start

import {
  MAINNET_PRESET,
  createCageCallsClient,
  createFallbackRpcTransport,
  createIpfsMetadataTransport,
  createToriiGraphqlTransport,
} from "@medievaltech/cage-calls-sdk";

const client = createCageCallsClient({
  network: "mainnet",
  transports: {
    torii: createToriiGraphqlTransport({ url: MAINNET_PRESET.toriiUrl }),
    rpc: createFallbackRpcTransport({
      primaryUrl: process.env.ALCHEMY_RPC_URL,
      fallbackUrl: MAINNET_PRESET.cartridgeRpcUrl,
    }),
    metadata: createIpfsMetadataTransport({
      gateways: ["https://gateway.pinata.cloud/ipfs/"],
    }),
  },
});

const fights = await client.fightEvents.page({ limit: 20 });
console.log(fights.data.items, fights.meta);

// When an event service already knows the fight IDs, avoid historical discovery.
const account = "0x123";
const event = await client.fightEvents.get("Cage Night", {
  seasonId: 1n,
  fightIds: [42n, 43n],
  viewer: account,
});

// Load only the first actionable account page; fetch older pages on demand.
const accountPage = await client.accounts.fightStates(account, { limit: 20 });

Every read returns a DataResult<T>. Its meta field reports the selected source, fallback attempts, completeness, warnings, duration, and block number when available. Valid partial data resolves with complete: false; invalid configuration and total source failure throw typed SDK errors.

Capabilities

The client exposes fighters, fights, fightEvents, events, accounts, markets, relics, gacha, tokens, activity, analytics, and admin repositories.

  • Indexed catalogs and analytics query Torii first.
  • Authoritative or missing state falls back to the configured Starknet RPC.
  • RPC pools try the primary provider before Cartridge failover.
  • External IPFS JSON is fetched only by display-oriented relic reads and only when needed.
  • Exhaustive reads have configurable safety budgets rather than arbitrary result caps.
  • Concurrent identical work is coalesced; the core SDK does not retain completed-result caches.
  • Known fight IDs, Gacha pools, and account-relevant fight state use bounded contract batches.
  • Legacy Gacha deployments reconstruct one selected pool's complete rarity counters in one JSON-RPC HTTP batch; a failed batch retains only verified open/size state instead of starting an RPC fan-out.
  • client.capabilities.diagnostics() reports preset, override, and runtime-probe provenance.

Entry points

  • @medievaltech/cage-calls-sdk: framework-neutral client, repositories, types, transports, and pure statistics helpers.
  • @medievaltech/cage-calls-sdk/react: provider, React Query hooks, and live invalidation.
  • @medievaltech/cage-calls-sdk/testing: mock RPC, Torii, and metadata transports.

Guides

Development

pnpm install --frozen-lockfile
pnpm check
pnpm clean

pnpm check validates generated deployments, strict TypeScript, Vitest, ESM/CJS declarations, Node/SSR/Vite/Capacitor runtime examples, the public API report, the non-React core boundary, and the gzip bundle budget.

Security

Never commit API keys or private keys. Supply authenticated endpoints at runtime. Transport logs contain operations and error codes, not complete authenticated URLs. Report vulnerabilities privately to the Medieval Tech maintainers.

MIT licensed.