Scaffold a Typed TypeScript Client for Any Solana API in 5 Minutes (OpenAPI + Scalar)
If your Solana data API ships an OpenAPI spec, you can skip writing fetch wrappers entirely. Here's how to codegen a fully typed TypeScript client — with typed routes and parameters, explicit quota handling, and a reproducible contract update workflow.

An OpenAPI document can generate the request and response types for a Solana data API. That removes much of the manual interface maintenance, but the result is only as accurate as the specification you downloaded. Generated types do not validate a live JSON response and do not automatically update when the server changes.
This walkthrough uses MadeOnSol's OpenAPI document, openapi-typescript for generation, and openapi-fetch for HTTP calls. Scalar's API reference is the human-readable view; it is not the code generator.
1. Save the contract and install the tools
Run these commands in a server-side TypeScript project:
curl --fail --show-error --location https://madeonsol.com/api/v1/openapi.json -o openapi.json
npm install --save-dev openapi-typescript typescript @types/node
npm install openapi-fetch
npx openapi-typescript openapi.json -o src/api-types.ts
Keep the downloaded contract and generated types together in version control. Lock dependency versions after the example works. The generated file exports a paths type; the fetch client uses it to constrain route names, parameters, and response shapes.
2. Match the server URL to the path keys
MadeOnSol's specification declares https://madeonsol.com/api/v1 as its server. Its path keys include /kol/leaderboard and /me. Do not add another /v1 to a path that is already under that base URL.
// src/client.ts — server-side only
import createClient from "openapi-fetch";
import type { paths } from "./api-types";
const apiKey = process.env.MADEONSOL_API_KEY;
if (!apiKey) throw new Error("Set MADEONSOL_API_KEY");
export const client = createClient<paths>({
baseUrl: "https://madeonsol.com/api/v1",
headers: { Authorization: "Bearer " + apiKey },
});
Keep this module out of a browser bundle. A public dashboard should call your own authenticated backend, which can cache and filter data according to your account's redistribution rights.
3. Call the leaderboard with the correct contract
import { client } from "./client";
async function topKols() {
const { data, error, response } = await client.GET("/kol/leaderboard", {
params: { query: { period: "7d", limit: 20 } },
});
if (!response.ok || error || !data) {
throw new Error("Leaderboard failed: HTTP " + response.status);
}
if (!Array.isArray(data.leaderboard)) {
throw new Error("Leaderboard response has no ranking array");
}
for (const kol of data.leaderboard) {
const rate = typeof kol.win_rate === "number"
? kol.win_rate.toFixed(1) + "%"
: "unknown";
console.log(kol.name, kol.wallet, rate);
}
console.log("Universe:", data.universe);
}
topKols().catch(console.error);
The result array is leaderboard. The supported periods are today, 7d, 30d, 90d, and 180d. This route's win_rate is already a percentage, so multiplying it by 100 would misreport the value.
The endpoint ranks a fixed universe: the period's top 50 KOLs by realized PnL. Pagination and alternate sorts operate within that set. Read universe and pagination before claiming to have enumerated all tracked wallets. Sorting/filtering access also depends on tier; TypeScript accepting a parameter does not mean your key is entitled to use it.
4. Separate compile-time types from runtime checks
The openapi-fetch documentation describes its data, error, and response return values. HTTP errors are represented in the result; a failed network request can still throw. Handle both in the caller.
Code generation cannot repair an underspecified schema. Optional fields remain optional, and an unrestricted object remains broad. Options that alphabetize output or make properties readonly do not infer missing response fields. If you need stronger guarantees at a trust boundary, validate the actual response with a schema and report mismatches.
For a wallet activity monitor, those runtime checks should distinguish an empty successful result from an unavailable source. For a token blacklist guard, distinguish a known false from an absent flag.
Building a product on Solana or Robinhood Chain data?
Skip the Geyser pipeline — embed KOL flow, deployer reputation, and the all-DEX firehose over REST, WebSocket, or webhooks. The Business tier (€400/mo) is the self-serve embed license at 500k calls/day — Enterprise adds white-label & redistribution.
5. Inspect account quota and response headers
The account endpoint exposes separate daily and burst budgets:
const account = await client.GET("/me");
if (!account.response.ok || !account.data) {
throw new Error("Account lookup failed: " + account.response.status);
}
console.log(account.data.quota);
Normal authenticated responses can include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, and X-RateLimit-Reset. Reset is Unix seconds; the successful-response quota headers describe the daily bucket. Do not assume they describe the current minute's burst window, and do not treat a missing header as numeric zero.
function optionalNumber(headers: Headers, name: string): number | null {
const raw = headers.get(name);
if (raw === null || raw.trim() === "") return null;
const value = Number(raw);
return Number.isFinite(value) ? value : null;
}
const result = await client.GET("/kol/feed", {
params: { query: { limit: 10 } },
});
const remaining = optionalNumber(result.response.headers, "x-ratelimit-remaining");
const reset = optionalNumber(result.response.headers, "x-ratelimit-reset");
if (result.response.status === 429) {
console.log("Retry after:", result.response.headers.get("retry-after"));
} else if (!result.response.ok) {
throw new Error("Feed failed: " + result.response.status);
}
console.log({ remaining, reset });
A retry policy should honor Retry-After, cap its attempts, and distinguish a burst limit from an exhausted daily allowance. Retrying a 403 with the same key and parameters does not grant access. A subscription upgrade or a narrower request may be needed.
The free tier delays selected live feeds; inspect delay_seconds, as_of, and X-Data-Delay where present. Successful decoding alone does not prove that a result is current enough for your application.
6. Regenerate reproducibly
Add a script to your project:
{
"scripts": {
"generate:api": "openapi-typescript openapi.json -o src/api-types.ts",
"check:types": "tsc --noEmit"
}
}
A deterministic CI check should generate from the committed contract:
npm run generate:api
git diff --exit-code -- src/api-types.ts
npm run check:types
That checks reproducibility and the code that consumes the types. Separately, download a new upstream specification, review its changes, regenerate, and run your integration tests before accepting it. A job that merely compares two downloaded JSON files does not prove that the generated TypeScript is fresh or that your application still compiles.
Codegen or the MadeOnSol SDK?
Use the published madeonsol-sdk TypeScript package when its convenience methods and streaming helpers fit your application. Use generated types when you need a route directly from the documented REST surface or want a contract snapshot in your own build process.
Neither option guarantees zero drift. SDK versions, the OpenAPI snapshot, and deployed behavior must agree. For an end-to-end application, see the TypeScript SDK guide, the Rust SDK guide, token analytics dashboard, and public status endpoint. Health checks complement request validation; they do not replace it.
Plans and their request limits are on the pricing page.
Sources: MadeOnSol OpenAPI, interactive reference, openapi-typescript, and openapi-fetch.
Tools mentioned
Compare features and read reviews.
Live health scores, average ratings, and direct links on MadeOnSol.

