madeonsol 2.30.0 → 2.31.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
@@ -1301,7 +1301,7 @@ stream.subscribe(["kol:trades", "deployer:alerts"]);
1301
1301
  // stream.unsubscribe([...]) / stream.close() when done
1302
1302
  ```
1303
1303
 
1304
- Channels: `kol:trades`, `kol:coordination`, `kol:first_touches`, `deployer:alerts`, `wallet_tracker:events`, `copytrade:signals`, `price_alert:events`, `sniper:deploys`, `token:graduations`, `token:prices` (**new** in the channel list — event `token:price`, per-mint price/MC ticks; PRO+, REQUIRES `filters.mints` — PRO 25 / ULTRA 100 / BUSINESS 250 per connection; a state stream, so ticks carry no id/seq and are never replayed) (every pump.fun graduation in real time, tracked deployer or not — typed `GraduationEvent`), `token:locks` (**new 2.25** — event `token:lock` for every NEW Streamflow / Jupiter Lock / Bonfida lock or vesting contract, typed `TokenLockStreamEvent`; PRO+; updates are not pushed — poll `client.token.locks()`), `token:fee_claims` (**new 2.25** — event `token:fee_claim` for every pump.fun fee event: distributions, social-handle claims, config changes, typed `TokenFeeClaimStreamEvent`; PRO+), `token:surges` (**new 2.26** — events `token:surge` / `token:revival` the moment a momentum fire is confirmed, typed `TokenSurgeStreamEvent` with `tape` / `kol` / `early_buyers` / `deployer` / `risk_flags[]`; server-side filters `kinds[]`, `tiers[]`, `launchpads[]`, `exclude_flags[]`, `min_mc_usd` / `max_mc_usd`, `deployer_tier[]` — typed `TokenSurgesSubscribeFilters`; PRO+; the +1 h `outcome` is REST-only — poll `client.token.surges()`). Lifecycle: `open`, `close`, `reconnect`, `subscribed`, `heartbeat`, `warning`, `cursor`, `replay`, `gap`, `fatal`, `error`. Node 22+ uses the global `WebSocket`; on Node < 22 also `npm i ws`.
1304
+ Channels: `kol:trades`, `kol:coordination`, `kol:first_touches`, `deployer:alerts`, `wallet_tracker:events`, `copytrade:signals`, `price_alert:events`, `sniper:deploys`, `token:graduations`, `token:prices` (**new** in the channel list — event `token:price`, per-mint price/MC ticks; PRO+, REQUIRES `filters.mints` — PRO 25 / ULTRA 100 / BUSINESS 250 per connection; a state stream, so ticks carry no id/seq and are never replayed) (every pump.fun graduation in real time, tracked deployer or not — typed `GraduationEvent`), `token:locks` (**new 2.25** — event `token:lock` for every NEW Streamflow / Jupiter Lock / Bonfida lock or vesting contract, typed `TokenLockStreamEvent`; PRO+; updates are not pushed — poll `client.token.locks()`), `token:fee_claims` (**new 2.25** — event `token:fee_claim` for every pump.fun fee event: distributions, social-handle claims, config changes, typed `TokenFeeClaimStreamEvent`; PRO+), `token:surges` (**new 2.26** — events `token:surge` / `token:revival` the moment a momentum fire is confirmed, typed `TokenSurgeStreamEvent` with `tape` / `kol` / `early_buyers` / `deployer` / `risk_flags[]`; server-side filters `kinds[]`, `tiers[]`, `launchpads[]`, `exclude_flags[]`, `min_mc_usd` / `max_mc_usd`, `deployer_tier[]` — typed `TokenSurgesSubscribeFilters`; PRO+; the +1 h `outcome` is REST-only — poll `client.token.surges()`), `token:candles`, `token:risk`, `wallet:scores` (**new, server 2026-09-23** — live 1-minute candles, risk-input changes and wallet-score changes; all PRO+ and scoped, see below). Lifecycle: `open`, `close`, `reconnect`, `subscribed`, `heartbeat`, `warning`, `cursor`, `replay`, `gap`, `fatal`, `error`. Node 22+ uses the global `WebSocket`; on Node < 22 also `npm i ws`.
1305
1305
 
1306
1306
  ##### Recovery: cursor, resume, de-duplication *(new in 2.28.0)*
1307
1307
 
@@ -1354,6 +1354,24 @@ stream.subscribe({ subId: "locks", channels: ["token:locks"], filters: { lifecyc
1354
1354
  stream.on("token:unlock_available", (e: TokenUnlockScheduleEvent) => console.log(e.unlock_kind, e.amount_raw, "claimable, not claimed"));
1355
1355
  ```
