madeonsol 2.28.0 → 2.30.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
@@ -12,6 +12,8 @@
12
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
13
  > Real-time Solana trading intelligence: track 1,069 KOL wallets with <3s latency on paid keys and x402 pay-per-call (free-tier live feeds are 5-min delayed), score 23,000+ Pump.fun deployers, surface deshred deploy signals **~500ms before on-chain confirmation**, detect multi-KOL coordination, score token rug-risk 0–100 with a transparent factor breakdown, expose the bundle cohort that bought a token together and how much of supply it still holds, verify any wallet's current on-chain holdings with airdrop/insider `transfer_delta` detection, push every pump.fun graduation the second it bonds, and stream every DEX trade across 9+ programs. Free tier: 200 requests/day across 40+ endpoints (live feeds 5-min delayed) — no signup payment. Get a key at [madeonsol.com/pricing](https://madeonsol.com/pricing).
14
14
 
15
+ > **New in 2.29.0 — named subscriptions: several independent subscriptions per socket.** `subscribe({ subId, channels, filters })`, `updateSubscription(subId, filters)`, `unsubscribe(subId)`, `getSubscriptions()` / `listSubscriptions()`. Each named subscription has its own channels and filters (the server caps the total per connection, default included: PRO 5, ULTRA 10, BUSINESS 20); frames carry `evt.sub_id`; an event matching several subscriptions is delivered once per subscription (dedupe per `(sub_id, id)`). Resume is per subscription with one commit for the connection. The plain `subscribe(channels, filters)` API is unchanged. See "Named subscriptions" in the stream section.
16
+
15
17
  > **New in 2.28.0 — stream recovery: resume cursor, de-duplication, honest gaps.** The managed stream now tracks the cursor `{ instance, seq, ts }` of the last frame your handlers finished and resumes after it on every reconnect (the v1 `resume` request, with an automatic fallback to `replay_since_seq` / `replay_since_ts` on older servers). Delivery is at-least-once, de-duplicated by event `id`; new lifecycle events `cursor`, `replay`, `gap` (what could not be recovered — a `seq` gap is never loss) and `fatal`. Close codes are handled: 4001 re-fetches the token (bounded), 4002 waits ≥ 60 s instead of looping every second, 4003 stops, 4008 resumes; the backoff resets only after a `subscribed` ack. Every server `warning` frame is emitted (incl. `channels_rejected` / `channels_revoked`). `STREAM_CHANNELS` lists every Solana channel and `token:prices` joins the `StreamChannel` type. See the stream section's "Recovery" notes.
16
18
 
17
19
  > **New in 2.27.0 — deployer reputation as-of a date, and creator-fee rewards.** `client.deployerHunter.deployerAsOf(wallet, { date? })` (typed `DeployerAsOfResponse`) binds `GET /deployer-hunter/{wallet}/as-of`: the deployer's reputation exactly as it stood on `date` (default today, UTC) — the latest write-on-change snapshot at or before it, so a backtest sees only what was knowable then. `snapshot.snapshot_date` can predate `requested_date` (snapshots are write-on-change); `snapshot.carried: true` marks that. No snapshot at or before the date → `as_of: false, snapshot: null` — nothing is ever synthesized. `date` must be ≥ 2026-04-07 and not in the future. `client.deployerHunter.deployerRewards(wallet)` (typed `DeployerRewardsResponse`) binds `GET /deployer-hunter/{wallet}/rewards`: pump.fun creator-fee rewards, answered two ways that are never merged — `collected` (what actually reached the wallet: direct vault claims, kept 90 days; social-handle claims; shareholder payouts on **any** token) and `attributed` (every payout on the tokens it **deployed**, split `to_self`/`to_others` + `redirected_pct` — a deployer redirecting most of its fees elsewhere is visible in the gap between the two). Every money field is `{ sol, usdc, usd }`; `usd` is `null` (never a silent 0) when a SOL amount exists and no SOL price was available. `top_tokens`/`top_recipients` (≤10, USD-sorted) show where attributed fees went, recipients flagged `is_self`/`is_social_pda`. Works for non-deployers too (`is_deployer: false`, `attributed` empty). **PRO+** (BASIC receives HTTP 403) on the keyed `msk_` API. New types: `DeployerAsOfParams`, `DeployerAsOfResponse`, `DeployerAsOfSnapshot`, `DeployerRewardsResponse`, `DeployerRewardsMoney`, `DeployerRewardsRail`, `DeployerRewardsTopToken`, `DeployerRewardsTopRecipient`, `DeployerRewardsSocial`.
@@ -1326,6 +1328,32 @@ stream.on("gap", (g) => console.warn("may be missing:", g.reasons, g.skipped));
1326
1328
  stream.on("fatal", (f) => console.error("stream stopped:", f.code, f.reason));
