@freezeradar/wallet-kit
v1.0.0
Published
Fail-open pre-send address check helper for dApp transfer forms (<10 KB gzip core)
Maintainers
Readme
@freezeradar/wallet-kit
Fail-open pre-send helper for dApp transfer forms. Checks whether a destination address is frozen/blacklisted by a stablecoin issuer or sanctioned via FreezeRadar — before the user signs.
Core bundle target: <10 KB gzip. Never handles private keys or seed phrases.
Setup
npm install @freezeradar/wallet-kitOptional peers for framework helpers:
npm install viem # @freezeradar/wallet-kit/viem
npm install wagmi react # @freezeradar/wallet-kit/wagmi
npm install tronweb # @freezeradar/wallet-kit/tronwebLocal development:
npm install
npm run lint
npm test
npm run build
npm run sizeUsage
import {
checkAddress,
guardTransfer,
poweredByHref,
poweredByLabel,
TransferBlockedError,
} from "@freezeradar/wallet-kit";
const result = await checkAddress({
address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
chain: "ethereum",
});
// result.decision: "allow" | "review" | "block"
// result.failedOpen: true if the API was unreachable (never blocks)
try {
await guardTransfer({ address: recipient, chain: "ethereum" });
await sendFunds(recipient);
} catch (err) {
if (err instanceof TransferBlockedError) {
// Show err.result.reportUrl — do not send
}
}
// Attribution (free tier)
<a href={poweredByHref()}>{poweredByLabel()}</a>Viem
import { wrapWalletClient } from "@freezeradar/wallet-kit/viem";
const client = wrapWalletClient(walletClient, { chain: "ethereum" });
// sendTransaction / writeContract check recipient (transfer) or spender (approve)Wagmi
import {
useFreezeRadarCheck,
guardWriteContract,
} from "@freezeradar/wallet-kit/wagmi";
const { result, loading } = useFreezeRadarCheck(to, "ethereum");
await guardWriteContract(
{ functionName: "transfer", args: [to, amount] },
{ chain: "ethereum" },
);TronWeb
import { guardTrc20Transfer } from "@freezeradar/wallet-kit/tronweb";
await guardTrc20Transfer(contract, { to, amount, chain: "tron" });See examples/ for RainbowKit/wagmi, viem, and TronWeb sketches.
Configuration
| Option | Default | Notes |
| --- | --- | --- |
| chain | required | ethereum, tron, bsc, polygon, solana, base, arbitrum, optimism, avalanche |
| timeoutMs | 2500 | Fail-open on timeout |
| signal | — | AbortSignal; combined with timeout |
| cacheTtlMs | 60000 | In-memory TTL; 0 disables |
| useQuickCheck | false | Opt into POST /api/v1/quick-check |
| apiKey | — | Bearer key for quick-check (server-side only) |
| onError | — | Called when the check fails open |
| apiBase | https://freezeradar.com | Override for tests/staging |
Public API (no key):
GET /api/widget/check?address=…&chain=…→{ ok, data: { address, chain, blacklisted, sanctioned } }- Report:
https://freezeradar.com/scan?address=…
Optional authenticated (off by default):
POST /api/v1/quick-checkwithAuthorization: Bearer <api key>, body{ address, chain? }- Returns
{ decision: allow\|review\|block, riskLevel, reportUrl, … } - Falls back to the public widget check on failure
Fail-open: if FreezeRadar is unreachable, the decision is allow with failedOpen: true and an optional warning. Never block the user on an outage.
Partnership copy for wallets/dApps: docs/PARTNERS.md.
Listing / distribution steps
Owner checklist (do not publish until ready):
- Confirm
@freezeradarnpm org access andNPM_TOKEN. - Run
npm run lint && npm test && npm run build && npm run sizeon a clean tree. - Set
"publishConfig": { "access": "public" }if the org defaults to private. npm publish --access publicfrom a tagged release (owner only).- Link the package from https://freezeradar.com/developers and partner docs.
- Keep free-tier integrations showing Powered by FreezeRadar → https://freezeradar.com.
- Optional: publish example snippets to a public gist or docs site — no outreach emails without approval.
Scripts
| Script | Purpose |
| --- | --- |
| npm run lint | ESLint |
| npm test | Vitest |
| npm run build | tsup (ESM + CJS + types) |
| npm run size | Gzip size gate for dist/index.js (<10 KB) |
| npm run typecheck | tsc --noEmit |
License
MIT © FreezeRadar
