@fazedotfun/sdk 0.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.
@@ -0,0 +1,560 @@
1
+ import { $ as TradeSide, A as CreatorStatsView, B as LaunchSort, C as CoinTraderDirection, Ct as WorldPlayerSearch, D as CoinTradersQuery, E as CoinTradersList, Et as AddressNamespace, F as LaunchBuildRequest, G as NativeUsdRates, H as MetricWindow, I as LaunchConfig, J as ProfileUpdateRequest, K as PoolFeeView, L as LaunchConfirmRequest, M as EvmTxRequest, N as GraduationView, O as CoinTradesView, P as Health, Q as TradeQuote, R as LaunchLifecycleState, S as CoinTradeView, St as WorldMapPlayers, T as CoinTraderView, Tt as WorldProp, U as MomentumSignals, V as MediaUpload, W as NativeUsdRate, X as SentimentVote, Y as RingTier, Z as StallTier, _ as CoinListQuery, _t as WalletUnlinkRequest, a as CandleSeries, at as WalletHoldingsView, b as CoinMetricsWindows, bt as WatchlistView, c as CandleView, ct as WalletPnlCurvePoint, d as CoinHiddenMarker, dt as WalletStatsCoinRef, et as UsernameAvailability, f as CoinHolderView, ft as WalletTradesQuery, g as CoinListItem, gt as WalletUnlink, h as CoinListDirection, ht as WalletTradingWindowStats, i as AdVenuePulse, it as WalletHoldingView, j as CurveContracts, k as CreatorBestLaunch, kt as NativeCurrency, l as CoinBurnsView, lt as WalletPnlCurveView, m as CoinList, mt as WalletTradingStatsView, n as ActivityQuery, nt as WalletChallengeRequest, o as CandleTimeframe, ot as WalletLink, p as CoinHoldersView, pt as WalletTradesView, q as Profile, r as ActivityTradeView, rt as WalletCoinPnlView, s as CandleTimeframeRequest, st as WalletModeration, t as ActivityFeedView, tt as WalletChallenge, u as CoinDetailsEditRequest, ut as WalletPnlView, v as CoinListSort, vt as WatchlistEntryView, w as CoinTraderSort, wt as WorldPlayerSearchResult, x as CoinSentimentView, xt as WindowMetrics, y as CoinMetricsView, yt as WatchlistToggleView, z as LaunchProviderMeta } from "./index-DiWbmSpu.mjs";
2
+ import "zod";
3
+ /**
4
+ * Thrown on HTTP 429 so a caller can DISTINGUISH throttling from other failures and resume on the server's schedule
5
+ * instead of guessing. Carries the rate-limit headers the API sends.
6
+ */
7
+ export declare class RateLimitError extends Error {
8
+ readonly retryAfterMs: number;
9
+ readonly limit: number | undefined;
10
+ readonly remaining: number | undefined;
11
+ /** Epoch ms when the bucket is expected to be full again, or undefined if the server did not say. */
12
+ readonly resetAt: number | undefined;
13
+ constructor(message: string, details: {
14
+ retryAfterMs: number;
15
+ limit: number | undefined;
16
+ remaining: number | undefined;
17
+ resetAt: number | undefined;
18
+ });
19
+ }
20
+ /**
21
+ * One field-level rejection from a 400: which field the API refused and why. `field` is the dotted path within the
22
+ * body you sent (`(body)` for a whole-object rule); `reason` is human-readable and may be re-worded at any time -
23
+ * branch on `ApiError.apiError`, render `reason`.
24
+ */
25
+ interface ApiErrorDetail {
26
+ field: string;
27
+ reason: string;
28
+ }
29
+ /**
30
+ * Thrown on any other non-ok response. Carries the HTTP status plus the API's `{ error }` body string - its stable
31
+ * error identifier - so callers branch on that rather than matching message text, and on a schema-validation 400 the
32
+ * per-field `details` the API sends alongside it.
33
+ */
34
+ export declare class ApiError extends Error {
35
+ readonly status: number;
36
+ /** The API's `{ error }` body string, or undefined when the body carried none (empty body, HTML error page). */
37
+ readonly apiError: string | undefined;
38
+ /** Field-level rejections on a schema-validation 400; undefined when the body carried none (every other status,
39
+ * and 400s refused above the schema). */
40
+ readonly details: readonly ApiErrorDetail[] | undefined;
41
+ constructor(message: string, details: {
42
+ status: number;
43
+ apiError: string | undefined;
44
+ details: readonly ApiErrorDetail[] | undefined;
45
+ });
46
+ }
47
+ interface ClientOptions {
48
+ /** Base URL of the API, including the version prefix - e.g. `https://your-origin/api/v1`. */
49
+ baseUrl: string;
50
+ /** Injected for tests or a custom transport (a cookie-jar-aware fetch); defaults to the global `fetch`. */
51
+ fetch?: typeof fetch;
52
+ /**
53
+ * Headers merged into every request. The browser round-trips the API session cookie on its own, so this exists for
54
+ * NON-browser consumers, which have no cookie jar and would otherwise be unable to reach any session-gated verb.
55
+ */
56
+ headers?: Readonly<Record<string, string>>;
57
+ }
58
+ /** Raw bytes for an upload. A `File`/`Blob` in the browser, a `Uint8Array`/`ArrayBuffer` on a server. */
59
+ type AssetBody = Blob | ArrayBuffer | Uint8Array;
60
+ /** A launch protocol provider id.
61
+ *
62
+ * Deliberately WIDENED to `string` rather than the internal union. Which providers a deployment runs is a SERVER-side
63
+ * fact this client never decides: it only ever echoes back what the API sent. Publishing the narrow union would pin
64
+ * the package's types to whichever provider happened to be committed at release time, and a new one would need an SDK
65
+ * release before it could even be named. */
66
+ type LaunchProviderId = string;
67
+ /** A chain profile id - the `chain` value on launch records and requests.
68
+ *
69
+ * Widened to `string` for the same reason as LaunchProviderId: which networks a deployment serves is decided by the
70
+ * server. Every request field here is already `chain: string` and no chain registry ships in the bundle, so a narrow
71
+ * union would only be a release-time snapshot of the deployment's network set. */
72
+ type ChainProfileId = string;
73
+ /**
74
+ * Complete a wallet link: the address, its EIP-191 `personal_sign` signature over the challenge text, and the terms
75
+ * version being accepted.
76
+ *
77
+ * `acceptedTermsVersion` is required - the API refuses the link without it, and with it every wallet-scoped verb.
78
+ * Read the value from `getLaunchConfig().termsVersion` rather than hardcoding it: it changes when the terms do, and
79
+ * the refusal body carries the current value, so a client can recover from a change without a release.
80
+ */
81
+ interface WalletLinkRequest {
82
+ publicKey: string;
83
+ signature: string;
84
+ namespace?: 'eip155' | undefined;
85
+ acceptedTermsVersion: string;
86
+ }
87
+ /**
88
+ * A launch registry record. `id` is the internal ULID (the canonical tracking id - ticker and name are not unique);
89
+ * coin identity is `(chain, mint)`. Timestamps are ISO strings, each null until its edge is crossed, mirrored in
90
+ * epoch-ms fields so a client never has to `Date.parse` them. `curveProgress` is the backend-computed curve fill in
91
+ * [0, 1]; `signals` is null until the indexer has scored the coin.
92
+ */
93
+ interface LaunchRecord {
94
+ id: string;
95
+ mint: string;
96
+ chain: ChainProfileId;
97
+ provider: LaunchProviderId;
98
+ providerMeta: LaunchProviderMeta;
99
+ /** Per-launch graduation threshold, native base units as a decimal string. */
100
+ bondingTarget: string;
101
+ creatorWallet: string;
102
+ ticker: string;
103
+ name: string;
104
+ metadataUri: string;
105
+ lifecycleState: LaunchLifecycleState;
106
+ createdAt: string;
107
+ confirmedAt: string | null;
108
+ curveCompletedAt: string | null;
109
+ graduatedAt: string | null;
110
+ signals: MomentumSignals | null;
111
+ curveProgress: number | null;
112
+ /** The coin mint's decimals, null until the pool confirms (they are unknown before the mint exists on chain). */
113
+ decimals: number | null;
114
+ createdAtMs: number;
115
+ curveCompletedAtMs: number | null;
116
+ graduatedAtMs: number | null;
117
+ /** The creator's IRREVERSIBLE commitment to burn the coin side of their post-graduation fee stream. */
118
+ /** Present ONLY on a delisted coin - it is absent from every discovery surface but still trades and still
119
+ * resolves by exact mint, so this marker is what lets a client label it. */
120
+ hidden?: CoinHiddenMarker | undefined;
121
+ }
122
+ /** A page of launches. `nextCursor` is opaque - pass it back verbatim, or null at the end of the walk. */
123
+ interface LaunchList {
124
+ launches: LaunchRecord[];
125
+ nextCursor: string | null;
126
+ }
127
+ /** The creator's fee-burn commitment: the coin's post-graduation creator fee stream is handed irreversibly to a
128
+ * buy-and-burn contract. Null = no commitment; `active` = the contract really holds the creator seat now (a
129
+ * deployed-but-unclaimed one is a commitment in progress); `shareBps` is the committed slice (10000 = the whole
130
+ * stream); the counters are lifetime burns. Absent = unknown, never "no". */
131
+ interface CoinFeeBurn {
132
+ shareBps: number;
133
+ active: boolean;
134
+ ethBurnedWei: string;
135
+ tokensBurned: string;
136
+ burnCount: number;
137
+ }
138
+ /** One coin's registry record plus its metrics snapshot, composed server-side so a coin page is one round trip. */
139
+ interface CoinSummaryView {
140
+ launch: LaunchRecord;
141
+ metrics: CoinMetricsView;
142
+ feeBurn?: CoinFeeBurn | null | undefined;
143
+ /** The count of current theses on the coin. Additive - absent on rows served before the field existed. */
144
+ thesisCount?: number | undefined;
145
+ }
146
+ /** One bazaar slot: its index, the lane its coin qualifies under, and the coin standing there (null when vacant). */
147
+ interface BazaarSlot {
148
+ slotIndex: number;
149
+ tier: StallTier | null;
150
+ coin: LaunchRecord | null;
151
+ }
152
+ /** The bazaar read model: every slot, occupied or vacant. */
153
+ interface BazaarSnapshot {
154
+ slots: BazaarSlot[];
155
+ generatedAt: string;
156
+ }
157
+ /** One showcase pedestal. A vacant one renders as reserved, so scarcity stays visible. */
158
+ interface RingSlotView {
159
+ slotIndex: number;
160
+ tier: RingTier | null;
161
+ coin: LaunchRecord | null;
162
+ }
163
+ /** The first-ring showcase read model: every pedestal, occupied or reserved-empty. */
164
+ interface RingSnapshot {
165
+ slots: RingSlotView[];
166
+ generatedAt: string;
167
+ }
168
+ /** One coin's island placement. `rank` is the island ordinal - 1 stands closest to the plaza. */
169
+ interface MapPlacement {
170
+ mint: string;
171
+ rank: number;
172
+ districtId: string;
173
+ /** The coin's stall within the district, 0-based. */
174
+ stallIndex: number;
175
+ scoreAtAssign: number;
176
+ assignedAtMs: number;
177
+ /** The coin standing at the stall - what the shop's sign renders. */
178
+ coin: LaunchRecord;
179
+ }
180
+ /**
181
+ * The island placement read model, rank-ascending. An unplaced coin is simply ABSENT: stalls fill densely from the
182
+ * plaza outward, so "absent" and "beyond the last rank" say the same thing. Contrast the bazaar and ring snapshots,
183
+ * whose fixed grids must report vacancy explicitly.
184
+ */
185
+ interface MapPlacementsSnapshot {
186
+ placements: MapPlacement[];
187
+ generatedAt: string;
188
+ }
189
+ /**
190
+ * Launch-build response: the created registry record (state `launched`, carrying the server-predicted coin address and
191
+ * metadata URI) plus the tx requests the wallet signs AND broadcasts itself. Report the hash back with `confirmLaunch`
192
+ * and poll `evmTxStatus` for the receipt. `launchTxIndex` names the create whose hash confirms the launch (absent =
193
+ * the last request).
194
+ */
195
+ interface LaunchBuildResponse {
196
+ launch: LaunchRecord;
197
+ txRequests: EvmTxRequest[];
198
+ /** Index into `txRequests` of the create (the launch itself); absent = the last request. A launch with a
199
+ * burn commitment appends the factory clone deploy and the curve payout dial after the create. */
200
+ launchTxIndex?: number | undefined;
201
+ /** True when the launch asked for a burn but the bundle carries no deploy leg: a gated launch (`awaitDevBuy`)
202
+ * deploys the coin dormant and the curve refuses to seat a dormant coin, so the burn wires through
203
+ * `buildLaunchBurnLegs` once the reserved first buy has landed. Absent otherwise. */
204
+ burnAwaitsFirstBuy?: boolean | undefined;
205
+ /** The dev buy's server-quoted fill in base units, present only when the request carried `devBuy`. */
206
+ devBuyTokensOut?: string | undefined;
207
+ }
208
+ /** The details edit's answer: the updated registry record, whose new `metadataUri` is the cache-buster. */
209
+ interface CoinDetailsEditResponse {
210
+ launch: LaunchRecord;
211
+ }
212
+ /** One ad board's placement in the world. `y` null means terrain-snapped at render time. */
213
+ interface AdBoard {
214
+ id: string;
215
+ worldId: string;
216
+ x: number;
217
+ z: number;
218
+ y: number | null;
219
+ yaw: number;
220
+ tier: 'small' | 'medium' | 'large';
221
+ status: 'active' | 'disabled';
222
+ /** Concurrent campaign slots this board sells per window. A renderer needs it to reason about the rotation the
223
+ * board's placements cycle through. */
224
+ slotCount: number;
225
+ }
226
+ /**
227
+ * What is showing on a board right now. The URLs point at DERIVED bytes - what the platform's media pipeline emitted,
228
+ * never what an advertiser uploaded - so a renderer uses them directly and resolves nothing itself. The booking
229
+ * identifiers the internal shape carries are dropped here: they address a purchase surface this package does not have.
230
+ */
231
+ interface AdBoardPlacement {
232
+ boardId: string;
233
+ /** Which of the board's slots this booking holds - the cycle order key, stable for the campaign's whole run. A
234
+ * board can carry several live placements at once and rotates through them on the shared wall clock, so a
235
+ * renderer that ignores this shows one advertiser and hides the rest. */
236
+ slotIndex: number;
237
+ assetUrl: string;
238
+ /** The video's poster still, or null for an image (which IS its own still). */
239
+ posterUrl: string | null;
240
+ /** The type of the bytes at `assetUrl`, decided by the pipeline - what an ImageDecoder is constructed with. */
241
+ contentType: string;
242
+ kind: 'image' | 'video';
243
+ /** Playback length of the derivative; null for a STILL. Non-null on an `image` therefore means it ANIMATES - the
244
+ * only signal that survives the re-encode, since an animated gif comes out as an animated WebP and the content
245
+ * type no longer tells the two apart. */
246
+ durationMs: number | null;
247
+ clickUrl: string;
248
+ /** When this placement stops being true - the render layer's own refresh deadline. */
249
+ endsAtMs: number;
250
+ }
251
+ /**
252
+ * One feed's bound prop ids in a world - which placed props render a live coin display (empty = the feed is dark).
253
+ *
254
+ * `feedId` is WIDENED to `string` for the LaunchProviderId reason: internally it is a union over a committed feed
255
+ * registry, and publishing it would mean a new feed needs an SDK release before a consumer could name it.
256
+ */
257
+ interface WorldFeedBinding {
258
+ feedId: string;
259
+ propIds: string[];
260
+ }
261
+ /** Every runtime-placed prop for a world - what a renderer draws instead of hardcoded scenery. `feedBindings` is
262
+ * absent on deployments predating the feed layer, never null. */
263
+ interface WorldPropsSnapshot {
264
+ worldId: string;
265
+ props: WorldProp[];
266
+ feedBindings?: WorldFeedBinding[] | undefined;
267
+ generatedAt: string;
268
+ }
269
+ /** The world's ad layer: every board plus whatever is showing on each right now. */
270
+ interface AdBoardsSnapshot {
271
+ worldId: string;
272
+ boards: readonly AdBoard[];
273
+ placements: readonly AdBoardPlacement[];
274
+ generatedAt: string;
275
+ /** Whether NON-ADMIN wallets may book campaigns right now. Absent on a snapshot predating the toggle, which
276
+ * reads as disabled. */
277
+ publicBookingEnabled?: boolean | undefined;
278
+ }
279
+ /** The API client. Every method validates the response at the boundary, so a drifting API fails here rather than
280
+ * deep inside your own code. */
281
+ export interface PlatformClient {
282
+ /** Probe the API's health. */
283
+ health(): Promise<Health>;
284
+ /**
285
+ * The coin discovery list: the sorted, filtered coin feed. Every field of `query` is optional; an absent one is
286
+ * OMITTED from the wire (the API refuses a present-but-empty param), `states`/`keywords`/`links` serialize as CSV,
287
+ * and `limit` is clamped into the API's accepted range. Keyset-paginated: pass `nextCursor` back verbatim as
288
+ * `query.cursor`. The cursor is OPAQUE and bound to `(sort, window, dir)` - never build one, and never reuse one
289
+ * across a re-sort, which is a 400. USD row fields are nullable when the rate feed is down: show "-", not $0.
290
+ */
291
+ listCoins(query?: CoinListQuery): Promise<CoinList>;
292
+ /** One coin's registry record plus its metrics snapshot in a single read, so a coin page renders in one trip. */
293
+ getCoinSummary(mint: string): Promise<CoinSummaryView>;
294
+ /**
295
+ * A coin's market-metrics snapshot: price and valuation, the m5/h1/h6/h24 windows, holder stats, fees, ATH, and
296
+ * the graduation record once migrated. Freshness is the indexer's rollup cadence - `computedAtMs` says how fresh.
297
+ */
298
+ getCoinMetrics(mint: string): Promise<CoinMetricsView>;
299
+ /** A coin's holder surface: live holder count plus top holders by balance. Venue addresses (curve, pool, burn) are
300
+ * excluded from the ranking and ride `venues` as labeled rows instead. */
301
+ getCoinHolders(mint: string, parameters?: {
302
+ limit?: number;
303
+ cursor?: string;
304
+ }): Promise<CoinHoldersView>;
305
+ /**
306
+ * A coin's traders, ranked by `volume` (default), `realized-pnl`, `last-trade` or `buys`. Keyset-paginated by an
307
+ * OPAQUE cursor bound to (sort, dir), like `listCoins`.
308
+ *
309
+ * INGEST-ERA TRUTH: every figure is folded from the trades the indexer has SEEN, so a coin whose ingest began
310
+ * mid-life has traders whose earlier history is not counted. `realizedPnlNative` degrades further - a sell of
311
+ * tokens the ledger never saw bought has no basis to relieve, so it is skipped rather than booked as a gain, and
312
+ * that trader's realized figure UNDERSTATES what they made. `volume` needs no basis and stays honest, which is
313
+ * why it is the default sort.
314
+ */
315
+ getCoinTraders(mint: string, query?: CoinTradersQuery): Promise<CoinTradersList>;
316
+ /** A coin's trade tape, newest first. `before` (epoch ms) pages older trades; the next cursor is the last row's
317
+ * `timeMs`. */
318
+ getCoinTrades(mint: string, parameters?: {
319
+ limit?: number;
320
+ before?: number;
321
+ }): Promise<CoinTradesView>;
322
+ /**
323
+ * A coin's fee-burn history, newest first: one row per firing of the creator's fee-burn conveyor (fees spent, coin
324
+ * sent to the dead address, who cranked it and their bounty, the tx). Empty for a coin without a burn commitment.
325
+ *
326
+ * `before` (block number) pages older burns; the next cursor is the last row's `blockRef`. The tip page also
327
+ * carries `graduationBurn` - the one-off token-tail burn at graduation - which is null on cursored pages and on a
328
+ * coin still on the curve.
329
+ */
330
+ getCoinBurns(mint: string, parameters?: {
331
+ limit?: number;
332
+ before?: number;
333
+ }): Promise<CoinBurnsView>;
334
+ /**
335
+ * A coin's community sentiment: the rocket/shit tallies plus THIS caller's own standing.
336
+ *
337
+ * Per-caller by construction, so never cache it across users. A disconnected caller gets the tallies with
338
+ * `canVote: false` and `myVote: null` - not an error, and not a reason to hide the counts.
339
+ */
340
+ getCoinSentiment(mint: string): Promise<CoinSentimentView>;
341
+ /**
342
+ * Cast, change, or clear the caller's vote (`vote: null` un-votes - re-clicking the face you picked). Returns the
343
+ * fresh view, so the surface renders the SERVER's tallies rather than a local increment.
344
+ *
345
+ * Gated on having BOUGHT the coin: a wallet that has bought less than `minBuyUsd` of it is refused with a 403
346
+ * whose `error` is the stable identifier `sentiment buy required`. Read `canVote` first and disable the
347
+ * affordance - the view carries both it and the threshold, so the gate can be stated before anything is refused.
348
+ */
349
+ setCoinSentiment(mint: string, vote: SentimentVote | null): Promise<CoinSentimentView>;
350
+ /**
351
+ * Replace a coin's description + links (the universal edit pathway). REPLACE semantics: the request is the full
352
+ * editable set, and an omitted or empty field CLEARS that detail. Image, name and ticker are launch-time
353
+ * identity and are not editable.
354
+ *
355
+ * Gated on being the coin's RESOLVED creator - the launch creator unless an accepted creator handoff moved the
356
+ * role - with a 403 whose `error` is the stable identifier `coin creator required` otherwise. The returned
357
+ * record carries the coin's NEW `metadataUri`; the old URI keeps serving the old JSON.
358
+ */
359
+ editCoinDetails(mint: string, request: CoinDetailsEditRequest): Promise<CoinDetailsEditResponse>;
360
+ /**
361
+ * A graduated coin's pool base fee, for a post-graduation status row. `baseFeeBps` is null while the coin has no
362
+ * pool yet (on the curve or mid-migration) - and also when the chain read failed, which the platform degrades to
363
+ * rather than failing an otherwise usable panel. It is a DISPLAY figure: what a trade actually pays is quoted.
364
+ */
365
+ getPoolFee(mint: string): Promise<PoolFeeView>;
366
+ /**
367
+ * A coin's candle series. `timeframe` is auto/1m/1h/4h/1d (`auto` picks a readable width from the coin's candle
368
+ * counts); the response's `timeframe` is always the CONCRETE width. Candles come oldest-first, so a chart appends
369
+ * and the next `before` is `candles[0].bucketStartMs`.
370
+ */
371
+ getCandles(mint: string, parameters?: {
372
+ timeframe?: CandleTimeframeRequest;
373
+ limit?: number;
374
+ before?: number;
375
+ }): Promise<CandleSeries>;
376
+ /**
377
+ * The global recent-trades feed across every coin the deployment serves, newest first. Paged like the tapes
378
+ * (`before` = the last row's `timeMs`), and `chain` narrows the scope like `listCoins`.
379
+ *
380
+ * A TIP, NOT AN ARCHIVE: it reaches back 24h and reports that edge as `windowStartMs`, so a walk ENDS there by
381
+ * design rather than by running out of data - an empty page at the edge is not an error. For depth on one coin
382
+ * use `getCoinTrades`, which is indexed for it.
383
+ */
384
+ getActivity(query?: ActivityQuery): Promise<ActivityFeedView>;
385
+ /** One launch by its on-chain mint address. */
386
+ getLaunch(mint: string): Promise<LaunchRecord>;
387
+ /**
388
+ * List launches, keyset-paginated by `cursor`. `sort` is `recency` (default) or `momentum`, and the cursor is
389
+ * sort-specific. `world` narrows to coins on that named world's home chain; an unknown world is a 404, because the
390
+ * server never widens past the chain-homing rail.
391
+ */
392
+ listLaunches(parameters?: {
393
+ cursor?: string;
394
+ limit?: number;
395
+ sort?: LaunchSort;
396
+ state?: LaunchLifecycleState;
397
+ world?: string;
398
+ /** Substring search over coin name and ticker; server-bounded to 32 chars. */
399
+ q?: string;
400
+ }): Promise<LaunchList>;
401
+ /**
402
+ * The static launch config: the enabled chains, the default launch chain, the live owner-tunable fee knobs, and
403
+ * `curveContracts` - the deployment's effective contract addresses. It changes only on a redeploy or a knob
404
+ * change, so cache it aggressively.
405
+ *
406
+ * `curveContracts` is what this package's `/chain` builders take (via `curveConfigFrom`). Read the addresses
407
+ * from here rather than hardcoding them: a deployment can move a contract, and a stale address still builds a
408
+ * perfectly valid transaction - aimed at the wrong one.
409
+ */
410
+ getLaunchConfig(): Promise<LaunchConfig>;
411
+ /** Every placed coin with the island shop it stands at, rank-ascending (1 = closest to the plaza). Unplaced coins
412
+ * are absent; find them through `listCoins`. */
413
+ getPlacements(): Promise<MapPlacementsSnapshot>;
414
+ /**
415
+ * The gas-token/USD rates the PLATFORM is using - one per native symbol the deployment serves. Convert with these
416
+ * and nothing else: every USD figure on a coin row was computed from exactly this rate, so another oracle drifts
417
+ * against the rows on the same screen. A null `priceUsd` means the platform itself has no fresh rate - hide USD
418
+ * rather than substituting a zero.
419
+ */
420
+ getNativeUsdRates(): Promise<NativeUsdRates>;
421
+ /** Every launchpad coin a wallet holds (balance > 0), value-sorted. Public by wallet - it is all on-chain. */
422
+ getWalletHoldings(wallet: string): Promise<WalletHoldingsView>;
423
+ /** A wallet's realized and unrealized PnL across every coin it has ever traded, held and exited alike.
424
+ * `totalPnlPct` is null when nothing was spent - a zero basis has no percent. */
425
+ getWalletPnl(wallet: string): Promise<WalletPnlView>;
426
+ /** Every trade a wallet has made, newest first. `mint` narrows to one coin; page with the last row's `timeMs` as
427
+ * `before`. */
428
+ getWalletTrades(wallet: string, query?: WalletTradesQuery): Promise<WalletTradesView>;
429
+ /**
430
+ * A wallet's lifetime trading aggregates plus the 24h/7d/30d/all windows in one read (a window switch must not
431
+ * cost a round trip). Public by wallet, like the holdings and PnL reads.
432
+ *
433
+ * TWO HONESTY LEVELS in one payload, worth carrying into whatever you render. The per-coin aggregates (counts,
434
+ * volumes, realized PnL, the win rate) fold rows that are never pruned, so they are lifetime-exact. Anything
435
+ * folded from the trade TAPE - fees, average and largest trade, every window - is bounded by the tape's retention,
436
+ * so a heavy wallet's earliest trades on a busy coin may simply be gone. Both cover BONDING-CURVE trading only.
437
+ */
438
+ getWalletTradingStats(wallet: string): Promise<WalletTradingStatsView>;
439
+ /**
440
+ * A wallet's cumulative realized-PnL curve, ascending and downsampled (the first and last real trades always
441
+ * survive). Its own read because the replay is the expensive one.
442
+ *
443
+ * `complete: false` means retention pruned part of the tape: the difference between the replay and the stored
444
+ * lifetime truth is folded into every point as `baselineRealizedNative`, so the LAST point is always right and
445
+ * the early ones are approximate. Say so rather than drawing an exact-looking early curve.
446
+ */
447
+ getWalletPnlCurve(wallet: string): Promise<WalletPnlCurveView>;
448
+ /** A wallet's creator-side aggregates: what it launched, how much graduated, fees collected, reach. A wallet that
449
+ * never launched reads back the zeroed shape, not a 404. Deliberately carries no claimable-now figure - that is a
450
+ * point-in-time chain read, and serving it under a cache TTL would show a stale claim amount. */
451
+ getCreatorStats(wallet: string): Promise<CreatorStatsView>;
452
+ /**
453
+ * Upload media bytes and get back a HANDLE, not a URL.
454
+ *
455
+ * The platform never serves user-supplied bytes: an upload lands private and a worker re-encodes it, so `url` is
456
+ * null at this moment and `status` is what matters. Usually 'pending' - but 'ready' immediately when identical
457
+ * bytes were derived before, since uploads are content-addressed and dedupe.
458
+ *
459
+ * This is the ONLY way to obtain the `imageKey` that `buildLaunch` and the avatar field of `updateProfile` take:
460
+ * those are sha256 content-addresses the API mints in response to an upload, so an arbitrary hash is refused.
461
+ *
462
+ * Session + linked wallet required. Oversized bytes reject as an ordinary ApiError with `status` 413.
463
+ */
464
+ uploadAsset(body: AssetBody, contentType: string): Promise<MediaUpload>;
465
+ /** Derivation status for an `uploadAsset` handle. Poll until `status` leaves 'pending'/'processing'; 'ready'
466
+ * carries the derived `url` (and `posterUrl` for video). */
467
+ getMedia(key: string): Promise<MediaUpload>;
468
+ /**
469
+ * Upload and wait until the platform has finished deriving, returning a handle that is 'ready' (or 'failed').
470
+ *
471
+ * Bundled because every consumer of `uploadAsset` needs this loop before it can use the key for anything, and
472
+ * hand-rolling it means re-deriving the poll interval, the timeout, and the fact that 'failed' is terminal. An
473
+ * upload that dedupes to an already-derived asset returns without polling at all.
474
+ *
475
+ * Rejects with an ApiError-free plain Error on timeout; the handle is still valid, so a caller that would rather
476
+ * keep waiting can go back to `getMedia`.
477
+ */
478
+ uploadAndAwaitReady(body: AssetBody, contentType: string, options?: AwaitReadyOptions): Promise<MediaUpload>;
479
+ /**
480
+ * The caller's watchlist - their starred coins, each joined with enough market context to render a row without a
481
+ * second read, newest star first. Requires a linked wallet (the list belongs to the WALLET, not the session);
482
+ * without one the API answers 403.
483
+ */
484
+ getWatchlist(): Promise<WatchlistView>;
485
+ /** Star a coin. Idempotent, and returns the coin's fresh PUBLIC watcher count - render that rather than a local
486
+ * increment, since the caller may not even qualify for the count. */
487
+ watchCoin(mint: string): Promise<WatchlistToggleView>;
488
+ /** Unstar a coin. Idempotent, and works on a coin that has left the registry - otherwise the star would be
489
+ * unremovable. */
490
+ unwatchCoin(mint: string): Promise<WatchlistToggleView>;
491
+ /** Any wallet's PUBLIC profile - handle and avatar. An unregistered wallet reads back empty, never an error. */
492
+ getProfile(wallet: string): Promise<Profile>;
493
+ /** The caller's own profile. Requires a live session with a linked wallet; fields are null until set. */
494
+ getMyProfile(): Promise<Profile>;
495
+ /** Update the caller's own profile: set or change the handle, set or clear the avatar. The avatar is an upload
496
+ * content-address from `uploadAndAwaitReady` (null clears it); a still-processing one is a 409 that succeeds on
497
+ * retry, and a video is a 415. A taken handle also rejects with a 409 ApiError. */
498
+ updateProfile(request: ProfileUpdateRequest): Promise<Profile>;
499
+ /** Is this handle free? Public and anonymous, safe at typing cadence. ADVISORY ONLY - the save-time unique index
500
+ * is the arbiter, so `updateProfile` can still 409 on a handle this said was available. `reason` says WHY a
501
+ * refused one is refused (invalid / reserved / taken). */
502
+ checkHandle(handle: string): Promise<UsernameAvailability>;
503
+ /** Every runtime-placed prop for the deployment's world - what a renderer draws instead of hardcoded scenery. */
504
+ getWorldProps(): Promise<WorldPropsSnapshot>;
505
+ /** Anonymous player-dot positions for the world map. Server-cached, so seconds-fresh. */
506
+ getWorldPlayers(world?: string): Promise<WorldMapPlayers>;
507
+ /** Search online players by display-name substring. */
508
+ searchWorldPlayers(q: string, world?: string): Promise<WorldPlayerSearch>;
509
+ /** The bazaar stall allocation: every slot with the coin currently placed at it, or vacant. */
510
+ getBazaar(): Promise<BazaarSnapshot>;
511
+ /** The first-ring showcase: every pedestal with the graduated coin currently showcased at it, or reserved-empty. */
512
+ getRing(): Promise<RingSnapshot>;
513
+ /**
514
+ * The world's ad layer: every board plus whatever is showing on each right now. A placement's `endsAtMs` is the
515
+ * render layer's own refresh deadline - a board whose placement lapsed keeps showing until the next read, so poll
516
+ * at least that often on a board that matters.
517
+ */
518
+ getAdBoards(world?: string): Promise<AdBoardsSnapshot>;
519
+ /** Venue reach: 24h volume, trades and traders, plus live players and board occupancy. Coarse and server-cached. */
520
+ getAdPulse(world?: string): Promise<AdVenuePulse>;
521
+ /**
522
+ * Build a coin launch - the ONE transaction the platform still builds, because it is the one a client cannot build
523
+ * for itself: the API predicts the coin's CREATE2 address before the transaction exists and writes the registry
524
+ * row keyed on it. The wallet signs AND broadcasts. Report the hash with `confirmLaunch`, then read the receipt
525
+ * from your own RPC. Requires a live session with the target chain's linked wallet, and a tight rate-limit bucket.
526
+ *
527
+ * The request's `imageKey` is a sha256 content-address, NOT a URL - get one from `uploadAndAwaitReady` (or
528
+ * `uploadAsset` plus your own poll). An arbitrary hash is refused with image-not-found.
529
+ */
530
+ buildLaunch(request: LaunchBuildRequest): Promise<LaunchBuildResponse>;
531
+ /** Record a broadcast launch's transaction hash. It does not itself flip lifecycle state - the API's on-chain
532
+ * verifier owns that. Requires the caller to own the launch. */
533
+ confirmLaunch(mint: string, request: LaunchConfirmRequest): Promise<LaunchRecord>;
534
+ /** Start linking a wallet to the caller's session: returns the exact single-use, short-lived challenge message the
535
+ * wallet must sign. Requires a live session - the API answers 401 otherwise. */
536
+ walletChallenge(request?: WalletChallengeRequest): Promise<WalletChallenge>;
537
+ /** Complete the link with the wallet's address and its EIP-191 `personal_sign` signature over the challenge. */
538
+ walletLink(request: WalletLinkRequest): Promise<WalletLink>;
539
+ /** Clear the session's wallet link - the disconnect path. Without it a wallet switch leaves the OLD wallet as the
540
+ * session identity until some lazy re-link fires. */
541
+ walletUnlink(request?: WalletUnlinkRequest): Promise<WalletUnlink>;
542
+ /**
543
+ * The caller's own moderation standing, combined across their linked wallets.
544
+ *
545
+ * Check it before offering a trade you build YOURSELF. Building client-side means there is no server build left to
546
+ * refuse a banned wallet outside the world, so this is the check that used to happen implicitly - the chain will
547
+ * happily execute a banned wallet's swap.
548
+ */
549
+ walletModeration(): Promise<WalletModeration>;
550
+ }
551
+ /** Create an API client. `options.baseUrl` is your API base including the version prefix. */
552
+ /** Tuning for `uploadAndAwaitReady`. Defaults suit an image; a long video wants a larger timeout. */
553
+ export interface AwaitReadyOptions {
554
+ /** Gap between status polls. Default 1s. */
555
+ intervalMs?: number;
556
+ /** Give up after this long. Default 60s. */
557
+ timeoutMs?: number;
558
+ }
559
+ export declare function createClient(options: ClientOptions): PlatformClient;
560
+ export type { ActivityFeedView, ActivityQuery, ActivityTradeView, AdBoard, AdBoardPlacement, AdBoardsSnapshot, AdVenuePulse, AddressNamespace, ApiErrorDetail, BazaarSlot, BazaarSnapshot, CandleSeries, CandleTimeframe, CandleTimeframeRequest, CandleView, ChainProfileId, ClientOptions, CoinBurnsView, CoinDetailsEditRequest, CoinDetailsEditResponse, CoinHiddenMarker, CoinHolderView, CoinHoldersView, CoinList, CoinListDirection, CoinListItem, CoinListQuery, CoinListSort, CoinMetricsView, CoinMetricsWindows, CoinSentimentView, CoinSummaryView, CoinTradeView, CoinTraderDirection, CoinTraderSort, CoinTraderView, CoinTradersList, CoinTradersQuery, CoinTradesView, CreatorBestLaunch, CreatorStatsView, CurveContracts, EvmTxRequest, GraduationView, Health, LaunchBuildRequest, LaunchBuildResponse, LaunchConfig, LaunchConfirmRequest, LaunchLifecycleState, LaunchList, LaunchProviderId, LaunchProviderMeta, LaunchRecord, LaunchSort, MapPlacement, MapPlacementsSnapshot, MetricWindow, MomentumSignals, NativeCurrency, NativeUsdRate, NativeUsdRates, PoolFeeView, Profile, ProfileUpdateRequest, RingSlotView, RingSnapshot, RingTier, SentimentVote, StallTier, TradeQuote, TradeSide, UsernameAvailability, WalletChallenge, WalletChallengeRequest, WalletCoinPnlView, WalletHoldingView, WalletHoldingsView, WalletLink, WalletLinkRequest, WalletModeration, WalletPnlCurvePoint, WalletPnlCurveView, WalletPnlView, WalletStatsCoinRef, WalletTradesQuery, WalletTradesView, WalletTradingStatsView, WalletTradingWindowStats, WalletUnlink, WalletUnlinkRequest, WatchlistEntryView, WatchlistToggleView, WatchlistView, WindowMetrics, WorldFeedBinding, WorldMapPlayers, WorldPlayerSearch, WorldPlayerSearchResult, WorldProp, WorldPropsSnapshot };
@@ -0,0 +1 @@
1
+ import*as e from"zod";const t=[`sort`,`window`,`dir`,`q`,`chain`,`world`,`creator`,`cursor`],n=[`minFdv`,`maxFdv`,`minVolume`,`maxVolume`,`minFdvUsd`,`maxFdvUsd`,`minHolders`,`maxHolders`,`minTrades`,`maxTrades`,`minTraders`,`maxTraders`,`minProgressPct`,`maxProgressPct`,`minTop10HolderPct`,`maxTop10HolderPct`,`minChangePct`,`maxChangePct`,`minAgeMinutes`,`maxAgeMinutes`,`minBurned`,`maxBurned`],r=[`burn`,`devSold`,`devSoldAll`,`graveyard`,`mapPlaced`],i=[`states`,`keywords`,`excludeKeywords`,`links`];function a(e,t){return Math.min(t,Math.max(1,Math.trunc(e)))}function o(e,t,n,r){for(let i of n){let n=t[i];n!==void 0&&e.set(i,r(n))}}function s(e){let s=new URLSearchParams;return o(s,e,t,e=>e),o(s,e,n,String),o(s,e,r,e=>e?`true`:`false`),o(s,e,i,e=>e.join(`,`)),e.limit!==void 0&&Number.isFinite(e.limit)&&s.set(`limit`,String(a(e.limit,100))),s}function c(e){let t=new URLSearchParams;return e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.before!==void 0&&Number.isFinite(e.before)&&t.set(`before`,String(e.before)),t}function ee(e){let t=c(e);return e.mint!==void 0&&t.set(`mint`,e.mint),t}function te(e){let t=c(e);return e.chain!==void 0&&t.set(`chain`,e.chain),t}function ne(e){let t=new URLSearchParams;return e.sort!==void 0&&t.set(`sort`,e.sort),e.dir!==void 0&&t.set(`dir`,e.dir),e.limit!==void 0&&Number.isFinite(e.limit)&&t.set(`limit`,String(a(e.limit,100))),e.cursor!==void 0&&t.set(`cursor`,e.cursor),t}function l(e,t){let n=t.toString();return n?`${e}?${n}`:e}const u={health:`/health`,coins:`/launchpad/coins`,launches:`/launchpad/launches`,config:`/launchpad/config`,placements:`/launchpad/placements`,bazaar:`/launchpad/bazaar`,ring:`/launchpad/ring`,rates:`/launchpad/rates`,activity:`/launchpad/activity`,wallets:`/launchpad/wallets`,watchlist:`/launchpad/watchlist`,launchBuild:`/launchpad/launch/build`,walletChallenge:`/wallet/challenge`,walletLink:`/wallet/link`,walletUnlink:`/wallet/unlink`,walletModeration:`/wallet/moderation`,profile:`/profile`,profileMe:`/profile/me`,profileHandleCheck:`/profile/handle-check`,garageAsset:`/garage/asset`,media:`/media`,worldProps:`/world/props`,worldPlayers:`/world/players`,worldPlayerSearch:`/world/players/search`,worldAdBoards:`/world/ad-boards`,adsPulse:`/ads/pulse`},d=e.iso.datetime(),f=e.number().int().nonnegative(),p=f,m=e.string().regex(/^\d+$/,`must be a non-negative integer string`),h=e.string().regex(/^0x[0-9a-fA-F]{40}$/,`must be a 0x address`),g=e.string().min(1),_=e.number().min(0).max(100),v=e.enum([`launched`,`awaiting-dev-buy`,`curve-trading`,`dormant`,`graduating`,`graduated`,`abandoned`,`launch-failed`]),y=e.object({feeBps:e.number().int().min(0).max(1e4),decaySeconds:f}),b=e.enum([`v3`,`v4`]),re=e.object({curveAddress:g.nullable(),graduatedPoolAddress:g.nullable(),curveKind:b.optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),hookAddress:g.nullable().optional(),quoteToken:g.nullable().optional(),quoteDecimals:e.number().int().min(0).max(255).optional(),graduatedPoolId:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a bytes32 hex string`).nullable().optional(),poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().min(0).max(1e4).optional(),burnShareBps:e.number().int().min(0).max(1e4).optional(),creatorCurveFees:e.boolean().optional(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional()}),ie=e.object({momentum:e.number().nonnegative(),uniqueBuyers:f,buyVolumeWei:m,windowMs:e.number().int().positive(),computedAt:d}),x=e.object({at:d,reason:e.string().nullable()}),S=e.enum([`recency`,`momentum`]),ae=e.enum([`recency`,`performance`]),oe=e.object({status:e.literal(`ok`)}),se=e.object({message:g}),ce=e.object({wallet:g}),le=e.object({unlinked:e.boolean()}),ue=e.object({banned:e.boolean(),muted:e.boolean()}),C=e.object({wallet:g,username:g.nullable(),avatarKey:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`).nullable(),avatarUrl:g.nullable(),twitterHandle:g.nullable(),telegramHandle:g.nullable(),bio:e.string().nullable(),showsStats:e.boolean(),isKol:e.boolean(),isRegistered:e.boolean().optional(),createdAt:d,updatedAt:d}),de=e.object({handle:g,available:e.boolean(),reason:e.enum([`invalid`,`reserved`,`taken`]).nullable()}),w=e.object({key:e.string().regex(/^[0-9a-f]{64}$/,`must be a sha256 content-address`),kind:e.enum([`image`,`video`]),status:e.enum([`pending`,`processing`,`ready`,`failed`]),url:g.nullable(),posterUrl:g.nullable(),thumbUrl:g.nullable(),thumbMotionUrl:g.nullable(),width:e.number().int().positive().nullable(),height:e.number().int().positive().nullable(),durationMs:f.nullable(),failureReason:g.nullable()}),fe=e.enum([`buy`,`sell`]),T=e.enum([`curve`,`dex`]),E=e.object({id:g,timeMs:p,blockRef:f,direction:fe,username:g,wallet:g,amountNative:m,tokenAmount:m,price:e.number().nonnegative(),venue:T,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional()}),pe=e.object({mint:g,trades:e.array(E),generatedAt:d}),me=e.object({id:g,timeMs:p.nullable(),blockRef:f,txHash:g,caller:g,username:g,isKol:e.boolean().optional(),isVerified:e.boolean().optional(),avatarUrl:e.string().nullable().optional(),amountNative:m,tokenAmount:m,bountyNative:m}),he=e.object({tokenAmount:m,txHash:g,timeMs:p.nullable(),blockRef:f,isExact:e.boolean()}),ge=e.object({mint:g,burns:e.array(me),graduationBurn:he.nullable().optional(),generatedAt:d}),D=E.extend({mint:g,chain:g}),_e=e.object({trades:e.array(D),windowStartMs:p,generatedAt:d}),ve=e.object({wallet:g,trades:e.array(D),generatedAt:d}),ye=e.object({username:g,wallet:g,buyCount:f,sellCount:f,spentNative:m,receivedNative:m,volumeNative:m,realizedPnlNative:e.number(),tokensBought:m,tokensSold:m,firstTradeAtMs:p,lastTradeAtMs:p}),O=e.object({mint:g,traders:e.array(ye),nextCursor:e.string().nullable(),generatedAt:d}),k=e.object({buys:f,sells:f,buyVolume:m,sellVolume:m,buyers:f,sellers:f,priceChangePct:e.number().nullable()}),A=e.object({m5:k,h1:k,h6:k,h24:k}),j=e.object({mint:h,chain:g,pool:h,txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/,`must be a 0x tx hash`),blockNumber:f,blockTimeMs:p,caller:h,ethMigrated:m,migrationFee:m,liquidity:m,feeTierBps:f,closingPriceNative:e.number().nonnegative().nullable()}),M=e.object({source:g,priceNative:e.number().nonnegative().nullable(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volume24hUsd:e.number().nonnegative().nullable(),priceChange24hPct:e.number().nullable(),holders:f.nullable(),fetchedAtMs:p}),N=e.object({mint:g,chain:g,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,feesTotal:m,creatorFeesNative:m,creatorFeesToken:m,holders:f,top10HolderPct:_.nullable(),watcherCount:f,creatorHoldingPct:_.nullable(),creatorSold:e.boolean(),athPriceNative:e.number().nonnegative(),athAtMs:p.nullable(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),windows:A,graduation:j.nullable(),external:M.nullable(),computedAtMs:p.nullable(),generatedAt:d}),P=e.object({username:g,avatarUrl:e.string().nullable().optional(),isKol:e.boolean().optional(),isVerified:e.boolean().optional(),wallet:g,balance:m,pct:_}),be=e.object({wallet:g,kind:e.enum([`curve`,`pool`,`burn`]),balance:m,pct:_}),xe=e.object({mint:g,holderCount:f,holders:e.array(P),venues:e.array(be),nextCursor:e.string().nullable(),generatedAt:d}),F=e.object({mint:g,rocket:f,shit:f,myVote:e.enum([`rocket`,`shit`]).nullable(),canVote:e.boolean(),minBuyUsd:e.number().nonnegative(),generatedAt:d}),Se=e.object({mint:g,curveKind:b,baseFeeBps:e.number().int().nonnegative().max(1e4).nullable(),generatedAt:d}),Ce=e.enum([`1m`,`1h`,`4h`,`1d`]),we=e.object({bucketStartMs:p,open:e.number().nonnegative(),high:e.number().nonnegative(),low:e.number().nonnegative(),close:e.number().nonnegative(),volumeWei:m,tradeCount:f,venue:T}),Te=e.object({mint:g,timeframe:Ce,candles:e.array(we),generatedAt:d,changePercent:e.number().nullable(),linkOutUrl:e.string().nullable(),coverageThroughMs:e.number().nullable()}),Ee=e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),I=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(255),thumbUrl:e.string().nullable(),unitPriceUsd:e.number().nonnegative().nullable().optional()}),De=e.object({id:e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),creatorWallet:g,lifecycleState:v,createdAtMs:p,graduatedAtMs:p.nullable(),feeBurn:e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:m,tokensBurned:m,burnCount:e.number().int().nonnegative()}).nullable().optional(),bondingTarget:m,poolFeeBps:e.number().int().min(0).max(1e4).optional(),earlyBuyFeeBps:e.number().int().min(0).max(1e4).optional(),quoteToken:g.nullable().optional(),quoteAsset:I.nullable().optional(),curveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).optional(),compounding:e.boolean().optional(),compoundCommitBps:e.number().int().optional(),burnShareBps:e.number().int().optional(),launchWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),buyWindow:e.object({feeBps:e.number().int().positive(),decaySeconds:e.number().int().positive()}).nullable().optional(),priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),curveProgressPct:_,volume24h:m,buyVolume24h:m,sellVolume24h:m,changePct:Ee,trades24h:f,traders24h:f,holders:f,creatorSold:e.boolean(),creatorHoldingPct:_.nullable(),top10HolderPct:_.nullable(),athPriceNative:e.number().nonnegative(),lastTradeAtMs:p.nullable(),lastTradeDirection:e.enum([`buy`,`sell`]).nullable().default(null),momentum:e.number().nonnegative(),priceUsd:e.number().nonnegative().nullable(),fdvUsd:e.number().nonnegative().nullable(),volumeUsd:e.string().regex(/^\d+(?:\.\d+)?$/,`must be a non-negative decimal string`).nullable(),nativeUsdPrice:e.number().nonnegative().nullable(),nativeUsdAtMs:p.nullable(),mapRank:e.number().int().positive().nullable(),graveyard:e.boolean(),computedAtMs:p.nullable()}),Oe=e.object({coins:e.array(De),nextCursor:e.string().nullable(),generatedAt:d}),ke=e.object({symbol:g,priceUsd:e.number().positive().nullable(),feedUpdatedAtMs:p.nullable(),stalenessBoundMs:e.number().int().positive().nullable(),sourceNetwork:g.nullable()}),Ae=e.object({rates:e.array(ke),generatedAt:d}),je=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),metadataUri:e.string(),lifecycleState:g,balance:m,tokens:e.number().nonnegative(),priceNative:e.number().nonnegative(),valueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),quoteAsset:I.nullable().optional()}),Me=e.object({wallet:g,holdings:e.array(je),generatedAt:d}),Ne=e.object({mint:g,chain:g,ticker:e.string(),name:e.string(),lifecycleState:v,spentNative:m,receivedNative:m,tokensBought:m,tokensSold:m,balance:m,priceNative:e.number().nonnegative(),currentValueNative:e.number().nonnegative(),valuation:e.enum([`exit`,`mark`]),costBasisNative:e.number().nonnegative(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),totalPnlPct:e.number().nullable(),firstTradeAtMs:p,lastTradeAtMs:p,quoteAsset:I.nullable().optional()}),Pe=e.object({wallet:g,coins:e.array(Ne),generatedAt:d}),L=e.object({trades:f,buys:f,sells:f,buyVolumeNative:m,sellVolumeNative:m,volumeNative:m,feesNative:m,avgTradeNative:e.number().nonnegative().nullable(),largestTradeNative:e.number().nonnegative()}),R=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),realizedPnlNative:e.number()}),Fe=e.object({wallet:g,coinsTraded:f,coinsWithSells:f,winningCoins:f,winRatePct:e.number().nonnegative().nullable(),realizedPnlNative:e.number(),unrealizedPnlNative:e.number(),totalPnlNative:e.number(),spentNative:m,receivedNative:m,roiPct:e.number().nullable(),grossWinsNative:e.number().nonnegative(),grossLossesNative:e.number().nonnegative(),profitFactor:e.number().nonnegative().nullable(),avgWinNative:e.number().nonnegative().nullable(),avgLossNative:e.number().nonnegative().nullable(),bestCoin:R.nullable(),worstCoin:R.nullable(),avgHoldTimeMs:e.number().nonnegative().nullable(),graduationsBacked:f,tradingSinceMs:p.nullable(),mostActiveDay:e.object({date:g,trades:e.number().int().positive()}).nullable(),windows:e.object({"24h":L,"7d":L,"30d":L,all:L}),generatedAt:d}),Ie=e.object({t:p,realizedPnlNative:e.number()}),Le=e.object({wallet:g,points:e.array(Ie),tradeCount:f,complete:e.boolean(),baselineRealizedNative:e.number(),generatedAt:d}),Re=e.object({mint:g,ticker:e.string(),name:e.string(),metadataUri:e.string().nullable(),athFdvNative:e.number().nonnegative()}),ze=e.object({wallet:g,coinsCreated:f,coinsGraduated:f,coinsInBonding:f,coinsFailed:f,graduationRatePct:e.number().nonnegative().nullable(),creatorFeesNative:m,creatorFeesToken:m,combinedFdvNative:e.number().nonnegative(),bestLaunch:Re.nullable(),volumeNative:m,uniqueTraders:f,totalHolders:f,coinsCreatorStillHolding:f,handoffsGiven:f,handoffsReceived:f,generatedAt:d}),Be=e.object({mint:g,chain:g,ticker:g,name:g,metadataUri:e.string().nullable(),lifecycleState:v,watchedAtMs:p,priceNative:e.number().nonnegative(),fdvNative:e.number().nonnegative(),fdvUsd:e.number().nonnegative().nullable(),volume24h:m,changePct:e.object({m5:e.number().nullable(),h1:e.number().nullable(),h6:e.number().nullable(),h24:e.number().nullable()}),curveProgressPct:_,holders:f,nativeDecimals:f}),Ve=e.object({entries:e.array(Be),generatedAt:d}),z=e.object({mint:g,watching:e.boolean(),watcherCount:f}),B=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),He=e.number().int().min(1).max(1e4),Ue=e.object({chainId:e.number().int().positive(),publicRpcUrl:g.nullable().optional(),explorer:e.object({addressUrlTemplate:g,txUrlTemplate:g}).nullable().optional(),bondingCurveV4:g.nullable(),v4Quoter:g.nullable(),stateView:g.nullable(),universalRouter:g.nullable(),permit2:g.nullable(),positionManager:g.nullable().optional(),launchpadHook:g.nullable(),legacyBondingCurveV4:g.nullable(),legacyLaunchpadHook:g.nullable(),activeCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]),legacyCurveRelease:e.enum([`2.0`,`3.0`,`4.0`,`5.0`,`6.0`,`7.0`,`7.1`,`8.0`,`9.0`]).nullable().optional(),passBurnerFactory:g.nullable()}),We=e.object({address:g,symbol:g,name:g,decimals:e.number().int().min(0).max(36),description:e.string().nullable(),imageUrl:e.string().nullable(),thumbUrl:e.string().nullable(),minTarget:m,maxTarget:m,minTargetUsd:e.number().nullable(),maxTargetUsd:e.number().nullable(),defaultTarget:m.nullable(),unitPriceUsd:e.number().nullable(),priceUpdatedAt:d.nullable(),pegMaxAgeHours:e.number().int().min(1).max(72),sortOrder:e.number().int(),raiseMenuEnabled:e.boolean()}),V=e.number().positive(),Ge=e.object({usd:e.tuple([V,V,V,V,V]),defaultIndex:e.number().int().min(0).max(4)}),Ke=e.object({card:e.boolean().optional(),bank:e.boolean().optional(),deposit:e.boolean().optional(),asset:g}),qe=e.object({evmLaunchChain:B.nullable(),enabledChains:e.array(B).nonempty(),creatorFeeShareBps:e.number().int().min(0).max(1e4).nullable(),landFeeShareBps:e.number().int().min(0).max(1e4).nullable(),compounding:e.object({creatorShareBps:e.number().int().min(0).max(1e4),compoundShareBps:e.number().int().min(0).max(1e4).optional(),mandatory:e.boolean().optional(),commitMenu:e.array(He).optional(),mandatoryCommitBps:e.number().int().min(0).max(1e4).optional()}).nullable(),launchFeeWei:m.nullable(),tradeFeeBps:e.number().int().min(0).max(1e4).nullable(),migrationFeeBps:e.number().int().min(0).max(1e4).nullable(),ctoFeeWei:m.nullable(),launchWindow:y.nullable().optional(),buyWindow:y.nullable().optional(),graduationSurchargeEnabled:e.boolean().nullable().optional(),earlyBuyEnabled:e.boolean().nullable().optional(),sellWindowEnabled:e.boolean().nullable().optional(),curveCreatorFeesEnabled:e.boolean().nullable().optional(),burnCommitEnabled:e.boolean().nullable().optional(),sniperTaxWindowSeconds:e.number().int().min(0).nullable().optional(),quoteAssets:e.array(We).nullable().optional(),raiseLadder:Ge.nullable().optional(),curveContracts:Ue.nullable().optional(),termsVersion:g,agentAccessEnabled:e.boolean(),worldEnabled:e.boolean().optional(),funding:Ke.optional(),fundingEnabled:e.boolean().optional()}),Je=e.object({from:h,to:h,data:e.string().regex(/^0x(?:[0-9a-fA-F]{2})*$/,`must be 0x hex bytes`),value:m,chainId:e.number().int().positive(),gas:m.nullable()}),Ye=e.object({id:e.uuid(),worldId:g,model:g,x:e.number(),z:e.number(),y:e.number().nullable(),yaw:e.number(),scale:e.number().positive(),updatedAtMs:p}),Xe=e.tuple([e.number(),e.number()]),Ze=e.object({players:e.array(Xe),total:f}),Qe=e.object({peerId:e.string().nullable(),name:e.string(),wallet:g.nullable(),username:e.string().nullable(),online:e.boolean()}),$e=e.object({players:e.array(Qe)}),et=e.object({volume24hWei:m,volume24hUsd:e.number().nullable(),trades24h:f,activeTraders24h:f,playersOnline:f,boardsActive:f,boardsOccupied:f,generatedAt:d});var H=class extends Error{retryAfterMs;limit;remaining;resetAt;constructor(e,t){super(e),this.name=`RateLimitError`,this.retryAfterMs=t.retryAfterMs,this.limit=t.limit,this.remaining=t.remaining,this.resetAt=t.resetAt}},U=class extends Error{status;apiError;details;constructor(e,t){super(e),this.name=`ApiError`,this.status=t.status,this.apiError=t.apiError,this.details=t.details}};async function tt(e){try{let t=await e.json();if(typeof t==`object`&&t)return{apiError:`error`in t&&typeof t.error==`string`?t.error:void 0,details:nt(t)}}catch{}return{apiError:void 0,details:void 0}}function nt(e){if(!(`details`in e)||!Array.isArray(e.details))return;let t=e.details.filter(e=>typeof e==`object`&&!!e&&`field`in e&&typeof e.field==`string`&&`reason`in e&&typeof e.reason==`string`);return t.length>0?t:void 0}function W(e,t){let n=e.headers.get(t);if(n===null||n.trim()===``)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function rt(e){let t=e.headers.get(`retry-after`);if(t===null||t.trim()===``)return;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1e3);let r=Date.parse(t);return Number.isNaN(r)?void 0:Math.max(0,r-Date.now())}function it(e){let t=e.fetch??fetch,n=e.baseUrl.replace(/\/+$/,``),r=e.headers??{};async function i(e,t,n){if(n.status===429){let e=W(n,`x-ratelimit-reset`);return new H(`API rate limit exceeded (${t})`,{retryAfterMs:rt(n)??0,limit:W(n,`x-ratelimit-limit`),remaining:W(n,`x-ratelimit-remaining`),resetAt:e===void 0?void 0:Date.now()+e*1e3})}return new U(`API request failed: ${n.status} ${n.statusText} (${e} ${t})`,{status:n.status,...await tt(n)})}return{async request(e,a,o){let s=await t(`${n}${a}`,{method:e,credentials:`include`,headers:{...r,...o!==void 0&&{"content-type":`application/json`}},...o!==void 0&&{body:JSON.stringify(o)}});if(!s.ok)throw await i(e,a,s);if(s.status!==204)return await s.json()},async requestRaw(e,a,o){let s=await t(`${n}${e}`,{method:`POST`,credentials:`include`,headers:{...r,"content-type":o},body:a});if(!s.ok)throw await i(`POST`,e,s);return await s.json()}}}const at=e.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`must be a ULID`),ot=e.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a kebab-case chain profile id`),G=e.string().min(1),K=e.iso.datetime(),q=e.number().int().nonnegative(),J=q,Y=e.string().regex(/^\d+$/,`must be a non-negative integer string`),X=e.object({id:at,mint:G,chain:ot,provider:e.string().min(1),providerMeta:re,bondingTarget:Y,creatorWallet:G,ticker:e.string().min(1),name:e.string().min(1),metadataUri:e.string().min(1),lifecycleState:v,createdAt:K,confirmedAt:K.nullable(),curveCompletedAt:K.nullable(),graduatedAt:K.nullable(),signals:ie.nullable(),curveProgress:e.number().min(0).max(1).nullable(),decimals:e.number().int().nonnegative().nullable(),createdAtMs:J,curveCompletedAtMs:J.nullable(),graduatedAtMs:J.nullable(),hidden:x.optional()}),st=e.object({launches:e.array(X),nextCursor:e.string().nullable()}),ct=e.object({shareBps:e.number().int().min(0).max(1e4),active:e.boolean(),ethBurnedWei:Y,tokensBurned:Y,burnCount:e.number().int().nonnegative()}),lt=e.object({launch:X,metrics:N,feeBurn:ct.nullable().optional(),thesisCount:e.number().int().nonnegative().optional()}),ut=e.object({slotIndex:q,tier:S.nullable(),coin:X.nullable()}),dt=e.object({slots:e.array(ut),generatedAt:K}),ft=e.object({slotIndex:q,tier:ae.nullable(),coin:X.nullable()}),pt=e.object({slots:e.array(ft),generatedAt:K}),mt=e.object({mint:G,rank:e.number().int().positive(),districtId:e.string().min(1),stallIndex:q,scoreAtAssign:e.number().nonnegative(),assignedAtMs:J,coin:X}),Z=e.object({placements:e.array(mt),generatedAt:K}),ht=e.object({launch:X,txRequests:e.array(Je).min(1),launchTxIndex:e.number().int().min(0).optional(),burnAwaitsFirstBuy:e.literal(!0).optional(),devBuyTokensOut:Y.optional()}),gt=e.object({launch:X}),Q=e.number(),_t=e.object({id:e.string().min(1),worldId:e.string().min(1),x:Q,z:Q,y:Q.nullable(),yaw:Q,tier:e.enum([`small`,`medium`,`large`]),status:e.enum([`active`,`disabled`]),slotCount:e.number().int().positive()}),vt=e.object({boardId:e.string().min(1),slotIndex:q,assetUrl:e.string().min(1),posterUrl:e.string().min(1).nullable(),contentType:e.string().min(1),kind:e.enum([`image`,`video`]),durationMs:e.number().nonnegative().nullable(),clickUrl:e.string().min(1),endsAtMs:J}),yt=e.object({feedId:e.string().min(1),propIds:e.array(e.uuid())}),bt=e.object({worldId:e.string().min(1),props:e.array(Ye),feedBindings:e.array(yt).optional(),generatedAt:K}),xt=e.object({worldId:e.string().min(1),boards:e.array(_t),placements:e.array(vt),publicBookingEnabled:e.boolean().optional(),generatedAt:K});function $(e){return e.status===`ready`||e.status===`failed`}async function St(e){return new Promise(t=>{setTimeout(t,e)})}function Ct(e){let t=it(e),n=async e=>t.request(`GET`,e),r=async(e,n)=>t.request(`POST`,e,n),i=e=>`${u.coins}/${encodeURIComponent(e)}`,a=e=>`${u.wallets}/${encodeURIComponent(e)}`;return{async health(){return oe.parse(await n(u.health))},async listCoins(e){let t=e?s(e):new URLSearchParams,r=l(u.coins,t);return Oe.parse(await n(r))},async getCoinSummary(e){return lt.parse(await n(i(e)))},async getCoinMetrics(e){return N.parse(await n(`${i(e)}/metrics`))},async getCoinHolders(e,t){let r=new URLSearchParams;t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.cursor!==void 0&&r.set(`cursor`,t.cursor);let a=l(`${i(e)}/holders`,r);return xe.parse(await n(a))},async getCoinTraders(e,t){let r=t?ne(t):new URLSearchParams,a=l(`${i(e)}/traders`,r);return O.parse(await n(a))},async getCoinTrades(e,t){let r=c(t??{}),a=l(`${i(e)}/trades`,r);return pe.parse(await n(a))},async getCoinBurns(e,t){let r=c(t??{}),a=l(`${i(e)}/burns`,r);return ge.parse(await n(a))},async getCandles(e,t){let r=new URLSearchParams;t?.timeframe!==void 0&&r.set(`tf`,t.timeframe),t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.before!==void 0&&r.set(`before`,String(t.before));let a=l(`${i(e)}/candles`,r);return Te.parse(await n(a))},async getCoinSentiment(e){return F.parse(await n(`${i(e)}/sentiment`))},async setCoinSentiment(e,n){return F.parse(await t.request(`PUT`,`${i(e)}/sentiment`,{vote:n}))},async editCoinDetails(e,n){return gt.parse(await t.request(`PUT`,`${i(e)}/details`,n))},async getPoolFee(e){return Se.parse(await n(`${i(e)}/pool-fee`))},async getActivity(e){let t=e?te(e):new URLSearchParams,r=l(u.activity,t);return _e.parse(await n(r))},async getLaunch(e){return X.parse(await n(`${u.launches}/${encodeURIComponent(e)}`))},async listLaunches(e){let t=new URLSearchParams;e?.cursor!==void 0&&t.set(`cursor`,e.cursor),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.sort!==void 0&&t.set(`sort`,e.sort),e?.state!==void 0&&t.set(`state`,e.state),e?.world!==void 0&&t.set(`world`,e.world),e?.q!==void 0&&t.set(`q`,e.q);let r=l(u.launches,t);return st.parse(await n(r))},async getLaunchConfig(){return qe.parse(await n(u.config))},async getPlacements(){return Z.parse(await n(u.placements))},async getNativeUsdRates(){return Ae.parse(await n(u.rates))},async getWalletHoldings(e){return Me.parse(await n(`${a(e)}/holdings`))},async getWalletPnl(e){return Pe.parse(await n(`${a(e)}/pnl`))},async getWalletTrades(e,t){let r=t?ee(t):new URLSearchParams,i=l(`${a(e)}/trades`,r);return ve.parse(await n(i))},async getWalletTradingStats(e){return Fe.parse(await n(`${a(e)}/trading-stats`))},async getWalletPnlCurve(e){return Le.parse(await n(`${a(e)}/pnl-curve`))},async getCreatorStats(e){return ze.parse(await n(`${a(e)}/creator-stats`))},async uploadAsset(e,n){return w.parse(await t.requestRaw(u.garageAsset,e,n))},async getMedia(e){return w.parse(await n(`${u.media}/${encodeURIComponent(e)}`))},async uploadAndAwaitReady(e,r,i){let a=i?.intervalMs??1e3,o=i?.timeoutMs??6e4,s=w.parse(await t.requestRaw(u.garageAsset,e,r));if($(s))return s;let c=Date.now()+o;for(;Date.now()<c;)if(await St(a),s=w.parse(await n(`${u.media}/${encodeURIComponent(s.key)}`)),$(s))return s;throw Error(`Media ${s.key} was still ${s.status} after ${String(o)}ms`)},async getWatchlist(){return Ve.parse(await n(u.watchlist))},async watchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`PUT`,n))},async unwatchCoin(e){let n=`${u.watchlist}/${encodeURIComponent(e)}`;return z.parse(await t.request(`DELETE`,n))},async getProfile(e){return C.parse(await n(`${u.profile}/${encodeURIComponent(e)}`))},async getMyProfile(){return C.parse(await n(u.profileMe))},async updateProfile(e){return C.parse(await t.request(`PUT`,u.profile,e))},async checkHandle(e){let t=l(u.profileHandleCheck,new URLSearchParams({handle:e}));return de.parse(await n(t))},async getWorldProps(){return bt.parse(await n(u.worldProps))},async getWorldPlayers(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldPlayers,t);return Ze.parse(await n(r))},async searchWorldPlayers(e,t){let r=new URLSearchParams({q:e});t!==void 0&&r.set(`world`,t);let i=l(u.worldPlayerSearch,r);return $e.parse(await n(i))},async getBazaar(){return dt.parse(await n(u.bazaar))},async getRing(){return pt.parse(await n(u.ring))},async getAdBoards(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.worldAdBoards,t);return xt.parse(await n(r))},async getAdPulse(e){let t=new URLSearchParams;e!==void 0&&t.set(`world`,e);let r=l(u.adsPulse,t);return et.parse(await n(r))},async buildLaunch(e){return ht.parse(await r(u.launchBuild,e))},async confirmLaunch(e,t){return X.parse(await r(`${u.launches}/${encodeURIComponent(e)}/confirm`,t))},async walletChallenge(e){return se.parse(await r(u.walletChallenge,e??{}))},async walletLink(e){return ce.parse(await r(u.walletLink,e))},async walletUnlink(e){return le.parse(await r(u.walletUnlink,e??{}))},async walletModeration(){return ue.parse(await n(u.walletModeration))}}}export{U as ApiError,H as RateLimitError,Ct as createClient};