@chainstream-io/sdk 0.1.25 → 0.2.1

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.
@@ -1,540 +0,0 @@
1
- import { h2 as Resolution, a as Configuration, U as DexApi, Y as DexPoolApi, bf as TokenApi, bK as WalletApi, bv as TradeApi, au as RankingApi, bD as TransactionApi, z as DefiSolanaMoonshotApi, K as DefiSolanaPumpfunApi, aT as RedPacketApi, a6 as IpfsApi, w as BlockchainApi, bM as WatchlistApi, a9 as JobsApi, ao as KYTApi, a4 as EndpointApi } from './WatchlistApi-BG3KoB75.cjs';
2
-
3
- declare enum TokenActivityType {
4
- Sell = "sell",
5
- Buy = "buy",
6
- AddLiquidity = "add_liquidity",
7
- RemoveLiquidity = "remove_liquidity"
8
- }
9
- declare enum ChannelType {
10
- New = "new",
11
- HOT = "trending",
12
- US_STOCKS = "us_stocks",
13
- COMPLETED = "completed",
14
- GRADUATED = "graduated"
15
- }
16
- declare enum MetricType {
17
- LIQUIDITY_IN_USD = "liquidity_in_usd",
18
- MIGRATED_RATIO = "migrated_ratio"
19
- }
20
- interface TokenActivity {
21
- address: string;
22
- priceUsd: string;
23
- amount: string;
24
- type: TokenActivityType;
25
- txHash: string;
26
- timestamp: number;
27
- }
28
- interface TokenStat {
29
- address: string;
30
- timestamp: number;
31
- buys1m?: number;
32
- sells1m?: number;
33
- buyers1m?: number;
34
- sellers1m?: number;
35
- buyVolumeInUsd1m?: string;
36
- sellVolumeInUsd1m?: string;
37
- price1m?: string;
38
- openInUsd1m?: string;
39
- closeInUsd1m?: string;
40
- buys5m?: number;
41
- sells5m?: number;
42
- buyers5m?: number;
43
- sellers5m?: number;
44
- buyVolumeInUsd5m?: string;
45
- sellVolumeInUsd5m?: string;
46
- price5m?: string;
47
- openInUsd5m?: string;
48
- closeInUsd5m?: string;
49
- buys15m?: number;
50
- sells15m?: number;
51
- buyers15m?: number;
52
- sellers15m?: number;
53
- buyVolumeInUsd15m?: string;
54
- sellVolumeInUsd15m?: string;
55
- price15m?: string;
56
- openInUsd15m?: string;
57
- closeInUsd15m?: string;
58
- buys30m?: number;
59
- sells30m?: number;
60
- buyers30m?: number;
61
- sellers30m?: number;
62
- buyVolumeInUsd30m?: string;
63
- sellVolumeInUsd30m?: string;
64
- price30m?: string;
65
- openInUsd30m?: string;
66
- closeInUsd30m?: string;
67
- buys1h?: number;
68
- sells1h?: number;
69
- buyers1h?: number;
70
- sellers1h?: number;
71
- buyVolumeInUsd1h?: string;
72
- sellVolumeInUsd1h?: string;
73
- price1h?: string;
74
- openInUsd1h?: string;
75
- closeInUsd1h?: string;
76
- buys4h?: number;
77
- sells4h?: number;
78
- buyers4h?: number;
79
- sellers4h?: number;
80
- buyVolumeInUsd4h?: string;
81
- sellVolumeInUsd4h?: string;
82
- price4h?: string;
83
- openInUsd4h?: string;
84
- closeInUsd4h?: string;
85
- buys24h?: number;
86
- sells24h?: number;
87
- buyers24h?: number;
88
- sellers24h?: number;
89
- buyVolumeInUsd24h?: string;
90
- sellVolumeInUsd24h?: string;
91
- price24h?: string;
92
- openInUsd24h?: string;
93
- closeInUsd24h?: string;
94
- price?: string;
95
- }
96
- interface TokenHolder {
97
- tokenAddress: string;
98
- holders?: number;
99
- top100HoldersAmount?: string;
100
- top50HoldersAmount?: string;
101
- top10HoldersAmount?: string;
102
- top100Holders?: number;
103
- top50Holders?: number;
104
- top10Holders?: number;
105
- top100HoldersRatio?: string;
106
- top50HoldersRatio?: string;
107
- top10HoldersRatio?: string;
108
- creatorsHolders?: number;
109
- creatorsAmount?: string;
110
- creatorsRatio?: string;
111
- balanceTagFreshHolders?: number;
112
- balanceTagFreshAmount?: string;
113
- balanceTagFreshRatio?: string;
114
- balanceTagSandwichHolders?: number;
115
- balanceTagSandwichAmount?: string;
116
- balanceTagSandwichRatio?: string;
117
- balanceTagBundleHolders?: number;
118
- balanceTagBundleAmount?: string;
119
- balanceTagBundleRatio?: string;
120
- balanceTagSniperHolders?: number;
121
- balanceTagSniperAmount?: string;
122
- balanceTagSniperRatio?: string;
123
- balanceTagDevHolders?: number;
124
- balanceTagDevAmount?: string;
125
- balanceTagDevRatio?: string;
126
- balanceTagProHolders?: number;
127
- balanceTagProAmount?: string;
128
- balanceTagProRatio?: string;
129
- balanceTagInsiderHolders?: number;
130
- balanceTagInsiderAmount?: string;
131
- balanceTagInsiderRatio?: string;
132
- balanceTagSmartHolders?: number;
133
- balanceTagSmartAmount?: string;
134
- balanceTagSmartRatio?: string;
135
- balanceTagKolHolders?: number;
136
- balanceTagKolAmount?: string;
137
- balanceTagKolRatio?: string;
138
- balanceTagPhishingHolders?: number;
139
- balanceTagPhishingAmount?: string;
140
- balanceTagPhishingRatio?: string;
141
- balanceTagBluechipHolders?: number;
142
- balanceTagBluechipAmount?: string;
143
- balanceTagBluechipRatio?: string;
144
- balanceTagRatHolders?: number;
145
- balanceTagRatAmount?: string;
146
- balanceTagRatRatio?: string;
147
- timestamp: number;
148
- }
149
- interface WalletBalance {
150
- walletAddress: string;
151
- tokenAddress: string;
152
- tokenPriceInUsd: string;
153
- balance: string;
154
- timestamp: number;
155
- }
156
- interface WalletPnl {
157
- walletAddress: string;
158
- buys: number;
159
- buyAmount: string;
160
- buyAmountInUsd: string;
161
- averageBuyPriceInUsd: string;
162
- sellAmount: string;
163
- sellAmountInUsd: string;
164
- sells: number;
165
- wins: number;
166
- winRatio: string;
167
- pnlInUsd: string;
168
- averagePnlInUsd: string;
169
- pnlRatio: string;
170
- profitableDays: number;
171
- losingDays: number;
172
- tokens: number;
173
- resolution: string;
174
- }
175
- interface NewToken {
176
- tokenAddress: string;
177
- name: string;
178
- symbol: string;
179
- decimals?: number;
180
- launchFrom?: DexProtocol;
181
- createdAtMs: number;
182
- }
183
- interface TokenSupply {
184
- tokenAddress: string;
185
- supply?: string;
186
- marketCapInUsd?: string;
187
- timestamp: number;
188
- }
189
- interface DexPoolBalance {
190
- poolAddress: string;
191
- tokenAAddress: string;
192
- tokenALiquidityInUsd: string;
193
- tokenBAddress: string;
194
- tokenBLiquidityInUsd: string;
195
- }
196
- interface TokenLiquidity {
197
- tokenAddress: string;
198
- metricType: MetricType;
199
- value: string;
200
- timestamp: number;
201
- }
202
- interface DexProtocol {
203
- programAddress?: string;
204
- protocolFamily?: string;
205
- protocolName?: string;
206
- }
207
- interface TokenBondingCurve {
208
- tokenAddress?: string;
209
- progressRatio?: string;
210
- }
211
- interface TokenMetadata {
212
- tokenAddress: string;
213
- name?: string;
214
- decimals?: number;
215
- symbol?: string;
216
- imageUrl?: string;
217
- description?: string;
218
- socialMedia?: socialMedia;
219
- createdAtMs?: number;
220
- launchFrom?: DexProtocol;
221
- migratedTo?: DexProtocol;
222
- }
223
- interface socialMedia {
224
- twitter?: string;
225
- telegram?: string;
226
- website?: string;
227
- tiktok?: string;
228
- discord?: string;
229
- facebook?: string;
230
- github?: string;
231
- instagram?: string;
232
- linkedin?: string;
233
- medium?: string;
234
- reddit?: string;
235
- youtube?: string;
236
- bitbucket?: string;
237
- }
238
- interface TokenCandle {
239
- open: string;
240
- close: string;
241
- high: string;
242
- low: string;
243
- volume: string;
244
- resolution: Resolution;
245
- time: number;
246
- number: number;
247
- }
248
- interface TradeActivity {
249
- tokenAddress: string;
250
- timestamp: number;
251
- kind: string;
252
- buyAmount: string;
253
- buyAmountInUsd: string;
254
- buyTokenAddress: string;
255
- buyTokenName: string;
256
- buyTokenSymbol: string;
257
- buyWalletAddress: string;
258
- sellAmount: string;
259
- sellAmountInUsd: string;
260
- sellTokenAddress: string;
261
- sellTokenName: string;
262
- sellTokenSymbol: string;
263
- sellWalletAddress: string;
264
- txHash: string;
265
- }
266
- interface WalletTokenPnl {
267
- walletAddress: string;
268
- tokenAddress: string;
269
- tokenPriceInUsd: string;
270
- timestamp: number;
271
- opentime: number;
272
- lasttime: number;
273
- closetime: number;
274
- buyAmount: string;
275
- buyAmountInUsd: string;
276
- buyCount: number;
277
- buyCount30d: number;
278
- buyCount7d: number;
279
- sellAmount: string;
280
- sellAmountInUsd: string;
281
- sellCount: number;
282
- sellCount30d: number;
283
- sellCount7d: number;
284
- heldDurationTimestamp: number;
285
- averageBuyPriceInUsd: string;
286
- averageSellPriceInUsd: string;
287
- unrealizedProfitInUsd: string;
288
- unrealizedProfitRatio: string;
289
- realizedProfitInUsd: string;
290
- realizedProfitRatio: string;
291
- totalRealizedProfitInUsd: string;
292
- totalRealizedProfitRatio: string;
293
- }
294
- declare enum RankingType {
295
- NEW = "new",
296
- HOT = "trending",
297
- STOCKS = "stocks",
298
- FINALSTRETCH = "completed",
299
- MIGRATED = "graduated"
300
- }
301
- declare enum Dex {
302
- PUMP_FUN = "pump_fun",
303
- RAYDIUM_LAUNCHPAD = "raydium_launchpad",
304
- METEOR_DYNAMIC_BOUNDING_CURVE = "meteora_dynamic_bounding_curve",
305
- BONK_FUN = "bonk_fun",
306
- BOOP_FUN = "boop_fun",
307
- MOONIT_FUN = "moonit_fun"
308
- }
309
- interface RankingTokenList {
310
- metadata?: TokenMetadata;
311
- holder?: TokenHolder;
312
- supply?: TokenSupply;
313
- stat?: TokenStat;
314
- bondingCurve?: TokenBondingCurve;
315
- }
316
-
317
- interface Unsubscrible {
318
- unsubscribe(): void;
319
- }
320
- declare class StreamApi {
321
- private realtimeClient;
322
- private listenersMap;
323
- private context;
324
- private initPromise;
325
- constructor(context: DexRequestContext);
326
- /**
327
- * Initialize Centrifuge client with current token
328
- * This is called lazily when connect() is called
329
- */
330
- private initClient;
331
- /**
332
- * Wait for initialization to complete
333
- * If not initialized, auto-connect first
334
- */
335
- private ensureInitialized;
336
- /**
337
- * Get token value from string or TokenProvider
338
- */
339
- private getTokenValue;
340
- /**
341
- * Build WebSocket URL with token as query parameter
342
- */
343
- private buildWsUrl;
344
- /**
345
- * Connect to the WebSocket server.
346
- * This is automatically called when you use subscribe methods if not already connected.
347
- * You can also call this method manually for explicit control.
348
- */
349
- connect(): void;
350
- /**
351
- * Disconnect from the WebSocket server.
352
- * All subscriptions will be automatically removed.
353
- */
354
- disconnect(): void;
355
- /**
356
- * Check if the WebSocket is currently connected.
357
- */
358
- isConnected(): boolean;
359
- /**
360
- * Start batching commands for efficient bulk operations
361
- * All subscription commands after this call will be batched until stopBatching is called
362
- */
363
- startBatching(): void;
364
- /**
365
- * Stop batching and flush all collected commands to the server
366
- * This will send all batched subscription commands in a single network request
367
- */
368
- stopBatching(): void;
369
- /**
370
- * Batch subscribe method that accepts a function containing subscription calls
371
- * All subscription methods called within the function will be batched
372
- * @param batchFunction Function containing subscription method calls
373
- * @returns Array of unsubscribe functions
374
- */
375
- batchSubscribe(batchFunction: () => Unsubscrible[]): Unsubscrible[];
376
- /**
377
- * Batch unsubscribe method that accepts an array of unsubscribe functions
378
- * All unsubscribe calls will be executed at once
379
- * @param unsubscribles Array of unsubscribe functions to execute
380
- */
381
- batchUnsubscribe(unsubscribles: Unsubscrible[]): void;
382
- subscribe<T = any>(channel: string, fn: (data: T) => void, filter?: string, methodName?: string): Unsubscrible;
383
- unsubscribe<T = any>(channel: string, fn: (data: T) => void): void;
384
- private formatScientificNotation;
385
- subscribeTokenCandles({ chain, tokenAddress, resolution, callback, filter, }: {
386
- chain: string;
387
- tokenAddress: string;
388
- resolution: Resolution;
389
- callback: (data: TokenCandle) => void;
390
- filter?: string;
391
- }): Unsubscrible;
392
- subscribeTokenStats({ chain, tokenAddress, callback, filter, }: {
393
- chain: string;
394
- tokenAddress: string;
395
- callback: (data: TokenStat) => void;
396
- filter?: string;
397
- }): Unsubscrible;
398
- subscribeTokenHolders({ chain, tokenAddress, callback, filter, }: {
399
- chain: string;
400
- tokenAddress: string;
401
- callback: (data: TokenHolder) => void;
402
- filter?: string;
403
- }): Unsubscrible;
404
- subscribeNewToken({ chain, callback, filter, }: {
405
- chain: string;
406
- callback: (data: NewToken) => void;
407
- filter?: string;
408
- }): Unsubscrible;
409
- subscribeNewTokensMetadata({ chain, callback, }: {
410
- chain: string;
411
- callback: (data: TokenMetadata[]) => void;
412
- }): Unsubscrible;
413
- subscribeTokenSupply({ chain, tokenAddress, callback, filter, }: {
414
- chain: string;
415
- tokenAddress: string;
416
- callback: (data: TokenSupply) => void;
417
- filter?: string;
418
- }): Unsubscrible;
419
- subscribeTokenLiquidity({ chain, tokenAddress, callback, filter, }: {
420
- chain: string;
421
- tokenAddress: string;
422
- callback: (data: TokenLiquidity) => void;
423
- filter?: string;
424
- }): Unsubscrible;
425
- subscribeRankingTokensLiquidity({ chain, channelType, callback, }: {
426
- chain: string;
427
- channelType: ChannelType;
428
- callback: (data: TokenLiquidity[]) => void;
429
- }): Unsubscrible;
430
- subscribeRankingTokensList({ chain, ranking_type, dex, callback, }: {
431
- chain: string;
432
- ranking_type: RankingType;
433
- dex?: Dex;
434
- callback: (data: RankingTokenList[]) => void;
435
- }): Unsubscrible;
436
- subscribeRankingTokensStats({ chain, channelType, callback, }: {
437
- chain: string;
438
- channelType: ChannelType;
439
- callback: (data: TokenStat[]) => void;
440
- }): Unsubscrible;
441
- subscribeRankingTokensHolders({ chain, channelType, callback, }: {
442
- chain: string;
443
- channelType: ChannelType;
444
- callback: (data: TokenHolder[]) => void;
445
- }): Unsubscrible;
446
- subscribeRankingTokensSupply({ chain, channelType, callback, }: {
447
- chain: string;
448
- channelType: ChannelType;
449
- callback: (data: TokenSupply[]) => void;
450
- }): Unsubscrible;
451
- subscribeRankingTokensBondingCurve({ chain, callback, }: {
452
- chain: string;
453
- callback: (data: TokenBondingCurve[]) => void;
454
- }): Unsubscrible;
455
- subscribeWalletBalance({ chain, walletAddress, callback, filter, }: {
456
- chain: string;
457
- walletAddress: string;
458
- callback: (data: WalletBalance[]) => void;
459
- filter?: string;
460
- }): Unsubscrible;
461
- subscribeWalletPnl({ chain, walletAddress, callback, filter, }: {
462
- chain: string;
463
- walletAddress: string;
464
- callback: (data: WalletTokenPnl) => void;
465
- filter?: string;
466
- }): Unsubscrible;
467
- subscribeWalletPnlList({ chain, walletAddress, callback, }: {
468
- chain: string;
469
- walletAddress: string;
470
- callback: (data: WalletPnl[]) => void;
471
- }): Unsubscrible;
472
- subscribeTokenTrade({ chain, tokenAddress, callback, filter, }: {
473
- chain: string;
474
- tokenAddress: string;
475
- callback: (data: TradeActivity) => void;
476
- filter?: string;
477
- }): Unsubscrible;
478
- subscribeWalletTrade({ chain, walletAddress, callback, filter, }: {
479
- chain: string;
480
- walletAddress: string;
481
- callback: (data: TradeActivity) => void;
482
- filter?: string;
483
- }): Unsubscrible;
484
- subscribeDexPoolBalance({ chain, poolAddress, callback, }: {
485
- chain: string;
486
- poolAddress: string;
487
- callback: (data: DexPoolBalance) => void;
488
- }): Unsubscrible;
489
- }
490
-
491
- interface TokenProvider {
492
- getToken(): Promise<string> | string;
493
- }
494
- interface DexRequestContext {
495
- baseUrl: string;
496
- streamUrl: string;
497
- accessToken: string | TokenProvider;
498
- }
499
- interface DexAggregatorOptions {
500
- debug?: boolean;
501
- serverUrl?: string;
502
- streamUrl?: string;
503
- /**
504
- * Whether to automatically connect to WebSocket on initialization.
505
- * Default: false
506
- *
507
- * If set to true, WebSocket will connect automatically.
508
- * If false or not set, you need to manually call `client.stream.connect()` when needed.
509
- */
510
- autoConnectWebSocket?: boolean;
511
- }
512
- declare const LIB_VERSION = "0.1.25";
513
- declare class DexClient {
514
- readonly requestCtx: DexRequestContext;
515
- readonly _configuration: Configuration;
516
- readonly dex: DexApi;
517
- readonly dexpool: DexPoolApi;
518
- readonly token: TokenApi;
519
- readonly wallet: WalletApi;
520
- readonly trade: TradeApi;
521
- readonly ranking: RankingApi;
522
- readonly transaction: TransactionApi;
523
- readonly moonshot: DefiSolanaMoonshotApi;
524
- readonly pumpfun: DefiSolanaPumpfunApi;
525
- readonly stream: StreamApi;
526
- readonly redPacket: RedPacketApi;
527
- readonly ipfs: IpfsApi;
528
- readonly blockchain: BlockchainApi;
529
- readonly watchlist: WatchlistApi;
530
- readonly jobs: JobsApi;
531
- readonly kyt: KYTApi;
532
- readonly endpoint: EndpointApi;
533
- constructor(accessToken: string | TokenProvider, options?: DexAggregatorOptions);
534
- waitForJob<T>(jobId: string, timeout?: number): Promise<T>;
535
- }
536
- interface PostOptions {
537
- idempotencyKey?: string;
538
- }
539
-
540
- export { ChannelType as C, type DexPoolBalance as D, LIB_VERSION as L, MetricType as M, type NewToken as N, type PostOptions as P, RankingType as R, StreamApi as S, TokenActivityType as T, type Unsubscrible as U, type WalletBalance as W, type TokenActivity as a, type TokenStat as b, type TokenHolder as c, type WalletPnl as d, type TokenSupply as e, type TokenLiquidity as f, type DexProtocol as g, type TokenBondingCurve as h, type TokenMetadata as i, type TokenCandle as j, type TradeActivity as k, type WalletTokenPnl as l, Dex as m, type RankingTokenList as n, type TokenProvider as o, type DexRequestContext as p, type DexAggregatorOptions as q, DexClient as r, type socialMedia as s };