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

@repla/sdk-ts

v0.3.0

Published

REPLA TypeScript SDK -- programmatic interface to sequencer runtime + Anchor settler.

Readme

@repla/sdk-ts

TypeScript SDK for the REPLA framework — a workbench for Solana game-specific L3 rollups. It gives you three things: an HTTP client for the REPLA backend API, the byte-identical state-root hash the Rust sequencer runtime uses, and helpers for deriving the on-chain settler program's PDAs.

REPLA settles game state to Solana via an Anchor program and runs live state inside a MagicBlock-backed sequencer. The settler program is currently deployed on mainnet.

Install

npm i @repla/sdk-ts

Requires Node ≥ 20.

Exports

| Export | Kind | What it does | | --- | --- | --- | | ReplaClient | class | HTTP client for the REPLA backend API (/api/health, /api/launch, /api/stats, /api/settle). | | computeStateRoot(payloads) | fn | 32-byte root over raw payloads; byte-identical to the Rust runtime's batch.rs. | | stateRootFromOps(ops) / merkleRoot(leaves) | fn | Apply 40-byte ledger ops ({ account, delta }) to a sorted balance ledger and Merkle-commit the resulting state; byte-identical to the Rust runtime's state machine. | | bytesToHex(bytes) | fn | Lowercase hex encoding of a byte array. | | REPLA_PROGRAM_ID | const | Settler program id (mainnet 42LxZ…). | | registryPda / sequencerPda / l3Pda / settlementPda | fn | Derive the settler program's PDAs. | | l3IdFromString(hex) | fn | Parse a 64-char hex id into a 32-byte Uint8Array. | | defaultConnection() / PUBLIC_MAINNET_RPC | fn / const | Convenience Connection to the public mainnet-beta RPC. | | LaunchConfig, LaunchResponse, StatsResponse, SettleRequest, Engine, GameType, LedgerOp | type | Request / response shapes for the API, plus the ledger op shape. |

REPLA API client

ReplaClient is a thin HTTP client over the REPLA backend service. It does not sign or send Solana transactions itself — it calls the REPLA API, which queues the on-chain work and reports status.

import { ReplaClient } from '@repla/sdk-ts';

const client = new ReplaClient({ apiUrl: 'https://api.repla.fun' });

const health = await client.health(); // { ok, version, network }
const stats = await client.stats();   // { sequencer_count, l3_count, settlement_count, ... }

const launch = await client.launchL3({
  game_name: 'my-game',
  engine: 'web',
  owner: 'YOUR_OWNER_PUBKEY',
});

const settle = await client.settle({
  l3_id: '00'.repeat(32),
  from_slot: 1,
  to_slot: 200,
  state_root: '00'.repeat(32),
  action_count: 0,
  sequencer: 'YOUR_SEQUENCER_PUBKEY',
}); // { queued, tx_intent }

Pass a custom fetchImpl (new ReplaClient({ apiUrl, fetchImpl })) to run the client outside a runtime that has a global fetch.

State root

import { computeStateRoot, bytesToHex } from '@repla/sdk-ts';

const payloads = [new Uint8Array([0x61]), new Uint8Array([0x62, 0x62])];
const root = computeStateRoot(payloads);
console.log(bytesToHex(root));

computeStateRoot takes the ordered action payloads and returns the 32-byte root: each payload is prefixed with its 4-byte little-endian length, then the whole stream is hashed once with SHA-256. This is byte-identical to the Rust sequencer runtime (packages/sequencer-runtime/src/batch.rs), so the same inputs produce the same root the chain settles against.

PDAs

import { PublicKey } from '@solana/web3.js';
import {
  registryPda,
  sequencerPda,
  l3Pda,
  settlementPda,
  l3IdFromString,
} from '@repla/sdk-ts';

const [registry] = registryPda();
const [sequencer] = sequencerPda(new PublicKey('OPERATOR_PUBKEY'));
const l3Id = l3IdFromString('00'.repeat(32));
const [l3] = l3Pda(l3Id);
const [settlement] = settlementPda(l3Id, 200n); // toSlot is a bigint

Each helper returns the [PublicKey, bump] tuple from PublicKey.findProgramAddressSync and derives against REPLA_PROGRAM_ID by default; pass a different program id as the last argument to target another deployment.

On-chain

Anchor settler program (mainnet): 42LxZbUQHUSiBvuVzo1YtAxbjDbxLDLHNmQhyG5wabVV. Mainnet deploy is scheduled into the launch sequence.

Related

Links

  • Site — https://repla.fun
  • Diorama — https://repla.fun/diorama
  • Bench — https://repla.fun/bench
  • Reference crate — https://github.com/replalabs/repla-core
  • X — https://x.com/replagg

License

Apache-2.0.