@freezeradar/sdk
v0.1.0
Published
TypeScript SDK for FreezeRadar wallet-risk screening: issuer blacklists, sanctions, and freeze-risk scores for exchanges, OTC desks, wallets, and payment gateways.
Maintainers
Readme
@freezeradar/sdk
TypeScript SDK for FreezeRadar: wallet-risk intelligence for freezeable assets (USDT, USDC, PAXG, XAUt, …). Built for exchanges, OTC desks, wallets, and payment gateways that need a pre-withdrawal or deposit screen before funds move.
The client talks to the live FreezeRadar API (https://freezeradar.com). Types are generated from GET /api/openapi/v1. Webhook HMAC rules come from the developer docs.
Works in Node 18+ and edge runtimes (fetch + Web Crypto). Dual ESM / CommonJS build.
npm install @freezeradar/sdkimport { FreezeRadar } from "@freezeradar/sdk";
const fr = new FreezeRadar({
apiKey: process.env.FREEZERADAR_API_KEY, // Business key; public checks work without it
});
const check = await fr.checkAddress("TBZefVsyQpzzxc2WSCLbZBECvxVdzGqdtC");
// { chain: "tron", sanctioned: true, blacklisted: false, matches: [OFAC…] }
const decision = await fr.screenWithdrawal({
toAddress: "0x…",
asset: "USDT",
amount: "1200",
chain: "ethereum",
});
// decision.decision === "allow" | "review" | "block"CLI (after install, or via npx -p @freezeradar/sdk freezeradar):
npx freezeradar check TBZefVsyQpzzxc2WSCLbZBECvxVdzGqdtC
npx freezeradar check 0x… --chain polygon --json
npx freezeradar healthAuthentication
Business routes expect Authorization: Bearer <API_KEY>. Create a key in the Developer Console. Store it server-side (FREEZERADAR_API_KEY). Public catalog and widget/sanctions checks are IP rate-limited and do not need a key.
Endpoints used (live)
| SDK method | HTTP | Auth |
| --- | --- | --- |
| checkAddress / checkAddresses | GET /api/widget/check + GET /api/sanctions/check | none (IP rate limit) |
| getReport / waitForScreening | GET /api/v1/screenings/{id} | Bearer |
| createAddressScreening | POST /api/v1/address-screenings | Bearer, async |
| createTransactionScreening | POST /api/v1/transaction-screenings | Bearer, async |
| health | GET /api/chains | none |
| getStats / getEvents / getAssets / getChains | /api/stats, /api/events, /api/assets, /api/chains | none |
checkAddresses is client-side concurrency (default 5). There is no batch route on the API.
Synchronous checkAddress always uses widget + sanctions unless you opt into the planned quick-check (below).
Endpoints the main app should expose
These are not live (404 today). The SDK is written so they can be turned on without a breaking client change.
| Route | Status | SDK hook |
| --- | --- | --- |
| POST /api/v1/quick-check | Planned, not live. Body { address, chain, assets? }. Response { ok, data: { address, chain, blacklisted, sanctioned, matches? } }. Bearer. | new FreezeRadar({ useQuickCheck: true }) — on 404 the SDK falls back to widget + sanctions |
| POST /api/v1/address-screenings/batch | Not implemented. | Not called; checkAddresses fans out |
| GET /api/v1/health | Not implemented. | health() uses GET /api/chains as a public liveness probe |
Do not treat POST /api/scan as the exchange API: it is the signed-in product scan (401 Sign in to run a wallet scan.).
Helpers
screenWithdrawal({ toAddress, asset, amount, chain? }) and screenDeposit({ fromAddress, ... }) return allow | review | block plus reasons.
Default policy (override with thresholds):
- issuer-blacklisted or sanctioned → block
overallRisk >= 70orHIGH/CRITICAL→ blockoverallRisk >= 30orMEDIUM→ review- optional
reviewAboveAmountbumps allow → review - Bitcoin is sanctions-only (no freeze-risk score)
With a Business API key, screening also creates POST /api/v1/address-screenings and polls GET /api/v1/screenings/{id} until COMPLETED / FAILED. Pass mode: "sync" to skip that.
Address validation
Chain is auto-detected, in this order: EVM → Tron → Bitcoin → Solana. Pass chain for EVM L2s (polygon, base, arbitrum, optimism, avalanche, bsc). Bitcoin is accepted on public sanctions/widget checks only.
Middleware
No Express/Fastify dependency. Factories take a generic (req, res, next) / Fastify preHandler shape:
import { expressScreen, expressWebhook, fastifyScreen } from "@freezeradar/sdk";
app.post("/withdraw", express.json(), expressScreen(client), (req, res) => {
res.json(req.freezeRadar); // ScreenDecision
});
app.post(
"/webhooks/freezeradar",
express.raw({ type: "application/json" }),
expressWebhook({ secret: process.env.FREEZERADAR_WEBHOOK_SECRET }),
(req, res) => {
res.sendStatus(200);
},
);Webhooks
Verify against the raw body:
x-freezeradar-event
x-freezeradar-timestamp
x-freezeradar-signature # sha256= HMAC-SHA256(`${timestamp}.${rawBody}`)import { parseWebhookEvent } from "@freezeradar/sdk";
const event = await parseWebhookEvent({
payload: rawBody,
secret: process.env.FREEZERADAR_WEBHOOK_SECRET,
headers: req.headers,
});Reject stale timestamps (SDK default 5 minutes). Deduplicate on event id. Return 2xx or FreezeRadar retries (up to 5 times).
Configuration
| Option | Default |
| --- | --- |
| apiKey | undefined |
| baseUrl | https://freezeradar.com |
| timeoutMs | 30000 |
| maxRetries | 3 |
| useQuickCheck | false |
| fetch | globalThis.fetch |
429 responses honor Retry-After and expose X-RateLimit-* on client.lastRateLimit.
Examples
examples/exchange-withdrawal.ts— exchange pre-withdrawal gateexamples/deposit-worker.ts— credit/hold/reject workerexamples/express-middleware.ts/examples/fastify-plugin.ts
Development
npm install
npm test
npm run lint
npm run typecheck
npm run build
npm run generate # refresh src/generated/openapi.ts from spec/openapi.jsonRequires Node 18+.
Publishing
GitHub Actions publishes to npm on a GitHub Release (NPM_TOKEN repository secret). This package is not published from CI in this change. The @freezeradar org on npm and the token must exist first.
License
MIT