Arweave
Permanent decentralized storage for Solana data and NFT assets

Pinata
IPFS storage and retrieval platform for Solana NFT metadata

CoinFactory
Multi-chain no-code token generator for 20+ blockchains

Torque
On-chain incentive protocol for targeted airdrop and reward campaigns on Solana

Nosana
Decentralized GPU compute marketplace for AI inference on Solana
Build with MadeOnSol API
KOL tracking, deployer intelligence, DEX streaming, and webhooks. Free API key — 200 requests/day.
import { MadeOnSol } from "madeonsol";
// Get a free API key at madeonsol.com/pricing
const client = new MadeOnSol({ apiKey: "msk_your_key" });
const { trades } = await client.kol.feed({ limit: 10 });
const { alerts } = await client.deployer.alerts({ limit: 5 });
const { tools } = await client.tools.search({ q: "trading" });Building a product on Solana or Robinhood Chain data?
MadeOnSol isn't an RPC or another generic token API — it's Solana & Robinhood Chain memecoin intelligence that's painful to build in-house, pulled from dual-region gRPC shred streams and our own Robinhood Chain node, pushed to your app as events land.
Signals you'd otherwise build
KOL & smart-money flow from 2,000+ labeled wallets, deployer reputation, coordination clusters, linked-wallet entity resolution, and an all-DEX firehose.
Embed it in your product
The Business tier (€400/mo, self-serve) licenses you to display MadeOnSol data inside your own product — 500k calls/day, 15 WS + 6 firehose connections. Enterprise above adds white-label & redistribution rights and custom endpoints.
Evaluate first, commit later
Test everything on a free ULTRA key — no commitment. If it fits, we scope volume or white-label pricing.
Keep reading
More from the blog.