1356
1356
 
1357
+ #### Candles, risk inputs and wallet scores *(server 2026-09-23)*
1358
+
1359
+ Three PRO+ channels, all **scoped** (per-connection cap PRO 25 / ULTRA 100 / BUSINESS 250, counted across named subscriptions; over the cap or without a scope the channel is rejected, never truncated):
1360
+
1361
+ - **`token:candles`** — `filters.mints` (REQUIRED, a budget separate from `token:prices`). `candle:closed` carries the stored 1-minute row (`TokenCandleClosedEvent`, id `candle:solana:<mint>:<bucket epoch s>`, ≈ ≤ 25 s after the minute ends; fully flat zero-trade minutes are skipped) and resumes durably. `filters.updates: true` adds `candle:update`, the in-progress minute (`TokenCandleUpdateEvent`, ≤ 1 per mint per second, a state stream: no id, never replayed, no snapshot). Filters `TokenCandlesFilters`.
1362
+ - **`token:risk`** — `filters.mints` (REQUIRED). Risk-INPUT changes, not a score stream: `risk:authority_changed` (mint / freeze authority revoked, Token-2022 transfer fee changed) and `risk:supply_inflated` (first crossing of 0.5 % / 5 % supply drift), plus one `risk:inputs` snapshot frame per mint (`frame.snapshot === true`) on subscribe, scope change and resume. Optional `risk_events[]`, `risk_snapshot` (default `true`). Types `TokenRiskFilters`, `TokenRiskAuthorityChangedEvent`, `TokenRiskSupplyInflatedEvent`, `TokenRiskInputsSnapshot`.
1363
+ - **`wallet:scores`** — `filters.wallets` (REQUIRED, base58). `deployer:tier_changed` (`DeployerTierChangedEvent`; `entered_ranking: true` when a wallet leaves `unranked`) and `kol:score_state_changed` (`is_cold` / `is_heating_up` / `auto_strategy_tag`, `KolScoreStateChangedEvent`). Every frame carries `computed_at` + `source` (`live_write` / `scheduled_recompute` / `matview_refresh`): "recomputed at T", not "changed at T". Optional `score_events[]`.
1364
+
1365
+ ```ts
1366
+ const stream = client.stream.connect();
1367
+ stream.subscribe({ subId: "candles", channels: ["token:candles"], filters: { mints: [MINT], updates: true } });
1368
+ stream.subscribe({ subId: "risk", channels: ["token:risk"], filters: { mints: [MINT] } });
1369
+ stream.subscribe({ subId: "scores", channels: ["wallet:scores"], filters: { wallets: [DEPLOYER] } });
1370
+ stream.on("candle:closed", (c: TokenCandleClosedEvent) => console.log(c.bucket_start, c.open_price_usd, c.close_price_usd, c.volume_usd));
1371
+ stream.on("risk:authority_changed", (e: TokenRiskAuthorityChangedEvent) => console.log(e.mint, e.field, e.before, "→", e.after));
1372
+ stream.on("deployer:tier_changed", (e: DeployerTierChangedEvent) => console.log(e.wallet, e.tier_before, "→", e.tier_after, e.source));
1373
+ ```
1374
+
1357
1375
  #### `client.stream.sessions()` / `client.stream.deleteSession(id)` *(new in 2.17 — PRO+)*
1358
1376
 
1359
1377
  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.
package/dist/index.d.ts CHANGED
@@ -2182,6 +2182,257 @@ export interface TokenUnlockScheduleEvent extends TokenLockLifecycleBase {
2182
2182
  }
2183
2183
  /** Any lifecycle payload on `token:locks` — narrow on the frame's `event`. */
2184
2184
  export type TokenLockLifecycleEvent = TokenLockClaimedEvent | TokenLockCancelledEvent | TokenLockClosedEvent | TokenLockUpdatedEvent | TokenUnlockScheduleEvent;
