@chainstream-io/sdk 0.1.26 → 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,576 +0,0 @@
1
- import { hA as Resolution, a as Configuration, U as DexApi, Z as DexPoolApi, bh as TokenApi, bR as WalletApi, by as TradeApi, av as RankingApi, bK as TransactionApi, z as DefiSolanaMoonshotApi, K as DefiSolanaPumpfunApi, aU as RedPacketApi, a7 as IpfsApi, w as BlockchainApi, bT as WatchlistApi, aa as JobsApi, ap as KYTApi, a5 as EndpointApi } from './WatchlistApi-XN9Rn27y.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 TokenMaxLiquidity {
203
- tokenAddress: string;
204
- poolAddress: string;
205
- liquidityInUsd: string;
206
- liquidityInNative: string;
207
- timestamp: number;
208
- }
209
- interface TokenTotalLiquidity {
210
- tokenAddress: string;
211
- liquidityInUsd: string;
212
- liquidityInNative: string;
213
- poolCount: number;
214
- timestamp: number;
215
- }
216
- interface DexProtocol {
217
- programAddress?: string;
218
- protocolFamily?: string;
219
- protocolName?: string;
220
- }
221
- interface TokenBondingCurve {
222
- tokenAddress?: string;
223
- progressRatio?: string;
224
- }
225
- interface TokenMetadata {
226
- tokenAddress: string;
227
- name?: string;
228
- decimals?: number;
229
- symbol?: string;
230
- imageUrl?: string;
231
- description?: string;
232
- socialMedia?: socialMedia;
233
- createdAtMs?: number;
234
- launchFrom?: DexProtocol;
235
- migratedTo?: DexProtocol;
236
- }
237
- interface socialMedia {
238
- twitter?: string;
239
- telegram?: string;
240
- website?: string;
241
- tiktok?: string;
242
- discord?: string;
243
- facebook?: string;
244
- github?: string;
245
- instagram?: string;
246
- linkedin?: string;
247
- medium?: string;
248
- reddit?: string;
249
- youtube?: string;
250
- bitbucket?: string;
251
- }
252
- interface TokenCandle {
253
- open: string;
254
- close: string;
255
- high: string;
256
- low: string;
257
- volume: string;
258
- resolution: Resolution;
259
- time: number;
260
- number: number;
261
- }
262
- interface TradeActivity {
263
- tokenAddress: string;
264
- timestamp: number;
265
- kind: string;
266
- buyAmount: string;
267
- buyAmountInUsd: string;
268
- buyTokenAddress: string;
269
- buyTokenName: string;
270
- buyTokenSymbol: string;
271
- buyWalletAddress: string;
272
- sellAmount: string;
273
- sellAmountInUsd: string;
274
- sellTokenAddress: string;
275
- sellTokenName: string;
276
- sellTokenSymbol: string;
277
- sellWalletAddress: string;
278
- txHash: string;
279
- }
280
- interface WalletTokenPnl {
281
- walletAddress: string;
282
- tokenAddress: string;
283
- tokenPriceInUsd: string;
284
- timestamp: number;
285
- opentime: number;
286
- lasttime: number;
287
- closetime: number;
288
- buyAmount: string;
289
- buyAmountInUsd: string;
290
- buyCount: number;
291
- buyCount30d: number;
292
- buyCount7d: number;
293
- sellAmount: string;
294
- sellAmountInUsd: string;
295
- sellCount: number;
296
- sellCount30d: number;
297
- sellCount7d: number;
298
- heldDurationTimestamp: number;
299
- averageBuyPriceInUsd: string;
300
- averageSellPriceInUsd: string;
301
- unrealizedProfitInUsd: string;
302
- unrealizedProfitRatio: string;
303
- realizedProfitInUsd: string;
304
- realizedProfitRatio: string;
305
- totalRealizedProfitInUsd: string;
306
- totalRealizedProfitRatio: string;
307
- }
308
- declare enum RankingType {
309
- NEW = "new",
310
- HOT = "trending",
311
- STOCKS = "stocks",
312
- FINALSTRETCH = "completed",
313
- MIGRATED = "graduated"
314
- }
315
- declare enum Dex {
316
- PUMP_FUN = "pump_fun",
317
- RAYDIUM_LAUNCHPAD = "raydium_launchpad",
318
- METEOR_DYNAMIC_BOUNDING_CURVE = "meteora_dynamic_bounding_curve",
319
- BONK_FUN = "bonk_fun",
320
- BOOP_FUN = "boop_fun",
321
- MOONIT_FUN = "moonit_fun"
322
- }
323
- interface RankingTokenList {
324
- metadata?: TokenMetadata;
325
- holder?: TokenHolder;
326
- supply?: TokenSupply;
327
- stat?: TokenStat;
328
- bondingCurve?: TokenBondingCurve;
329
- }
330
-
331
- interface Unsubscrible {
332
- unsubscribe(): void;
333
- }
334
- declare class StreamApi {
335
- private realtimeClient;
336
- private listenersMap;
337
- private context;
338
- private initPromise;
339
- constructor(context: DexRequestContext);
340
- /**
341
- * Initialize Centrifuge client with current token
342
- * This is called lazily when connect() is called
343
- */
344
- private initClient;
345
- /**
346
- * Wait for initialization to complete
347
- * If not initialized, auto-connect first
348
- */
349
- private ensureInitialized;
350
- /**
351
- * Get token value from string or TokenProvider
352
- */
353
- private getTokenValue;
354
- /**
355
- * Build WebSocket URL with token as query parameter
356
- */
357
- private buildWsUrl;
358
- /**
359
- * Connect to the WebSocket server.
360
- * This is automatically called when you use subscribe methods if not already connected.
361
- * You can also call this method manually for explicit control.
362
- */
363
- connect(): void;
364
- /**
365
- * Disconnect from the WebSocket server.
366
- * All subscriptions will be automatically removed.
367
- */
368
- disconnect(): void;
369
- /**
370
- * Check if the WebSocket is currently connected.
371
- */
372
- isConnected(): boolean;
373
- /**
374
- * Start batching commands for efficient bulk operations
375
- * All subscription commands after this call will be batched until stopBatching is called
376
- */
377
- startBatching(): void;
378
- /**
379
- * Stop batching and flush all collected commands to the server
380
- * This will send all batched subscription commands in a single network request
381
- */
382
- stopBatching(): void;
383
- /**
384
- * Batch subscribe method that accepts a function containing subscription calls
385
- * All subscription methods called within the function will be batched
386
- * @param batchFunction Function containing subscription method calls
387
- * @returns Array of unsubscribe functions
388
- */
389
- batchSubscribe(batchFunction: () => Unsubscrible[]): Unsubscrible[];
390
- /**
391
- * Batch unsubscribe method that accepts an array of unsubscribe functions
392
- * All unsubscribe calls will be executed at once
393
- * @param unsubscribles Array of unsubscribe functions to execute
394
- */
395
- batchUnsubscribe(unsubscribles: Unsubscrible[]): void;
396
- subscribe<T = any>(channel: string, fn: (data: T) => void, filter?: string, methodName?: string): Unsubscrible;
397
- unsubscribe<T = any>(channel: string, fn: (data: T) => void): void;
398
- private formatScientificNotation;
399
- subscribeTokenCandles({ chain, tokenAddress, resolution, callback, filter, }: {
400
- chain: string;
401
- tokenAddress: string;
402
- resolution: Resolution;
403
- callback: (data: TokenCandle) => void;
404
- filter?: string;
405
- }): Unsubscrible;
406
- subscribeTokenStats({ chain, tokenAddress, callback, filter, }: {
407
- chain: string;
408
- tokenAddress: string;
409
- callback: (data: TokenStat) => void;
410
- filter?: string;
411
- }): Unsubscrible;
412
- subscribeTokenHolders({ chain, tokenAddress, callback, filter, }: {
413
- chain: string;
414
- tokenAddress: string;
415
- callback: (data: TokenHolder) => void;
416
- filter?: string;
417
- }): Unsubscrible;
418
- subscribeNewToken({ chain, callback, filter, }: {
419
- chain: string;
420
- callback: (data: NewToken) => void;
421
- filter?: string;
422
- }): Unsubscrible;
423
- subscribeNewTokensMetadata({ chain, callback, }: {
424
- chain: string;
425
- callback: (data: TokenMetadata[]) => void;
426
- }): Unsubscrible;
427
- subscribeTokenSupply({ chain, tokenAddress, callback, filter, }: {
428
- chain: string;
429
- tokenAddress: string;
430
- callback: (data: TokenSupply) => void;
431
- filter?: string;
432
- }): Unsubscrible;
433
- subscribeTokenLiquidity({ chain, tokenAddress, callback, filter, }: {
434
- chain: string;
435
- tokenAddress: string;
436
- callback: (data: TokenLiquidity) => void;
437
- filter?: string;
438
- }): Unsubscrible;
439
- /**
440
- * Subscribe to token max liquidity updates
441
- * Pushes the max liquidity info of a token in a single pool
442
- * Channel: dex-token-liquidity:{chain}_{token_address}
443
- */
444
- subscribeTokenMaxLiquidity({ chain, tokenAddress, callback, filter, }: {
445
- chain: string;
446
- tokenAddress: string;
447
- callback: (data: TokenMaxLiquidity) => void;
448
- filter?: string;
449
- }): Unsubscrible;
450
- /**
451
- * Subscribe to token total liquidity updates
452
- * Pushes the total liquidity info of a token across all pools
453
- * Channel: dex-token-total-liquidity:{chain}_{token_address}
454
- */
455
- subscribeTokenTotalLiquidity({ chain, tokenAddress, callback, filter, }: {
456
- chain: string;
457
- tokenAddress: string;
458
- callback: (data: TokenTotalLiquidity) => void;
459
- filter?: string;
460
- }): Unsubscrible;
461
- subscribeRankingTokensLiquidity({ chain, channelType, callback, }: {
462
- chain: string;
463
- channelType: ChannelType;
464
- callback: (data: TokenLiquidity[]) => void;
465
- }): Unsubscrible;
466
- subscribeRankingTokensList({ chain, ranking_type, dex, callback, }: {
467
- chain: string;
468
- ranking_type: RankingType;
469
- dex?: Dex;
470
- callback: (data: RankingTokenList[]) => void;
471
- }): Unsubscrible;
472
- subscribeRankingTokensStats({ chain, channelType, callback, }: {
473
- chain: string;
474
- channelType: ChannelType;
475
- callback: (data: TokenStat[]) => void;
476
- }): Unsubscrible;
477
- subscribeRankingTokensHolders({ chain, channelType, callback, }: {
478
- chain: string;
479
- channelType: ChannelType;
480
- callback: (data: TokenHolder[]) => void;
481
- }): Unsubscrible;
482
- subscribeRankingTokensSupply({ chain, channelType, callback, }: {
483
- chain: string;
484
- channelType: ChannelType;
485
- callback: (data: TokenSupply[]) => void;
486
- }): Unsubscrible;
487
- subscribeRankingTokensBondingCurve({ chain, callback, }: {
488
- chain: string;
489
- callback: (data: TokenBondingCurve[]) => void;
490
- }): Unsubscrible;
491
- subscribeWalletBalance({ chain, walletAddress, callback, filter, }: {
492
- chain: string;
493
- walletAddress: string;
494
- callback: (data: WalletBalance[]) => void;
495
- filter?: string;
496
- }): Unsubscrible;
497
- subscribeWalletPnl({ chain, walletAddress, callback, filter, }: {
498
- chain: string;
499
- walletAddress: string;
500
- callback: (data: WalletTokenPnl) => void;
501
- filter?: string;
502
- }): Unsubscrible;
503
- subscribeWalletPnlList({ chain, walletAddress, callback, }: {
504
- chain: string;
505
- walletAddress: string;
506
- callback: (data: WalletPnl[]) => void;
507
- }): Unsubscrible;
508
- subscribeTokenTrade({ chain, tokenAddress, callback, filter, }: {
509
- chain: string;
510
- tokenAddress: string;
511
- callback: (data: TradeActivity) => void;
512
- filter?: string;
513
- }): Unsubscrible;
514
- subscribeWalletTrade({ chain, walletAddress, callback, filter, }: {
515
- chain: string;
516
- walletAddress: string;
517
- callback: (data: TradeActivity) => void;
518
- filter?: string;
519
- }): Unsubscrible;
520
- subscribeDexPoolBalance({ chain, poolAddress, callback, }: {
521
- chain: string;
522
- poolAddress: string;
523
- callback: (data: DexPoolBalance) => void;
524
- }): Unsubscrible;
525
- }
526
-
527
- interface TokenProvider {
528
- getToken(): Promise<string> | string;
529
- }
530
- interface DexRequestContext {
531
- baseUrl: string;
532
- streamUrl: string;
533
- accessToken: string | TokenProvider;
534
- }
535
- interface DexAggregatorOptions {
536
- debug?: boolean;
537
- serverUrl?: string;
538
- streamUrl?: string;
539
- /**
540
- * Whether to automatically connect to WebSocket on initialization.
541
- * Default: false
542
- *
543
- * If set to true, WebSocket will connect automatically.
544
- * If false or not set, you need to manually call `client.stream.connect()` when needed.
545
- */
546
- autoConnectWebSocket?: boolean;
547
- }
548
- declare const LIB_VERSION = "0.1.26";
549
- declare class ChainStreamClient {
550
- readonly requestCtx: DexRequestContext;
551
- readonly _configuration: Configuration;
552
- readonly dex: DexApi;
553
- readonly dexpool: DexPoolApi;
554
- readonly token: TokenApi;
555
- readonly wallet: WalletApi;
556
- readonly trade: TradeApi;
557
- readonly ranking: RankingApi;
558
- readonly transaction: TransactionApi;
559
- readonly moonshot: DefiSolanaMoonshotApi;
560
- readonly pumpfun: DefiSolanaPumpfunApi;
561
- readonly stream: StreamApi;
562
- readonly redPacket: RedPacketApi;
563
- readonly ipfs: IpfsApi;
564
- readonly blockchain: BlockchainApi;
565
- readonly watchlist: WatchlistApi;
566
- readonly jobs: JobsApi;
567
- readonly kyt: KYTApi;
568
- readonly endpoint: EndpointApi;
569
- constructor(accessToken: string | TokenProvider, options?: DexAggregatorOptions);
570
- waitForJob<T>(jobId: string, timeout?: number): Promise<T>;
571
- }
572
- interface PostOptions {
573
- idempotencyKey?: string;
574
- }
575
-
576
- 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 TokenMaxLiquidity as g, type TokenTotalLiquidity as h, type DexProtocol as i, type TokenBondingCurve as j, type TokenMetadata as k, type TokenCandle as l, type TradeActivity as m, type WalletTokenPnl as n, Dex as o, type RankingTokenList as p, type TokenProvider as q, type DexRequestContext as r, type socialMedia as s, type DexAggregatorOptions as t, ChainStreamClient as u };