1327
1329
  ```
1328
1330
 
1331
+ #### Named subscriptions *(new in 2.29.0)*
1332
+
1333
+ One socket can hold several independent subscriptions, each with its own channels and filters; the server caps the total per connection, the default one included (PRO 5, ULTRA 10, BUSINESS 20). `subscribe(channels, filters)` stays the connection's `"default"` subscription and its wire is unchanged; `subscribe({ subId, channels, filters })` opens a named one (`subId`: 1-64 characters of `A-Z a-z 0-9 _ . -`). A frame delivered under a named subscription carries `evt.sub_id`. **An event that matches several subscriptions is delivered once per matching subscription**, each copy stamped with its `sub_id`: the client dedupes per `(sub_id, id)`, so the same event can legitimately reach a handler twice, under two sub_ids. Filters of one subscription never affect another. `updateSubscription(subId, filters)` REPLACES that subscription's filters (`"default"` addresses the plain one), `unsubscribe(subId)` removes it, `getSubscriptions()` is the local view and `listSubscriptions()` asks the server (`list` / `subscriptions`). Server refusals arrive as `warning` frames carrying the `sub_id` and one of `invalid_sub_id`, `too_many_subscriptions`, `unknown_sub_id`, `invalid_filters`, `channels_rejected`, `channels_revoked`, `replay_in_progress`; a subscription refused as `too_many_subscriptions` or `invalid_sub_id` is dropped locally so reconnects stop re-requesting it. Lifecycle events `updated` and `unsubscribed` surface the server acks.
1334
+
1335
+ **Resume with several subscriptions** is per subscription: on every reconnect each subscription is re-sent with the same cursor, the server serves one replay per subscription, one after another (`replay_start` … `replay_end` each carry the `sub_id`; live frames are held until the last one ends), and the cursor commits once ALL of them have ended, at the smallest `last_seq` / `last_ts` across them. The `replay` event lists `subscriptions` and the raw `ends` per subscription; a gap's `channels` entries are keyed `sub_id/channel` for named subscriptions, and an incomplete retryable replay is retried for those subscriptions only. Against an older server that ignores `sub_id`, the client emits `warning` `named_subscriptions_unsupported` once.
1336
+
1337
+ ```ts
1338
+ const stream = client.stream.connect();
1339
+ stream.subscribe({ subId: "kol-buys", channels: ["kol:trades"], filters: { action: "buy", min_sol: 1 } });
1340
+ stream.subscribe({ subId: "deploys", channels: ["deployer:alerts"], filters: { deployer_tier: ["elite"] } });
1341
+ stream.on("kol:trade", (t, evt) => console.log(evt!.sub_id, t)); // "kol-buys"
1342
+ stream.updateSubscription("kol-buys", { action: "buy", min_sol: 5 });
1343
+ console.log(await stream.listSubscriptions()); // [{ subId, channels, filters }, …]
1344
+ stream.unsubscribe("deploys");
1345
+ ```
1346
+
1347
+ #### Lock lifecycle on `token:locks` *(server 2026-09-23)*
1348
+
1349
+ Add `filters.lifecycle: true` to a `token:locks` subscription to also receive `token:lock_claimed`, `token:lock_cancelled`, `token:lock_closed`, `token:lock_updated` (`change`: `topup` | `extended` | `schedule_changed` | `recipient_changed`), `token:unlock_upcoming` (next unlock within 24 h) and `token:unlock_available` (passed within 30 min — **claimable per the schedule, not claimed**). Without `lifecycle` the channel is unchanged. Optional `events[]`, `unlock_kinds[]`, `mints[]` (≤ 500) and `include_automatic_claims` (default `false`: Streamflow keeper-cranked withdrawals, ~90 % of claims, are hidden unless set). Types `TokenLockLifecycleFilters` / `TokenLockLifecycleEvent`; raw string amounts, no USD field, no events for history.
1350
+
1351
+ ```ts
1352
+ const stream = client.stream.connect();
1353
+ stream.subscribe({ subId: "locks", channels: ["token:locks"], filters: { lifecycle: true, events: ["token:lock_claimed", "token:unlock_available"], mints: [MINT] } });
1354
+ stream.on("token:unlock_available", (e: TokenUnlockScheduleEvent) => console.log(e.unlock_kind, e.amount_raw, "claimable, not claimed"));
1355
+ ```
1356
+
1329
1357
  #### `client.stream.sessions()` / `client.stream.deleteSession(id)` *(new in 2.17 — PRO+)*
1330
1358
 
1331
1359
  Audit and evict your **live** WebSocket sessions across the KOL/deployer (`ws-streaming`) and all-DEX (`dex-stream`) services. `sessions()` lists each open connection; `deleteSession(id)` force-closes one — handy for freeing a connection slot held by a ghost/stale socket after a network drop.
@@ -1382,6 +1410,16 @@ ws.on("message", (raw) => {
1382
1410
  });
1383
1411
  ```