Developer Tools
White-Label Solana Data: What Redistribution Rights Actually Mean for Your Product (2026)
You can often embed a Solana data API in your app on a self-serve plan, but the moment you resell the data, expose it as your own feed, or strip the branding, you're in licensing territory most builders discover too late. This guide maps the three usage zones (internal use, user-facing display, redistribution), the questions to ask any data vendor before you build, and what an Enterprise data license actually covers: white-label, bulk export, extended caching, SLA, and dedicated limits.

Developer Tools
Pump.fun Deployer Alerts in Your Discord: Build the Bot in 5 Minutes
Get a Discord embed the moment a proven Solana deployer — one with a real bonding track record on pump.fun or LaunchLab — launches a new token or one of their tokens bonds. This tutorial walks the open-source deployer-alert-discord-bot starter: zero dependencies, ~130 lines, a Discord webhook, and a free MadeOnSol API key.

Developer Tools
Copy-Trade Solana KOL Wallets: Build a Paper-Trading Bot in 5 Minutes
Watch live smart-money trades on Solana and paper-trade them in real time: open a virtual position when a tracked KOL buys, close when they sell, and track PnL from the market-cap multiple. This tutorial walks the open-source kol-copytrade-bot-starter — ~300 lines, one dependency, free API key — and shows how to filter by KOL win rate, deployer tier, and multi-KOL confirmation before risking anything real.

Developer Tools
Power Your AI Trading Agent with Solana Data: MCP vs Agent-Kit vs x402 (2026)
An AI agent is only as sharp as the data it can reach. This guide compares the three ways to wire live Solana memecoin intelligence — KOL flow, rug scores, deployer reputation — into an agent: the MCP server for Claude and Cursor, the solana-agent-kit plugin for autonomous JS agents, and x402 micropayments where the agent's wallet IS the API key. With the decision table, code-free setup for each, and the safety line that matters: the data layer never executes trades.

Developer Tools
Build a Solana Rug-Check Telegram Bot in 10 Minutes (Free API Key)
Paste a mint into Telegram, get a scored rug-risk report back in seconds. This tutorial walks the open-source rug-check-telegram-bot starter: zero dependencies, ~150 lines of Node, a free MadeOnSol API key, and a transparent 0–100 score where every point is attributed to a named factor — mint authority, liquidity depth, LP burn, bundled launch, deployer track record.

Developer Tools
The Data Layer for a Telegram Trading Bot or Terminal SaaS (2026)
Users judge a Solana trading bot by its edge features — rug checks at buy time, wallet PnL cards, smart-money alerts — not by its swap routing. This is the architecture guide for teams building a Telegram bot or web terminal: which intelligence features users actually expect in 2026, the endpoint that powers each one, the quota math per active user, what you may cache, and the point where Enterprise white-labeling becomes the right call.
Enjoyed this article?
Explore the live data.
Real-time KOL trades, Pump.fun deployer intel, and 1,200+ ranked Solana & Robinhood Chain tools — free to explore.
Open the KOL Tracker