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

@haven-protocol-ckb/sdk

v0.2.3

Published

Haven Protocol SDK for CKB — read and verify Haven Scores directly from the chain via CCC

Readme

Haven Protocol SDK

TypeScript SDK for dApps to integrate Haven Protocol on CKB. Reads and verifies Haven Scores directly from the chain via CCC, with no Haven server required for on-chain reads.

Package: @haven-protocol-ckb/sdk

Install

npm install @haven-protocol-ckb/sdk

Sub-path Exports

| Import path | Description | |-------------|-------------| | @haven-protocol-ckb/sdk | Core client, types, cell parser, constants, tiers, deposits | | @haven-protocol-ckb/sdk/tee | TEE client for OAuth flows, identity registration, score history, notifications | | @haven-protocol-ckb/sdk/react | React hooks and HavenProvider | | @haven-protocol-ckb/sdk/contracts | Script builders, cell builders, deploy info | | @haven-protocol-ckb/sdk/attestations | Off-chain attestation generation |

Core API: HavenClient

All reads are pure on-chain. Wraps a CCC client instance.

import { ccc } from '@ckb-ccc/core';
import { HavenClient } from '@haven-protocol-ckb/sdk';

const client = new ccc.ClientPublicTestnet();
const haven = new HavenClient(client, {
  typeScriptCodeHash: '0x134e98b0...',
  typeScriptHashType: 'type',
});

const score = await haven.getScore(lockHash);
const eligible = await haven.verifyThreshold(lockHash, 650);
const isGuardian = await haven.verifyTier(lockHash, 'Guardian');
const top100 = await haven.getLeaderboard(100);
const myScore = await haven.getMyScore(signer);
const registry = await haven.getRegistryConfig();

Methods:

  • getScore(lockHash) - fetch a user's Haven Score by lock script hash
  • getMyScore(signer) - fetch the connected wallet's score via CCC signer
  • verifyThreshold(lockHash, minScore) - check if score meets a minimum threshold
  • verifyTier(lockHash, tier) - check if score qualifies for a tier
  • getLeaderboard(limitOrOptions) - fetch sorted leaderboard (by score or any component)
  • getRegistryConfig() - fetch protocol configuration from the registry cell
  • getAllScoreCells() - fetch all live score cells on-chain

TEE Client: HavenTeeClient

HTTP client for the Haven TEE service. Handles OAuth flows, identity registration, score history, and notifications.

import { HavenTeeClient } from '@haven-protocol-ckb/sdk/tee';

const tee = new HavenTeeClient('https://your-tee-endpoint/api');

// Identity
const { identityCommitment } = await tee.registerIdentity(address, pubKey, signature, message);
const { registered } = await tee.checkIdentity(identityCommitment);

// Connections (Twitter, GitHub, Discord, LinkedIn)
const status = await tee.getConnectionStatus(identityCommitment);
// { wallet: true, twitter: false, github: true, discord: true, linkedin: false }

// Score
await tee.requestScoreRefresh(identityCommitment);
const history = await tee.getScoreHistory(identityCommitment);

// Health
const health = await tee.getHealth();

// Notifications
const notifications = await tee.getNotifications(identityCommitment);
await tee.markNotificationRead(id);

// Score cell
await tee.saveScoreCellOutpoint(identityCommitment, txHash, index);

React Hooks

import {
  HavenProvider,
  useHavenScore,
  useHavenGate,
  useLeaderboard,
  useAuth,
  useDeposit,
  useNotifications,
} from '@haven-protocol-ckb/sdk/react';

// Wrap your app
<HavenProvider
  client={cccClient}
  options={{ typeScriptCodeHash: '0x134e98b0...' }}
>
  <App />
</HavenProvider>

| Hook | Description | |------|-------------| | useHavenScore | Fetch and cache the connected wallet's Haven Score | | useHavenGate | Gate access based on score threshold or tier | | useLeaderboard | Fetch and paginate the public leaderboard | | useAuth | Manage OAuth connection flows | | useDeposit | Build and submit deposit top-up transactions | | useNotifications | Fetch and manage user notifications |

Score Tiers

| Tier | Range | |------|-------| | Observer | 0-199 | | Initiate | 200-399 | | Trusted | 400-649 | | Guardian | 650-849 | | Sovereign | 850-1000 |

Utilities

| Export | Description | |--------|-------------| | parseScoreCell / serializeScoreCell | Parse/serialize 127-byte score cell data | | getTierForScore / getTierDefinition | Tier lookup and metadata | | getProgressToNextTier | Progress percentage to next tier | | formatScore / truncateHash | Display formatting | | estimateUpdatesRemaining | Estimate scoring updates a deposit can fund | | isLowBalance / formatCkbAmount | Deposit balance utilities |

Build

npm run build    # tsc -p tsconfig.build.json
npm run dev      # watch mode

CI/CD

The SDK auto-publishes on push to sdk/** on main. The CI bumps the patch version and publishes to npm.