madeonsol-x402 4.4.0 → 4.5.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/dist/types.d.ts CHANGED
@@ -6,7 +6,9 @@ export interface KolTrade {
6
6
  token_name: string | null;
7
7
  token_symbol: string | null;
8
8
  action: "buy" | "sell";
9
- sol_amount: number;
9
+ /** SOL size of the trade. `null` on a sell whose SOL proceeds are unknown (they went to
10
+ * another wallet or cannot be proven; since 2026-10-18). The sell still happened. Never read null as 0. */
11
+ sol_amount: number | null;
10
12
  token_amount: number;
11
13
  /** Token market cap in USD at the moment of trade (real-time, sourced from
12
14
  * our in-memory price tracker — not the Dexscreener spot which lags). */
@@ -423,7 +425,20 @@ export interface FirstTouchSubscriptionCreateResponse {
423
425
  * below are REST-only. (The x402 route still sends deprecated wallet_address / pnl_sol /
424
426
  * total_buy_sol / total_sell_sol aliases until 2026-11-03; they are not typed.)
425
427
  */
426
- export interface KolLeaderboardEntry {
428
+ /**
429
+ * Migration 512 — realized-PnL completeness of a KOL. A KOL sell whose SOL proceeds went to another
430
+ * wallet (or cannot be proven) still reduces holdings, but its position is left out of PnL, win rate,
431
+ * ROI and rankings (never booked as 0 proceeds or a loss). Same vocabulary as /wallet/{address}/pnl.
432
+ */
433
+ export interface KolPnlCompletenessFields {
434
+ completeness?: "complete" | "incomplete";
435
+ incomplete_reasons?: Array<"proceeds_unattributed">;
436
+ /** Positions excluded from realized PnL / win rate / ROI because a sell's proceeds are unknown. */
437
+ unknown_realizations?: number;
438
+ /** KOL sells with unknown proceeds (sol_amount null) in the window. */
439
+ unknown_proceeds_sells?: number;
440
+ }
441
+ export interface KolLeaderboardEntry extends KolPnlCompletenessFields {
427
442
  wallet: string;
428
443
  name: string;
429
444
  /** Realized (cost-basis) PnL in SOL, 6 decimals. */
@@ -433,6 +448,20 @@ export interface KolLeaderboardEntry {
433
448
  buy_count: number;
434
449
  sell_count: number;
435
450
  win_rate: number | null;
451
+ /** Migration 526 (TR-14): present when win_rate is the full-history FIFO win rate (same number as the KOL profile). */
452
+ win_rate_method?: "fifo_full_history" | "unavailable";
453
+ /** not_computed_for_period: FIFO covers 7d / 30d only; other periods serve win_rate null. */
454
+ win_rate_status?: "available" | "partial" | "insufficient_sample" | "no_known_positions" | "no_closed_positions" | "unavailable" | "not_computed_for_period";
455
+ win_rate_window?: "7d" | "30d" | null;
456
+ win_rate_rule_version?: string | null;
457
+ /** Win-rate denominator (known closed positions) for win_rate_window. */
458
+ closed_positions_known?: number | null;
459
+ /** Closed positions with an unproven realization: never a win or loss, not in the denominator. */
460
+ unknown_realizations_winrate?: number | null;
461
+ win_rate_computed_at?: string | null;
462
+ /** classifier_076 = roster classifier; otherwise the auto tag and its method. */
463
+ strategy_tag_source?: "classifier_076" | "fifo_auto_v2" | "in_window_auto_512" | null;
464
+ auto_strategy_tag_source?: "fifo_auto_v2" | "in_window_auto_512";
436
465
  /** v1.12 — median hold time in minutes over the last 30 days. */
437
466
  median_hold_minutes_30d?: number | null;
438
467
  /** v1.12 — percentile rank (0-100) of early entry quality over the last 30 days. */
@@ -796,6 +825,10 @@ export interface HotToken {
796
825
  total_buy_sol: number;
797
826
  total_sell_sol: number;
798
827
  net_flow: number;
828
+ /** Sells with unknown proceeds left out of total_sell_sol / net flow (never counted as 0 SOL); null = not measured. */
829
+ unknown_proceeds_sells?: number | null;
830
+ /** false when unknown_proceeds_sells > 0; null = not measured. */
831
+ sell_sol_complete?: boolean | null;
799
832
  first_kol_buy_at?: string | null;
800
833
  first_kol_buy_age_minutes: number | null;
801
834
  /** Last KOL buy in the period (REST). */
@@ -967,7 +1000,7 @@ export interface KolEntryOrderParams {
967
1000
  limit?: number;
968
1001
  }
969
1002
  /** One requested wallet. `found: false` (not an active KOL) carries only `wallet` + `found`. */
970
- export interface KolCompareProfile {
1003
+ export interface KolCompareProfile extends KolPnlCompletenessFields {
971
1004
  wallet: string;
972
1005
  found: boolean;
973
1006
  name?: string;
@@ -994,7 +1027,37 @@ export interface KolCompareProfile {
994
1027
  percentile_pnl_30d?: number | null;
995
1028
  percentile_winrate_30d?: number | null;
996
1029
  percentile_early_entry_30d?: number | null;
997
- }
1030
+ /** Migration 512 — 7-day positions excluded from the 7-day PnL metrics (unknown proceeds). Under migration 526 (winrate_method present): the FIFO 7-day unknown realizations; the PnL counter moves to pnl_unknown_realizations_7d. */
1031
+ unknown_realizations_7d?: number;
1032
+ /** Migration 526 (TR-14): present once the FIFO win rate is served. Absent = the in-window method. */
1033
+ winrate_method?: "fifo_full_history" | "unavailable";
1034
+ /** Status of winrate_30d. */
1035
+ winrate_status?: KolWinrateStatus;
1036
+ winrate_status_7d?: KolWinrateStatus;
1037
+ winrate_status_30d?: KolWinrateStatus;
1038
+ /** Minimum known closed positions before a win rate is published. */
1039
+ winrate_min_known?: number;
1040
+ winrate_rule_version?: string | null;
1041
+ winrate_definition?: string;
1042
+ /** Win-rate denominator: completed buy lots whose realization is proven. */
1043
+ closed_positions_known_7d?: number;
1044
+ closed_positions_known_30d?: number;
1045
+ /** All completed buy lots in the window: known + unknown realizations. */
1046
+ closed_positions_all_7d?: number;
1047
+ closed_positions_all_30d?: number;
1048
+ /** Closed positions with an unproven realization: never a win or loss, not in the denominator. */
1049
+ unknown_realizations_30d?: number;
1050
+ /** Migration 526: the in-window 7-day PnL counter (positions excluded from pnl_7d for unknown proceeds). */
1051
+ pnl_unknown_realizations_7d?: number;
1052
+ /** opening_inventory_unproven / consideration_unknown / closure_unproven (KOL_WINRATE_SOURCE=fifo only). */
1053
+ unknown_by_reason_30d?: Record<string, number> | null;
1054
+ winrate_computed_at?: string | null;
1055
+ /** classifier_076 = roster classifier; otherwise the auto tag and its method. */
1056
+ strategy_tag_source?: "classifier_076" | "fifo_auto_v2" | "in_window_auto_512" | null;
1057
+ auto_strategy_tag_source?: "fifo_auto_v2" | "in_window_auto_512";
1058
+ }
1059
+ /** Migration 526 (TR-14) win-rate status vocabulary. */
1060
+ export type KolWinrateStatus = "available" | "partial" | "insufficient_sample" | "no_known_positions" | "no_closed_positions" | "unavailable";
998
1061
  export interface KolCompareOverlapToken {
999
1062
  token_mint: string;
1000
1063
  token_symbol: string | null;
@@ -1119,6 +1182,10 @@ export interface AlphaLeaderboardEntry {
1119
1182
  /** v1.24 — null (not 0) when the entry-MC aggregate failed. */
1120
1183
  entry_mc_samples?: number | null;
1121
1184
  avg_entry_mc_usd?: number | null;
1185
+ /** 2026-10 (migration 511) — early-buyer pairs whose realization is unknown (a sell whose proceeds went to another wallet); excluded from win_rate, net_pnl_sol and roi. null before migration 511. */
1186
+ unknown_realizations?: number | null;
1187
+ /** 2026-10 (migration 511) — SOL bought on those pairs, left out of net_pnl_sol and roi. */
1188
+ unknown_cost_basis_sol?: number | null;
1122
1189
  }
1123
1190
  export interface AlphaLeaderboardResponse {
1124
1191
  /** Launch-pipeline scope disclosure (absent ≠ clean). */
@@ -1153,18 +1220,28 @@ export interface AlphaWalletSummary {
1153
1220
  last_seen: string;
1154
1221
  bot_confidence: "low" | "medium" | "high" | "none";
1155
1222
  bot_signals: string[];
1223
+ /** 2026-10 (migration 511) — early-buyer pairs whose realization is unknown (a sell whose proceeds went to another wallet); excluded from win_rate, net_pnl_sol and roi. null before migration 511. */
1224
+ unknown_realizations?: number | null;
1225
+ /** 2026-10 (migration 511) — SOL bought on those pairs, left out of net_pnl_sol and roi. */
1226
+ unknown_cost_basis_sol?: number | null;
1156
1227
  }
1157
1228
  export interface AlphaWalletToken {
1158
1229
  token_mint: string;
1159
1230
  rank: number;
1160
- first_buy_sol: number;
1231
+ /** null = the first buy's SOL consideration is unknown (never reported as 0). */
1232
+ first_buy_sol: number | null;
1233
+ /** "unknown_consideration" exactly when first_buy_sol is null. */
1234
+ first_buy_sol_status: "measured" | "unknown_consideration";
1161
1235
  first_buy_at: string;
1162
- total_sol_bought: number;
1236
+ /** null when first_buy_sol is null (the first buy's cost is unknown), never the priced buys alone or 0. */
1237
+ total_sol_bought: number | null;
1163
1238
  total_sol_sold: number;
1164
- realized_pnl_sol: number;
1239
+ /** 2026-10 (migration 508) — null when the realization is unknown (a sell whose proceeds went to another wallet, price_status proceeds_unattributed); never reported as 0. */
1240
+ realized_pnl_sol: number | null;
1165
1241
  buy_count: number;
1166
1242
  sell_count: number;
1167
- result: "win" | "loss" | "open";
1243
+ /** 2026-10 (migration 508) — "unknown" when realized_pnl_sol is null: neither a win nor a loss. */
1244
+ result: "win" | "loss" | "open" | "unknown";
1168
1245
  }
1169
1246
  export interface AlphaWalletResponse {
1170
1247
  /** Launch-pipeline scope disclosure (absent ≠ clean). */
@@ -1193,8 +1270,11 @@ export type BuyerQualitySignal = "positive" | "neutral" | "negative";
1193
1270
  export interface CapTableBuyer {
1194
1271
  rank: number;
1195
1272
  wallet: string;
1196
- first_buy_sol: number;
1197
- first_buy_at: string;
1273
+ /** null = the first buy's SOL consideration is unknown (never reported as 0). */
1274
+ first_buy_sol: number | null;
1275
+ /** "unknown_consideration" exactly when first_buy_sol is null. */
1276
+ first_buy_sol_status: "measured" | "unknown_consideration";
1277
+ first_buy_at: string | null;
1198
1278
  /** Realized PnL on this token from confirmed swaps; null when unknown. */
1199
1279
  realized_pnl_sol?: number | null;
1200
1280
  total_sol_bought?: number | null;
@@ -1592,6 +1672,16 @@ export interface Candle {
1592
1672
  close_liquidity_usd?: number | null;
1593
1673
  high_mc_usd?: number | null;
1594
1674
  low_mc_usd?: number | null;
1675
+ /** Known data-quality issue for this candle (2026-10-27); null = no known issue. OHLCV is never altered. */
1676
+ quality?: CandleQuality | null;
1677
+ }
1678
+ /** Per-candle data-quality status. On rolled-up timeframes the worst status of the 1-minute buckets inside. */
1679
+ export interface CandleQuality {
1680
+ status: "contaminated_proven" | "contaminated_suspected" | "unknown";
1681
+ /** Machine-readable cause, e.g. "clmm_v2_create_as_swap". */
1682
+ reason: string;
1683
+ /** 1-minute buckets inside this candle that are listed. */
1684
+ flagged_minutes: number;
1595
1685
  }
1596
1686
  /** 1-minute-derived OHLC candles for a token. PRO/ULTRA only. */
1597
1687
  export interface CandlesResponse {
@@ -1603,6 +1693,8 @@ export interface CandlesResponse {
1603
1693
  /** True when ULTRA net-flow/liquidity fields are populated on each candle. */
1604
1694
  net_flow_included: boolean;
1605
1695
  candles: Candle[];
1696
+ /** false = the quality lookup failed, so a null candle quality means not checked (2026-10-27). */
1697
+ quality_checked?: boolean;
1606
1698
  /** true = the page budget ran out before `limit` candles or `from` was reached; covered_from is then the oldest instant actually searched. */
1607
1699
  truncated?: boolean;
1608
1700
  covered_from?: string;
@@ -1692,6 +1784,87 @@ export interface BundleWallet {
1692
1784
  slot: number;
1693
1785
  } | null;
1694
1786
  }
1787
+ export type InsiderFlowNullReason = "unpriced_trades" | "firehose_gap" | "gap_state_unverified" | "not_captured" | "capture_unverified" | "no_buy_volume" | "buy_volume_incomplete" | "liquidity_unknown" | "liquidity_stale" | "sol_price_unavailable";
1788
+ /** One cohort (or the deduplicated `insiders` union) in one window. Every amount is null when the window is `not_captured`. */
1789
+ export interface InsiderFlowCohort {
1790
+ wallets_trading: number | null;
1791
+ wallets_selling: number | null;
1792
+ buy_trades: number | null;
1793
+ sell_trades: number | null;
1794
+ /** Proven SOL spent on buys; unpriced trades are excluded and counted in unpriced_trades. */
1795
+ buy_sol: number | null;
1796
+ sell_sol: number | null;
1797
+ sell_tokens: number | null;
1798
+ unpriced_trades: number | null;
1799
+ amounts: "complete" | "partial" | null;
1800
+ /** sell_sol - buy_sol (positive = net selling); null when amounts are partial or the window overlaps a capture gap. */
1801
+ net_sell_sol: number | null;
1802
+ net_sell_usd: number | null;
1803
+ /** PERCENT of every proven buy in the window. */
1804
+ net_sell_pct_of_buy_volume: number | null;
1805
+ /** PERCENT of the token liquidity in USD. */
1806
+ net_sell_pct_of_liquidity: number | null;
1807
+ null_reasons: Partial<Record<"net_sell_sol" | "net_sell_usd" | "net_sell_pct_of_buy_volume" | "net_sell_pct_of_liquidity", InsiderFlowNullReason>>;
1808
+ }
1809
+ export interface InsiderFlowWindow {
1810
+ from: string;
1811
+ to: string;
1812
+ seconds: number;
1813
+ status: "ok" | "no_trades" | "gap_overlap" | "gap_unverified" | "not_captured" | "capture_unverified";
1814
+ market: {
1815
+ buy_trades: number | null;
1816
+ sell_trades: number | null;
1817
+ buy_sol: number | null;
1818
+ sell_sol: number | null;
1819
+ unpriced_trades: number | null;
1820
+ };
1821
+ insiders: InsiderFlowCohort;
1822
+ by_cohort: {
1823
+ creator?: InsiderFlowCohort;
1824
+ early_buyers?: InsiderFlowCohort;
1825
+ bundlers?: InsiderFlowCohort;
1826
+ kols?: InsiderFlowCohort;
1827
+ };
1828
+ }
1829
+ /** GET /tokens/{mint}/insider-flow (PRO+): net selling by creator, early buyers, bundlers and KOLs over 5 and 15 minutes. */
1830
+ export interface TokenInsiderFlowResponse {
1831
+ mint: string;
1832
+ as_of: string;
1833
+ rule_version: string;
1834
+ time_basis: "ingest_clock";
1835
+ windows: Record<string, InsiderFlowWindow>;
1836
+ cohorts: {
1837
+ creator?: {
1838
+ status: "known" | "platform_signer" | "not_recorded";
1839
+ wallet?: string | null;
1840
+ };
1841
+ early_buyers?: {
1842
+ status: "recorded" | "not_recorded";
1843
+ wallets?: number;
1844
+ };
1845
+ bundlers?: {
1846
+ status: "detected" | "none_detected" | "not_measured";
1847
+ wallets?: number;
1848
+ };
1849
+ kols?: {
1850
+ status: "matched_on_trades";
1851
+ note?: string;
1852
+ };
1853
+ };
1854
+ completeness: Record<string, unknown>;
1855
+ liquidity: {
1856
+ liquidity_usd?: number | null;
1857
+ updated_at?: string | null;
1858
+ status?: "ok" | "unknown" | "stale" | "no_primary_pool";
1859
+ };
1860
+ sol_usd: {
1861
+ price?: number | null;
1862
+ source?: string;
1863
+ status?: "ok" | "unavailable";
1864
+ };
1865
+ coverage: Record<string, unknown>;
1866
+ note: string;
1867
+ }
1695
1868
  /**
1696
1869
  * Bundle-cohort holdings for a token. `held_pct_of_supply` (net held / circulating
1697
1870
  * supply) is the headline signal. Field-gated by tier: BASIC get the
@@ -2175,6 +2348,10 @@ export interface KolConsensus {
2175
2348
  net_flow_sol: number;
2176
2349
  total_buy_sol: number;
2177
2350
  total_sell_sol: number;
2351
+ /** Sells with unknown proceeds left out of total_sell_sol / net flow (never counted as 0 SOL); null = not measured. */
2352
+ unknown_proceeds_sells?: number | null;
2353
+ /** false when unknown_proceeds_sells > 0; null = not measured. */
2354
+ sell_sol_complete?: boolean | null;
2178
2355
  first_kol_buy_at: string | null;
2179
2356
  last_kol_buy_at: string | null;
2180
2357
  first_touch_wallet: string | null;
@@ -2253,6 +2430,8 @@ export interface TokenSnapshot {
2253
2430
  price_sol: number | null;
2254
2431
  vwap_price_usd?: number | null;
2255
2432
  vwap_price_sol?: number | null;
2433
+ /** Why the VWAP fields are null, or "ok" (2026-10-15): an implausible VWAP is withheld, never served. */
2434
+ vwap_status?: "ok" | "unavailable" | "no_price_reference" | "implausible_vs_price";
2256
2435
  market_cap: number | null;
2257
2436
  fdv_usd: number | null;
2258
2437
  liquidity_usd: number | null;
@@ -2676,7 +2855,20 @@ export interface WalletStats {
2676
2855
  sold_sol: number;
2677
2856
  unique_tokens: number;
2678
2857
  window_days: number;
2858
+ /** 2026-10 (migration 508) — cost basis consumed by sells whose proceeds went to another wallet. Not in realized PnL or ROI (neither a loss nor a gain). 0 when complete. Absent on older servers. */
2859
+ unknown_realized_cost_basis_sol?: number;
2860
+ /** 2026-10 (migration 508) — sells with price_status proceeds_unattributed. Absent on older servers. */
2861
+ unattributed_sells?: number;
2679
2862
  }
2863
+ /**
2864
+ * 2026-10 (migration 508) — realized-PnL completeness. NOT the same field as
2865
+ * `coverage.completeness` (source-coverage verification, `"not_verified"`):
2866
+ * this one says whether realized PnL / ROI include every sell's proceeds.
2867
+ */
2868
+ export type RealizedPnlCompleteness = "complete" | "incomplete";
2869
+ export type RealizedPnlIncompleteReason = "proceeds_unattributed" | "unknown_consideration" | "missing_cost_basis";
2870
+ /** known = no unattributed sell; partial = some; unknown = every sell unattributed (outcome unknown, not a loss). */
2871
+ export type RealizedStatus = "known" | "partial" | "unknown";
2680
2872
  /** Rolling dump-cluster stats for a wallet (trailing 42 days, refreshed daily).
2681
2873
  * A "dump cohort" is a first-20 buyer appearance on a token that peaked <15min
2682
2874
  * after deploy. `null` on the parent means no cohort record for the wallet. */
@@ -2756,10 +2948,15 @@ export interface WalletTopToken {
2756
2948
  sells: number;
2757
2949
  sol_in: number;
2758
2950
  sol_out: number;
2951
+ /** Known basis only (migration 508): unattributed sells are excluded, see unknown_realized_cost_basis_sol. */
2759
2952
  realized_pnl_sol: number;
2760
2953
  current_mc_usd: number | null;
2761
2954
  peak_mc_usd: number | null;
2762
2955
  last_traded_at: string;
2956
+ /** 2026-10 (migration 508). Absent on older servers. */
2957
+ unknown_realized_cost_basis_sol?: number;
2958
+ unattributed_sells?: number;
2959
+ realized_status?: RealizedStatus;
2763
2960
  }
2764
2961
  export interface WalletTradingStyle {
2765
2962
  total_trades: number;
@@ -2790,9 +2987,14 @@ export interface WalletRecentTrade {
2790
2987
  tx_signature: string;
2791
2988
  }
2792
2989
  export interface WalletStatsResponse {
2793
- /** Trade-data coverage disclosure. */
2990
+ /** Trade-data coverage disclosure (its `completeness` is source coverage, not realized PnL). */
2794
2991
  coverage?: TradeCoverage;
2795
2992
  address: string;
2993
+ /** 2026-10 (migration 508) — realized-PnL completeness over stats + top_tokens. Absent on older servers. */
2994
+ completeness?: RealizedPnlCompleteness;
2995
+ incomplete_reasons?: RealizedPnlIncompleteReason[];
2996
+ /** 2026-10 — fixed sentence: realized PnL and ROI cover the known basis only. */
2997
+ pnl_basis_note?: string;
2796
2998
  stats: WalletStats | null;
2797
2999
  flags: WalletFlags;
2798
3000
  top_tokens?: WalletTopToken[];
@@ -2821,6 +3023,10 @@ export interface WalletPnlSummary {
2821
3023
  total_pnl_sol: number;
2822
3024
  total_bought_sol: number;
2823
3025
  total_sold_sol: number;
3026
+ /** 2026-10 (migration 508) — cost basis of FIFO lots consumed by disposals whose realization is unknown (proceeds_unattributed sells). Not in realized_sol: neither a loss nor a gain. 0 when complete. Absent on analyses cached before the field existed. */
3027
+ unknown_realized_cost_basis_sol?: number;
3028
+ /** Migration 516 (not yet enabled): proven single-event SOL tips inside the basis / proceeds above; tips shared by 2+ trades of one tx are in notes.unallocated_tx_costs. */
3029
+ tips_sol?: number;
2824
3030
  wins: number;
2825
3031
  losses: number;
2826
3032
  win_rate: number | null;
@@ -2855,15 +3061,21 @@ export interface WalletClosedPosition {
2855
3061
  pnl_sol: number;
2856
3062
  roi_pct: number | null;
2857
3063
  hold_minutes: number | null;
2858
- result: "win" | "loss" | "breakeven";
3064
+ /** 2026-10 (migration 508) — "unknown": at least one disposal's realization is unknown; not a win, not a loss, not in win_rate / profit_factor; sorted after the known positions. */
3065
+ result: "win" | "loss" | "breakeven" | "unknown";
3066
+ /** 2026-10 (migration 508) — known | partial (pnl_sol is the known part) | unknown. Absent on analyses cached before the field existed. */
3067
+ realized_status?: "known" | "partial" | "unknown";
3068
+ /** 2026-10 (migration 508) — basis of the lots consumed by unknown disposals of this token; not in pnl_sol. */
3069
+ unknown_realized_cost_basis_sol?: number;
2859
3070
  first_trade: string | null;
2860
3071
  last_trade: string | null;
2861
3072
  }
2862
3073
  export interface WalletOpenPosition {
2863
3074
  token_mint: string;
2864
3075
  token_amount: number;
2865
- cost_basis_sol: number;
2866
- avg_entry_price_sol: number;
3076
+ /** null when cost_basis_status is unknown. */
3077
+ cost_basis_sol: number | null;
3078
+ avg_entry_price_sol: number | null;
2867
3079
  current_price_sol: number | null;
2868
3080
  current_value_sol: number | null;
2869
3081
  unrealized_sol: number | null;
@@ -2874,8 +3086,9 @@ export interface WalletOpenPosition {
2874
3086
  position_basis?: "swap_derived";
2875
3087
  holding_status?: "verified" | "unverified";
2876
3088
  holding_unverified_reason?: "not_checked" | "no_fresh_snapshot" | "snapshot_unreadable" | "snapshot_older_than_trades" | "decimals_mismatch" | "balance_invalid" | null;
2877
- /** partial = a verified balance exceeds the trade position; the excess arrived without a swap and has no cost basis. */
2878
- cost_basis_status?: "known" | "partial";
3089
+ /** partial = a verified balance exceeds the trade position; the excess arrived without a swap and has no cost basis.
3090
+ * unknown = part of the position was bought with unknown consideration: cost_basis_sol / avg_entry_price_sol / unrealized_* are null. */
3091
+ cost_basis_status?: "known" | "partial" | "unknown";
2879
3092
  /** Present (non-null) only when holding_status = verified. */
2880
3093
  holding?: WalletPositionHolding | null;
2881
3094
  }
@@ -2885,10 +3098,10 @@ export interface WalletPositionHolding {
2885
3098
  onchain_balance: number;
2886
3099
  held_known_amount: number;
2887
3100
  external_inflow_amount: number;
2888
- cost_basis_held_sol: number;
3101
+ cost_basis_held_sol: number | null;
2889
3102
  unrealized_known_sol: number | null;
2890
3103
  /** Cost of FIFO lots no longer in the wallet. Outcome unknown: neither realized nor unrealized. */
2891
- cost_basis_not_held_sol: number;
3104
+ cost_basis_not_held_sol: number | null;
2892
3105
  verified_at: string;
2893
3106
  source: "wallet_holdings_cache";
2894
3107
  }
@@ -2908,6 +3121,9 @@ export interface WalletHoldingCheck {
2908
3121
  export interface WalletPnlResponse {
2909
3122
  address: string;
2910
3123
  window_days: number;
3124
+ /** 2026-10 (migration 508) — "incomplete" when at least one disposal's realized PnL is unknown (a sell whose proceeds went to another wallet, price_status proceeds_unattributed; or unknown consideration). Lots are consumed (holdings right), the realization is excluded from realized_sol / win_rate / best-worst, never booked as 0 proceeds. Absent on analyses cached before the field existed. */
3125
+ completeness?: "complete" | "incomplete";
3126
+ incomplete_reasons?: Array<"proceeds_unattributed" | "unknown_consideration" | "missing_cost_basis">;
2911
3127
  summary: WalletPnlSummary;
2912
3128
  pnl_curve: WalletPnlCurvePoint[];
2913
3129
  closed_positions: WalletClosedPosition[];
@@ -2924,6 +3140,16 @@ export interface WalletPnlResponse {
2924
3140
  sells_without_cost_basis?: {
2925
3141
  tokens: number;
2926
3142
  cost_basis: "unknown";
3143
+ }; /** 2026-10 (migration 508) — disposals whose realization is unknown; their basis is excluded from every realized figure. */
3144
+ unknown_realizations?: {
3145
+ proceeds_unattributed_sells: number;
3146
+ tokens: number;
3147
+ unknown_realized_cost_basis_sol: number;
3148
+ realized_pnl: "excluded";
3149
+ }; /** Migration 516 (not yet enabled): SOL tips in no basis and no realized PnL (shared by 2+ trades of one tx, never split; or on a trade with unknown realization). */
3150
+ unallocated_tx_costs?: {
3151
+ count: number;
3152
+ sol: number;
2927
3153
  };
2928
3154
  };
2929
3155
  /** 2026-10 (COV-21) — proven-holding check summary. Absent on older responses. */
@@ -2940,6 +3166,12 @@ export interface WalletPnlResponse {
2940
3166
  }
2941
3167
  export interface WalletPositionsResponse {
2942
3168
  address: string;
3169
+ /** 2026-10 (migration 508) — realized-PnL completeness of the wallet, same values as /pnl (NOT coverage.completeness). Absent on older servers. */
3170
+ completeness?: RealizedPnlCompleteness;
3171
+ incomplete_reasons?: RealizedPnlIncompleteReason[];
3172
+ summary?: {
3173
+ unknown_realized_cost_basis_sol: number;
3174
+ };
2943
3175
  positions: WalletOpenPosition[];
2944
3176
  /** 2026-10 (COV-21) — proven-holding check summary. Absent on older responses. */
2945
3177
  holding_check?: WalletHoldingCheck;
@@ -3008,7 +3240,10 @@ export interface WalletTrade {
3008
3240
  tx_signature: string;
3009
3241
  token_mint: string;
3010
3242
  action: "buy" | "sell";
3011
- sol_amount: number;
3243
+ /** SOL moved by this trade. `null` = the SOL consideration is unproven
3244
+ * (`event.price_status` "quote_unpriced" or "proceeds_unattributed"); `0` = a measured zero.
3245
+ * Since 2026-10-28 an unproven amount is never served as 0. */
3246
+ sol_amount: number | null;
3012
3247
  token_amount: number;
3013
3248
  /** This trade's executed price — `sol_amount / token_amount`. Added 2026-08-16;
3014
3249
  * this route returned amounts and no price before. See {@link TokenTrade}. */
@@ -3023,6 +3258,8 @@ export interface WalletTrade {
3023
3258
  traded_at: string;
3024
3259
  /** Exact on-chain amounts — see {@link TradeRawAmounts}. Present once exact amounts are enabled server-side. */
3025
3260
  amounts?: TradeRawAmounts;
3261
+ /** Event identity + attribution labels — see {@link TradeEventFacts}. Present once event reads are enabled server-side. */
3262
+ event?: TradeEventFacts;
3026
3263
  }
3027
3264
  export interface WalletTradesResponse {
3028
3265
  /** Trade-data coverage disclosure. */
@@ -3070,7 +3307,10 @@ export interface TokenTrade {
3070
3307
  tx_signature: string;
3071
3308
  wallet_address: string;
3072
3309
  action: "buy" | "sell";
3073
- sol_amount: number;
3310
+ /** SOL moved by this trade. `null` = the SOL consideration is unproven
3311
+ * (`event.price_status` "quote_unpriced" or "proceeds_unattributed"); `0` = a measured zero.
3312
+ * Since 2026-10-28 an unproven amount is never served as 0. */
3313
+ sol_amount: number | null;
3074
3314
  token_amount: number;
3075
3315
  /** THIS TRADE's executed price: `sol_amount / token_amount`, so it reconciles
3076
3316
  * exactly with the amounts on the same row and with the PnL endpoints.
@@ -3099,6 +3339,69 @@ export interface TokenTrade {
3099
3339
  traded_at: string;
3100
3340
  /** Exact on-chain amounts — see {@link TradeRawAmounts}. Present once exact amounts are enabled server-side. */
3101
3341
  amounts?: TradeRawAmounts;
3342
+ /** Event identity + attribution labels — see {@link TradeEventFacts}. Present once event reads are enabled server-side. */
3343
+ event?: TradeEventFacts;
3344
+ }
3345
+ /** Event identity and attribution labels of one Solana trade row (migration 493).
3346
+ * Every field null = a netted legacy row (one row per transaction, wallet and mint),
3347
+ * which is every row stored today. Labels are open-ended strings: treat an
3348
+ * unrecognised value as "not proven". Never deduplicate on
3349
+ * (tx_signature, wallet_address); event rows of one transaction differ in event_id. */
3350
+ export interface TradeEventFacts {
3351
+ /** `signature:outer_ix[.inner_ix]`; null = netted row. */
3352
+ event_id: string | null;
3353
+ /** "signer" | "non_signer" | "unproven" (excluded from wallet-scoped reads); null = legacy row. */
3354
+ trader_status: string | null;
3355
+ /** null = priced | "quote_unpriced" | "proceeds_unattributed": with either label sol_amount is NOT the
3356
+ * consideration and price_sol / price_usd are null. */
3357
+ price_status: string | null;
3358
+ /** "chain" | "ingest_clock"; null = legacy row (ingest clock). */
3359
+ block_time_source: string | null;
3360
+ /** Migrations 515/516 (not yet enabled): proven economic settlement of an event row; null = netted / nothing proven. */
3361
+ settlement?: TradeSettlement | null;
3362
+ /** Migrations 515/516 (not yet enabled): roles the tx proves; `wallet` only for a proven signer. */
3363
+ parties?: TradeEventParty[];
3364
+ }
3365
+ /** Amounts are exact base-unit decimal strings (parse with BigInt). */
3366
+ export interface TradeSettlement {
3367
+ /** "custody_fee" | "custody_forward" | "router_funded" (later "direct" | "split_parties" | "pumpfun_multihop"); null = only tips / fees. */
3368
+ route: string | null;
3369
+ amount: {
3370
+ mint: string;
3371
+ amount_raw: string;
3372
+ } | null;
3373
+ gross_token_amount_raw: string | null;
3374
+ pool_quote: {
3375
+ mint: string;
3376
+ amount_raw: string;
3377
+ } | null;
3378
+ /** Facts only: a router_fee / pumpswap_cashback fee is never part of the trade's amounts, price, volume, cost basis or PnL. program / recipient / payer: router_fee + pumpswap_cashback only (payer = this trade's wallet, else null); recipient_account: pumpswap_cashback only. */
3379
+ fees: Array<{
3380
+ kind: "funding_fee" | "route_fee_sol" | "router_fee" | "pumpswap_cashback" | (string & {});
3381
+ mint: string;
3382
+ amount_raw: string;
3383
+ program?: string;
3384
+ recipient?: string;
3385
+ recipient_account?: string;
3386
+ payer?: string | null;
3387
+ }>;
3388
+ tips: Array<{
3389
+ amount_raw: string;
3390
+ mint: string;
3391
+ recipient: string;
3392
+ instruction_index: number;
3393
+ }>;
3394
+ /** 1 = the tips are in this trade's PnL basis; 2+ = unallocated (never split). */
3395
+ tips_shared_by_events: number | null;
3396
+ }
3397
+ export interface TradeEventParty {
3398
+ role: string;
3399
+ ordinal: number;
3400
+ is_signer: boolean | null;
3401
+ /** Only when is_signer is true. */
3402
+ wallet: string | null;
3403
+ mint: string | null;
3404
+ amount_raw: string | null;
3102
3405
  }
3103
3406
  /** Exact amounts of one Solana trade (#508). Integers are decimal STRINGS (u64
3104
3407
  * base units exceed the JS number range; parse with BigInt).
@@ -3169,6 +3472,11 @@ export interface TokenTopTrader {
3169
3472
  unmatched_sell_tokens?: number | null;
3170
3473
  /** FIFO only: every sold token matched an observed buy. null under average_cost. */
3171
3474
  cost_basis_complete?: boolean | null;
3475
+ /** 2026-10 (migration 508) — basis consumed by sells whose proceeds went to another wallet; not in realized_pnl_sol / roi. Absent on older servers. */
3476
+ unknown_realized_cost_basis_sol?: number;
3477
+ unattributed_sells?: number;
3478
+ /** "unknown" = every sell unattributed: the outcome is unknown, this wallet is not a loser. */
3479
+ realized_status?: RealizedStatus;
3172
3480
  first_trade_at: string;
3173
3481
  last_trade_at: string;
3174
3482
  is_kol: boolean;
@@ -3186,12 +3494,17 @@ export interface TokenTopTradersResponse {
3186
3494
  /** "fifo" = same cost basis as /wallet/{address}/pnl; "average_cost" = legacy fallback (overstates profit on unmatched sells). */
3187
3495
  cost_method?: "fifo" | "average_cost";
3188
3496
  cost_method_note?: string;
3497
+ /** 2026-10 (migration 508) — realized-PnL completeness of the returned page (NOT coverage.completeness). Absent on older servers. */
3498
+ completeness?: RealizedPnlCompleteness;
3499
+ incomplete_reasons?: RealizedPnlIncompleteReason[];
3189
3500
  traders: TokenTopTrader[];
3190
3501
  summary: {
3191
3502
  returned: number;
3192
3503
  known_kols: number;
3193
3504
  known_alpha_wallets: number;
3194
3505
  net_realized_pnl_sol: number;
3506
+ unknown_realized_cost_basis_sol?: number;
3507
+ unattributed_sells?: number;
3195
3508
  };
3196
3509
  /** v1.23.4 — trade-coverage disclosure; when `in_scope` is false an empty
3197
3510
  * `traders` list means "outside the write-gate", not "nobody traded". */
@@ -4230,7 +4543,7 @@ export interface TokenFeedPagination {
4230
4543
  /** Pass as `before` to page back. */
4231
4544
  next_before: string | null;
4232
4545
  }
4233
- /** The locks feed's pagination: adds the strict keyset cursor and the post-filter scan meta. (Earlier types put these on every feed; the fee-claims and surges routes never send them.) */
4546
+ /** The locks feed's pagination: adds the strict keyset cursor and the post-filter scan meta. */
4234
4547
  export interface TokenLocksFeedPagination extends TokenFeedPagination {
4235
4548
  /** v1.24 — pass as `cursor` to page back without skipping same-timestamp rows; null = end. */
4236
4549
  next_cursor?: string | null;
@@ -4858,11 +5171,13 @@ export interface TokenFeeClaimsParams {
4858
5171
  social_platform?: number;
4859
5172
  /** Platform-native numeric user id. */
4860
5173
  social_user_id?: string;
4861
- /** Amount floor in SOL. */
5174
+ /** Amount floor in SOL; only SOL-quoted events match. */
4862
5175
  min_sol?: number;
4863
5176
  /** ISO date-time (use `pagination.next_since`). */
4864
5177
  since?: string;
4865
- /** ISO date-time (use `pagination.next_before`). */
5178
+ /** Opaque lossless backward-page cursor (pagination.next_cursor). */
5179
+ cursor?: string;
5180
+ /** Legacy strict timestamp bound; can skip same-timestamp events. */
4866
5181
  before?: string;
4867
5182
  /** 1–100, default 50. */
4868
5183
  limit?: number;
@@ -4908,7 +5223,9 @@ export interface TokenFeeClaimEvent {
4908
5223
  /** GET /tokens/fee-claims — pump.fun fee-event feed, newest first. **History starts 2026-08-17.** PRO+, keyed only. */
4909
5224
  export interface TokenFeeClaimsResponse {
4910
5225
  events: TokenFeeClaimEvent[];
4911
- pagination: TokenFeedPagination;
5226
+ pagination: TokenFeedPagination & {
5227
+ next_cursor: string | null;
5228
+ };
4912
5229
  /** Pointer to the `token:fee_claims` WS channel (event `token:fee_claim`). */
4913
5230
  stream: TokenFeedStreamPointer;
4914
5231
  meta?: Record<string, unknown>;
@@ -4984,7 +5301,10 @@ export interface TokenSurgeEarlyBuyers {
4984
5301
  count: number;
4985
5302
  /** Early buyers that bought in the same block. */
4986
5303
  bundled: number;
5304
+ /** null when any cohort first buy has an unknown SOL cost (never summed as 0); see cohort_sol_unknown_ranks. */
4987
5305
  cohort_sol: number | null;
5306
+ /** Cohort wallets whose first-buy SOL cost is unknown (0 = cohort_sol is complete). Absent on fires before 2026-10-27. */
5307
+ cohort_sol_unknown_ranks?: number;
4988
5308
  /** Cohort wallets that have already sold. */
4989
5309
  sold: number;
4990
5310
  /** Cohort wallets that are known sniper wallets. */
@@ -5370,6 +5690,21 @@ export interface DeployerActivityFamilyCoverage {
5370
5690
  missing_months: string[];
5371
5691
  months_read: string[];
5372
5692
  };
5693
+ /** launches only (2026-10-18): per supported launchpad, whether this window is fully held. The family-level complete / complete_from follow the strictest of these boundaries. A boundary is known coverage, not proof every transaction arrived. */
5694
+ launchpads?: DeployerActivityLaunchpadCoverage[];
5695
+ /** launches only: NOT supported launchpads (moonit, boop, heaven); their launches never appear and do not affect complete. */
5696
+ launchpads_not_indexed?: string[];
5697
+ }
5698
+ export interface DeployerActivityLaunchpadCoverage {
5699
+ launchpad: "pumpfun" | "raydium_launchlab" | "meteora_dbc";
5700
+ /** true when the window starts at or after this launchpad's boundary. */
5701
+ complete: boolean;
5702
+ /** Later of the window start and the boundary (pump.fun / LaunchLab unbonded: 2026-07-03T05:00Z; Meteora DBC: 2026-10-03T16:32:57Z). */
5703
+ complete_from: string;
5704
+ /** What exists before complete_from: bonded launches only, or nothing. */
5705
+ before_complete_from: "bonded_only" | "none";
5706
+ /** Launches that never reach a creator's timeline (Bags via a known relayer), or null. */
5707
+ creator_gaps: string | null;
5373
5708
  }
5374
5709
  export interface DeployerActivityRange {
5375
5710
  from: string | null;
@@ -5904,6 +6239,9 @@ export interface TokenBundleExitEvent extends Omit<TokenBundleClusterEvent, "sol
5904
6239
  /** sum over wallets of min(sold, bought) / bought, 0..1. */
5905
6240
  sold_pct: number | null;
5906
6241
  realized_sol: number;
6242
+ /** 2026-10 (migration 511) — "incomplete" when a recorded sell has unknown proceeds: its tokens count in sold_pct, its proceeds are not in realized_sol (never 0). null = not measured. */
6243
+ realized_status?: "complete" | "incomplete" | null;
6244
+ unknown_proceeds_sells?: number | null;
5907
6245
  last_sell_at: string | null;
5908
6246
  recent_sells: Array<{
5909
6247
  wallet: string;