2185
+ /**
2186
+ * `token:candles` subscribe filters (PRO+). `mints` is REQUIRED (base58) and
2187
+ * capped per CONNECTION across named subscriptions — PRO 25 / ULTRA 100 /
2188
+ * BUSINESS 250, a budget separate from `token:prices`. Over the cap, a missing
2189
+ * scope or a non-boolean `updates` rejects the channel, never truncates.
2190
+ */
2191
+ export interface TokenCandlesFilters {
2192
+ mints: string[];
2193
+ /** Also receive the in-progress minute as `candle:update` (a state stream). Default false. */
2194
+ updates?: boolean;
2195
+ }
2196
+ /**
2197
+ * `candle:closed` frame `data` on `token:candles` — the STORED 1-minute row
2198
+ * (`token_ohlc_1m`), identical live and on a durable resume. Every key is
2199
+ * always present (null when unknown). Frame id =
2200
+ * `candle:solana:<mint>:<bucket_start epoch s>` (not event-prefixed). A fully
2201
+ * flat zero-trade candle (o = h = l = c, trades 0) is never emitted.
2202
+ */
2203
+ export interface TokenCandleClosedEvent {
2204
+ chain: "solana";
2205
+ mint: string;
2206
+ bucket_start: string;
2207
+ /** bucket_start + 60 s. */
2208
+ bucket_end: string;
2209
+ /** When the row was first written (≈ ≤ 25 s after bucket_end). */
2210
+ closed_at: string | null;
2211
+ open_price_usd: number | null;
2212
+ high_price_usd: number | null;
2213
+ low_price_usd: number | null;
2214
+ close_price_usd: number | null;
2215
+ open_mc_usd: number | null;
2216
+ high_mc_usd: number | null;
2217
+ low_mc_usd: number | null;
2218
+ close_mc_usd: number | null;
2219
+ open_liquidity_usd: number | null;
2220
+ close_liquidity_usd: number | null;
2221
+ close_supply: number | null;
2222
+ volume_usd: number | null;
2223
+ volume_mev_usd: number | null;
2224
+ buy_volume_usd: number | null;
2225
+ sell_volume_usd: number | null;
2226
+ trades: number | null;
2227
+ buy_count: number | null;
2228
+ sell_count: number | null;
2229
+ dex: string | null;
2230
+ pool_address: string | null;
2231
+ write_id: string | null;
2232
+ final: true;
2233
+ source: "token_ohlc_1m";
2234
+ }
2235
+ /**
2236
+ * `candle:update` frame `data` (only with `filters.updates: true`) — the
2237
+ * producer's in-progress minute, ≤ 1 per mint per second. A state stream: no
2238
+ * id / seq, never replayed, no snapshot on subscribe.
2239
+ */
2240
+ export interface TokenCandleUpdateEvent {
2241
+ chain: "solana";
2242
+ mint: string;
2243
+ bucket_start: string;
2244
+ bucket_end: string;
2245
+ open_price_usd: number | null;
2246
+ high_price_usd: number | null;
2247
+ low_price_usd: number | null;
2248
+ close_price_usd: number | null;
2249
+ close_mc_usd: number | null;
2250
+ volume_usd: number | null;
2251
+ trades: number | null;
2252
+ final: false;
2253
+ /** The producer's timestamp of this state (ISO). */
2254
+ as_of: string | null;
2255
+ source: "mc-tracker:open_candle";
2256
+ }
2257
+ /** Event types on `token:risk`. */
2258
+ export type TokenRiskEventName = "risk:authority_changed" | "risk:supply_inflated";
2259
+ /**
2260
+ * `token:risk` subscribe filters (PRO+). `mints` is REQUIRED (base58), capped
2261
+ * per connection PRO 25 / ULTRA 100 / BUSINESS 250. Invalid values reject the
2262
+ * channel (`channels_rejected`) or the whole update (`invalid_filters`).
2263
+ */
2264
+ export interface TokenRiskFilters {
2265
+ mints: string[];
2266
+ /** Non-empty subset of the channel's event types. */
2267
+ risk_events?: TokenRiskEventName[];
2268
+ /** Send one `risk:inputs` snapshot per mint on subscribe / scope change / resume. Default true. */
2269
+ risk_snapshot?: boolean;
2270
+ }
2271
+ /**
2272
+ * `risk:authority_changed` — the stored mint / freeze authority went from not
2273
+ * revoked to revoked (once per mint + field, ever), or the Token-2022 transfer
2274
+ * fee changed with both values known. Never a re-enable, never a first
2275
+ * observation. Frame id = `risk:authority_changed:<event_key>`.
2276
+ */
2277
+ export interface TokenRiskAuthorityChangedEvent {
2278
+ chain: "solana";
2279
+ mint: string;
2280
+ /** `<mint>:mint_authority:revoked` | `<mint>:freeze_authority:revoked` | `<mint>:transfer_fee:<before>><after>:<observed_at ms>`. */
2281
+ event_key: string;
2282
+ field: "mint_authority" | "freeze_authority" | "transfer_fee";
2283
+ /** `{revoked}` for the authorities, `{transfer_fee_bps}` for the fee. */
2284
+ before: {
2285
+ revoked: boolean;
2286
+ } | {
2287
+ transfer_fee_bps: number;
2288
+ };
2289
+ after: {
2290
+ revoked: boolean;
2291
+ } | {
2292
+ transfer_fee_bps: number;
2293
+ };
2294
+ /** The full picture after the change. */
2295
+ mint_authority_revoked: boolean | null;
2296
+ freeze_authority_revoked: boolean | null;
2297
+ transfer_fee_bps: number | null;
2298
+ is_token_2022: boolean | null;
2299
+ /** When mc-tracker parsed the mint account that showed the change. */
2300
+ observed_at: string | null;
2301
+ /** The parse before: the change happened on chain in between. */
2302
+ previous_observed_at: string | null;
2303
+ written_at: string;
2304
+ slot: null;
2305
+ source: "token_prices";
2306
+ }
2307
+ /**
2308
+ * `risk:supply_inflated` — the first `supply_drift_events` row for the mint
2309
+ * reaching a level (warn 0.5 % / danger 5 %). Per-observation drift, not a
2310
+ * cumulative inflation. Frame id = `risk:supply_inflated:<event_key>`.
2311
+ */
2312
+ export interface TokenRiskSupplyInflatedEvent {
2313
+ chain: "solana";
2314
+ mint: string;
2315
+ /** `<mint>:supply_inflated:warn` | `<mint>:supply_inflated:danger`. */
2316
+ event_key: string;
2317
+ level: "warn" | "danger";
2318
+ /** 0.5 (warn) | 5 (danger). */
2319
+ threshold_pct: number;
2320
+ /** drift / expected of one drift row, in percent, 4 dp. */
2321
+ inflation_pct: number;
2322
+ /** Integer strings. */
2323
+ expected_supply_raw: string;
2324
+ onchain_supply_raw: string;
2325
+ drift_raw: string;
2326
+ detected_at: string;
2327
+ drift_event_id: number;
2328
+ window_days: 30;
2329
+ written_at: string;
2330
+ slot: null;
2331
+ source: "supply_drift_events";
2332
+ }
2333
+ /**
2334
+ * `risk:inputs` snapshot frame `data` (frame `snapshot: true`, no id / seq):
2335
+ * the CURRENT stored risk inputs of one scoped mint. Not the score or band —
2336
+ * `GET /tokens/{mint}/risk` computes those.
2337
+ */
2338
+ export interface TokenRiskInputsSnapshot {
2339
+ chain: "solana";
2340
+ mint: string;
2341
+ /** false = the mint is not in the price table (every input null). */
2342
+ tracked: boolean;
2343
+ mint_authority_revoked: boolean | null;
2344
+ freeze_authority_revoked: boolean | null;
2345
+ transfer_fee_bps: number | null;
2346
+ is_token_2022: boolean | null;
2347
+ authority_observed_at: string | null;
2348
+ /** Worst positive supply drift in the last 30 days; null when none. `level` null below 0.5 %. */
2349
+ supply_inflation: {
2350
+ inflation_pct: number;
2351
+ level: "warn" | "danger" | null;
2352
+ detected_at: string | null;
2353
+ window_days: 30;
2354
+ } | null;
2355
+ source: "token_prices+supply_drift_events";
2356
+ }
2357
+ /** Any event payload on `token:risk` — narrow on the frame's `event`. */
2358
+ export type TokenRiskEvent = TokenRiskAuthorityChangedEvent | TokenRiskSupplyInflatedEvent;
2359
+ /** Event types on `wallet:scores`. */
2360
+ export type WalletScoreEventName = "deployer:tier_changed" | "kol:score_state_changed";
2361
+ /**
2362
+ * `wallet:scores` subscribe filters (PRO+). `wallets` is REQUIRED — base58
2363
+ * deployer or KOL wallets — capped per connection per chain PRO 25 / ULTRA 100
2364
+ * / BUSINESS 250. A subscription that also holds `rhc:wallet_scores` may mix
2365
+ * in 0x addresses; an entry of a chain the subscription does not hold is refused.
2366
+ */
2367
+ export interface WalletScoresFilters {
2368
+ wallets: string[];
2369
+ /** Optional subset of the held channels' event types (e.g. `"rhc:deployer_tier_changed"` when mixing chains). */
2370
+ score_events?: Array<WalletScoreEventName | "rhc:deployer_tier_changed">;
2371
+ }
2372
+ /**
2373
+ * Where a score event came from. `computed_at` means "recomputed at T", not
2374
+ * "changed at T": `live_write` = a bond / deploy re-classified the deployer
2375
+ * (real time); `scheduled_recompute` = the 6-hourly stats worker (can lag the
2376
+ * stats by hours); `matview_refresh` = the KOL diff after each 10-min refresh.
2377
+ */
2378
+ export type WalletScoreSource = "live_write" | "scheduled_recompute" | "matview_refresh";
2379
+ /** Solana deployer tier values on `deployer:tier_changed`. */
2380
+ export type DeployerTierChangeValue = "elite" | "good" | "rising" | "moderate" | "cold" | "unranked";
2381
+ /**
2382
+ * `deployer:tier_changed` — `deployers.tier` changed. Frame id =
2383
+ * `deployer:tier_changed:<event_key>`. A wallet appearing is not an event;
2384
+ * entering a ranked tier is (`entered_ranking: true`, `tier_before: "unranked"`).
2385
+ */
2386
+ export interface DeployerTierChangedEvent {
2387
+ /** `<wallet>:<tier_before>><tier_after>:<txid>`. */
2388
+ event_key: string;
2389
+ chain: "solana";
2390
+ wallet: string;
2391
+ tier_before: DeployerTierChangeValue | null;
2392
+ tier_after: DeployerTierChangeValue | null;
2393
+ entered_ranking: boolean;
2394
+ is_tracked: boolean | null;
2395
+ /** As of the write. */
2396
+ stats: {
2397
+ total_tokens_deployed: number | null;
2398
+ total_bonded: number | null;
2399
+ instant_bonds: number | null;
2400
+ bonding_rate: number | null;
2401
+ recent_bond_rate: number | null;
2402
+ recent_outcomes: string | null;
2403
+ };
2404
+ computed_at: string;
2405
+ source: WalletScoreSource;
2406
+ }
2407
+ /** The categorical KOL score fields diffed on `kol:score_state_changed`. */
2408
+ export interface KolScoreState {
2409
+ is_cold: boolean | null;
2410
+ is_heating_up: boolean | null;
2411
+ auto_strategy_tag: KolStrategy | null;
2412
+ }
2413
+ /**
2414
+ * `kol:score_state_changed` — one event per KOL per `mv_kol_scores` refresh
2415
+ * where `is_cold`, `is_heating_up` or `auto_strategy_tag` differs (fields never
2416
+ * split). Frame id = `kol:score_state_changed:<event_key>`.
2417
+ */
2418
+ export interface KolScoreStateChangedEvent {
2419
+ /** `<wallet>:<computed_at epoch ms>`. */
2420
+ event_key: string;
2421
+ chain: "solana";
2422
+ wallet: string;
2423
+ kol_wallet_id: string | null;
2424
+ kol_name: string | null;
2425
+ /** All three for a KOL first seen after the seed. */
2426
+ changed: Array<keyof KolScoreState>;
2427
+ /** null for a first appearance. */
2428
+ before: KolScoreState | null;
2429
+ after: KolScoreState;
2430
+ computed_at: string;
2431
+ source: "matview_refresh";
2432
+ matview: "mv_kol_scores";
2433
+ }
2434
+ /** Any event payload on `wallet:scores` — narrow on the frame's `event`. */
2435
+ export type WalletScoreEvent = DeployerTierChangedEvent | KolScoreStateChangedEvent;
2185
2436
  /** pump.fun fee event types (`creator_claim` is excluded from the feed unless requested via `type=`). */
2186
2437
  export type TokenFeeEventType = "shares_created" | "shares_updated" | "shares_reset" | "distribution" | "social_pda_created" | "social_claim" | "creator_transferred" | "creator_claim";
2187
2438
  /** A shareholder on a SharingConfig: `{ address, share_bps }` (bps of the creator fee). */