1384
1412
 
1413
+ #### Liquidity events — `dex:liquidity` *(server 2026-09-23)*
1414
+
1415
+ Add `liquidity: true` (in addition to trades) or `liquidity: "only"` to a subscribe for one `dex:liquidity` frame per liquidity instruction: `action` `pool_created` | `add` | `remove`, `id` = `<signature>:<ix>[.<inner>]`, `pool`, `mints[]` (raw `amount_raw`, `side` in/out), `reserves_before[]` / `reserves_after[]`, `share_of_reserves` (constant-product only), `material` (a removal of ≥ 25 % of reserves), `depth_effect`. Filters `pool(s)`, `actions[]`, `min_share_of_reserves`, `material_only`. Only fixture-verified instructions are emitted; concentrated pools report share/depth as unknown; DAMM v1, LaunchLab and Moonshot are not emitted; no USD field (`min_usd` is rejected); ring replay only.
1416
+
1417
+ ```ts
1418
+ ws.send(JSON.stringify({ type: "subscribe", sub_id: "lp-pulls", liquidity: "only",
1419
+ filters: { dex: ["raydium", "pumpswap", "meteora"], actions: ["remove"], material_only: true } }));
1420
+ // → { channel: "dex:liquidity", sub_id: "lp-pulls", id, data: { action, pool, mints, share_of_reserves, material, ... } }
1421
+ ```
1422
+
1385
1423
  #### Protocol — client → server
1386
1424
 
1387
1425
  | `type` | Required fields | Notes |
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { MadeOnSolStream } from "./stream.js";
2
2
  import type { StreamClientOptions } from "./stream.js";
3
3
  export { MadeOnSolStream, STREAM_CHANNELS } from "./stream.js";
4
- export type { StreamClientOptions, StreamChannel, StreamEventName, StreamEvent, StreamLifecycleEvent, StreamWarning, StreamCursor, StreamReplayResult, StreamGap, StreamFatal, } from "./stream.js";
4
+ export type { StreamClientOptions, StreamChannel, StreamEventName, StreamEvent, StreamLifecycleEvent, StreamWarning, StreamCursor, StreamReplayResult, StreamGap, StreamFatal, StreamSubscription, StreamSubscribeOptions, } from "./stream.js";
5
5
  export declare class MadeOnSolError extends Error {
6
6
  readonly status: number;
7
7
  readonly body: unknown;
@@ -2055,7 +2055,9 @@ export interface TokenUnlocksResponse {
2055
2055
  * lock-tracker the moment a NEW contract's account is first seen (~seconds after
2056
2056
  * the create tx). A compact writer payload, NOT the full live-derived REST row:
2057
2057
  * poll GET /tokens/{mint}/locks for the live state. Updates (claims / cancels /
2058
- * closes) are NOT pushed.
2058
+ * closes) are NOT pushed on a plain subscription — since 2026-09-23 they are
2059
+ * opt-in lifecycle events on the same channel (`filters.lifecycle: true`, see
2060
+ * {@link TokenLockLifecycleFilters} / {@link TokenLockLifecycleEvent}).
2059
2061
  */
