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

priven-sdk

v0.3.0

Published

Privacy-preserving pool queries on Solana using MagicBlock TEE

Downloads

87

Readme

@priven/client

Privacy-preserving pool queries on Solana using MagicBlock TEE.

Installation

npm install @priven/client

Quick Start

import { Connection, Keypair } from "@solana/web3.js";
import { PrivenSession, discoverCpmmPools, FilterType, FilterOp } from "@priven/client";

// Setup
const connection = new Connection("https://api.devnet.solana.com");
const wallet = Keypair.fromSecretKey(/* your keypair */);

// Discover CPMM pools from mainnet
const mainnetConn = new Connection("https://api.mainnet-beta.solana.com");
const pools = await discoverCpmmPools(mainnetConn, { limit: 20 });

// Build predicate (v2 format)
const predicate = {
  filters: [
    { type: FilterType.TVL, op: FilterOp.GTE, value: BigInt(1_000_000) },
    { type: FilterType.TVL, op: FilterOp.LTE, value: BigInt(50_000_000) },
  ]
};

// Execute private query via session
const session = await PrivenSession.open(program, wallet, connection);
const result = await session.query(predicate, pools);
await session.close();

console.log("Matching pools:", result.matches);

Features

  • Private Queries: Search criteria encrypted with X25519 + AES-256-GCM
  • TEE Execution: Queries run inside MagicBlock's Intel TDX enclave
  • CPMM Integration: Query 200k+ Raydium CPMM pools on mainnet
  • Session Management: Group queries for lifecycle and stats tracking
  • Merkle Anchoring: Verifiable proof of TEE execution on L1

Predicate Format (v2)

import { FilterType, FilterOp, Predicate } from "@priven/client";

const predicate: Predicate = {
  filters: [
    { type: FilterType.TVL, op: FilterOp.GTE, value: BigInt(1_000_000) },
    { type: FilterType.RESERVE_0, op: FilterOp.LTE, value: BigInt(100_000_000) },
  ]
};

Filter Types (CPMM)

| FilterType | Description | Offset | |------------|-------------|--------| | TOKEN_MINT_0 | First token mint | 168 | | TOKEN_MINT_1 | Second token mint | 200 | | AMM_CONFIG | AMM configuration | 8 | | STATUS | Pool status | 329 | | RESERVE_0 | Token 0 reserve (from vault) | - | | RESERVE_1 | Token 1 reserve (from vault) | - | | TVL | Total value locked | - | | LP_SUPPLY | LP token supply | 333 | | OPEN_TIME | Pool open time | 373 |

Filter Operations

| FilterOp | Description | |----------|-------------| | GTE | Greater than or equal | | LTE | Less than or equal | | EQ | Equal | | NEQ | Not equal |

Pool Discovery

import { discoverCpmmPools, discoverCpmmPoolsWithRetry } from "@priven/client";

// Simple discovery
const pools = await discoverCpmmPools(connection, { limit: 100 });

// With retry logic
const pools = await discoverCpmmPoolsWithRetry(connection, {
  tokenMint: new PublicKey("..."), // Optional: filter by token
  limit: 50,
});

Session-Based API

Sessions provide lifecycle management and stats tracking:

import { PrivenSession } from "@priven/client";

// Open session (creates on-chain account)
const session = await PrivenSession.open(program, wallet, connection);

// Execute queries within session
const result1 = await session.query(predicate1, pools);
const result2 = await session.query(predicate2, pools);

// Close session (returns rent)
await session.close();

Direct Encryption

import { encryptPredicate, decryptResult } from "@priven/client";

// Encrypt predicate for TEE
const encrypted = await encryptPredicate(predicate, teePublicKey);
// encrypted.ciphertext - send to chain
// encrypted.publicKey - user's ephemeral public key
// encrypted.privateKey - keep secret for decryption

// Decrypt result from TEE
const result = await decryptResult(
  encryptedResult,
  encrypted.privateKey,
  teePublicKey
);

Constants

import {
  PRIVEN_PROGRAM_ID,
  RAYDIUM_CPMM_PROGRAM_ID,
  CPMM_POOL_SIZE,
  QUERY_SEED,
  SESSION_SEED,
  ANCHOR_SEED,
} from "@priven/client";

Types

import type {
  Predicate,
  Filter,
  QueryResult,
  QueryOptions,
  QueryExecutedEvent,
  QuerySessionAccount,
  MerkleAnchorAccount,
} from "@priven/client";

License

MIT