madeonsol 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,1112 +1,1166 @@
1
- # madeonsol
2
-
3
- [![npm version](https://img.shields.io/npm/v/madeonsol?style=flat-square)](https://www.npmjs.com/package/madeonsol)
4
- [![npm downloads](https://img.shields.io/npm/dm/madeonsol?style=flat-square)](https://www.npmjs.com/package/madeonsol)
5
- [![GitHub stars](https://img.shields.io/github/stars/LamboPoewert/madeonsol-sdk?style=flat-square&logo=github)](https://github.com/LamboPoewert/madeonsol-sdk)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.4+-blue?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
- [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen?style=flat-square)](package.json)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
9
-
10
- > ⭐ **[Star on GitHub](https://github.com/LamboPoewert/madeonsol-sdk)** if you find this useful · 📂 **[Examples](./examples/)** · 📚 **[API docs](https://madeonsol.com/api-docs)**
11
-
12
- Official TypeScript/JavaScript SDK for the **[MadeOnSol](https://madeonsol.com) Solana API** — zero dependencies, fully typed, works in Node.js ≥ 18 and edge runtimes.
13
- > Real-time Solana trading intelligence: track 1,000+ KOL wallets with <3s latency, score 6,700+ Pump.fun deployers by reputation, detect multi-KOL coordination signals, and stream every DEX trade across 9+ programs. Free tier: 200 requests/day at [madeonsol.com/pricing](https://madeonsol.com/pricing) — no credit card required.
14
-
15
- > **New in 2.6.1** *(2026-05-13)* — **Velocity types fixed.** Velocity fields are now correctly typed as `mc_change_pct`, `volume_usd`, `mev_volume_pct` each its own object keyed by `5m`/`15m`/`1h`/`2h`/`4h` to match the actual API response. The 2.6.0 shape (`velocity[window].mc_change_pct`) was wrong; clients reading it would get `undefined`. Patch is type-onlyno runtime breaking changes.
16
- >
17
- > **New in 2.6.0** *(2026-05-12)* — **Token directory + self-inspection.** `client.token.list({ min_liq, min_volume_1h_usd, max_mev_share_pct, mc_change_1h_min_pct, sort, ... })` browse and filter every active mint, with default `min_liq=2000` to skip phantom-MC dust. `client.me()` read your tier, daily/burst quota state, and per-feature usage in one call (no header parsing). Velocity / MEV-share fields added to every `TokenResponseBody`: `mc_change_pct`, `volume_usd`, `mev_volume_pct` (each keyed by `5m`/`15m`/`1h`/`2h`/`4h`) plus `history_age_seconds` on the parent. `/token/{mint}` 400s now ship `code`, `reason`, `received_length`, `example`, and `docs` URL stop guessing why a mint failed. Deprecated `avg_entry_mc_usd` / `entry_mc_samples` removed from leaderboard types. All other 2.5.x APIs unchanged.
18
-
19
- > **Build Solana trading bots, analytics dashboards, KOL copy-trading tools, deployer sniper bots, and ecosystem browsers.**
20
-
21
- ## Quick start (10 seconds)
22
-
23
- ```bash
24
- npm install madeonsol
25
- ```
26
-
27
- ```ts
28
- import { MadeOnSol } from "madeonsol";
29
- const client = new MadeOnSol({ apiKey: "msk_..." }); // free tier at madeonsol.com/pricing
30
- const { trades } = await client.kol.feed({ limit: 5, action: "buy" });
31
- ```
32
-
33
- | Feature | Description |
34
- |---|---|
35
- | **KOL Tracker** | Real-time trade feed, PnL leaderboard with five time windows (today, 7d, 30d, 90d, 180d), coordination detection, per-wallet profiles, and deep PnL analytics for 1,000+ tracked KOL wallets. **180 days of trade history** retained. |
36
- | **Alpha Wallet Intel** | Leaderboard of 47,000+ scored early-buyer wallets, full wallet profiles, linked-wallet clustering, token cap-table enrichment, and 0–100 buyer quality scores. |
37
- | **Wallet Tracker** | Monitor any Solana wallet for swaps and transfers. Track up to 10/50/100 wallets (Free/Pro/Ultra). Full wallets, counterparties, and tx_signatures on every tier. 120-day event retention. WS events on ULTRA. |
38
- | **Deployer Hunter** | Pump.fun deployer scoring, tier leaderboard, deploy alerts, and bonding intelligence |
39
- | **DEX Trade Stream** | Real-time WebSocket stream of ALL Solana DEX trades — filter by token, wallet, program, or trade size (Ultra) |
40
- | **Webhooks** | Push notifications for KOL trades, coordination signals, deployer alerts, and wallet tracker events (Pro/Ultra) |
41
- | **Tool Directory** | Search 950+ Solana tools and dApps indexed on MadeOnSol |
42
-
43
- **Links:** [Full docs](https://madeonsol.com/solana-api) · [Website](https://madeonsol.com) · [API docs](https://madeonsol.com/api-docs)
44
-
45
- ## Authentication
46
-
47
- Get a free API key at [madeonsol.com/pricing](https://madeonsol.com/pricing). Keys start with `msk_`.
48
-
49
- ---
50
-
51
- ## Install
52
-
53
- ```bash
54
- npm install madeonsol
55
- # or
56
- yarn add madeonsol
57
- # or
58
- pnpm add madeonsol
59
- ```
60
-
61
- Requires **Node.js ≥ 18** (uses native `fetch`). Works out of the box in Cloudflare Workers, Vercel Edge, and Bun.
62
-
63
- ---
64
-
65
- ## Quick start
66
-
67
- ```ts
68
- import { MadeOnSol } from "madeonsol";
69
-
70
- const client = new MadeOnSol({ apiKey: "msk_your_api_key_here" });
71
-
72
- // Latest KOL buy trades
73
- const { trades } = await client.kol.feed({ limit: 10, action: "buy" });
74
- console.log(trades[0].kol_name, "bought", trades[0].token_symbol);
75
-
76
- // Elite deployer leaderboard
77
- const { deployers } = await client.deployer.leaderboard({ tier: "elite" });
78
-
79
- // Recent deploy alerts
80
- const { alerts } = await client.deployer.alerts({ limit: 5 });
81
-
82
- // Search Solana tools
83
- const { tools } = await client.tools.search({ q: "trading", limit: 10 });
84
- ```
85
-
86
- ---
87
-
88
- ## Use cases
89
-
90
- - **Copy-trading bot** — stream KOL buys via `client.kol.feed()` and mirror trades
91
- - **DEX trade sniping** — subscribe to the all-DEX stream filtered by token or wallet
92
- - **Deployer sniper** monitor `client.deployer.alerts()` for elite-tier launches
93
- - **Coordination detector** — flag tokens with `client.kol.coordination({ min_kols: 3 })`
94
- - **Scout signal** track first-KOL-touch events filtered to S/A-tier scouts via `client.kol.firstTouches({ preset: "scout" })`
95
- - **Analytics dashboard** combine leaderboard, PnL, and tool data
96
- - **Telegram/Discord bot** pipe alerts via webhooks into chat
97
- - **Portfolio tracker** — use `client.kol.wallet()` to follow specific KOL positions
98
-
99
- ---
100
-
101
- ## API Reference
102
-
103
- ### KOL Tracker — `client.kol`
104
-
105
- #### `client.kol.feed(params?)`
106
-
107
- Live feed of trades made by tracked KOL wallets.
108
-
109
- ```ts
110
- const { trades, count } = await client.kol.feed({
111
- limit: 50, // 1–100, default 50
112
- action: "buy", // "buy" | "sell"
113
- kol: "7xKX...", // filter by specific wallet
114
- });
115
- ```
116
-
117
- Returns: `KolFeedResponse` — `{ trades: KolTrade[], count: number }`
118
-
119
- Each `KolTrade` includes `market_cap_usd_at_trade` and `price_usd_at_trade` — the token's MC and price at the exact moment the swap fired, sourced from our in-memory price tracker (real-time, faster than Dexscreener spot). Use these to surface "KOL bought $X SOL of token at $Y MC" without a second lookup.
120
-
121
- ---
122
-
123
- #### `client.kol.leaderboard(params?)`
124
-
125
- KOL PnL leaderboard ranked by realized profit.
126
-
127
- ```ts
128
- const { leaderboard, period } = await client.kol.leaderboard({
129
- period: "7d", // "today" | "7d" | "30d" | "90d" | "180d", default "7d"
130
- });
131
- ```
132
-
133
- > **180-day retention** — KOL trade data is retained for 180 days (extended from 31 on 2026-04-07). The 90d and 180d windows fill up over time as the trade table accumulates.
134
-
135
- Returns: `KolLeaderboardResponse`
136
-
137
- ---
138
-
139
- #### `client.kol.wallet(wallet, params?)`
140
-
141
- Full profile for a single KOL wallet, including trade history and optional per-token PnL breakdown.
142
-
143
- ```ts
144
- const profile = await client.kol.wallet("7xKX...", {
145
- include: "pnl_by_token",
146
- });
147
- ```
148
-
149
- Returns: `KolWalletProfile`
150
-
151
- ---
152
-
153
- #### `client.kol.coordination(params?)`
154
-
155
- Detect tokens where multiple KOLs are buying simultaneously — a strong signal of coordinated pumps. **v1.1** adds peak-density windows, exit tracking, and a composite 0–100 coordination score.
156
-
157
- ```ts
158
- const { coordination, score_version, window_minutes } = await client.kol.coordination({
159
- period: "24h", // "1h" | "6h" | "24h" | "7d", default "24h"
160
- min_kols: 3, // 2–50, default 3
161
- limit: 20, // 1–50, default 20
162
- window_minutes: 15, // v1.1 — peak-density window in minutes (1–60)
163
- min_score: 60, // v1.1 filter by composite score (0–100)
164
- include_majors: false, // v1.1 — include WIF/BONK/POPCAT
165
- });
166
-
167
- for (const c of coordination) {
168
- console.log(c.token_symbol, "score", c.coordination_score, "peak", c.peak_kols, "exited", c.exited_count);
169
- // c.kols[]: { name, wallet, buy_sol, sell_sol, exited }
170
- }
171
- ```
172
-
173
- Returns: `KolCoordinationResponse` — `{ coordination: CoordinatedToken[], score_version, window_minutes }`
174
-
175
- ---
176
-
177
- #### `client.coordinationAlerts.*` (v1.1)
178
-
179
- Create **real-time push alerts** that fire the moment a new coordination cluster forms. Alerts are evaluated per-trade by the signal-evaluator service (sub-second latency), delivered via WebSocket channel `kol:coordination` and/or HMAC-signed webhook. **PRO: 5 rules, ULTRA: 20 rules.**
180
-
181
- ```ts
182
- // Create a rule: ≥5 KOLs, 10-min window, score ≥70, webhook delivery
183
- const { rule, webhook_secret } = await client.coordinationAlerts.create({
184
- name: "strong-clusters",
185
- min_kols: 5,
186
- window_minutes: 10,
187
- min_score: 70,
188
- include_majors: false,
189
- cooldown_min: 30, // don't re-fire same token within 30 min
190
- score_jump_break: 15, // UNLESS score jumps by 15+ (catches conviction surges)
191
- delivery_mode: "webhook", // "websocket" | "webhook" | "both"
192
- webhook_url: "https://example.com/coord-hook",
193
- });
194
- // SAVE webhook_secret — used for HMAC-SHA256 signature verification.
195
-
196
- await client.coordinationAlerts.list();
197
- await client.coordinationAlerts.get(rule.id);
198
- await client.coordinationAlerts.update(rule.id, { min_score: 80, is_active: false });
199
- await client.coordinationAlerts.delete(rule.id);
200
- ```
201
-
202
- Webhook signatures: header `X-MadeOnSol-Signature` = `sha256(timestamp + "." + body)` with `webhook_secret` as the HMAC key. Reject deliveries older than ~5 min.
203
-
204
- WebSocket delivery: subscribe to channel `kol:coordination` on `wss://madeonsol.com/ws/v1/stream` — events are user-scoped (you only receive your own rule fires).
205
-
206
- ---
207
-
208
- #### `client.priceAlerts.*` *(new in 2.8)*
209
-
210
- **Sub-second token MC dip/recovery alerts.** Set a drop threshold on any token — when MC drops below baseline, a `price_alert:dip` event fires. Optionally track recovery. **PRO: 5 alerts, ULTRA: 25 alerts.**
211
-
212
- ```ts
213
- // Create: alert when token drops 20%, then notify when it recovers 15% from the dip low
214
- const { alert, webhook_secret } = await client.priceAlerts.create({
215
- token_mint: "So11111111111111111111111111111111111111112",
216
- drop_pct: 20,
217
- recovery_pct: 15,
218
- name: "SOL dip tracker",
219
- delivery_mode: "webhook",
220
- webhook_url: "https://example.com/dip-hook",
221
- });
222
-
223
- await client.priceAlerts.list();
224
- await client.priceAlerts.get(alert.id);
225
- await client.priceAlerts.update(alert.id, { name: "Renamed", is_active: false });
226
- await client.priceAlerts.delete(alert.id);
227
-
228
- // Event history (30-day retention)
229
- const { events } = await client.priceAlerts.events({ event_type: "dip", limit: 50 });
230
- ```
231
-
232
- Alert lifecycle: `watching` -> `dipped` -> `recovered` (terminal). One-shot per alert. Baseline MC captured at creation time. 30-day auto-expiry. Thresholds immutable delete and recreate to change.
233
-
234
- WebSocket: subscribe to channel `price_alert:events` — user-scoped. Webhook: per-alert HMAC-SHA256 signed (same scheme as coordination alerts).
235
-
236
- ---
237
-
238
- #### `client.sniper.*` — Deshred Sniper Alerts *(new in 2.9)*
239
-
240
- **The fastest path to a new pump.fun launch.** Deploys are reconstructed from shred-level (**deshred**) data and surface in the feed **~500ms before the chain confirms them** — a measured head start versus any confirmed-stream feed. **PRO** sees elite + good deployers; **ULTRA** sees every tier and can keep a custom deployer watchlist.
241
-
242
- ```ts
243
- // Newest-first deshred deploy feed (PRO: elite/good · ULTRA: all tiers)
244
- const { deploys } = await client.sniper.recent({ limit: 50, min_bond_rate: 0.5 });
245
-
246
- // Audit one deployer's recent launches (ULTRA)
247
- await client.sniper.byDeployer("7dEx...4pQ8");
248
-
249
- // Custom watchlist — get deploys from only the deployers you track, any tier (ULTRA, max 50)
250
- await client.sniper.addToWatchlist({ wallets: ["7dEx...4pQ8", "9aBc...2zZ1"], label: "alpha devs" });
251
- await client.sniper.watchlist();
252
- const { deploys: tracked } = await client.sniper.recent({ watchlist: true });
253
- await client.sniper.removeFromWatchlist("7dEx...4pQ8");
254
- ```
255
-
256
- Detection is pre-execution, so payloads carry no MC/logs/balances — `confirmed_on_chain` is `"deshred"`. For **live** push (not polling), use the `sniper:deploy` webhook event, the `sniper:deploys` WebSocket channel, or `/alert sniper` in the Telegram bot. ~1–3% of detected deploys may abandon before settlement.
257
-
258
- ---
259
-
260
- #### `client.kol.scoutLeaderboard(params?)` *(new in 2.8)*
261
-
262
- Scout leaderboard: top KOLs ranked by scout score, first-touch frequency, and swarm attraction rate. **ULTRA only.**
263
-
264
- ```ts
265
- const data = await client.kol.scoutLeaderboard({ limit: 20, scout_tier: "S", sort: "scout_score" });
266
- ```
267
-
268
- ---
269
-
270
- #### `client.kol.coordinationHistory(params?)` *(new in 2.8)*
271
-
272
- Historical coordination alert fires — past events with token, score, KOL count. **ULTRA only.**
273
-
274
- ```ts
275
- const data = await client.kol.coordinationHistory({ limit: 50, min_score: 70 });
276
- ```
277
-
278
- ---
279
-
280
- #### `client.token.kolConsensus(mint)` *(new in 2.8)*
281
-
282
- KOL consensus on a token: how many bought/sold, exit rate, net flow, median entry MC. **ULTRA** gets individual wallet arrays.
283
-
284
- ```ts
285
- const consensus = await client.token.kolConsensus("4sVahM4U8js62mQV58ABSkNRhf6Ztc7Xs2LXUznNpump");
286
- ```
287
-
288
- ---
289
-
290
- #### `client.token.peakHistory(mint)` *(new in 2.8)*
291
-
292
- Peak MC history: ATH, decline from peak, MC at bond and at 1h/6h/24h/7d after bond.
293
-
294
- ```ts
295
- const peak = await client.token.peakHistory("4sVahM4U8js62mQV58ABSkNRhf6Ztc7Xs2LXUznNpump");
296
- ```
297
-
298
- ---
299
-
300
- #### `client.kol.firstTouches(params?)` *(new in 2.2)*
301
-
302
- Recent first-KOL-touch events on tokens — every time a tracked KOL was the first to buy a given mint. Filterable by **scout tier** (S/A/B/C from the per-KOL `mv_kol_scout_score` view), KOL winrate, token age, mint suffix, etc.
303
-
304
- **Backtested signal:** top scouts attract ≥3 follow-on KOLs within 4h ~50% of the time vs ~14% baseline (38d / 491k buys / 72,549 events). The full leaderboard is at [madeonsol.com/kol/scouts](https://madeonsol.com/kol/scouts).
305
-
306
- ```ts
307
- // S-tier scouts on tokens younger than 1h
308
- const { events } = await client.kol.firstTouches({
309
- preset: "scout",
310
- min_scout_tier: "S",
311
- limit: 20,
312
- });
313
-
314
- for (const e of events) {
315
- console.log(e.first_kol.name, "scouted", e.token_symbol, `(scout_score=${e.first_kol.scout_score}%)`);
316
- }
317
- ```
318
-
319
- Filter knobs: `since`, `before`, `limit`, `kol`, `min_kol_winrate_7d`, `min_scout_tier`, `min_n_touches`, `strategy`, `token_age_max_min`, `min_first_buy_sol`, `mint_suffix`, `preset` (`"scout"` or `"fresh_launch"`), `include` (e.g. `"followers_4h"`).
320
-
321
- > **Don't poll push.** Median lead time before the second KOL is **12 seconds**, so REST polling will lose the swarm. Subscribe to the `kol:first_touches` WebSocket channel (PRO+) or, on Ultra, create an HMAC-signed webhook subscription via `client.firstTouchSubscriptions.create({...})`.
322
-
323
- Returns: `FirstTouchesResponse`
324
-
325
- ---
326
-
327
- #### `client.firstTouchSubscriptions.*` *(Ultra)*
328
-
329
- Create push-delivery rules for first-touch events. Up to 10 active subscriptions per Ultra user.
330
-
331
- ```ts
332
- const { subscription, webhook_secret } = await client.firstTouchSubscriptions.create({
333
- name: "S-tier scouts on pump tokens",
334
- filters: { min_scout_tier: "S", mint_suffix: "pump" },
335
- delivery_mode: "webhook",
336
- webhook_url: "https://my.bot/hooks/scout",
337
- });
338
- // store webhook_secret shown once
339
-
340
- await client.firstTouchSubscriptions.list();
341
- await client.firstTouchSubscriptions.update(subscription.id, { is_active: false });
342
- await client.firstTouchSubscriptions.delete(subscription.id);
343
- ```
344
-
345
- Same HMAC scheme as coordination alerts. WebSocket channel: `kol:first_touches`.
346
-
347
- ---
348
-
349
- #### `client.kol.token(mint)`
350
-
351
- KOL buy/sell activity for a specific token mint.
352
-
353
- ```ts
354
- const activity = await client.kol.token("EPjFW...");
355
- ```
356
-
357
- Returns: `KolTokenActivity`
358
-
359
- ---
360
-
361
- #### `client.kol.pnl(wallet, params?)`
362
-
363
- Deep per-wallet PnL breakdown with equity curve, risk metrics, and position history.
364
-
365
- ```ts
366
- const pnl = await client.kol.pnl("7xKX...", {
367
- period: "30d", // "7d" | "30d" | "90d" | "180d", default "30d"
368
- });
369
- // All tiers: summary + equity curve + closed positions
370
- // ULTRA: + open positions (tokens bought but not yet sold)
371
- ```
372
-
373
- Returns: `KolPnlResponse`
374
-
375
- ---
376
-
377
- #### `client.kol.trendingTokens(params?)`
378
-
379
- Tokens ranked by KOL buy volume across multiple time windows.
380
-
381
- ```ts
382
- const { tokens } = await client.kol.trendingTokens({
383
- period: "1h", // "5m" | "15m" | "30m" | "1h" | "4h" | "8h" | "12h", default "1h"
384
- min_kols: 2, // minimum distinct KOL buyers
385
- limit: 20, // 1–50, default 20
386
- });
387
- // Available on all tiers; ULTRA unlocks full KOL wallet addresses per token
388
- ```
389
-
390
- Returns: `KolTrendingTokensResponse`
391
-
392
- ---
393
-
394
- ### Alpha Wallet Intelligence — `client.alpha`
395
-
396
- #### `client.alpha.leaderboard(params?)`
397
-
398
- Leaderboard of 47,000+ scored early-buyer wallets ranked by win rate, PnL, or ROI.
399
-
400
- ```ts
401
- const { wallets } = await client.alpha.leaderboard({
402
- period: "30d", // "7d" | "30d" | "90d", default "30d"
403
- sort: "win_rate", // "win_rate" | "pnl" | "roi"
404
- min_tokens: 5,
405
- exclude_bots: true,
406
- });
407
- // Up to 100 results on Free/Pro; ULTRA unlocks 500 + bot signals
408
- ```
409
-
410
- Returns: `AlphaLeaderboardResponse`
411
-
412
- ---
413
-
414
- #### `client.alpha.wallet(wallet)`
415
-
416
- Full profile for an alpha wallet including per-token history and bot signals. ULTRA only.
417
-
418
- ```ts
419
- const profile = await client.alpha.wallet("7xKX...");
420
- ```
421
-
422
- Returns: `AlphaWalletResponse`
423
-
424
- ---
425
-
426
- #### `client.alpha.linked(wallet)`
427
-
428
- Linked-wallet clustering — wallets that co-bought with this address within 2 seconds. ULTRA only.
429
-
430
- ```ts
431
- const { linked } = await client.alpha.linked("7xKX...");
432
- ```
433
-
434
- Returns: `AlphaLinkedResponse`
435
-
436
- ---
437
-
438
- #### `client.alpha.capTable(mint)`
439
-
440
- First buyers for a token enriched with historical win rates, PnL, and KOL identity. PRO/ULTRA.
441
-
442
- ```ts
443
- const { buyers } = await client.alpha.capTable("EPjFW...");
444
- ```
445
-
446
- Returns: `AlphaCapTableResponse`
447
-
448
- ---
449
-
450
- #### `client.alpha.buyerQuality(mint)`
451
-
452
- 0–100 cohort quality score based on the profile of a token's first buyers. All tiers. 5-minute cache.
453
-
454
- ```ts
455
- const { score } = await client.alpha.buyerQuality("EPjFW...");
456
- ```
457
-
458
- Returns: `AlphaBuyerQualityResponse`
459
-
460
- ---
461
-
462
- ### Wallet Tracker `client.walletTracker`
463
-
464
- #### `client.walletTracker.watchlist()`
465
-
466
- List your tracked wallets and remaining capacity.
467
-
468
- ```ts
469
- const { wallets, capacity } = await client.walletTracker.watchlist();
470
- // capacity: { used, limit } — Free: 10, Pro: 50, Ultra: 100
471
- ```
472
-
473
- Returns: `WatchlistResponse`
474
-
475
- ---
476
-
477
- #### `client.walletTracker.addToWatchlist(wallet, params?)`
478
-
479
- Add a wallet to your watchlist. Tracking begins immediately.
480
-
481
- ```ts
482
- await client.walletTracker.addToWatchlist("7xKX...", { label: "whale" });
483
- ```
484
-
485
- ---
486
-
487
- #### `client.walletTracker.removeFromWatchlist(wallet)`
488
-
489
- Remove a wallet from your watchlist.
490
-
491
- ```ts
492
- await client.walletTracker.removeFromWatchlist("7xKX...");
493
- ```
494
-
495
- ---
496
-
497
- #### `client.walletTracker.updateLabel(wallet, label)`
498
-
499
- Update the label for a tracked wallet.
500
-
501
- ```ts
502
- await client.walletTracker.updateLabel("7xKX...", "smart money");
503
- ```
504
-
505
- ---
506
-
507
- #### `client.walletTracker.trades(params?)`
508
-
509
- Historical swap and transfer events for your watched wallets. 120-day retention.
510
-
511
- ```ts
512
- const { events } = await client.walletTracker.trades({
513
- wallet: "7xKX...", // filter by specific wallet
514
- action: "buy", // "buy" | "sell"
515
- event_type: "swap", // "swap" | "transfer"
516
- limit: 50,
517
- before: "2026-04-01T00:00:00Z", // ISO 8601 cursor
518
- });
519
- ```
520
-
521
- Returns: `WalletTrackerTradesResponse`
522
-
523
- ---
524
-
525
- #### `client.walletTracker.summary(params?)`
526
-
527
- Per-wallet stats across your watchlist: swap counts, SOL bought/sold, last event time.
528
-
529
- ```ts
530
- const { wallets } = await client.walletTracker.summary({
531
- period: "7d", // "24h" | "7d" | "30d", default "7d"
532
- wallet: "7xKX...", // optional: single wallet
533
- });
534
- ```
535
-
536
- Returns: `WalletTrackerSummaryResponse`
537
-
538
- ---
539
-
540
- ### Universal Wallet — `client.wallet` *(new in 2.7)*
541
-
542
- Per-wallet endpoints that work on **any** Solana wallet, not just curated KOLs. FIFO cost-basis PnL over the last 90 days. PRO+ on every method. Results are cached server-side in `wallet_analyses` with dynamic TTL (5min / 1h / 24h based on last activity); cache hits don't count against your daily quota.
543
-
544
- **Cost-basis honesty:** observable only inside the 90-day data window. Wallets that sold tokens bought before that window have the overflow silently discarded rather than fabricated. `notes.cost_basis_observable_from` makes the cutoff visible per call.
545
-
546
- #### `client.wallet.stats(address)`
547
-
548
- Aggregate stats over 90d plus cross-product flags (KOL / alpha / deployer). Includes enrichments: top traded tokens with realized PnL, trading style, deployer tier mix, recent trades. **v2.8** adds `derived` block: win rate, ROI, best/worst trade, biggest miss (token sold that later mooned), and AI-classified verdict.
549
-
550
- ```ts
551
- const { stats, flags, derived } = await client.wallet.stats("ASVz...ybJk");
552
- console.log(`${flags.kol_name ?? address}: ${stats?.total_trades} trades`);
553
- if (derived?.verdict) {
554
- console.log(`${derived.verdict.label}: ${derived.verdict.description}`);
555
- }
556
- if (derived?.biggest_miss) {
557
- console.log(`Biggest miss: ${derived.biggest_miss.token_symbol} — missed +${derived.biggest_miss.missed_sol.toFixed(1)} SOL`);
558
- }
559
- ```
560
-
561
- Returns: `WalletStatsResponse` (404 if the wallet has no trades and no flag-table presence).
562
-
563
- ---
564
-
565
- #### `client.wallet.pnl(address)`
566
-
567
- Full FIFO cost-basis PnL: realized + unrealized SOL, profit factor, max drawdown, avg + median hold minutes, daily UTC PnL curve, closed positions sorted by pnl desc (with ROI %, hold time, win/loss), and open positions hydrated with live current prices from the market-cap tracker.
568
-
569
- ```ts
570
- const pnl = await client.wallet.pnl("ASVz...ybJk");
571
- console.log(`Realized: ${pnl.summary.realized_sol} SOL · Unrealized: ${pnl.summary.unrealized_sol} SOL`);
572
- console.log(`Win rate: ${(pnl.summary.win_rate! * 100).toFixed(1)}% · PF: ${pnl.summary.profit_factor}`);
573
- for (const c of pnl.closed_positions.slice(0, 5)) {
574
- const sign = c.pnl_sol > 0 ? "+" : "";
575
- console.log(` ${c.token_mint.slice(0,8)}… ${sign}${c.pnl_sol} SOL (${c.roi_pct}% ROI, ${c.hold_minutes}m hold)`);
576
- }
577
- ```
578
-
579
- Returns: `WalletPnlResponse`. Cache hits include `cache_hit: true` + `computed_at`; misses include `ttl_seconds`.
580
-
581
- ---
582
-
583
- #### `client.wallet.positions(address)`
584
-
585
- Open positions only — lighter slice of `pnl()`. Shares the same cache, so calling this right after `pnl()` is an immediate hit.
586
-
587
- ```ts
588
- const { positions } = await client.wallet.positions("ASVz...ybJk");
589
- for (const p of positions) {
590
- const u = p.unrealized_sol;
591
- console.log(` ${p.token_mint.slice(0,8)}… cost ${p.cost_basis_sol} SOL unrealized ${u ?? "—"} SOL (${p.unrealized_pct ?? "—"}%)`);
592
- }
593
- ```
594
-
595
- Returns: `WalletPositionsResponse`. Mints without a current price return `unrealized_sol: null` rather than fabricated zero.
596
-
597
- ---
598
-
599
- #### `client.wallet.trades(address, params?)`
600
-
601
- Cursor-paginated raw trades. Default window is the last 90 days; override via `since` / `until` (Unix epoch seconds). Default limit 100, max 500.
602
-
603
- ```ts
604
- let cursor: string | undefined;
605
- while (true) {
606
- const page = await client.wallet.trades("ASVz...ybJk", { limit: 200, cursor, action: "buy" });
607
- for (const t of page.trades) processBuy(t);
608
- if (!page.has_more) break;
609
- cursor = page.next_cursor!;
610
- }
611
- ```
612
-
613
- Params:
614
- - `limit` 1-500, default 100
615
- - `cursor` — from `next_cursor` of previous response
616
- - `action` — `"buy"` or `"sell"`
617
- - `token_mint` — filter to one token
618
- - `since` / `until` — Unix epoch seconds (default last 90d)
619
-
620
- Returns: `WalletTradesResponse` with `trades[]` + `next_cursor` + `has_more` + `filters` echo.
621
-
622
- ---
623
-
624
- ### Deployer Hunter — `client.deployer`
625
-
626
- #### `client.deployer.stats()`
627
-
628
- Global statistics across all tracked deployer wallets.
629
-
630
- ```ts
631
- const stats = await client.deployer.stats();
632
- console.log(stats.overall_bonding_rate); // e.g. 0.043
633
- ```
634
-
635
- Returns: `DeployerStats`
636
-
637
- ---
638
-
639
- #### `client.deployer.leaderboard(params?)`
640
-
641
- Deployers ranked by bonding rate or recent performance.
642
-
643
- ```ts
644
- const { deployers } = await client.deployer.leaderboard({
645
- tier: "elite", // "elite" | "good" | "moderate" | "rising" | "cold"
646
- sort: "bonding_rate", // "bonding_rate" | "recent_bond_rate" | "total_bonded" | "last_deploy_at"
647
- limit: 20, // 1–50, default 20
648
- offset: 0,
649
- });
650
- ```
651
-
652
- Returns: `DeployerLeaderboardResponse`
653
-
654
- ---
655
-
656
- #### `client.deployer.profile(wallet)`
657
-
658
- Full profile for a single deployer wallet.
659
-
660
- ```ts
661
- const deployer = await client.deployer.profile("3xAB...");
662
- console.log(deployer.tier, deployer.bonding_rate);
663
- ```
664
-
665
- Returns: `DeployerProfile`
666
-
667
- ---
668
-
669
- #### `client.deployer.tokens(wallet, params?)`
670
-
671
- All tokens deployed by a specific wallet.
672
-
673
- ```ts
674
- const { tokens } = await client.deployer.tokens("3xAB...", {
675
- limit: 20,
676
- offset: 0,
677
- });
678
- ```
679
-
680
- Returns: `DeployerTokensResponse`
681
-
682
- ---
683
-
684
- #### `client.deployer.alerts(params?)`
685
-
686
- Real-time deploy alerts — fired when a tracked deployer launches a new token.
687
-
688
- ```ts
689
- const { alerts } = await client.deployer.alerts({
690
- since: "2025-01-01T00:00:00Z", // ISO 8601
691
- limit: 20,
692
- tier: "elite", // "elite" | "good" | "moderate" | "rising" | "cold"
693
- offset: 0,
694
- });
695
- ```
696
-
697
- Returns: `DeployerAlertsResponse`
698
-
699
- ---
700
-
701
- #### `client.deployer.alertStats(params?)`
702
-
703
- Aggregated alert statistics by tier.
704
-
705
- ```ts
706
- const stats = await client.deployer.alertStats({ period: "7d" });
707
- // "7d" | "30d" | "all", default "all"
708
- ```
709
-
710
- Returns: `DeployerAlertStats`
711
-
712
- ---
713
-
714
- #### `client.deployer.bestTokens(params?)`
715
-
716
- Top-performing tokens from tracked deployers by peak market cap.
717
-
718
- ```ts
719
- const { tokens } = await client.deployer.bestTokens({
720
- period: "7d", // "7d" | "30d" | "all", default "7d"
721
- limit: 5, // 1–20, default 5
722
- });
723
- ```
724
-
725
- Returns: `BestTokensResponse`
726
-
727
- ---
728
-
729
- #### `client.deployer.recentBonds(params?)`
730
-
731
- Most recently bonded tokens from tracked deployers.
732
-
733
- ```ts
734
- const { bonds } = await client.deployer.recentBonds({ limit: 20 });
735
- ```
736
-
737
- Returns: `RecentBondsResponse`
738
-
739
- ---
740
-
741
- ### Token Intelligence — `client.token`
742
-
743
- Per-mint snapshots (price, MC, volume, deployer rep, KOL activity, blacklist flags, **v1.7 velocity windows + MEV-share**) and a filtered directory.
744
-
745
- #### `client.token.get(mint)`
746
-
747
- Comprehensive per-mint snapshot in one call. **ULTRA** also returns individual KOL wallet addresses in `top_buyers[]`.
748
-
749
- ```ts
750
- const { token } = await client.token.get("So11111111111111111111111111111111111111112");
751
- console.log(token.price_usd, token.market_cap);
752
- console.log(token.mc_change_pct?.["1h"]); // v1.7
753
- console.log(token.mev_volume_pct?.["1h"]); // v1.7
754
- ```
755
-
756
- Invalid mints return a 400 with `code: "invalid_mint"`, `reason`, `received_length`, `example`, and `docs` URL — no trial and error.
757
-
758
- Returns: `TokenResponse` (with `mc_change_pct` / `volume_usd` / `mev_volume_pct` (each keyed by 5m/15m/1h/2h/4h) + `history_age_seconds` as of 1.7)
759
-
760
- #### `client.token.batch(mints)`
761
-
762
- Batch lookup up to 50 mints in one round-trip. ~10–20× cheaper than N sequential calls.
763
-
764
- ```ts
765
- const { tokens } = await client.token.batch(["mint1", "mint2", "mint3"]);
766
- ```
767
-
768
- Returns: `TokenBatchResponse`
769
-
770
- #### `client.token.list(params?)` *(new in 2.6 — PRO+)*
771
-
772
- Filtered, sortable token directory. Default `min_liq=2000` trims the long tail of phantom-MC tokens from low-liquidity pools; pass `min_liq=0` to opt out.
773
-
774
- **Server-side filters** (cheap, indexed): `min_mc`, `max_mc`, `min_liq`, `active_h`, `primary_dex` (`pumpfun`/`pumpswap`/`raydium`/`meteora`/`orca`/`raydium_clmm`), `authority_revoked`, `exclude_token2022`, `min_lp_burnt_pct`.
775
-
776
- **Computed post-filters** (over-fetches 3×): `min_volume_1h_usd`, `max_mev_share_pct`, `mc_change_1h_min_pct`, `mc_change_1h_max_pct`. When any of these are set, `pagination.post_filtered` is `true` and page size may be smaller than `limit`.
777
-
778
- ```ts
779
- // Momentum scanner: liquid mints up >20% in 1h, low bot share
780
- const { tokens, pagination } = await client.token.list({
781
- min_liq: 10000,
782
- min_volume_1h_usd: 5000,
783
- max_mev_share_pct: 60,
784
- mc_change_1h_min_pct: 20,
785
- sort: "mc_desc",
786
- limit: 50,
787
- });
788
-
789
- // Cleanest filter for a sane "top by MC" feed
790
- const { tokens } = await client.token.list({
791
- min_liq: 25000,
792
- active_h: 1,
793
- authority_revoked: true,
794
- sort: "mc_desc",
795
- });
796
- ```
797
-
798
- Returns: `TokenListResponse` (with `tokens[]`, `pagination`, `filters` echo)
799
-
800
- #### `client.token.batchBuyerQuality(mints)`
801
-
802
- Batch buyer-quality scoring for up to 50 mints. Shares the same 5-minute LRU cache as `client.alpha.buyerQuality(mint)`.
803
-
804
- Returns: `AlphaBuyerQualityBatchResponse`
805
-
806
- ---
807
-
808
- ### Account `client.me()` *(new in 2.6)*
809
-
810
- Inspect your tier, quota state, and feature usage in one call. Reads from the same in-memory counters that drive rate-limit enforcement, so `quota.daily.remaining` is authoritative — no header parsing needed. Works on every tier (BASIC/PRO/ULTRA).
811
-
812
- ```ts
813
- const me = await client.me();
814
- console.log(`${me.tier}: ${me.quota.daily.remaining}/${me.quota.daily.limit} req left today`);
815
- console.log(`Webhooks: ${me.features.webhooks.used}/${me.features.webhooks.limit}`);
816
- console.log(`Copy-trade wallets: ${me.features.copytrade_wallets.used}/${me.features.copytrade_wallets.limit}`);
817
-
818
- if (me.quota.daily.remaining < 100) {
819
- // self-throttle
820
- }
821
- ```
822
-
823
- Returns: `MeResponse`
824
-
825
- ---
826
-
827
- ### Tool Directory — `client.tools`
828
-
829
- #### `client.tools.search(params?)`
830
-
831
- Search 950+ Solana tools indexed on MadeOnSol.
832
-
833
- ```ts
834
- const { tools, count } = await client.tools.search({
835
- q: "trading bot", // full-text search
836
- category: "trading", // category slug filter
837
- limit: 20, // 1–50, default 20
838
- });
839
- ```
840
-
841
- Returns: `ToolsSearchResponse`
842
-
843
- ---
844
-
845
- ### WebSocket Streaming — `client.stream`
846
-
847
- #### `client.stream.getToken()`
848
-
849
- Generate a 24-hour WebSocket streaming token. Pro/Ultra subscribers get `ws_url` for KOL/deployer event streaming. Ultra subscribers also get `dex_ws_url` for the all-DEX trade stream.
850
-
851
- ```ts
852
- const token = await client.stream.getToken();
853
- console.log(token.ws_url); // wss://madeonsol.com/ws/v1/stream
854
- console.log(token.dex_ws_url); // wss://madeonsol.com/ws/v1/dex-stream (Ultra only)
855
- ```
856
-
857
- Returns: `StreamToken` — `{ token, expires_at, ws_url, dex_ws_url?, usage }`
858
-
859
- ---
860
-
861
- ### DEX Firehose (Ultra) — `wss://madeonsol.com/ws/v1/dex-stream`
862
-
863
- Real-time trades across **9+ Solana DEX programs** (Pump.fun, PumpAMM, PumpSwap, Raydium AMM/CPMM/CAMM, Jupiter v6, Orca Whirlpool, Meteora DBC/DAMM, LaunchLab/bonk.fun) on a single normalized WebSocket. Server-side filters drop everything you don't care about before it hits your socket.
864
-
865
- **Limits:** ULTRA = 2 connections, **10 named subscriptions per connection**, up to **500 trades replay** from in-memory ring buffer. Inbound rate limit: 5 messages/sec (excess emits one error per second).
866
-
867
- #### Quick start
868
-
869
- ```ts
870
- import { WebSocket } from "ws"; // or native WebSocket in browsers/Bun
871
-
872
- const { token, dex_ws_url } = await client.stream.getToken();
873
- const ws = new WebSocket(`${dex_ws_url}?token=${token}`); // token MUST be appended as query param
874
-
875
- ws.on("open", () => {
876
- // Multi-subscription: each sub has its own sub_id and filters
877
- ws.send(JSON.stringify({
878
- type: "subscribe",
879
- sub_id: "fresh-pumpfun",
880
- replay: 50, // backfill up to 500 from ring buffer
881
- filters: {
882
- dex: "pumpfun",
883
- token_age_max_seconds: 300, // first seen in last 5 min
884
- min_sol: 0.5,
885
- action: "buy",
886
- },
887
- }));
888
- });
889
-
890
- ws.on("message", (raw) => {
891
- const msg = JSON.parse(raw.toString());
892
- if (msg.channel === "dex:trades") {
893
- // { sub_id, data: { wallet, mint, action, sol_amount, token_amount, dex, ... }, replay, ts }
894
- console.log(msg.sub_id, msg.data.dex, msg.data.action, msg.data.sol_amount);
895
- }
896
- });
897
- ```
898
-
899
- #### Protocol — client → server
900
-
901
- | `type` | Required fields | Notes |
902
- |---|---|---|
903
- | `subscribe` | `sub_id`, `filters` | Optional `replay: 1–500` |
904
- | `update` | `sub_id`, `filters` | Replaces filters in place — no disconnect needed |
905
- | `unsubscribe` | `sub_id` | Or omit `sub_id` to clear all subs |
906
- | `list` | | Server replies with `{ type: "list", subs: [...] }` |
907
- | `ping` | — | Heartbeat — server replies `{ type: "pong" }` |
908
-
909
- #### Server client message shapes
910
-
911
- ```ts
912
- { type: "connected", tier: "ULTRA", capabilities: { max_subs: 10, max_replay: 500, dex_names: [...], deployer_tiers: [...] } } // on connect
913
- { type: "subscribed", sub_id: "fresh-pumpfun", filters: { ... } }
914
- { type: "replay_done", sub_id: "fresh-pumpfun", count: 50 } // after backfill
915
- { type: "updated", sub_id: "fresh-pumpfun", filters: { ... } }
916
- { type: "unsubscribed", sub_id: "fresh-pumpfun" }
917
- { type: "list", subs: [{ sub_id, filters }] } // reply to { type: "list" }
918
- { type: "heartbeat", ts: 1712160000000 } // every 30s
919
- { type: "error", sub_id?, message: "..." }
920
- { channel: "dex:trades", sub_id, data: { ... }, replay: false, ts: 1712160000000 }
921
- ```
922
-
923
- #### Filter dimensions
924
-
925
- At least **one targeting filter** is required (otherwise the firehose would dump every trade). Filters compose with AND semantics.
926
-
927
- | Filter | Type | Notes |
928
- |---|---|---|
929
- | `token_mint` / `token_mints` | string / string[] (≤50) | Targeting |
930
- | `wallet` / `wallets` | string / string[] (≤50) | Targeting |
931
- | `dex` | string \| string[] | `pumpfun`, `pumpamm`, `pumpswap`, `raydium`, `jupiter`, `orca`, `meteora`, `launchlab` |
932
- | `program` | string | Raw program ID |
933
- | `deployer_tier` | string \| string[] | `elite`, `good`, `moderate`, `rising`, `cold`, `unranked` (uses Deployer Hunter scoring) |
934
- | `token_age_max_seconds` | number | Only trades on mints first seen within window (uses persisted first-seen table) |
935
- | `market_cap_min_sol` / `market_cap_max_sol` | number | Bounded by current market cap (last trade price × cached supply, 1h TTL) |
936
- | `min_sol` / `max_sol` | number | Trade size bounds |
937
- | `action` | `"buy"` \| `"sell"` | Direction |
938
-
939
- **Async filters** (`token_age`, `deployer_tier`, `market_cap`) evaluate against live state and are **skipped on replay**. The first trade for an unseen mint may be skipped while the supply fetch is in flight.
940
-
941
- #### Multi-sub example
942
-
943
- ```ts
944
- ws.send(JSON.stringify({ type: "subscribe", sub_id: "snipers", filters: { token_age_max_seconds: 60 } }));
945
- ws.send(JSON.stringify({ type: "subscribe", sub_id: "whales", filters: { min_sol: 50 } }));
946
- ws.send(JSON.stringify({ type: "subscribe", sub_id: "kol-mints", filters: { token_mints: ["EPjF...", "So11..."] } }));
947
-
948
- // Tighten the snipers filter without disconnecting
949
- ws.send(JSON.stringify({ type: "update", sub_id: "snipers", filters: { token_age_max_seconds: 30, min_sol: 0.3 } }));
950
-
951
- // Drop whales when you're done
952
- ws.send(JSON.stringify({ type: "unsubscribe", sub_id: "whales" }));
953
- ```
954
-
955
- Each `dex:trades` message echoes the `sub_id` that matched, so you can route them locally without reapplying filter logic client-side.
956
-
957
- ---
958
-
959
- ### Webhooks — `client.webhooks`
960
-
961
- Manage push notification webhooks for real-time events (Pro: 3, Ultra: 10).
962
-
963
- ```ts
964
- // Create a webhook
965
- const webhook = await client.webhooks.create({
966
- url: "https://example.com/hook",
967
- events: ["kol:trade", "deployer:alert"],
968
- filters: { min_sol: 1 },
969
- });
970
-
971
- // List, update, delete
972
- const { webhooks } = await client.webhooks.list();
973
- await client.webhooks.update(webhook.id, { status: "paused" });
974
- await client.webhooks.delete(webhook.id);
975
- await client.webhooks.test(webhook.id);
976
- ```
977
-
978
- ---
979
-
980
- ## Error handling
981
-
982
- All methods throw `MadeOnSolError` on non-2xx responses.
983
-
984
- ```ts
985
- import { MadeOnSol, MadeOnSolError } from "madeonsol";
986
-
987
- try {
988
- const profile = await client.kol.wallet("invalid-wallet");
989
- } catch (err) {
990
- if (err instanceof MadeOnSolError) {
991
- console.error(err.message); // human-readable message
992
- console.error(err.status); // HTTP status code, e.g. 404
993
- console.error(err.body); // raw response body
994
- }
995
- }
996
- ```
997
-
998
- ---
999
-
1000
- ## Exported types
1001
-
1002
- All types are exported from the main entry point:
1003
-
1004
- ```ts
1005
- import type {
1006
- // Errors
1007
- MadeOnSolError,
1008
-
1009
- // KOL
1010
- KolTrade,
1011
- KolFeedParams,
1012
- KolFeedResponse,
1013
- KolLeaderboardParams,
1014
- KolLeaderboardResponse,
1015
- KolLeaderboardEntry,
1016
- KolWalletParams,
1017
- KolWalletProfile,
1018
- KolCoordinationParams,
1019
- KolCoordinationResponse,
1020
- CoordinatedToken,
1021
- KolTokenActivity,
1022
- KolPnlByToken,
1023
-
1024
- // Deployer
1025
- DeployerStats,
1026
- DeployerLeaderboardParams,
1027
- DeployerLeaderboardResponse,
1028
- DeployerLeaderboardEntry,
1029
- DeployerProfile,
1030
- DeployerToken,
1031
- DeployerTokensParams,
1032
- DeployerTokensResponse,
1033
- DeployerAlertsParams,
1034
- DeployerAlertsResponse,
1035
- DeployerAlert,
1036
- DeployerAlertStatsParams,
1037
- DeployerAlertStats,
1038
- BestTokensParams,
1039
- BestTokensResponse,
1040
- BestToken,
1041
- RecentBondsParams,
1042
- RecentBondsResponse,
1043
- RecentBond,
1044
-
1045
- // Tools
1046
- ToolsSearchParams,
1047
- ToolsSearchResponse,
1048
- Tool,
1049
-
1050
- // KOL PnL & Trending
1051
- KolPnlResponse,
1052
- KolTrendingTokensResponse,
1053
- TrendingToken,
1054
-
1055
- // Alpha Wallet Intelligence
1056
- AlphaWalletEntry,
1057
- AlphaLeaderboardResponse,
1058
- AlphaWalletResponse,
1059
- AlphaLinkedResponse,
1060
- AlphaCapTableResponse,
1061
- AlphaBuyerQualityResponse,
1062
-
1063
- // Wallet Tracker
1064
- WalletEntry,
1065
- WatchlistResponse,
1066
- WalletTrackerEvent,
1067
- WalletTrackerTradesResponse,
1068
- WalletTrackerSummaryResponse,
1069
-
1070
- // Streaming
1071
- StreamToken,
1072
-
1073
- // Webhooks
1074
- Webhook,
1075
- WebhookCreateParams,
1076
- WebhookUpdateParams,
1077
- WebhookListResponse,
1078
-
1079
- // Enums / unions
1080
- KolAction,
1081
- LeaderboardPeriod,
1082
- CoordinationPeriod,
1083
- DeployerTier,
1084
- DeployerSortField,
1085
- AlertPeriod,
1086
- BestTokensPeriod,
1087
- } from "madeonsol";
1088
- ```
1089
-
1090
- ---
1091
-
1092
- ## Related
1093
-
1094
- - [MadeOnSol website](https://madeonsol.com) — Browse 950+ Solana tools
1095
- - [API documentation](https://madeonsol.com/api-docs) — Interactive endpoint reference
1096
- - [MadeOnSol on GitHub](https://github.com/LamboPoewert/madeonsol) — Main project repository
1097
-
1098
- ## Also Available
1099
-
1100
- | Platform | Package |
1101
- |---|---|
1102
- | Rust | [`madeonsol`](https://crates.io/crates/madeonsol) on crates.io |
1103
- | Python (LangChain, CrewAI) | [`madeonsol-x402`](https://pypi.org/project/madeonsol-x402/) on PyPI |
1104
- | MCP Server (Claude, Cursor) | [`mcp-server-madeonsol`](https://www.npmjs.com/package/mcp-server-madeonsol) · [Smithery](https://smithery.ai/servers/madeonsol/solana-kol-intelligence) · [Glama](https://glama.ai/mcp/servers/LamboPoewert/mcp-server-madeonsol) |
1105
- | ElizaOS | [`@madeonsol/plugin-madeonsol`](https://www.npmjs.com/package/@madeonsol/plugin-madeonsol) |
1106
- | Solana Agent Kit | [`solana-agent-kit-plugin-madeonsol`](https://www.npmjs.com/package/solana-agent-kit-plugin-madeonsol) |
1107
-
1108
- ---
1109
-
1110
- ## License
1111
-
1112
- MIT © [MadeOnSol](https://madeonsol.com)
1
+ # madeonsol
2
+
3
+ [![npm version](https://img.shields.io/npm/v/madeonsol?style=flat-square)](https://www.npmjs.com/package/madeonsol)
4
+ [![npm downloads](https://img.shields.io/npm/dm/madeonsol?style=flat-square)](https://www.npmjs.com/package/madeonsol)
5
+ [![GitHub stars](https://img.shields.io/github/stars/LamboPoewert/madeonsol-sdk?style=flat-square&logo=github)](https://github.com/LamboPoewert/madeonsol-sdk)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4+-blue?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen?style=flat-square)](package.json)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
9
+
10
+ > ⭐ **[Star on GitHub](https://github.com/LamboPoewert/madeonsol-sdk)** if you find this useful · 📂 **[Examples](./examples/)** · 📚 **[API docs](https://madeonsol.com/api-docs)**
11
+
12
+ Official TypeScript/JavaScript SDK for the **[MadeOnSol](https://madeonsol.com) Solana API** — zero dependencies, fully typed, works in Node.js ≥ 18 and edge runtimes.
13
+ > Real-time Solana trading intelligence: track 1,069 KOL wallets with <3s latency, score 23,000+ Pump.fun deployers, surface deshred deploy signals **~500ms before on-chain confirmation**, detect multi-KOL coordination, push every pump.fun graduation the second it bonds, and stream every DEX trade across 9+ programs. Free tier: 200 requests/day at [madeonsol.com/pricing](https://madeonsol.com/pricing) — no credit card required.
14
+
15
+ > **New in 2.11** — **Graduation events + dump-cluster detection.** Subscribe `token:graduations` for every pump.fun bond in real time — tracked deployer or not — with typed `GraduationEvent` payloads (mint, deployer tier, time-to-bond, MC at bond). Buyer-quality `breakdown` adds `dump_cluster_count` (out-of-sample validated: 3+ such wallets in the first-20 94% dump vs 61% base) and `recycled_early_buyer_count` (high count with zero cluster leans runner). DEX firehose: replay buffer deepened to ~5 minutes; mint-scoped subs now receive in-band `dex:graduations` frames the bond lands on the same connection as your position's trade flow.
16
+
17
+ > **New in 2.9** — **Deshred Sniper Alerts.** `client.sniper.recent()` surfaces new pump.fun deploys reconstructed from shred-level data ~500ms before the chain confirms thema measured head start over any confirmed-stream feed. PRO sees elite/good deployers; ULTRA sees every tier and maintains a custom deployer watchlist (`client.sniper.addToWatchlist()`). Use the `sniper:deploys` WebSocket channel or `sniper:deploy` webhook for live push instead of polling.
18
+ >
19
+ > **New in 2.8** — **Price alerts, scout leaderboard, wallet derived stats.** `client.priceAlerts.*` CRUD for token MC dip/recovery alerts delivered via webhook or WebSocket (PRO=5, ULTRA=25). `client.kol.scoutLeaderboard()` — top scouts ranked by first-touch follow-on rate. `client.kol.coordinationHistory()` and `client.token.peakHistory()` expose the historical record. `client.wallet.stats()` now returns a `derived` block: `win_rate`, `roi`, `verdict`, and `biggest_miss`.
20
+ >
21
+ > **New in 2.7** — **Universal Wallet API.** `client.wallet.stats()`, `client.wallet.pnl()`, `client.wallet.positions()`, `client.wallet.trades()` — FIFO cost-basis PnL, open positions hydrated with live prices, and cursor-paginated raw trades for **any** Solana wallet (not just curated KOLs). PRO+. Server-side cache (5min/1h/24h based on activity) — cache hits don't count against your quota.
22
+ >
23
+ > **New in 2.6.1** *(2026-05-13)* — **Velocity types fixed.** Velocity fields are now correctly typed as `mc_change_pct`, `volume_usd`, `mev_volume_pct` — each its own object keyed by `5m`/`15m`/`1h`/`2h`/`4h` — to match the actual API response. The 2.6.0 shape (`velocity[window].mc_change_pct`) was wrong; clients reading it would get `undefined`. Patch is type-only — no runtime breaking changes.
24
+ >
25
+ > **New in 2.6.0** *(2026-05-12)* — **Token directory + self-inspection.** `client.token.list({ min_liq, min_volume_1h_usd, max_mev_share_pct, mc_change_1h_min_pct, sort, ... })` — browse and filter every active mint, with default `min_liq=2000` to skip phantom-MC dust. `client.me()` — read your tier, daily/burst quota state, and per-feature usage in one call (no header parsing). Velocity / MEV-share fields added to every `TokenResponseBody`: `mc_change_pct`, `volume_usd`, `mev_volume_pct` (each keyed by `5m`/`15m`/`1h`/`2h`/`4h`) plus `history_age_seconds` on the parent. `/token/{mint}` 400s now ship `code`, `reason`, `received_length`, `example`, and `docs` URL — stop guessing why a mint failed. Deprecated `avg_entry_mc_usd` / `entry_mc_samples` removed from leaderboard types. All other 2.5.x APIs unchanged.
26
+
27
+ > **Build Solana trading bots, analytics dashboards, KOL copy-trading tools, deshred sniper bots, and ecosystem browsers.**
28
+
29
+ ## Quick start (10 seconds)
30
+
31
+ ```bash
32
+ npm install madeonsol
33
+ ```
34
+
35
+ ```ts
36
+ import { MadeOnSol } from "madeonsol";
37
+ const client = new MadeOnSol({ apiKey: "msk_..." }); // free tier at madeonsol.com/pricing
38
+ const { trades } = await client.kol.feed({ limit: 5, action: "buy" });
39
+ ```
40
+
41
+ | Feature | Description |
42
+ |---|---|
43
+ | **KOL Tracker** | Real-time trade feed, PnL leaderboard with five time windows (today, 7d, 30d, 90d, 180d), coordination detection, per-wallet profiles, and deep PnL analytics for 1,069 tracked KOL wallets. **180 days of trade history** retained. |
44
+ | **Deshred Sniper** | Deploy feed reconstructed from shred-level data — surfaces new pump.fun launches **~500ms before on-chain confirmation**. PRO: elite/good deployers. ULTRA: all tiers + custom watchlist. Use WebSocket/webhook for live push. |
45
+ | **Alpha Wallet Intel** | Leaderboard of 1M+ scored early-buyer wallets, full wallet profiles, linked-wallet clustering, token cap-table enrichment, and 0–100 buyer quality scores with dump-cluster wallet detection. |
46
+ | **Universal Wallet** | FIFO cost-basis PnL, open positions (hydrated with live prices), and raw trade history for **any** Solana wallet — not just curated KOLs. 90-day window, server-side cache. PRO+. |
47
+ | **Price Alerts** | Token MC dip/recovery alerts delivered via WebSocket or HMAC-signed webhook. PRO: 5 rules, ULTRA: 25. |
48
+ | **Wallet Tracker** | Monitor any Solana wallet for swaps and transfers. Track up to 10/50/100 wallets (Free/Pro/Ultra). Full wallets, counterparties, and tx_signatures on every tier. 120-day event retention. WS events on ULTRA. |
49
+ | **Deployer Hunter** | 23,000+ pump.fun deployers scored by bonding rate — tier leaderboard, deploy alerts, deployer profiles, and best-tokens feed. |
50
+ | **DEX Trade Stream** | Real-time WebSocket stream of ALL Solana DEX trades across 9+ programs — filter by token, wallet, DEX, deployer tier, or trade size. ~5 min replay + in-band graduation frames on mint-scoped subs. ULTRA. |
51
+ | **Webhooks** | Push notifications for KOL trades, coordination signals, deployer alerts, and wallet tracker events (Pro/Ultra) |
52
+ | **Tool Directory** | Search 1,070+ Solana tools and dApps indexed on MadeOnSol |
53
+
54
+ **Links:** [Full docs](https://madeonsol.com/solana-api) · [Website](https://madeonsol.com) · [API docs](https://madeonsol.com/api-docs)
55
+
56
+ ## Authentication
57
+
58
+ Get a free API key at [madeonsol.com/pricing](https://madeonsol.com/pricing). Keys start with `msk_`.
59
+
60
+ ---
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ npm install madeonsol
66
+ # or
67
+ yarn add madeonsol
68
+ # or
69
+ pnpm add madeonsol
70
+ ```
71
+
72
+ Requires **Node.js 18** (uses native `fetch`). Works out of the box in Cloudflare Workers, Vercel Edge, and Bun.
73
+
74
+ ---
75
+
76
+ ## Quick start
77
+
78
+ ```ts
79
+ import { MadeOnSol } from "madeonsol";
80
+
81
+ const client = new MadeOnSol({ apiKey: "msk_your_api_key_here" });
82
+
83
+ // Latest KOL buy trades
84
+ const { trades } = await client.kol.feed({ limit: 10, action: "buy" });
85
+ console.log(trades[0].kol_name, "bought", trades[0].token_symbol);
86
+
87
+ // Deshred sniper — ~500ms before on-chain confirmation (PRO/ULTRA)
88
+ const { deploys } = await client.sniper.recent({ limit: 20, min_bond_rate: 0.5 });
89
+ console.log(deploys[0].token_name, "deployed by", deploys[0].deployer_tier, "tier deployer");
90
+
91
+ // Multi-KOL coordination signal
92
+ const { coordination } = await client.kol.coordination({ min_kols: 3, min_score: 70 });
93
+
94
+ // FIFO PnL for any wallet (PRO+)
95
+ const pnl = await client.wallet.pnl("ASVz...ybJk");
96
+ console.log(`Realized: ${pnl.summary.realized_sol} SOL · Win rate: ${(pnl.summary.win_rate! * 100).toFixed(1)}%`);
97
+
98
+ // Search Solana tools
99
+ const { tools } = await client.tools.search({ q: "trading", limit: 10 });
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Use cases
105
+
106
+ - **Copy-trading bot** — stream KOL buys via `client.kol.feed()` and mirror trades
107
+ - **Deshred sniper** `client.sniper.recent()` or subscribe to `sniper:deploys` WebSocket for ~500ms pre-confirm deploy signals
108
+ - **DEX trade sniping** — subscribe to the all-DEX stream filtered by token, wallet, or deployer tier
109
+ - **Graduation sniper / position manager** — subscribe `token:graduations` for every pump.fun bond in real time, or hold a mint-scoped firehose sub and get the bond in-band with your position's trade flow
110
+ - **Coordination detector** flag tokens with `client.kol.coordination({ min_kols: 3, min_score: 70 })`
111
+ - **Scout signal** track first-KOL-touch events filtered to S/A-tier scouts via `client.kol.firstTouches({ preset: "scout" })`
112
+ - **Wallet analyser** `client.wallet.pnl()` for FIFO cost-basis PnL on any Solana wallet
113
+ - **Price alert bot** `client.priceAlerts.create()` for MC dip/recovery alerts delivered via webhook
114
+ - **Analytics dashboard** — combine leaderboard, PnL, token velocity, and tool data
115
+ - **Telegram/Discord bot** — pipe alerts via webhooks into chat
116
+ - **Portfolio tracker** — use `client.kol.wallet()` to follow specific KOL positions
117
+
118
+ ---
119
+
120
+ ## API Reference
121
+
122
+ ### KOL Tracker — `client.kol`
123
+
124
+ #### `client.kol.feed(params?)`
125
+
126
+ Live feed of trades made by tracked KOL wallets.
127
+
128
+ ```ts
129
+ const { trades, count } = await client.kol.feed({
130
+ limit: 50, // 1–100, default 50
131
+ action: "buy", // "buy" | "sell"
132
+ kol: "7xKX...", // filter by specific wallet
133
+ });
134
+ ```
135
+
136
+ Returns: `KolFeedResponse` — `{ trades: KolTrade[], count: number }`
137
+
138
+ Each `KolTrade` includes `market_cap_usd_at_trade` and `price_usd_at_trade` — the token's MC and price at the exact moment the swap fired, sourced from our in-memory price tracker (real-time, faster than Dexscreener spot). Use these to surface "KOL bought $X SOL of token at $Y MC" without a second lookup.
139
+
140
+ ---
141
+
142
+ #### `client.kol.leaderboard(params?)`
143
+
144
+ KOL PnL leaderboard ranked by realized profit.
145
+
146
+ ```ts
147
+ const { leaderboard, period } = await client.kol.leaderboard({
148
+ period: "7d", // "today" | "7d" | "30d" | "90d" | "180d", default "7d"
149
+ });
150
+ ```
151
+
152
+ > **180-day retention** — KOL trade data is retained for 180 days (extended from 31 on 2026-04-07). The 90d and 180d windows fill up over time as the trade table accumulates.
153
+
154
+ Returns: `KolLeaderboardResponse`
155
+
156
+ ---
157
+
158
+ #### `client.kol.wallet(wallet, params?)`
159
+
160
+ Full profile for a single KOL wallet, including trade history and optional per-token PnL breakdown.
161
+
162
+ ```ts
163
+ const profile = await client.kol.wallet("7xKX...", {
164
+ include: "pnl_by_token",
165
+ });
166
+ ```
167
+
168
+ Returns: `KolWalletProfile`
169
+
170
+ ---
171
+
172
+ #### `client.kol.coordination(params?)`
173
+
174
+ Detect tokens where multiple KOLs are buying simultaneously — a strong signal of coordinated pumps. **v1.1** adds peak-density windows, exit tracking, and a composite 0–100 coordination score.
175
+
176
+ ```ts
177
+ const { coordination, score_version, window_minutes } = await client.kol.coordination({
178
+ period: "24h", // "1h" | "6h" | "24h" | "7d", default "24h"
179
+ min_kols: 3, // 2–50, default 3
180
+ limit: 20, // 1–50, default 20
181
+ window_minutes: 15, // v1.1 — peak-density window in minutes (1–60)
182
+ min_score: 60, // v1.1 filter by composite score (0–100)
183
+ include_majors: false, // v1.1 include WIF/BONK/POPCAT
184
+ });
185
+
186
+ for (const c of coordination) {
187
+ console.log(c.token_symbol, "score", c.coordination_score, "peak", c.peak_kols, "exited", c.exited_count);
188
+ // c.kols[]: { name, wallet, buy_sol, sell_sol, exited }
189
+ }
190
+ ```
191
+
192
+ Returns: `KolCoordinationResponse` — `{ coordination: CoordinatedToken[], score_version, window_minutes }`
193
+
194
+ ---
195
+
196
+ #### `client.coordinationAlerts.*` (v1.1)
197
+
198
+ Create **real-time push alerts** that fire the moment a new coordination cluster forms. Alerts are evaluated per-trade by the signal-evaluator service (sub-second latency), delivered via WebSocket channel `kol:coordination` and/or HMAC-signed webhook. **PRO: 5 rules, ULTRA: 20 rules.**
199
+
200
+ ```ts
201
+ // Create a rule: ≥5 KOLs, 10-min window, score ≥70, webhook delivery
202
+ const { rule, webhook_secret } = await client.coordinationAlerts.create({
203
+ name: "strong-clusters",
204
+ min_kols: 5,
205
+ window_minutes: 10,
206
+ min_score: 70,
207
+ include_majors: false,
208
+ cooldown_min: 30, // don't re-fire same token within 30 min
209
+ score_jump_break: 15, // UNLESS score jumps by 15+ (catches conviction surges)
210
+ delivery_mode: "webhook", // "websocket" | "webhook" | "both"
211
+ webhook_url: "https://example.com/coord-hook",
212
+ });
213
+ // SAVE webhook_secret used for HMAC-SHA256 signature verification.
214
+
215
+ await client.coordinationAlerts.list();
216
+ await client.coordinationAlerts.get(rule.id);
217
+ await client.coordinationAlerts.update(rule.id, { min_score: 80, is_active: false });
218
+ await client.coordinationAlerts.delete(rule.id);
219
+ ```
220
+
221
+ Webhook signatures: header `X-MadeOnSol-Signature` = `sha256(timestamp + "." + body)` with `webhook_secret` as the HMAC key. Reject deliveries older than ~5 min.
222
+
223
+ WebSocket delivery: subscribe to channel `kol:coordination` on `wss://madeonsol.com/ws/v1/stream` — events are user-scoped (you only receive your own rule fires).
224
+
225
+ ---
226
+
227
+ #### `client.priceAlerts.*` *(new in 2.8)*
228
+
229
+ **Sub-second token MC dip/recovery alerts.** Set a drop threshold on any token — when MC drops below baseline, a `price_alert:dip` event fires. Optionally track recovery. **PRO: 5 alerts, ULTRA: 25 alerts.**
230
+
231
+ ```ts
232
+ // Create: alert when token drops 20%, then notify when it recovers 15% from the dip low
233
+ const { alert, webhook_secret } = await client.priceAlerts.create({
234
+ token_mint: "So11111111111111111111111111111111111111112",
235
+ drop_pct: 20,
236
+ recovery_pct: 15,
237
+ name: "SOL dip tracker",
238
+ delivery_mode: "webhook",
239
+ webhook_url: "https://example.com/dip-hook",
240
+ });
241
+
242
+ await client.priceAlerts.list();
243
+ await client.priceAlerts.get(alert.id);
244
+ await client.priceAlerts.update(alert.id, { name: "Renamed", is_active: false });
245
+ await client.priceAlerts.delete(alert.id);
246
+
247
+ // Event history (30-day retention)
248
+ const { events } = await client.priceAlerts.events({ event_type: "dip", limit: 50 });
249
+ ```
250
+
251
+ Alert lifecycle: `watching` -> `dipped` -> `recovered` (terminal). One-shot per alert. Baseline MC captured at creation time. 30-day auto-expiry. Thresholds immutable — delete and recreate to change.
252
+
253
+ WebSocket: subscribe to channel `price_alert:events` — user-scoped. Webhook: per-alert HMAC-SHA256 signed (same scheme as coordination alerts).
254
+
255
+ ---
256
+
257
+ #### `client.sniper.*` — Deshred Sniper Alerts *(new in 2.9)*
258
+
259
+ **The fastest path to a new pump.fun launch.** Deploys are reconstructed from shred-level (**deshred**) data and surface in the feed **~500ms before the chain confirms them** — a measured head start versus any confirmed-stream feed. **PRO** sees elite + good deployers; **ULTRA** sees every tier and can keep a custom deployer watchlist.
260
+
261
+ ```ts
262
+ // Newest-first deshred deploy feed (PRO: elite/good · ULTRA: all tiers)
263
+ const { deploys } = await client.sniper.recent({ limit: 50, min_bond_rate: 0.5 });
264
+
265
+ // Audit one deployer's recent launches (ULTRA)
266
+ await client.sniper.byDeployer("7dEx...4pQ8");
267
+
268
+ // Custom watchlist — get deploys from only the deployers you track, any tier (ULTRA, max 50)
269
+ await client.sniper.addToWatchlist({ wallets: ["7dEx...4pQ8", "9aBc...2zZ1"], label: "alpha devs" });
270
+ await client.sniper.watchlist();
271
+ const { deploys: tracked } = await client.sniper.recent({ watchlist: true });
272
+ await client.sniper.removeFromWatchlist("7dEx...4pQ8");
273
+ ```
274
+
275
+ Detection is pre-execution, so payloads carry no MC/logs/balances — `confirmed_on_chain` is `"deshred"`. For **live** push (not polling), use the `sniper:deploy` webhook event, the `sniper:deploys` WebSocket channel, or `/alert sniper` in the Telegram bot. ~1–3% of detected deploys may abandon before settlement.
276
+
277
+ ---
278
+
279
+ #### `client.kol.scoutLeaderboard(params?)` *(new in 2.8)*
280
+
281
+ Scout leaderboard: top KOLs ranked by scout score, first-touch frequency, and swarm attraction rate. **ULTRA only.**
282
+
283
+ ```ts
284
+ const data = await client.kol.scoutLeaderboard({ limit: 20, scout_tier: "S", sort: "scout_score" });
285
+ ```
286
+
287
+ ---
288
+
289
+ #### `client.kol.coordinationHistory(params?)` *(new in 2.8)*
290
+
291
+ Historical coordination alert fires — past events with token, score, KOL count. **ULTRA only.**
292
+
293
+ ```ts
294
+ const data = await client.kol.coordinationHistory({ limit: 50, min_score: 70 });
295
+ ```
296
+
297
+ ---
298
+
299
+ #### `client.token.kolConsensus(mint)` *(new in 2.8)*
300
+
301
+ KOL consensus on a token: how many bought/sold, exit rate, net flow, median entry MC. **ULTRA** gets individual wallet arrays.
302
+
303
+ ```ts
304
+ const consensus = await client.token.kolConsensus("4sVahM4U8js62mQV58ABSkNRhf6Ztc7Xs2LXUznNpump");
305
+ ```
306
+
307
+ ---
308
+
309
+ #### `client.token.peakHistory(mint)` *(new in 2.8)*
310
+
311
+ Peak MC history: ATH, decline from peak, MC at bond and at 1h/6h/24h/7d after bond.
312
+
313
+ ```ts
314
+ const peak = await client.token.peakHistory("4sVahM4U8js62mQV58ABSkNRhf6Ztc7Xs2LXUznNpump");
315
+ ```
316
+
317
+ ---
318
+
319
+ #### `client.kol.firstTouches(params?)` *(new in 2.2)*
320
+
321
+ Recent first-KOL-touch events on tokens every time a tracked KOL was the first to buy a given mint. Filterable by **scout tier** (S/A/B/C from the per-KOL `mv_kol_scout_score` view), KOL winrate, token age, mint suffix, etc.
322
+
323
+ **Backtested signal:** top scouts attract ≥3 follow-on KOLs within 4h ~50% of the time vs ~14% baseline (38d / 491k buys / 72,549 events). The full leaderboard is at [madeonsol.com/kol/scouts](https://madeonsol.com/kol/scouts).
324
+
325
+ ```ts
326
+ // S-tier scouts on tokens younger than 1h
327
+ const { events } = await client.kol.firstTouches({
328
+ preset: "scout",
329
+ min_scout_tier: "S",
330
+ limit: 20,
331
+ });
332
+
333
+ for (const e of events) {
334
+ console.log(e.first_kol.name, "scouted", e.token_symbol, `(scout_score=${e.first_kol.scout_score}%)`);
335
+ }
336
+ ```
337
+
338
+ Filter knobs: `since`, `before`, `limit`, `kol`, `min_kol_winrate_7d`, `min_scout_tier`, `min_n_touches`, `strategy`, `token_age_max_min`, `min_first_buy_sol`, `mint_suffix`, `preset` (`"scout"` or `"fresh_launch"`), `include` (e.g. `"followers_4h"`).
339
+
340
+ > **Don't poll — push.** Median lead time before the second KOL is **12 seconds**, so REST polling will lose the swarm. Subscribe to the `kol:first_touches` WebSocket channel (PRO+) or, on Ultra, create an HMAC-signed webhook subscription via `client.firstTouchSubscriptions.create({...})`.
341
+
342
+ Returns: `FirstTouchesResponse`
343
+
344
+ ---
345
+
346
+ #### `client.firstTouchSubscriptions.*` *(Ultra)*
347
+
348
+ Create push-delivery rules for first-touch events. Up to 10 active subscriptions per Ultra user.
349
+
350
+ ```ts
351
+ const { subscription, webhook_secret } = await client.firstTouchSubscriptions.create({
352
+ name: "S-tier scouts on pump tokens",
353
+ filters: { min_scout_tier: "S", mint_suffix: "pump" },
354
+ delivery_mode: "webhook",
355
+ webhook_url: "https://my.bot/hooks/scout",
356
+ });
357
+ // store webhook_secret — shown once
358
+
359
+ await client.firstTouchSubscriptions.list();
360
+ await client.firstTouchSubscriptions.update(subscription.id, { is_active: false });
361
+ await client.firstTouchSubscriptions.delete(subscription.id);
362
+ ```
363
+
364
+ Same HMAC scheme as coordination alerts. WebSocket channel: `kol:first_touches`.
365
+
366
+ ---
367
+
368
+ #### `client.kol.token(mint)`
369
+
370
+ KOL buy/sell activity for a specific token mint.
371
+
372
+ ```ts
373
+ const activity = await client.kol.token("EPjFW...");
374
+ ```
375
+
376
+ Returns: `KolTokenActivity`
377
+
378
+ ---
379
+
380
+ #### `client.kol.pnl(wallet, params?)`
381
+
382
+ Deep per-wallet PnL breakdown with equity curve, risk metrics, and position history.
383
+
384
+ ```ts
385
+ const pnl = await client.kol.pnl("7xKX...", {
386
+ period: "30d", // "7d" | "30d" | "90d" | "180d", default "30d"
387
+ });
388
+ // All tiers: summary + equity curve + closed positions
389
+ // ULTRA: + open positions (tokens bought but not yet sold)
390
+ ```
391
+
392
+ Returns: `KolPnlResponse`
393
+
394
+ ---
395
+
396
+ #### `client.kol.trendingTokens(params?)`
397
+
398
+ Tokens ranked by KOL buy volume across multiple time windows.
399
+
400
+ ```ts
401
+ const { tokens } = await client.kol.trendingTokens({
402
+ period: "1h", // "5m" | "15m" | "30m" | "1h" | "4h" | "8h" | "12h", default "1h"
403
+ min_kols: 2, // minimum distinct KOL buyers
404
+ limit: 20, // 1–50, default 20
405
+ });
406
+ // Available on all tiers; ULTRA unlocks full KOL wallet addresses per token
407
+ ```
408
+
409
+ Returns: `KolTrendingTokensResponse`
410
+
411
+ ---
412
+
413
+ ### Alpha Wallet Intelligence — `client.alpha`
414
+
415
+ #### `client.alpha.leaderboard(params?)`
416
+
417
+ Leaderboard of 1M+ scored early-buyer wallets ranked by win rate, PnL, or ROI.
418
+
419
+ ```ts
420
+ const { wallets } = await client.alpha.leaderboard({
421
+ period: "30d", // "7d" | "30d" | "90d", default "30d"
422
+ sort: "win_rate", // "win_rate" | "pnl" | "roi"
423
+ min_tokens: 5,
424
+ exclude_bots: true,
425
+ });
426
+ // Up to 100 results on Free/Pro; ULTRA unlocks 500 + bot signals
427
+ ```
428
+
429
+ Returns: `AlphaLeaderboardResponse`
430
+
431
+ ---
432
+
433
+ #### `client.alpha.wallet(wallet)`
434
+
435
+ Full profile for an alpha wallet including per-token history and bot signals. ULTRA only.
436
+
437
+ ```ts
438
+ const profile = await client.alpha.wallet("7xKX...");
439
+ ```
440
+
441
+ Returns: `AlphaWalletResponse`
442
+
443
+ ---
444
+
445
+ #### `client.alpha.linked(wallet)`
446
+
447
+ Linked-wallet clustering — wallets that co-bought with this address within 2 seconds. ULTRA only.
448
+
449
+ ```ts
450
+ const { linked } = await client.alpha.linked("7xKX...");
451
+ ```
452
+
453
+ Returns: `AlphaLinkedResponse`
454
+
455
+ ---
456
+
457
+ #### `client.alpha.capTable(mint)`
458
+
459
+ First buyers for a token enriched with historical win rates, PnL, and KOL identity. PRO/ULTRA.
460
+
461
+ ```ts
462
+ const { buyers } = await client.alpha.capTable("EPjFW...");
463
+ ```
464
+
465
+ Returns: `AlphaCapTableResponse`
466
+
467
+ ---
468
+
469
+ #### `client.alpha.buyerQuality(mint)`
470
+
471
+ 0–100 cohort quality score based on the profile of a token's first buyers. All tiers. 5-minute cache.
472
+
473
+ ```ts
474
+ const { score } = await client.alpha.buyerQuality("EPjFW...");
475
+ ```
476
+
477
+ Returns: `AlphaBuyerQualityResponse`
478
+
479
+ ---
480
+
481
+ ### Wallet Tracker — `client.walletTracker`
482
+
483
+ #### `client.walletTracker.watchlist()`
484
+
485
+ List your tracked wallets and remaining capacity.
486
+
487
+ ```ts
488
+ const { wallets, capacity } = await client.walletTracker.watchlist();
489
+ // capacity: { used, limit } — Free: 10, Pro: 50, Ultra: 100
490
+ ```
491
+
492
+ Returns: `WatchlistResponse`
493
+
494
+ ---
495
+
496
+ #### `client.walletTracker.addToWatchlist(wallet, params?)`
497
+
498
+ Add a wallet to your watchlist. Tracking begins immediately.
499
+
500
+ ```ts
501
+ await client.walletTracker.addToWatchlist("7xKX...", { label: "whale" });
502
+ ```
503
+
504
+ ---
505
+
506
+ #### `client.walletTracker.removeFromWatchlist(wallet)`
507
+
508
+ Remove a wallet from your watchlist.
509
+
510
+ ```ts
511
+ await client.walletTracker.removeFromWatchlist("7xKX...");
512
+ ```
513
+
514
+ ---
515
+
516
+ #### `client.walletTracker.updateLabel(wallet, label)`
517
+
518
+ Update the label for a tracked wallet.
519
+
520
+ ```ts
521
+ await client.walletTracker.updateLabel("7xKX...", "smart money");
522
+ ```
523
+
524
+ ---
525
+
526
+ #### `client.walletTracker.trades(params?)`
527
+
528
+ Historical swap and transfer events for your watched wallets. 120-day retention.
529
+
530
+ ```ts
531
+ const { events } = await client.walletTracker.trades({
532
+ wallet: "7xKX...", // filter by specific wallet
533
+ action: "buy", // "buy" | "sell"
534
+ event_type: "swap", // "swap" | "transfer"
535
+ limit: 50,
536
+ before: "2026-04-01T00:00:00Z", // ISO 8601 cursor
537
+ });
538
+ ```
539
+
540
+ Returns: `WalletTrackerTradesResponse`
541
+
542
+ ---
543
+
544
+ #### `client.walletTracker.summary(params?)`
545
+
546
+ Per-wallet stats across your watchlist: swap counts, SOL bought/sold, last event time.
547
+
548
+ ```ts
549
+ const { wallets } = await client.walletTracker.summary({
550
+ period: "7d", // "24h" | "7d" | "30d", default "7d"
551
+ wallet: "7xKX...", // optional: single wallet
552
+ });
553
+ ```
554
+
555
+ Returns: `WalletTrackerSummaryResponse`
556
+
557
+ ---
558
+
559
+ ### Universal Wallet — `client.wallet` *(new in 2.7)*
560
+
561
+ Per-wallet endpoints that work on **any** Solana wallet, not just curated KOLs. FIFO cost-basis PnL over the last 90 days. PRO+ on every method. Results are cached server-side in `wallet_analyses` with dynamic TTL (5min / 1h / 24h based on last activity); cache hits don't count against your daily quota.
562
+
563
+ **Cost-basis honesty:** observable only inside the 90-day data window. Wallets that sold tokens bought before that window have the overflow silently discarded rather than fabricated. `notes.cost_basis_observable_from` makes the cutoff visible per call.
564
+
565
+ #### `client.wallet.stats(address)`
566
+
567
+ Aggregate stats over 90d plus cross-product flags (KOL / alpha / deployer). Includes enrichments: top traded tokens with realized PnL, trading style, deployer tier mix, recent trades. **v2.8** adds `derived` block: win rate, ROI, best/worst trade, biggest miss (token sold that later mooned), and AI-classified verdict.
568
+
569
+ ```ts
570
+ const { stats, flags, derived } = await client.wallet.stats("ASVz...ybJk");
571
+ console.log(`${flags.kol_name ?? address}: ${stats?.total_trades} trades`);
572
+ if (derived?.verdict) {
573
+ console.log(`${derived.verdict.label}: ${derived.verdict.description}`);
574
+ }
575
+ if (derived?.biggest_miss) {
576
+ console.log(`Biggest miss: ${derived.biggest_miss.token_symbol} — missed +${derived.biggest_miss.missed_sol.toFixed(1)} SOL`);
577
+ }
578
+ ```
579
+
580
+ Returns: `WalletStatsResponse` (404 if the wallet has no trades and no flag-table presence).
581
+
582
+ ---
583
+
584
+ #### `client.wallet.pnl(address)`
585
+
586
+ Full FIFO cost-basis PnL: realized + unrealized SOL, profit factor, max drawdown, avg + median hold minutes, daily UTC PnL curve, closed positions sorted by pnl desc (with ROI %, hold time, win/loss), and open positions hydrated with live current prices from the market-cap tracker.
587
+
588
+ ```ts
589
+ const pnl = await client.wallet.pnl("ASVz...ybJk");
590
+ console.log(`Realized: ${pnl.summary.realized_sol} SOL · Unrealized: ${pnl.summary.unrealized_sol} SOL`);
591
+ console.log(`Win rate: ${(pnl.summary.win_rate! * 100).toFixed(1)}% · PF: ${pnl.summary.profit_factor}`);
592
+ for (const c of pnl.closed_positions.slice(0, 5)) {
593
+ const sign = c.pnl_sol > 0 ? "+" : "";
594
+ console.log(` ${c.token_mint.slice(0,8)}… ${sign}${c.pnl_sol} SOL (${c.roi_pct}% ROI, ${c.hold_minutes}m hold)`);
595
+ }
596
+ ```
597
+
598
+ Returns: `WalletPnlResponse`. Cache hits include `cache_hit: true` + `computed_at`; misses include `ttl_seconds`.
599
+
600
+ ---
601
+
602
+ #### `client.wallet.positions(address)`
603
+
604
+ Open positions only lighter slice of `pnl()`. Shares the same cache, so calling this right after `pnl()` is an immediate hit.
605
+
606
+ ```ts
607
+ const { positions } = await client.wallet.positions("ASVz...ybJk");
608
+ for (const p of positions) {
609
+ const u = p.unrealized_sol;
610
+ console.log(` ${p.token_mint.slice(0,8)}… cost ${p.cost_basis_sol} SOL unrealized ${u ?? "—"} SOL (${p.unrealized_pct ?? "—"}%)`);
611
+ }
612
+ ```
613
+
614
+ Returns: `WalletPositionsResponse`. Mints without a current price return `unrealized_sol: null` rather than fabricated zero.
615
+
616
+ ---
617
+
618
+ #### `client.wallet.trades(address, params?)`
619
+
620
+ Cursor-paginated raw trades. Default window is the last 90 days; override via `since` / `until` (Unix epoch seconds). Default limit 100, max 500.
621
+
622
+ ```ts
623
+ let cursor: string | undefined;
624
+ while (true) {
625
+ const page = await client.wallet.trades("ASVz...ybJk", { limit: 200, cursor, action: "buy" });
626
+ for (const t of page.trades) processBuy(t);
627
+ if (!page.has_more) break;
628
+ cursor = page.next_cursor!;
629
+ }
630
+ ```
631
+
632
+ Params:
633
+ - `limit` — 1-500, default 100
634
+ - `cursor` — from `next_cursor` of previous response
635
+ - `action` — `"buy"` or `"sell"`
636
+ - `token_mint` — filter to one token
637
+ - `since` / `until` — Unix epoch seconds (default last 90d)
638
+
639
+ Returns: `WalletTradesResponse` with `trades[]` + `next_cursor` + `has_more` + `filters` echo.
640
+
641
+ ---
642
+
643
+ ### Deployer Hunter — `client.deployer`
644
+
645
+ #### `client.deployer.stats()`
646
+
647
+ Global statistics across all tracked deployer wallets.
648
+
649
+ ```ts
650
+ const stats = await client.deployer.stats();
651
+ console.log(stats.overall_bonding_rate); // e.g. 0.043
652
+ ```
653
+
654
+ Returns: `DeployerStats`
655
+
656
+ ---
657
+
658
+ #### `client.deployer.leaderboard(params?)`
659
+
660
+ Deployers ranked by bonding rate or recent performance.
661
+
662
+ ```ts
663
+ const { deployers } = await client.deployer.leaderboard({
664
+ tier: "elite", // "elite" | "good" | "moderate" | "rising" | "cold"
665
+ sort: "bonding_rate", // "bonding_rate" | "recent_bond_rate" | "total_bonded" | "last_deploy_at"
666
+ limit: 20, // 1–50, default 20
667
+ offset: 0,
668
+ });
669
+ ```
670
+
671
+ Returns: `DeployerLeaderboardResponse`
672
+
673
+ ---
674
+
675
+ #### `client.deployer.profile(wallet)`
676
+
677
+ Full profile for a single deployer wallet.
678
+
679
+ ```ts
680
+ const deployer = await client.deployer.profile("3xAB...");
681
+ console.log(deployer.tier, deployer.bonding_rate);
682
+ ```
683
+
684
+ Returns: `DeployerProfile`
685
+
686
+ ---
687
+
688
+ #### `client.deployer.tokens(wallet, params?)`
689
+
690
+ All tokens deployed by a specific wallet.
691
+
692
+ ```ts
693
+ const { tokens } = await client.deployer.tokens("3xAB...", {
694
+ limit: 20,
695
+ offset: 0,
696
+ });
697
+ ```
698
+
699
+ Returns: `DeployerTokensResponse`
700
+
701
+ ---
702
+
703
+ #### `client.deployer.alerts(params?)`
704
+
705
+ Real-time deploy alerts — fired when a tracked deployer launches a new token.
706
+
707
+ ```ts
708
+ const { alerts } = await client.deployer.alerts({
709
+ since: "2025-01-01T00:00:00Z", // ISO 8601
710
+ limit: 20,
711
+ tier: "elite", // "elite" | "good" | "moderate" | "rising" | "cold"
712
+ offset: 0,
713
+ });
714
+ ```
715
+
716
+ Returns: `DeployerAlertsResponse`
717
+
718
+ ---
719
+
720
+ #### `client.deployer.alertStats(params?)`
721
+
722
+ Aggregated alert statistics by tier.
723
+
724
+ ```ts
725
+ const stats = await client.deployer.alertStats({ period: "7d" });
726
+ // "7d" | "30d" | "all", default "all"
727
+ ```
728
+
729
+ Returns: `DeployerAlertStats`
730
+
731
+ ---
732
+
733
+ #### `client.deployer.bestTokens(params?)`
734
+
735
+ Top-performing tokens from tracked deployers by peak market cap.
736
+
737
+ ```ts
738
+ const { tokens } = await client.deployer.bestTokens({
739
+ period: "7d", // "7d" | "30d" | "all", default "7d"
740
+ limit: 5, // 1–20, default 5
741
+ });
742
+ ```
743
+
744
+ Returns: `BestTokensResponse`
745
+
746
+ ---
747
+
748
+ #### `client.deployer.recentBonds(params?)`
749
+
750
+ Most recently bonded tokens from tracked deployers.
751
+
752
+ ```ts
753
+ const { bonds } = await client.deployer.recentBonds({ limit: 20 });
754
+ ```
755
+
756
+ Returns: `RecentBondsResponse`
757
+
758
+ ---
759
+
760
+ ### Token Intelligence — `client.token`
761
+
762
+ Per-mint snapshots (price, MC, volume, deployer rep, KOL activity, blacklist flags, **v1.7 velocity windows + MEV-share**) and a filtered directory.
763
+
764
+ #### `client.token.get(mint)`
765
+
766
+ Comprehensive per-mint snapshot in one call. **ULTRA** also returns individual KOL wallet addresses in `top_buyers[]`.
767
+
768
+ ```ts
769
+ const { token } = await client.token.get("So11111111111111111111111111111111111111112");
770
+ console.log(token.price_usd, token.market_cap);
771
+ console.log(token.mc_change_pct?.["1h"]); // v1.7
772
+ console.log(token.mev_volume_pct?.["1h"]); // v1.7
773
+ ```
774
+
775
+ Invalid mints return a 400 with `code: "invalid_mint"`, `reason`, `received_length`, `example`, and `docs` URL — no trial and error.
776
+
777
+ Returns: `TokenResponse` (with `mc_change_pct` / `volume_usd` / `mev_volume_pct` (each keyed by 5m/15m/1h/2h/4h) + `history_age_seconds` as of 1.7)
778
+
779
+ #### `client.token.batch(mints)`
780
+
781
+ Batch lookup up to 50 mints in one round-trip. ~10–20× cheaper than N sequential calls.
782
+
783
+ ```ts
784
+ const { tokens } = await client.token.batch(["mint1", "mint2", "mint3"]);
785
+ ```
786
+
787
+ Returns: `TokenBatchResponse`
788
+
789
+ #### `client.token.list(params?)` *(new in 2.6 PRO+)*
790
+
791
+ Filtered, sortable token directory. Default `min_liq=2000` trims the long tail of phantom-MC tokens from low-liquidity pools; pass `min_liq=0` to opt out.
792
+
793
+ **Server-side filters** (cheap, indexed): `min_mc`, `max_mc`, `min_liq`, `active_h`, `primary_dex` (`pumpfun`/`pumpswap`/`raydium`/`meteora`/`orca`/`raydium_clmm`), `authority_revoked`, `exclude_token2022`, `min_lp_burnt_pct`.
794
+
795
+ **Computed post-filters** (over-fetches 3×): `min_volume_1h_usd`, `max_mev_share_pct`, `mc_change_1h_min_pct`, `mc_change_1h_max_pct`. When any of these are set, `pagination.post_filtered` is `true` and page size may be smaller than `limit`.
796
+
797
+ ```ts
798
+ // Momentum scanner: liquid mints up >20% in 1h, low bot share
799
+ const { tokens, pagination } = await client.token.list({
800
+ min_liq: 10000,
801
+ min_volume_1h_usd: 5000,
802
+ max_mev_share_pct: 60,
803
+ mc_change_1h_min_pct: 20,
804
+ sort: "mc_desc",
805
+ limit: 50,
806
+ });
807
+
808
+ // Cleanest filter for a sane "top by MC" feed
809
+ const { tokens } = await client.token.list({
810
+ min_liq: 25000,
811
+ active_h: 1,
812
+ authority_revoked: true,
813
+ sort: "mc_desc",
814
+ });
815
+ ```
816
+
817
+ Returns: `TokenListResponse` (with `tokens[]`, `pagination`, `filters` echo)
818
+
819
+ #### `client.token.batchBuyerQuality(mints)`
820
+
821
+ Batch buyer-quality scoring for up to 50 mints. Shares the same 5-minute LRU cache as `client.alpha.buyerQuality(mint)`.
822
+
823
+ Returns: `AlphaBuyerQualityBatchResponse`
824
+
825
+ ---
826
+
827
+ ### Account — `client.me()` *(new in 2.6)*
828
+
829
+ Inspect your tier, quota state, and feature usage in one call. Reads from the same in-memory counters that drive rate-limit enforcement, so `quota.daily.remaining` is authoritative — no header parsing needed. Works on every tier (BASIC/PRO/ULTRA).
830
+
831
+ ```ts
832
+ const me = await client.me();
833
+ console.log(`${me.tier}: ${me.quota.daily.remaining}/${me.quota.daily.limit} req left today`);
834
+ console.log(`Webhooks: ${me.features.webhooks.used}/${me.features.webhooks.limit}`);
835
+ console.log(`Copy-trade wallets: ${me.features.copytrade_wallets.used}/${me.features.copytrade_wallets.limit}`);
836
+
837
+ if (me.quota.daily.remaining < 100) {
838
+ // self-throttle
839
+ }
840
+ ```
841
+
842
+ Returns: `MeResponse`
843
+
844
+ ---
845
+
846
+ ### Tool Directory — `client.tools`
847
+
848
+ #### `client.tools.search(params?)`
849
+
850
+ Search 950+ Solana tools indexed on MadeOnSol.
851
+
852
+ ```ts
853
+ const { tools, count } = await client.tools.search({
854
+ q: "trading bot", // full-text search
855
+ category: "trading", // category slug filter
856
+ limit: 20, // 1–50, default 20
857
+ });
858
+ ```
859
+
860
+ Returns: `ToolsSearchResponse`
861
+
862
+ ---
863
+
864
+ ### WebSocket Streaming — `client.stream`
865
+
866
+ #### `client.stream.getToken()`
867
+
868
+ Generate a 24-hour WebSocket streaming token. Pro/Ultra subscribers get `ws_url` for KOL/deployer event streaming. Ultra subscribers also get `dex_ws_url` for the all-DEX trade stream.
869
+
870
+ ```ts
871
+ const token = await client.stream.getToken();
872
+ console.log(token.ws_url); // wss://madeonsol.com/ws/v1/stream
873
+ console.log(token.dex_ws_url); // wss://madeonsol.com/ws/v1/dex-stream (Ultra only)
874
+ ```
875
+
876
+ Returns: `StreamToken` `{ token, expires_at, ws_url, dex_ws_url?, usage }`
877
+
878
+ #### `client.stream.connect()` *(new in 2.10)*
879
+
880
+ Open a **managed** stream — token fetch + 24h refresh, auto-reconnect (backoff + jitter), heartbeat liveness, and typed events are handled for you. No need to touch `getToken()` or `ws` directly.
881
+
882
+ ```ts
883
+ const stream = client.stream.connect();
884
+ stream.on("kol:trade", (t) => console.log(t.token_symbol, t.action));
885
+ stream.on("deployer:alert", (a) => console.log("new deploy", a.token_mint));
886
+ stream.subscribe(["kol:trades", "deployer:alerts"]);
887
+ // stream.unsubscribe([...]) / stream.close() when done
888
+ ```
889
+
890
+ Channels: `kol:trades`, `kol:coordination`, `kol:first_touches`, `deployer:alerts`, `wallet_tracker:events`, `copytrade:signals`, `price_alert:events`, `sniper:deploys`, `token:graduations` (every pump.fun graduation in real time, tracked deployer or not — typed `GraduationEvent`). Lifecycle: `open`, `close`, `reconnect`, `heartbeat`, `error`. Node 22+ uses the global `WebSocket`; on Node < 22 also `npm i ws`.
891
+
892
+ ---
893
+
894
+ ### DEX Firehose (Ultra) — `wss://madeonsol.com/ws/v1/dex-stream`
895
+
896
+ Real-time trades across **9+ Solana DEX programs** (Pump.fun, PumpAMM, PumpSwap, Raydium AMM/CPMM/CAMM, Jupiter v6, Orca Whirlpool, Meteora DBC/DAMM, LaunchLab/bonk.fun) on a single normalized WebSocket. Server-side filters drop everything you don't care about before it hits your socket.
897
+
898
+ **Limits:** ULTRA = 2 connections, **10 named subscriptions per connection**, up to **500 trades replay** from a server-side buffer holding ~5 minutes of firehose history (not connection-scoped — covers trades from before you connected; newest-first, sort by `block_time`). Inbound rate limit: 5 messages/sec (excess emits one error per second).
899
+
900
+ #### Quick start
901
+
902
+ ```ts
903
+ import { WebSocket } from "ws"; // or native WebSocket in browsers/Bun
904
+
905
+ const { token, dex_ws_url } = await client.stream.getToken();
906
+ const ws = new WebSocket(`${dex_ws_url}?token=${token}`); // token MUST be appended as query param
907
+
908
+ ws.on("open", () => {
909
+ // Multi-subscription: each sub has its own sub_id and filters
910
+ ws.send(JSON.stringify({
911
+ type: "subscribe",
912
+ sub_id: "fresh-pumpfun",
913
+ replay: 50, // backfill up to 500 from ring buffer
914
+ filters: {
915
+ dex: "pumpfun",
916
+ token_age_max_seconds: 300, // first seen in last 5 min
917
+ min_sol: 0.5,
918
+ action: "buy",
919
+ },
920
+ }));
921
+ });
922
+
923
+ ws.on("message", (raw) => {
924
+ const msg = JSON.parse(raw.toString());
925
+ if (msg.channel === "dex:trades") {
926
+ // { sub_id, data: { wallet, mint, action, sol_amount, token_amount, dex, ... }, replay, ts }
927
+ console.log(msg.sub_id, msg.data.dex, msg.data.action, msg.data.sol_amount);
928
+ }
929
+ });
930
+ ```
931
+
932
+ #### Protocol client server
933
+
934
+ | `type` | Required fields | Notes |
935
+ |---|---|---|
936
+ | `subscribe` | `sub_id`, `filters` | Optional `replay: 1–500` |
937
+ | `update` | `sub_id`, `filters` | Replaces filters in place — no disconnect needed |
938
+ | `unsubscribe` | `sub_id` | Or omit `sub_id` to clear all subs |
939
+ | `list` | | Server replies with `{ type: "list", subs: [...] }` |
940
+ | `ping` | — | Heartbeat — server replies `{ type: "pong" }` |
941
+
942
+ #### Server → client message shapes
943
+
944
+ ```ts
945
+ { type: "connected", tier: "ULTRA", capabilities: { max_subs: 10, max_replay: 500, dex_names: [...], deployer_tiers: [...] } } // on connect
946
+ { type: "subscribed", sub_id: "fresh-pumpfun", filters: { ... } }
947
+ { type: "replay_done", sub_id: "fresh-pumpfun", count: 50 } // after backfill
948
+ { type: "updated", sub_id: "fresh-pumpfun", filters: { ... } }
949
+ { type: "unsubscribed", sub_id: "fresh-pumpfun" }
950
+ { type: "list", subs: [{ sub_id, filters }] } // reply to { type: "list" }
951
+ { type: "heartbeat", ts: 1712160000000 } // every 30s
952
+ { type: "error", sub_id?, message: "..." }
953
+ { channel: "dex:trades", sub_id, data: { ... }, replay: false, ts: 1712160000000 }
954
+ ```
955
+
956
+ #### Filter dimensions
957
+
958
+ At least **one targeting filter** is required (otherwise the firehose would dump every trade). Filters compose with AND semantics.
959
+
960
+ | Filter | Type | Notes |
961
+ |---|---|---|
962
+ | `token_mint` / `token_mints` | string / string[] (≤50) | Targeting |
963
+ | `wallet` / `wallets` | string / string[] (≤50) | Targeting |
964
+ | `dex` | string \| string[] | `pumpfun`, `pumpamm`, `pumpswap`, `raydium`, `jupiter`, `orca`, `meteora`, `launchlab` |
965
+ | `program` | string | Raw program ID |
966
+ | `deployer_tier` | string \| string[] | `elite`, `good`, `moderate`, `rising`, `cold`, `unranked` (uses Deployer Hunter scoring) |
967
+ | `token_age_max_seconds` | number | Only trades on mints first seen within window (uses persisted first-seen table) |
968
+ | `market_cap_min_sol` / `market_cap_max_sol` | number | Bounded by current market cap (last trade price × cached supply, 1h TTL) |
969
+ | `min_sol` / `max_sol` | number | Trade size bounds |
970
+ | `action` | `"buy"` \| `"sell"` | Direction |
971
+
972
+ **Async filters** (`token_age`, `deployer_tier`, `market_cap`) evaluate against live state and are **skipped on replay**. The first trade for an unseen mint may be skipped while the supply fetch is in flight.
973
+
974
+ #### Multi-sub example
975
+
976
+ ```ts
977
+ ws.send(JSON.stringify({ type: "subscribe", sub_id: "snipers", filters: { token_age_max_seconds: 60 } }));
978
+ ws.send(JSON.stringify({ type: "subscribe", sub_id: "whales", filters: { min_sol: 50 } }));
979
+ ws.send(JSON.stringify({ type: "subscribe", sub_id: "kol-mints", filters: { token_mints: ["EPjF...", "So11..."] } }));
980
+
981
+ // Tighten the snipers filter without disconnecting
982
+ ws.send(JSON.stringify({ type: "update", sub_id: "snipers", filters: { token_age_max_seconds: 30, min_sol: 0.3 } }));
983
+
984
+ // Drop whales when you're done
985
+ ws.send(JSON.stringify({ type: "unsubscribe", sub_id: "whales" }));
986
+ ```
987
+
988
+ Each `dex:trades` message echoes the `sub_id` that matched, so you can route them locally without reapplying filter logic client-side.
989
+
990
+ ---
991
+
992
+ ### Copy-Trade — `client.copytrade` *(new in 2.10)*
993
+
994
+ Mirror N source wallets into actionable signals (delivered via webhook/WebSocket). PRO/ULTRA — PRO: 3 rules × 5 wallets, ULTRA: 20 × 50.
995
+
996
+ ```ts
997
+ const { subscription, webhook_secret } = await client.copytrade.create({
998
+ name: "whale mirror",
999
+ source_wallets: ["WalletA…", "WalletB…"],
1000
+ sizing_mode: "fixed",
1001
+ sizing_amount: 0.5, // SOL per mirrored buy
1002
+ only_action: "buy",
1003
+ delivery_mode: "webhook",
1004
+ webhook_url: "https://you.example/hook",
1005
+ });
1006
+
1007
+ await client.copytrade.subscriptions(); // list rules
1008
+ await client.copytrade.update(subscription.id, { is_active: false });
1009
+ await client.copytrade.signals({ limit: 50 }); // 7-day fired-signal history
1010
+ await client.copytrade.delete(subscription.id);
1011
+ ```
1012
+
1013
+ ### Webhooks — `client.webhooks`
1014
+
1015
+ Manage push notification webhooks for real-time events (Pro: 3, Ultra: 10).
1016
+
1017
+ ```ts
1018
+ // Create a webhook
1019
+ const webhook = await client.webhooks.create({
1020
+ url: "https://example.com/hook",
1021
+ events: ["kol:trade", "deployer:alert"],
1022
+ filters: { min_sol: 1 },
1023
+ });
1024
+
1025
+ // List, update, delete
1026
+ const { webhooks } = await client.webhooks.list();
1027
+ await client.webhooks.update(webhook.id, { status: "paused" });
1028
+ await client.webhooks.delete(webhook.id);
1029
+ await client.webhooks.test(webhook.id);
1030
+ ```
1031
+
1032
+ ---
1033
+
1034
+ ## Error handling
1035
+
1036
+ All methods throw `MadeOnSolError` on non-2xx responses.
1037
+
1038
+ ```ts
1039
+ import { MadeOnSol, MadeOnSolError } from "madeonsol";
1040
+
1041
+ try {
1042
+ const profile = await client.kol.wallet("invalid-wallet");
1043
+ } catch (err) {
1044
+ if (err instanceof MadeOnSolError) {
1045
+ console.error(err.message); // human-readable message
1046
+ console.error(err.status); // HTTP status code, e.g. 404
1047
+ console.error(err.body); // raw response body
1048
+ }
1049
+ }
1050
+ ```
1051
+
1052
+ ---
1053
+
1054
+ ## Exported types
1055
+
1056
+ All types are exported from the main entry point:
1057
+
1058
+ ```ts
1059
+ import type {
1060
+ // Errors
1061
+ MadeOnSolError,
1062
+
1063
+ // KOL
1064
+ KolTrade,
1065
+ KolFeedParams,
1066
+ KolFeedResponse,
1067
+ KolLeaderboardParams,
1068
+ KolLeaderboardResponse,
1069
+ KolLeaderboardEntry,
1070
+ KolWalletParams,
1071
+ KolWalletProfile,
1072
+ KolCoordinationParams,
1073
+ KolCoordinationResponse,
1074
+ CoordinatedToken,
1075
+ KolTokenActivity,
1076
+ KolPnlByToken,
1077
+
1078
+ // Deployer
1079
+ DeployerStats,
1080
+ DeployerLeaderboardParams,
1081
+ DeployerLeaderboardResponse,
1082
+ DeployerLeaderboardEntry,
1083
+ DeployerProfile,
1084
+ DeployerToken,
1085
+ DeployerTokensParams,
1086
+ DeployerTokensResponse,
1087
+ DeployerAlertsParams,
1088
+ DeployerAlertsResponse,
1089
+ DeployerAlert,
1090
+ DeployerAlertStatsParams,
1091
+ DeployerAlertStats,
1092
+ BestTokensParams,
1093
+ BestTokensResponse,
1094
+ BestToken,
1095
+ RecentBondsParams,
1096
+ RecentBondsResponse,
1097
+ RecentBond,
1098
+
1099
+ // Tools
1100
+ ToolsSearchParams,
1101
+ ToolsSearchResponse,
1102
+ Tool,
1103
+
1104
+ // KOL PnL & Trending
1105
+ KolPnlResponse,
1106
+ KolTrendingTokensResponse,
1107
+ TrendingToken,
1108
+
1109
+ // Alpha Wallet Intelligence
1110
+ AlphaWalletEntry,
1111
+ AlphaLeaderboardResponse,
1112
+ AlphaWalletResponse,
1113
+ AlphaLinkedResponse,
1114
+ AlphaCapTableResponse,
1115
+ AlphaBuyerQualityResponse,
1116
+
1117
+ // Wallet Tracker
1118
+ WalletEntry,
1119
+ WatchlistResponse,
1120
+ WalletTrackerEvent,
1121
+ WalletTrackerTradesResponse,
1122
+ WalletTrackerSummaryResponse,
1123
+
1124
+ // Streaming
1125
+ StreamToken,
1126
+
1127
+ // Webhooks
1128
+ Webhook,
1129
+ WebhookCreateParams,
1130
+ WebhookUpdateParams,
1131
+ WebhookListResponse,
1132
+
1133
+ // Enums / unions
1134
+ KolAction,
1135
+ LeaderboardPeriod,
1136
+ CoordinationPeriod,
1137
+ DeployerTier,
1138
+ DeployerSortField,
1139
+ AlertPeriod,
1140
+ BestTokensPeriod,
1141
+ } from "madeonsol";
1142
+ ```
1143
+
1144
+ ---
1145
+
1146
+ ## Related
1147
+
1148
+ - [MadeOnSol website](https://madeonsol.com) — Browse 950+ Solana tools
1149
+ - [API documentation](https://madeonsol.com/api-docs) — Interactive endpoint reference
1150
+ - [MadeOnSol on GitHub](https://github.com/LamboPoewert/madeonsol) — Main project repository
1151
+
1152
+ ## Also Available
1153
+
1154
+ | Platform | Package |
1155
+ |---|---|
1156
+ | Rust | [`madeonsol`](https://crates.io/crates/madeonsol) on crates.io |
1157
+ | Python (LangChain, CrewAI) | [`madeonsol-x402`](https://pypi.org/project/madeonsol-x402/) on PyPI |
1158
+ | MCP Server (Claude, Cursor) | [`mcp-server-madeonsol`](https://www.npmjs.com/package/mcp-server-madeonsol) · [Smithery](https://smithery.ai/servers/madeonsol/solana-kol-intelligence) · [Glama](https://glama.ai/mcp/servers/LamboPoewert/mcp-server-madeonsol) |
1159
+ | ElizaOS | [`@madeonsol/plugin-madeonsol`](https://www.npmjs.com/package/@madeonsol/plugin-madeonsol) |
1160
+ | Solana Agent Kit | [`solana-agent-kit-plugin-madeonsol`](https://www.npmjs.com/package/solana-agent-kit-plugin-madeonsol) |
1161
+
1162
+ ---
1163
+
1164
+ ## License
1165
+
1166
+ MIT © [MadeOnSol](https://madeonsol.com)