2060
2062
  export interface TokenLockStreamEvent {
2061
2063
  lock_account: string;
@@ -2076,6 +2078,110 @@ export interface TokenLockStreamEvent {
2076
2078
  slot: number | null;
2077
2079
  created_at: string;
2078
2080
  }
2081
+ /** Lifecycle event names delivered on `token:locks` to a subscription with `filters.lifecycle: true`. */
2082
+ export type TokenLockLifecycleEventName = "token:lock_claimed" | "token:lock_cancelled" | "token:lock_closed" | "token:lock_updated" | "token:unlock_upcoming" | "token:unlock_available";
2083
+ /** Kind of unlock instant a schedule event describes. */
2084
+ export type TokenUnlockKind = "cliff" | "period" | "final" | "tranche";
2085
+ /**
2086
+ * Subscribe filters that switch `token:locks` to lifecycle mode. Without
2087
+ * `lifecycle: true` the channel carries only the `token:lock` create event,
2088
+ * byte-identical. Per (named) subscription, AND-combined; a malformed value
2089
+ * refuses the channel (`channels_rejected`) or the update (`invalid_filters`).
2090
+ */
2091
+ export interface TokenLockLifecycleFilters {
2092
+ lifecycle: true;
2093
+ /** Subset of the lifecycle event names. Create events always pass. */
2094
+ events?: TokenLockLifecycleEventName[];
2095
+ /** Narrows schedule events only. */
2096
+ unlock_kinds?: TokenUnlockKind[];
2097
+ /** Default false: Streamflow keeper-cranked withdrawals (~90 % of claims) are hidden unless true. */
2098
+ include_automatic_claims?: boolean;
2099
+ /** Token scope for creates AND lifecycle (≤ 500); applied only with `lifecycle: true`. */
2100
+ mints?: string[];
2101
+ }
2102
+ /** Fields every Solana lifecycle event carries. Frame `id` = `<event>:<event_key>`. */
2103
+ export interface TokenLockLifecycleBase {
2104
+ event_key: string;
2105
+ lock_account: string;
2106
+ mint: string;
2107
+ program: TokenLockProgram;
2108
+ /** Null on schedule events. */
2109
+ slot: number | null;
2110
+ observed_at: string | null;
2111
+ decimals?: number | null;
2112
+ }
2113
+ /** `token:lock_claimed` — withdrawn increased since the tracker's last observed state. */
2114
+ export interface TokenLockClaimedEvent extends TokenLockLifecycleBase {
2115
+ claimed_raw: string;
2116
+ withdrawn_raw: string;
2117
+ remaining_raw: string;
2118
+ partial: boolean;
2119
+ automatic_withdrawal: boolean | null;
2120
+ before: {
2121
+ withdrawn_raw: string;
2122
+ };
2123
+ after: {
2124
+ withdrawn_raw: string;
2125
+ };
2126
+ tx_signature: string | null;
2127
+ }
2128
+ /** `token:lock_cancelled`. */
2129
+ export interface TokenLockCancelledEvent extends TokenLockLifecycleBase {
2130
+ cancelled_at: string;
2131
+ withdrawn_raw: string | null;
2132
+ amount_raw: string | null;
2133
+ before: {
2134
+ cancelled_at: null;
2135
+ status: TokenLockStatus | null;
2136
+ };
2137
+ after: {
2138
+ cancelled_at: string;
2139
+ status: TokenLockStatus | null;
2140
+ };
2141
+ tx_signature: string | null;
2142
+ }
2143
+ /** `token:lock_closed` — Streamflow `closed` flag, or the account closed on chain. */
2144
+ export interface TokenLockClosedEvent extends TokenLockLifecycleBase {
2145
+ reason: "closed_flag" | "account_closed";
2146
+ withdrawn_raw?: string | null;
2147
+ amount_raw?: string | null;
2148
+ before: {
2149
+ status: TokenLockStatus | null;
2150
+ };
2151
+ after: {
2152
+ status: "closed";
2153
+ };
2154
+ tx_signature: string | null;
2155
+ }
2156
+ /** `token:lock_updated` — one event per change; `before` / `after` hold only the changed fields. */
2157
+ export interface TokenLockUpdatedEvent extends TokenLockLifecycleBase {
2158
+ change: "topup" | "extended" | "schedule_changed" | "recipient_changed";
2159
+ added_raw?: string;
2160
+ fields?: string[];
2161
+ before: Record<string, string | number | null>;
2162
+ after: Record<string, string | number | null>;
2163
+ tx_signature: string | null;
2164
+ }
2165
+ /**
2166
+ * `token:unlock_upcoming` (next unlock within 24 h) / `token:unlock_available`
2167
+ * (passed within the last 30 min — claimable PER THE SCHEDULE, NOT claimed).
2168
+ */
2169
+ export interface TokenUnlockScheduleEvent extends TokenLockLifecycleBase {
2170
+ unlock_at: string;
2171
+ unlock_kind: TokenUnlockKind;
2172
+ amount_raw: string | null;
2173
+ amount_reason: string | null;
2174
+ unlocked_total_raw: string | null;
2175
+ release_model: "periodic" | "continuous" | "tranched";
2176
+ claimable?: true;
2177
+ kind: TokenLockKind | null;
2178
+ sender: string | null;
2179
+ recipient: string | null;
2180
+ locked_amount_raw: string | null;
2181
+ withdrawn_raw: string | null;
2182
+ }
2183
+ /** Any lifecycle payload on `token:locks` — narrow on the frame's `event`. */
2184
+ export type TokenLockLifecycleEvent = TokenLockClaimedEvent | TokenLockCancelledEvent | TokenLockClosedEvent | TokenLockUpdatedEvent | TokenUnlockScheduleEvent;
2079
2185
  /** pump.fun fee event types (`creator_claim` is excluded from the feed unless requested via `type=`). */
2080
2186
  export type TokenFeeEventType = "shares_created" | "shares_updated" | "shares_reset" | "distribution" | "social_pda_created" | "social_claim" | "creator_transferred" | "creator_claim";
2081
2187
  /** A shareholder on a SharingConfig: `{ address, share_bps }` (bps of the creator fee). */