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

clearchain-sdk

v1.0.0

Published

Official JavaScript/TypeScript SDK for the ClearChain AML intelligence API

Readme

clearchain-sdk

Official JavaScript/TypeScript SDK for the ClearChain AML intelligence API.

Zero dependencies. Node 18+ (native fetch) or any modern browser.

Installation

npm install clearchain-sdk

Quick start

import { ClearChainClient } from 'clearchain-sdk'

const client = new ClearChainClient({ apiKey: 'ck_live_your_key_here' })

// Analyze a single address
const result = await client.analyze('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'ETH')

console.log(result.riskScore.total)      // 0–100
console.log(result.riskScore.level)      // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.ofacResult.matched)   // false
console.log(result.narrative)            // AI-generated compliance narrative
console.log(result.sarDraft)             // SAR-ready filing draft

// ENS names are resolved automatically (ETH only)
const vitalik = await client.analyze('vitalik.eth')
console.log(vitalik.resolvedAddress)     // 0xd8dA...45

Batch screening

Screen up to 100 addresses in a single API call. Results are sorted by risk_score DESC.

const batch = await client.batch([
  { address: '0xd882cfc20f52f2599d84b8e8d58c7fb62cfe344b', chain: 'ETH' },
  { address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', chain: 'ETH' },
  { address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf5n',         chain: 'BTC' },
])

console.log(batch.data.total)       // 3
console.log(batch.data.processed)   // 3
console.log(batch.data.summary)     // { critical: 0, high: 1, medium: 0, low: 0, clean: 2 }

// Find high-risk addresses
const flagged = batch.data.results.filter(r => (r.risk_score ?? 0) >= 50)
for (const r of flagged) {
  console.log(`${r.address}: ${r.risk_level} (${r.risk_score}) — top signal: ${r.top_signal}`)
}

// Handle per-address failures gracefully
const failed = batch.data.results.filter(r => r.error !== null)
for (const r of failed) {
  console.error(`${r.address}: ${r.error}`)
}

// Rate limit state after the batch
console.log(batch.meta.rate_limit.remaining)  // calls left today
console.log(batch.meta.rate_limit.reset_at)   // ISO timestamp

Error handling

import { ClearChainClient, RateLimitError, InvalidAddressError, ClearChainError } from 'clearchain-sdk'

const client = new ClearChainClient({ apiKey: 'ck_live_your_key_here' })

try {
  const result = await client.analyze('not-a-valid-address', 'ETH')
} catch (err) {
  if (err instanceof RateLimitError) {
    console.log(`Rate limited. Retry in ${err.retryAfter} seconds.`)
    // The SDK already retried up to 3 times — this is the final failure.
  } else if (err instanceof InvalidAddressError) {
    console.log(`Invalid address: ${err.address}`)
  } else if (err instanceof ClearChainError) {
    console.log(`API error [${err.code}] HTTP ${err.status}: ${err.message}`)
  } else {
    throw err
  }
}

The SDK automatically retries on 429 (using Retry-After) and 5xx responses with exponential backoff (1s, 2s, 4s). Errors thrown are always after all retry attempts are exhausted.

Configuration

const client = new ClearChainClient({
  apiKey:  'ck_live_your_key_here',
  baseUrl: 'https://your-custom-deployment.vercel.app',  // optional
})

Type reference

AnalysisResult

| Field | Type | Description | |---|---|---| | address | string | The input address as provided | | chain | 'ETH' \| 'BTC' \| 'TRX' | Chain analyzed | | resolvedAddress | string | Checksummed/resolved address (ENS resolved for ETH) | | riskScore.total | number | Aggregate risk score 0–100 | | riskScore.level | RiskLevel | LOW / MEDIUM / HIGH / CRITICAL | | riskScore.signals | Record<string, ScoringSignal> | All evaluated risk signals | | ofacResult.matched | boolean | OFAC SDN list match | | ofacResult.matchedEntity | string? | SDN entity name if matched | | typologies | AMLTypology[] | AML typology detections (ETH only) | | transactions | WalletTransaction[] | Recent transaction history | | narrative | string | AI-generated plain-English risk narrative | | sarDraft | string | FinCEN SAR-ready draft. Requires BSA/AML officer review. | | hopData | HopEntry[] | Top counterparty transactions (ETH only, up to 5 hops) | | analyzedAt | string | ISO 8601 analysis timestamp |

BatchResult (per-address in batch() response)

| Field | Type | Description | |---|---|---| | address | string | Address as submitted | | chain | SupportedChain | Chain analyzed | | risk_score | number \| null | Score 0–100. null if failed | | risk_level | RiskLevel \| null | Risk band. null if failed | | ofac_match | boolean \| null | OFAC match. null if failed | | mixer_interaction | boolean \| null | Mixer/CoinJoin detected. null if failed | | top_signal | string \| null | Highest-scoring triggered signal name | | typologies | string[] \| null | Triggered typology names | | error | string \| null | Error code on failure, otherwise null |

Error classes

| Class | When thrown | Extra fields | |---|---|---| | ClearChainError | All non-2xx responses (base class) | code: string, status: number | | RateLimitError | 429 after all retries | retryAfter: number (seconds) | | InvalidAddressError | 400 INVALID_ADDRESS | address: string |

Rate limits

| Tier | Daily limit | |---|---| | free | 100 requests | | analyst | 2,000 requests | | team | Unlimited |

Batch requests count as N calls (one per address). Get your API key at /dashboard/settings.