robinhood-chain-sdk 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MadeOnSol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # robinhood-chain-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/robinhood-chain-sdk?style=flat-square)](https://www.npmjs.com/package/robinhood-chain-sdk)
4
+ [![npm downloads](https://img.shields.io/npm/dm/robinhood-chain-sdk?style=flat-square)](https://www.npmjs.com/package/robinhood-chain-sdk)
5
+ [![GitHub stars](https://img.shields.io/github/stars/madeonsol/robinhood-chain-sdk?style=flat-square&logo=github)](https://github.com/madeonsol/robinhood-chain-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
+ > **Robinhood Chain API / SDK β€” EVM-native on-chain trading intelligence for Robinhood Chain (chain id 4663).** The official, fully-typed, zero-dependency TypeScript client for live KOL trades, token discovery & launch-bundle detection, the Uniswap DEX trade tape, 1-minute OHLC candles, deployer reputation, and smart-money wallet rankings β€” served from a self-hosted Robinhood Chain node.
11
+
12
+ > ⭐ **[Star on GitHub](https://github.com/madeonsol/robinhood-chain-sdk)** Β· πŸ“‚ **[Examples](./examples/)** Β· 🌐 **[Robinhood Chain](https://madeonsol.com/robinhood)** Β· πŸ“š **[API docs](https://madeonsol.com/api-docs)**
13
+
14
+ Robinhood Chain (RHC) is an **Arbitrum Orbit L2, chain id 4663**. This SDK wraps the MadeOnSol Robinhood Chain API β€” every field is EVM-native (`token_address` lowercase `0x`, `eth_amount`, `tx_hash`, `block_number`, `net_flow_eth`). It runs in Node.js β‰₯ 18 and edge runtimes with **zero runtime dependencies** (native `fetch`; the WebSocket stream uses the optional `ws` package on Node < 22 and the platform WebSocket everywhere else).
15
+
16
+ The KOL→EVM mapping is unique to MadeOnSol: each tracked Solana KOL's Robinhood-Chain wallet is recovered by tracing their Solana→EVM bridge deposits (deBridge / Relay / Mayan / Wormhole), then attributed on-chain via `tx.from`. Robinhood Chain coverage is **bundled into every MadeOnSol tier at no extra cost — same `msk_` API key, same base URL** as the Solana product.
17
+
18
+ ## Quick start (10 seconds)
19
+
20
+ ```bash
21
+ npm install robinhood-chain-sdk
22
+ ```
23
+
24
+ ```ts
25
+ import { RobinhoodClient } from "robinhood-chain-sdk";
26
+
27
+ const client = new RobinhoodClient({ apiKey: "msk_..." }); // free key at madeonsol.com/developer
28
+
29
+ // Tokens being bought by 2+ tracked KOLs on Robinhood Chain right now
30
+ const { tokens } = await client.kol.hotTokens({ window: "1h" });
31
+ console.log(tokens[0]?.token_symbol, tokens[0]?.kols_buying, "KOLs, net", tokens[0]?.net_eth, "ETH");
32
+ ```
33
+
34
+ Requires **Node.js β‰₯ 18** (native `fetch`). Works in Cloudflare Workers, Vercel Edge, Bun, and Deno.
35
+
36
+ ## Authentication
37
+
38
+ Get a free API key at **[madeonsol.com/developer](https://madeonsol.com/developer)** β€” keys start with `msk_`. The same key unlocks both the Solana API and Robinhood Chain.
39
+
40
+ ```ts
41
+ const client = new RobinhoodClient({
42
+ apiKey: process.env.MADEONSOL_API_KEY!,
43
+ maxRetries: 2, // optional β€” auto-retry on 429 / 5xx with backoff (default 2)
44
+ });
45
+ ```
46
+
47
+ ## Every endpoint β†’ SDK method
48
+
49
+ All 14 Robinhood Chain endpoints live under `https://madeonsol.com/api/v1`. Bearer `msk_` auth on every call.
50
+
51
+ | # | Endpoint | SDK method | Tier |
52
+ |---|---|---|---|
53
+ | 1 | `GET /rhc/kol/feed` | `client.kol.feed(params?)` | BASIC |
54
+ | 2 | `GET /rhc/kol/leaderboard` | `client.kol.leaderboard(params?)` | BASIC |
55
+ | 3 | `GET /rhc/kol/hot-tokens` | `client.kol.hotTokens(params?)` | BASIC |
56
+ | 4 | `GET /rhc/kol/{wallet}` | `client.kol.wallet(wallet)` | BASIC |
57
+ | 5 | `GET /rhc/trades` | `client.trades(params?)` | PRO+ |
58
+ | 6 | `GET /rhc/tokens` | `client.tokens.list(params?)` | PRO+ |
59
+ | 7 | `GET /rhc/tokens/{address}` | `client.tokens.get(address)` | BASIC |
60
+ | 8 | `GET /rhc/tokens/{address}/candles` | `client.tokens.candles(address, params?)` | PRO+ |
61
+ | 9 | `GET /rhc/tokens/{address}/kol-consensus` | `client.tokens.kolConsensus(address)` | PRO+ |
62
+ | 10 | `GET /rhc/tokens/{address}/buyer-quality` | `client.tokens.buyerQuality(address)` | BASIC |
63
+ | 11 | `GET /rhc/tokens/{address}/bundle` | `client.tokens.bundle(address)` | BASIC |
64
+ | 12 | `GET /rhc/deployer-hunter/leaderboard` | `client.deployerHunter.leaderboard(params?)` | BASIC |
65
+ | 13 | `GET /rhc/deployer-hunter/{address}` | `client.deployerHunter.profile(address)` | BASIC |
66
+ | 14 | `GET /rhc/alpha-wallets` | `client.alphaWallets(params?)` | PRO+ |
67
+ | + | `POST /stream/token` β†’ WebSocket | `client.stream.connect()` | PRO+ |
68
+
69
+ ## What you can build
70
+
71
+ - **KOL copy-trading on Robinhood Chain** β€” stream `client.kol.feed()` / the `rhc:kol_trades` channel and mirror verified-KOL buys, EVM-native.
72
+ - **Consensus scanner** β€” `client.kol.hotTokens()` surfaces tokens 2+ KOLs are accumulating, ranked by buyer count then ETH flow.
73
+ - **Launch-bundle / rug gate** β€” `client.tokens.bundle()` flags a same-block early-buyer bundle and how much of supply it still holds; `client.tokens.buyerQuality()` scores the first-20 cohort 0–100 with a dump-cluster ensemble.
74
+ - **MEV / sandwich analysis** β€” `client.trades()` gives every Uniswap v2/v3/v4 swap with the real trader EOA (`tx.from`), `gas_price`, `tx_index`, and `method_selector`.
75
+ - **Deployer due-diligence** β€” `client.deployerHunter.leaderboard()` / `.profile()` rank 40k+ RHC deployers (graduation = $40K peak MC, runner = $100K).
76
+ - **Smart-money discovery** β€” `client.alphaWallets()` ranks trader wallets by realized net ETH, win rate, and memecoin share, flagging bot fleets and known KOLs.
77
+ - **Charting** β€” `client.tokens.candles()` returns 1-minute price + market-cap OHLC with buy/sell volume split.
78
+
79
+ ## KOL trade intelligence β€” `client.kol`
80
+
81
+ ### `client.kol.feed(params?)` β€” `GET /rhc/kol/feed` (BASIC)
82
+
83
+ Live buy/sell feed from tracked KOLs' verified Robinhood-Chain wallets, enriched with the token's current/peak MC, deployer tier, and `mc_multiple_since_trade` ("did the call run").
84
+
85
+ ```ts
86
+ const { trades, next_before } = await client.kol.feed({
87
+ limit: 50, // 1–100
88
+ action: "buy", // "buy" | "sell"
89
+ kol: "0xabc…", // filter to one KOL's EVM wallet
90
+ min_eth: 0.25, // minimum trade size in ETH
91
+ // before: next_before, // cursor β€” page backwards
92
+ });
93
+ for (const t of trades) {
94
+ console.log(t.kol_name, "bought", t.token_symbol, `${t.eth_amount} ETH`, `${t.mc_multiple_since_trade}x since`);
95
+ }
96
+ ```
97
+
98
+ Returns `RhcKolFeedResponse` β€” `{ chain, trades: RhcKolFeedTrade[], count, data_age_seconds, next_before }`.
99
+
100
+ ### `client.kol.leaderboard(params?)` β€” `GET /rhc/kol/leaderboard` (BASIC)
101
+
102
+ KOLs ranked by trade count then net ETH flow over `24h` / `7d` / `30d`. `net_eth` is buyβˆ’sell flow (not realized PnL).
103
+
104
+ ```ts
105
+ const { leaderboard } = await client.kol.leaderboard({ period: "7d", limit: 25 });
106
+ ```
107
+
108
+ ### `client.kol.hotTokens(params?)` β€” `GET /rhc/kol/hot-tokens` (BASIC)
109
+
110
+ Tokens bought by **2+ distinct KOLs** in the window (`5m`/`15m`/`1h`/`6h`/`24h`) β€” a consensus signal.
111
+
112
+ ```ts
113
+ const { tokens } = await client.kol.hotTokens({ window: "1h" });
114
+ ```
115
+
116
+ ### `client.kol.wallet(wallet)` β€” `GET /rhc/kol/{wallet}` (BASIC)
117
+
118
+ Aggregate stats over one KOL's last 200 RHC trades plus their 50 most recent.
119
+
120
+ ```ts
121
+ const profile = await client.kol.wallet("0xabc…");
122
+ console.log(profile.kol_name, profile.stats.net_eth, "ETH net");
123
+ ```
124
+
125
+ ## DEX trade tape β€” `client.trades(params?)` β€” `GET /rhc/trades` (PRO+)
126
+
127
+ Every Uniswap v2/v3/v4 swap on chain 4663, ~sub-second from execution. Each row carries the authoritative trader wallet (`trader_eoa` = `tx.from`, not the router), gas/ordering for MEV work, pool state, and KOL/deployer flags. Cursor via `next_before`.
128
+
129
+ ```ts
130
+ const { trades } = await client.trades({
131
+ token: "0xdef…", // filter to one token
132
+ dex: "uniswap-v3", // "uniswap-v2" | "uniswap-v3" | "uniswap-v4"
133
+ min_eth: 1,
134
+ limit: 100,
135
+ });
136
+ for (const t of trades) {
137
+ console.log(t.trader_eoa, t.action, t.eth_amount, "ETH", "gas", t.gas_price, "gwei", t.is_kol ? `(KOL ${t.kol_name})` : "");
138
+ }
139
+ ```
140
+
141
+ ## Token intelligence β€” `client.tokens`
142
+
143
+ | Method | Endpoint | Tier | Returns |
144
+ |---|---|---|---|
145
+ | `list(params?)` | `/rhc/tokens` | PRO+ | Live-priced token discovery β€” MC, liquidity, peak MC + drawdown, launchpad, deployer tier. Sort by `last_trade` / `market_cap` / `liquidity` / `peak_mc`. |
146
+ | `get(address)` | `/rhc/tokens/{address}` | BASIC | Full snapshot: metadata, price/MC/FDV, peak + drawdown, deployer reputation block, KOL activity, pool inventory. |
147
+ | `candles(address, params?)` | `/rhc/tokens/{address}/candles` | PRO+ | 1-minute price + market-cap OHLC, close liquidity, volume with buy/sell split, trade counts. |
148
+ | `kolConsensus(address)` | `/rhc/tokens/{address}/kol-consensus` | PRO+ | KOL buyers vs sellers, `kol_exit_rate`, `net_flow_eth`, median entry MC, first touch. ULTRA adds buyer/exited wallet lists. |
149
+ | `buyerQuality(address)` | `/rhc/tokens/{address}/buyer-quality` | BASIC | 0–100 first-20 buyer-cohort quality β€” win-rate, KOL presence, bot-domination, bundle-buyer legs, dump-cluster ensemble. |
150
+ | `bundle(address)` | `/rhc/tokens/{address}/bundle` | BASIC | Same-block launch-bundle detection + how much of what the cohort bought it still holds. |
151
+
152
+ ```ts
153
+ // Launch-bundle + quality gate before buying
154
+ const { bundle } = await client.tokens.bundle("0xdef…");
155
+ const quality = await client.tokens.buyerQuality("0xdef…");
156
+ if (bundle.bundle_kind === "same_block" && (bundle.held_pct_of_supply ?? 0) > 0.2 && !bundle.fully_exited) {
157
+ // bundle still sitting on supply β€” it can dump
158
+ }
159
+ if (quality.quality.signal === "negative") { /* skip */ }
160
+ ```
161
+
162
+ > **EVM note:** Robinhood Chain is an Arbitrum Orbit L2 with no atomic multi-signer transaction, so a detected bundle is `bundle_kind: "same_block"` (or `"none"`) β€” there is no `atomic_tx` kind. KOL consensus is denominated in ETH (`net_flow_eth`).
163
+
164
+ ## Deployer reputation β€” `client.deployerHunter`
165
+
166
+ Most RHC launchpads are direct-to-DEX (no bonding curve), so "graduation" is a market-cap milestone: `graduation_rate` = share of a deployer's tokens that reached a **$40K+** peak MC; `runner_rate` = share that reached **$100K+**. `tier` is `elite` / `good` / `neutral` / `spammer`.
167
+
168
+ ```ts
169
+ // Leaderboard β€” 40k+ deployers, 5-min-refresh rollup
170
+ const { deployers, has_more } = await client.deployerHunter.leaderboard({
171
+ sort: "runner_rate", // graduation_rate | runner_rate | tokens_deployed | best_peak_mc_usd | last_deploy_at
172
+ tier: "elite",
173
+ min_tokens: 3,
174
+ limit: 20,
175
+ offset: 0,
176
+ });
177
+
178
+ // One deployer β€” unknown wallets return 200 with is_deployer:false (not a 404)
179
+ const { is_deployer, deployer, recent_tokens } = await client.deployerHunter.profile("0xabc…");
180
+ ```
181
+
182
+ ## Smart-money wallets β€” `client.alphaWallets(params?)` β€” `GET /rhc/alpha-wallets` (PRO+)
183
+
184
+ The reverse of KOL discovery: rank Robinhood Chain trader wallets by realized on-chain performance. `net_eth` is realized net flow (sell βˆ’ buy), `win_rate` is the share of tokens taken out profitably, `likely_bot` flags atomic-arb/MM fleets. RHC is dual-natured (launchpad memecoins vs tokenized stocks/stables), so filter with `min_memecoin_share` to isolate memecoin traders.
185
+
186
+ ```ts
187
+ const { wallets } = await client.alphaWallets({
188
+ classification: "smart_money", // all | human | bot | smart_money
189
+ identity: "unknown", // all | known_kol | unknown (net-new RHC smart money)
190
+ min_memecoin_share: 0.7,
191
+ sort: "net_eth", // net_eth | win_rate | trades | tokens | buy_eth | memecoin_share | last_trade_at
192
+ limit: 25,
193
+ });
194
+ ```
195
+
196
+ ## Streaming β€” `client.stream` (PRO+)
197
+
198
+ Managed WebSocket with token fetch + 24h refresh, auto-reconnect with backoff, heartbeat liveness, and typed events. Channels: **`rhc:kol_trades`** and **`rhc:trades`**.
199
+
200
+ ```ts
201
+ const stream = client.stream.connect();
202
+
203
+ stream
204
+ .on("open", () => console.log("connected"))
205
+ .on("rhc:kol_trade", (trade) => console.log("KOL trade", trade))
206
+ .on("rhc:trade", (trade) => console.log("DEX trade", trade))
207
+ .on("error", (err) => console.error(err));
208
+
209
+ stream.subscribe(["rhc:kol_trades", "rhc:trades"]);
210
+ // …later
211
+ stream.close(); // clean shutdown β€” short-lived scripts exit promptly
212
+ ```
213
+
214
+ On **Node < 22**, install the optional `ws` package (`npm i ws`) for the fastest clean exit; on Node β‰₯ 22 and in browsers the platform WebSocket is used automatically. You can also inject an implementation via `client.stream.connect({ WebSocketImpl })`.
215
+
216
+ ## Error handling
217
+
218
+ Every method throws `RobinhoodError` on a non-2xx response, with `.status`, `.body`, `.message`, and `.requestId` (the API's `_rid` β€” include it when reporting issues). Rate-limits (`429`) and transient server errors (`5xx`) are retried automatically with exponential backoff, honoring `Retry-After` / `X-RateLimit-Reset`.
219
+
220
+ ```ts
221
+ import { RobinhoodError } from "robinhood-chain-sdk";
222
+
223
+ try {
224
+ await client.trades({ limit: 100 }); // PRO+
225
+ } catch (err) {
226
+ if (err instanceof RobinhoodError) {
227
+ if (err.status === 403) console.error("Upgrade required:", err.message);
228
+ else console.error(err.status, err.requestId, err.message);
229
+ }
230
+ }
231
+ ```
232
+
233
+ ## Types & constants
234
+
235
+ Fully-typed responses and params for all 14 endpoints are exported (`RhcKolFeedResponse`, `RhcTradesResponse`, `RhcTokenSnapshot`, `RhcBundleResponse`, `RhcAlphaWalletsResponse`, …), plus shared types (`DeployerTier`, `TradeAction`, `UniswapVersion`, `RhcBundleKind`) and the `CHAIN_ID` constant (`4663`).
236
+
237
+ ## Links
238
+
239
+ - **Robinhood Chain** β€” [madeonsol.com/robinhood](https://madeonsol.com/robinhood)
240
+ - **Pricing** β€” [madeonsol.com/pricing](https://madeonsol.com/pricing) (Robinhood Chain bundled into every tier)
241
+ - **API docs** β€” [madeonsol.com/api-docs](https://madeonsol.com/api-docs)
242
+ - **Get a free key** β€” [madeonsol.com/developer](https://madeonsol.com/developer)
243
+ - **npm** β€” [robinhood-chain-sdk](https://www.npmjs.com/package/robinhood-chain-sdk)
244
+ - **GitHub** β€” [madeonsol/robinhood-chain-sdk](https://github.com/madeonsol/robinhood-chain-sdk)
245
+
246
+ ## License
247
+
248
+ MIT Β© MadeOnSol