@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.
@@ -8,232 +8,248 @@ import { Centrifuge } from "@chainstream-io/centrifuge";
8
8
  // src/stream/stream.fields.ts
9
9
  var CEL_FIELD_MAPPINGS = {
10
10
  // Wallet balance subscription fields
11
- "subscribeWalletBalance": {
12
- "walletAddress": "a",
13
- "tokenAddress": "ta",
14
- "tokenPriceInUsd": "tpiu",
15
- "balance": "b",
16
- "timestamp": "t"
11
+ subscribeWalletBalance: {
12
+ walletAddress: "a",
13
+ tokenAddress: "ta",
14
+ tokenPriceInUsd: "tpiu",
15
+ balance: "b",
16
+ timestamp: "t"
17
17
  },
18
18
  // Token candles subscription fields
19
- "subscribeTokenCandles": {
20
- "open": "o",
21
- "close": "c",
22
- "high": "h",
23
- "low": "l",
24
- "volume": "v",
25
- "resolution": "r",
26
- "time": "t",
27
- "number": "n"
19
+ subscribeTokenCandles: {
20
+ open: "o",
21
+ close: "c",
22
+ high: "h",
23
+ low: "l",
24
+ volume: "v",
25
+ resolution: "r",
26
+ time: "t",
27
+ number: "n"
28
28
  },
29
29
  // Token stats subscription fields
30
- "subscribeTokenStats": {
31
- "address": "a",
32
- "timestamp": "t",
33
- "buys1m": "b1m",
34
- "sells1m": "s1m",
35
- "buyers1m": "be1m",
36
- "sellers1m": "se1m",
37
- "buyVolumeInUsd1m": "bviu1m",
38
- "sellVolumeInUsd1m": "sviu1m",
39
- "price1m": "p1m",
40
- "openInUsd1m": "oiu1m",
41
- "closeInUsd1m": "ciu1m",
42
- "buys5m": "b5m",
43
- "sells5m": "s5m",
44
- "buyers5m": "be5m",
45
- "sellers5m": "se5m",
46
- "buyVolumeInUsd5m": "bviu5m",
47
- "sellVolumeInUsd5m": "sviu5m",
48
- "price5m": "p5m",
49
- "openInUsd5m": "oiu5m",
50
- "closeInUsd5m": "ciu5m",
51
- "buys15m": "b15m",
52
- "sells15m": "s15m",
53
- "buyers15m": "be15m",
54
- "sellers15m": "se15m",
55
- "buyVolumeInUsd15m": "bviu15m",
56
- "sellVolumeInUsd15m": "sviu15m",
57
- "price15m": "p15m",
58
- "openInUsd15m": "oiu15m",
59
- "closeInUsd15m": "ciu15m",
60
- "buys30m": "b30m",
61
- "sells30m": "s30m",
62
- "buyers30m": "be30m",
63
- "sellers30m": "se30m",
64
- "buyVolumeInUsd30m": "bviu30m",
65
- "sellVolumeInUsd30m": "sviu30m",
66
- "price30m": "p30m",
67
- "openInUsd30m": "oiu30m",
68
- "closeInUsd30m": "ciu30m",
69
- "buys1h": "b1h",
70
- "sells1h": "s1h",
71
- "buyers1h": "be1h",
72
- "sellers1h": "se1h",
73
- "buyVolumeInUsd1h": "bviu1h",
74
- "sellVolumeInUsd1h": "sviu1h",
75
- "price1h": "p1h",
76
- "openInUsd1h": "oiu1h",
77
- "closeInUsd1h": "ciu1h",
78
- "buys4h": "b4h",
79
- "sells4h": "s4h",
80
- "buyers4h": "be4h",
81
- "sellers4h": "se4h",
82
- "buyVolumeInUsd4h": "bviu4h",
83
- "sellVolumeInUsd4h": "sviu4h",
84
- "price4h": "p4h",
85
- "openInUsd4h": "oiu4h",
86
- "closeInUsd4h": "ciu4h",
87
- "buys24h": "b24h",
88
- "sells24h": "s24h",
89
- "buyers24h": "be24h",
90
- "sellers24h": "se24h",
91
- "buyVolumeInUsd24h": "bviu24h",
92
- "sellVolumeInUsd24h": "sviu24h",
93
- "price24h": "p24h",
94
- "price": "p",
95
- "openInUsd24h": "oiu24h",
96
- "closeInUsd24h": "ciu24h"
30
+ subscribeTokenStats: {
31
+ address: "a",
32
+ timestamp: "t",
33
+ buys1m: "b1m",
34
+ sells1m: "s1m",
35
+ buyers1m: "be1m",
36
+ sellers1m: "se1m",
37
+ buyVolumeInUsd1m: "bviu1m",
38
+ sellVolumeInUsd1m: "sviu1m",
39
+ price1m: "p1m",
40
+ openInUsd1m: "oiu1m",
41
+ closeInUsd1m: "ciu1m",
42
+ buys5m: "b5m",
43
+ sells5m: "s5m",
44
+ buyers5m: "be5m",
45
+ sellers5m: "se5m",
46
+ buyVolumeInUsd5m: "bviu5m",
47
+ sellVolumeInUsd5m: "sviu5m",
48
+ price5m: "p5m",
49
+ openInUsd5m: "oiu5m",
50
+ closeInUsd5m: "ciu5m",
51
+ buys15m: "b15m",
52
+ sells15m: "s15m",
53
+ buyers15m: "be15m",
54
+ sellers15m: "se15m",
55
+ buyVolumeInUsd15m: "bviu15m",
56
+ sellVolumeInUsd15m: "sviu15m",
57
+ price15m: "p15m",
58
+ openInUsd15m: "oiu15m",
59
+ closeInUsd15m: "ciu15m",
60
+ buys30m: "b30m",
61
+ sells30m: "s30m",
62
+ buyers30m: "be30m",
63
+ sellers30m: "se30m",
64
+ buyVolumeInUsd30m: "bviu30m",
65
+ sellVolumeInUsd30m: "sviu30m",
66
+ price30m: "p30m",
67
+ openInUsd30m: "oiu30m",
68
+ closeInUsd30m: "ciu30m",
69
+ buys1h: "b1h",
70
+ sells1h: "s1h",
71
+ buyers1h: "be1h",
72
+ sellers1h: "se1h",
73
+ buyVolumeInUsd1h: "bviu1h",
74
+ sellVolumeInUsd1h: "sviu1h",
75
+ price1h: "p1h",
76
+ openInUsd1h: "oiu1h",
77
+ closeInUsd1h: "ciu1h",
78
+ buys4h: "b4h",
79
+ sells4h: "s4h",
80
+ buyers4h: "be4h",
81
+ sellers4h: "se4h",
82
+ buyVolumeInUsd4h: "bviu4h",
83
+ sellVolumeInUsd4h: "sviu4h",
84
+ price4h: "p4h",
85
+ openInUsd4h: "oiu4h",
86
+ closeInUsd4h: "ciu4h",
87
+ buys24h: "b24h",
88
+ sells24h: "s24h",
89
+ buyers24h: "be24h",
90
+ sellers24h: "se24h",
91
+ buyVolumeInUsd24h: "bviu24h",
92
+ sellVolumeInUsd24h: "sviu24h",
93
+ price24h: "p24h",
94
+ price: "p",
95
+ openInUsd24h: "oiu24h",
96
+ closeInUsd24h: "ciu24h"
97
97
  },
98
98
  // Token holder subscription fields
99
- "subscribeTokenHolders": {
100
- "tokenAddress": "a",
101
- "holders": "h",
102
- "top100HoldersAmount": "t100a",
103
- "top50HoldersAmount": "t50a",
104
- "top10HoldersAmount": "t10a",
105
- "top100Holders": "t100h",
106
- "top50Holders": "t50h",
107
- "top10Holders": "t10h",
108
- "top100HoldersRatio": "t100r",
109
- "top50HoldersRatio": "t50r",
110
- "top10HoldersRatio": "t10r",
111
- "creatorsHolders": "ch",
112
- "creatorsAmount": "ca",
113
- "creatorsRatio": "cr",
114
- "balanceTagFreshHolders": "btfh",
115
- "balanceTagFreshAmount": "btfa",
116
- "balanceTagFreshRatio": "btfr",
117
- "balanceTagSandwichHolders": "btsh",
118
- "balanceTagSandwichAmount": "btsa",
119
- "balanceTagSandwichRatio": "btsr",
120
- "balanceTagBundleHolders": "btbh",
121
- "balanceTagBundleAmount": "btba",
122
- "balanceTagBundleRatio": "btbr",
123
- "balanceTagSniperHolders": "btsnh",
124
- "balanceTagSniperAmount": "btsna",
125
- "balanceTagSniperRatio": "btsnr",
126
- "balanceTagDevHolders": "btdh",
127
- "balanceTagDevAmount": "btda",
128
- "balanceTagDevRatio": "btdr",
129
- "balanceTagProHolders": "btph",
130
- "balanceTagProAmount": "btpa",
131
- "balanceTagProRatio": "btpr",
132
- "balanceTagInsiderHolders": "btih",
133
- "balanceTagInsiderAmount": "btia",
134
- "balanceTagInsiderRatio": "btir",
135
- "balanceTagSmartHolders": "btsmh",
136
- "balanceTagSmartAmount": "btsma",
137
- "balanceTagSmartRatio": "btsmr",
138
- "balanceTagKolHolders": "btkh",
139
- "balanceTagKolAmount": "btka",
140
- "balanceTagKolRatio": "btkr",
141
- "balanceTagPhishingHolders": "btphh",
142
- "balanceTagPhishingAmount": "btpha",
143
- "balanceTagPhishingRatio": "btphr",
144
- "balanceTagBluechipHolders": "btblh",
145
- "balanceTagBluechipAmount": "btbla",
146
- "balanceTagBluechipRatio": "btblr",
147
- "balanceTagRatHolders": "btrh",
148
- "balanceTagRatAmount": "btra",
149
- "balanceTagRatRatio": "btrr",
150
- "timestamp": "ts"
99
+ subscribeTokenHolders: {
100
+ tokenAddress: "a",
101
+ holders: "h",
102
+ top100HoldersAmount: "t100a",
103
+ top50HoldersAmount: "t50a",
104
+ top10HoldersAmount: "t10a",
105
+ top100Holders: "t100h",
106
+ top50Holders: "t50h",
107
+ top10Holders: "t10h",
108
+ top100HoldersRatio: "t100r",
109
+ top50HoldersRatio: "t50r",
110
+ top10HoldersRatio: "t10r",
111
+ creatorsHolders: "ch",
112
+ creatorsAmount: "ca",
113
+ creatorsRatio: "cr",
114
+ balanceTagFreshHolders: "btfh",
115
+ balanceTagFreshAmount: "btfa",
116
+ balanceTagFreshRatio: "btfr",
117
+ balanceTagSandwichHolders: "btsh",
118
+ balanceTagSandwichAmount: "btsa",
119
+ balanceTagSandwichRatio: "btsr",
120
+ balanceTagBundleHolders: "btbh",
121
+ balanceTagBundleAmount: "btba",
122
+ balanceTagBundleRatio: "btbr",
123
+ balanceTagSniperHolders: "btsnh",
124
+ balanceTagSniperAmount: "btsna",
125
+ balanceTagSniperRatio: "btsnr",
126
+ balanceTagDevHolders: "btdh",
127
+ balanceTagDevAmount: "btda",
128
+ balanceTagDevRatio: "btdr",
129
+ balanceTagProHolders: "btph",
130
+ balanceTagProAmount: "btpa",
131
+ balanceTagProRatio: "btpr",
132
+ balanceTagInsiderHolders: "btih",
133
+ balanceTagInsiderAmount: "btia",
134
+ balanceTagInsiderRatio: "btir",
135
+ balanceTagSmartHolders: "btsmh",
136
+ balanceTagSmartAmount: "btsma",
137
+ balanceTagSmartRatio: "btsmr",
138
+ balanceTagKolHolders: "btkh",
139
+ balanceTagKolAmount: "btka",
140
+ balanceTagKolRatio: "btkr",
141
+ balanceTagPhishingHolders: "btphh",
142
+ balanceTagPhishingAmount: "btpha",
143
+ balanceTagPhishingRatio: "btphr",
144
+ balanceTagBluechipHolders: "btblh",
145
+ balanceTagBluechipAmount: "btbla",
146
+ balanceTagBluechipRatio: "btblr",
147
+ balanceTagRatHolders: "btrh",
148
+ balanceTagRatAmount: "btra",
149
+ balanceTagRatRatio: "btrr",
150
+ timestamp: "ts"
151
151
  },
152
152
  // New token subscription fields
153
- "subscribeNewToken": {
154
- "tokenAddress": "a",
155
- "name": "n",
156
- "symbol": "s",
157
- "createdAtMs": "cts"
153
+ subscribeNewToken: {
154
+ tokenAddress: "a",
155
+ name: "n",
156
+ symbol: "s",
157
+ createdAtMs: "cts"
158
158
  },
159
159
  // Token supply subscription fields
160
- "subscribeTokenSupply": {
161
- "tokenAddress": "a",
162
- "supply": "s",
163
- "timestamp": "ts"
160
+ subscribeTokenSupply: {
161
+ tokenAddress: "a",
162
+ supply: "s",
163
+ timestamp: "ts"
164
164
  },
165
165
  // Dex pool balance subscription fields
166
- "subscribeDexPoolBalance": {
167
- "poolAddress": "a",
168
- "tokenAAddress": "taa",
169
- "tokenALiquidityInUsd": "taliu",
170
- "tokenBAddress": "tba",
171
- "tokenBLiquidityInUsd": "tbliu"
166
+ subscribeDexPoolBalance: {
167
+ poolAddress: "a",
168
+ tokenAAddress: "taa",
169
+ tokenALiquidityInUsd: "taliu",
170
+ tokenBAddress: "tba",
171
+ tokenBLiquidityInUsd: "tbliu"
172
172
  },
173
173
  // Token liquidity subscription fields
174
- "subscribeTokenLiquidity": {
175
- "tokenAddress": "a",
176
- "metricType": "t",
177
- "value": "v",
178
- "timestamp": "ts"
174
+ subscribeTokenLiquidity: {
175
+ tokenAddress: "a",
176
+ metricType: "t",
177
+ value: "v",
178
+ timestamp: "ts"
179
179
  },
180
180
  // New token metadata subscription fields
181
- "subscribeNewTokensMetadata": {
182
- "tokenAddress": "a",
183
- "name": "n",
184
- "symbol": "s",
185
- "imageUrl": "iu",
186
- "description": "de",
187
- "socialMedia": "sm",
188
- "createdAtMs": "cts"
181
+ subscribeNewTokensMetadata: {
182
+ tokenAddress: "a",
183
+ name: "n",
184
+ symbol: "s",
185
+ imageUrl: "iu",
186
+ description: "de",
187
+ socialMedia: "sm",
188
+ createdAtMs: "cts"
189
189
  },
190
190
  // Token trades subscription fields
191
- "subscribeTokenTrades": {
192
- "tokenAddress": "a",
193
- "timestamp": "t",
194
- "kind": "k",
195
- "buyAmount": "ba",
196
- "buyAmountInUsd": "baiu",
197
- "buyTokenAddress": "btma",
198
- "buyTokenName": "btn",
199
- "buyTokenSymbol": "bts",
200
- "buyWalletAddress": "bwa",
201
- "sellAmount": "sa",
202
- "sellAmountInUsd": "saiu",
203
- "sellTokenAddress": "stma",
204
- "sellTokenName": "stn",
205
- "sellTokenSymbol": "sts",
206
- "sellWalletAddress": "swa",
207
- "txHash": "h"
191
+ subscribeTokenTrades: {
192
+ tokenAddress: "a",
193
+ timestamp: "t",
194
+ kind: "k",
195
+ buyAmount: "ba",
196
+ buyAmountInUsd: "baiu",
197
+ buyTokenAddress: "btma",
198
+ buyTokenName: "btn",
199
+ buyTokenSymbol: "bts",
200
+ buyWalletAddress: "bwa",
201
+ sellAmount: "sa",
202
+ sellAmountInUsd: "saiu",
203
+ sellTokenAddress: "stma",
204
+ sellTokenName: "stn",
205
+ sellTokenSymbol: "sts",
206
+ sellWalletAddress: "swa",
207
+ txHash: "h"
208
208
  },
209
209
  // Wallet token PnL subscription fields
210
- "subscribeWalletPnl": {
211
- "walletAddress": "a",
212
- "tokenAddress": "ta",
213
- "tokenPriceInUsd": "tpiu",
214
- "timestamp": "t",
215
- "opentime": "ot",
216
- "lasttime": "lt",
217
- "closetime": "ct",
218
- "buyAmount": "ba",
219
- "buyAmountInUsd": "baiu",
220
- "buyCount": "bs",
221
- "buyCount30d": "bs30d",
222
- "buyCount7d": "bs7d",
223
- "sellAmount": "sa",
224
- "sellAmountInUsd": "saiu",
225
- "sellCount": "ss",
226
- "sellCount30d": "ss30d",
227
- "sellCount7d": "ss7d",
228
- "heldDurationTimestamp": "hdts",
229
- "averageBuyPriceInUsd": "abpiu",
230
- "averageSellPriceInUsd": "aspiu",
231
- "unrealizedProfitInUsd": "upiu",
232
- "unrealizedProfitRatio": "upr",
233
- "realizedProfitInUsd": "rpiu",
234
- "realizedProfitRatio": "rpr",
235
- "totalRealizedProfitInUsd": "trpiu",
236
- "totalRealizedProfitRatio": "trr"
210
+ subscribeWalletPnl: {
211
+ walletAddress: "a",
212
+ tokenAddress: "ta",
213
+ tokenPriceInUsd: "tpiu",
214
+ timestamp: "t",
215
+ opentime: "ot",
216
+ lasttime: "lt",
217
+ closetime: "ct",
218
+ buyAmount: "ba",
219
+ buyAmountInUsd: "baiu",
220
+ buyCount: "bs",
221
+ buyCount30d: "bs30d",
222
+ buyCount7d: "bs7d",
223
+ sellAmount: "sa",
224
+ sellAmountInUsd: "saiu",
225
+ sellCount: "ss",
226
+ sellCount30d: "ss30d",
227
+ sellCount7d: "ss7d",
228
+ heldDurationTimestamp: "hdts",
229
+ averageBuyPriceInUsd: "abpiu",
230
+ averageSellPriceInUsd: "aspiu",
231
+ unrealizedProfitInUsd: "upiu",
232
+ unrealizedProfitRatio: "upr",
233
+ realizedProfitInUsd: "rpiu",
234
+ realizedProfitRatio: "rpr",
235
+ totalRealizedProfitInUsd: "trpiu",
236
+ totalRealizedProfitRatio: "trr"
237
+ },
238
+ // Token max liquidity subscription fields
239
+ subscribeTokenMaxLiquidity: {
240
+ tokenAddress: "a",
241
+ poolAddress: "p",
242
+ liquidityInUsd: "liu",
243
+ liquidityInNative: "lin",
244
+ timestamp: "ts"
245
+ },
246
+ // Token total liquidity subscription fields
247
+ subscribeTokenTotalLiquidity: {
248
+ tokenAddress: "a",
249
+ liquidityInUsd: "liu",
250
+ liquidityInNative: "lin",
251
+ poolCount: "pc",
252
+ timestamp: "ts"
237
253
  }
238
254
  };
239
255
  function getFieldMappings(methodName) {
@@ -371,20 +387,20 @@ var StreamApi = class {
371
387
  */
372
388
  batchSubscribe(batchFunction) {
373
389
  this.startBatching();
374
- const unsubscribles = batchFunction();
390
+ const unsubscribables = batchFunction();
375
391
  this.stopBatching();
376
- return unsubscribles;
392
+ return unsubscribables;
377
393
  }
378
394
  /**
379
395
  * Batch unsubscribe method that accepts an array of unsubscribe functions
380
396
  * All unsubscribe calls will be executed at once
381
- * @param unsubscribles Array of unsubscribe functions to execute
397
+ * @param unsubscribables Array of unsubscribe functions to execute
382
398
  */
383
- batchUnsubscribe(unsubscribles) {
384
- if (!unsubscribles || unsubscribles.length === 0) {
399
+ batchUnsubscribe(unsubscribables) {
400
+ if (!unsubscribables || unsubscribables.length === 0) {
385
401
  return;
386
402
  }
387
- unsubscribles.forEach((unsub) => {
403
+ unsubscribables.forEach((unsub) => {
388
404
  if (unsub && typeof unsub.unsubscribe === "function") {
389
405
  unsub.unsubscribe();
390
406
  }
@@ -416,7 +432,7 @@ var StreamApi = class {
416
432
  }).subscribe();
417
433
  }
418
434
  });
419
- return new StreamUnsubscrible(this, channel, fn);
435
+ return new StreamUnsubscribable(this, channel, fn);
420
436
  }
421
437
  unsubscribe(channel, fn) {
422
438
  const listeners = this.listenersMap.get(channel);
@@ -455,18 +471,23 @@ var StreamApi = class {
455
471
  filter
456
472
  }) {
457
473
  const channel = `dex-candle:${chain}_${tokenAddress}_${resolution}`;
458
- return this.subscribe(channel, (data) => {
459
- callback({
460
- open: data.o,
461
- close: data.c,
462
- high: data.h,
463
- low: data.l,
464
- volume: data.v,
465
- resolution: data.r,
466
- time: data.t,
467
- number: data.n
468
- });
469
- }, filter, "subscribeTokenCandles");
474
+ return this.subscribe(
475
+ channel,
476
+ (data) => {
477
+ callback({
478
+ open: data.o,
479
+ close: data.c,
480
+ high: data.h,
481
+ low: data.l,
482
+ volume: data.v,
483
+ resolution: data.r,
484
+ time: data.t,
485
+ number: data.n
486
+ });
487
+ },
488
+ filter,
489
+ "subscribeTokenCandles"
490
+ );
470
491
  }
471
492
  subscribeTokenStats({
472
493
  chain,
@@ -475,74 +496,79 @@ var StreamApi = class {
475
496
  filter
476
497
  }) {
477
498
  const channel = `dex-token-stats:${chain}_${tokenAddress}`;
478
- return this.subscribe(channel, (data) => callback({
479
- address: data.a,
480
- timestamp: data.t,
481
- buys1m: data.b1m,
482
- sells1m: data.s1m,
483
- buyers1m: data.be1m,
484
- sellers1m: data.se1m,
485
- buyVolumeInUsd1m: this.formatScientificNotation(data.bviu1m),
486
- sellVolumeInUsd1m: this.formatScientificNotation(data.sviu1m),
487
- price1m: this.formatScientificNotation(data.p1m),
488
- openInUsd1m: this.formatScientificNotation(data.oiu1m),
489
- closeInUsd1m: this.formatScientificNotation(data.ciu1m),
490
- buys5m: data.b5m,
491
- sells5m: data.s5m,
492
- buyers5m: data.be5m,
493
- sellers5m: data.se5m,
494
- buyVolumeInUsd5m: this.formatScientificNotation(data.bviu5m),
495
- sellVolumeInUsd5m: this.formatScientificNotation(data.sviu5m),
496
- price5m: this.formatScientificNotation(data.p5m),
497
- openInUsd5m: this.formatScientificNotation(data.oiu5m),
498
- closeInUsd5m: this.formatScientificNotation(data.ciu5m),
499
- buys15m: data.b15m,
500
- sells15m: data.s15m,
501
- buyers15m: data.be15m,
502
- sellers15m: data.se15m,
503
- buyVolumeInUsd15m: this.formatScientificNotation(data.bviu15m),
504
- sellVolumeInUsd15m: this.formatScientificNotation(data.sviu15m),
505
- price15m: this.formatScientificNotation(data.p15m),
506
- openInUsd15m: this.formatScientificNotation(data.oiu15m),
507
- closeInUsd15m: this.formatScientificNotation(data.ciu15m),
508
- buys30m: data.b30m,
509
- sells30m: data.s30m,
510
- buyers30m: data.be30m,
511
- sellers30m: data.se30m,
512
- buyVolumeInUsd30m: this.formatScientificNotation(data.bviu30m),
513
- sellVolumeInUsd30m: this.formatScientificNotation(data.sviu30m),
514
- price30m: this.formatScientificNotation(data.p30m),
515
- openInUsd30m: this.formatScientificNotation(data.oiu30m),
516
- closeInUsd30m: this.formatScientificNotation(data.ciu30m),
517
- buys1h: data.b1h,
518
- sells1h: data.s1h,
519
- buyers1h: data.be1h,
520
- sellers1h: data.se1h,
521
- buyVolumeInUsd1h: this.formatScientificNotation(data.bviu1h),
522
- sellVolumeInUsd1h: this.formatScientificNotation(data.sviu1h),
523
- price1h: this.formatScientificNotation(data.p1h),
524
- openInUsd1h: this.formatScientificNotation(data.oiu1h),
525
- closeInUsd1h: this.formatScientificNotation(data.ciu1h),
526
- buys4h: data.b4h,
527
- sells4h: data.s4h,
528
- buyers4h: data.be4h,
529
- sellers4h: data.se4h,
530
- buyVolumeInUsd4h: this.formatScientificNotation(data.bviu4h),
531
- sellVolumeInUsd4h: this.formatScientificNotation(data.sviu4h),
532
- price4h: this.formatScientificNotation(data.p4h),
533
- openInUsd4h: this.formatScientificNotation(data.oiu4h),
534
- closeInUsd4h: this.formatScientificNotation(data.ciu4h),
535
- buys24h: data.b24h,
536
- sells24h: data.s24h,
537
- buyers24h: data.be24h,
538
- sellers24h: data.se24h,
539
- buyVolumeInUsd24h: this.formatScientificNotation(data.bviu24h),
540
- sellVolumeInUsd24h: this.formatScientificNotation(data.sviu24h),
541
- price24h: this.formatScientificNotation(data.p24h),
542
- openInUsd24h: this.formatScientificNotation(data.oiu24h),
543
- closeInUsd24h: this.formatScientificNotation(data.ciu24h),
544
- price: this.formatScientificNotation(data.p)
545
- }), filter, "subscribeTokenStats");
499
+ return this.subscribe(
500
+ channel,
501
+ (data) => callback({
502
+ address: data.a,
503
+ timestamp: data.t,
504
+ buys1m: data.b1m,
505
+ sells1m: data.s1m,
506
+ buyers1m: data.be1m,
507
+ sellers1m: data.se1m,
508
+ buyVolumeInUsd1m: this.formatScientificNotation(data.bviu1m),
509
+ sellVolumeInUsd1m: this.formatScientificNotation(data.sviu1m),
510
+ price1m: this.formatScientificNotation(data.p1m),
511
+ openInUsd1m: this.formatScientificNotation(data.oiu1m),
512
+ closeInUsd1m: this.formatScientificNotation(data.ciu1m),
513
+ buys5m: data.b5m,
514
+ sells5m: data.s5m,
515
+ buyers5m: data.be5m,
516
+ sellers5m: data.se5m,
517
+ buyVolumeInUsd5m: this.formatScientificNotation(data.bviu5m),
518
+ sellVolumeInUsd5m: this.formatScientificNotation(data.sviu5m),
519
+ price5m: this.formatScientificNotation(data.p5m),
520
+ openInUsd5m: this.formatScientificNotation(data.oiu5m),
521
+ closeInUsd5m: this.formatScientificNotation(data.ciu5m),
522
+ buys15m: data.b15m,
523
+ sells15m: data.s15m,
524
+ buyers15m: data.be15m,
525
+ sellers15m: data.se15m,
526
+ buyVolumeInUsd15m: this.formatScientificNotation(data.bviu15m),
527
+ sellVolumeInUsd15m: this.formatScientificNotation(data.sviu15m),
528
+ price15m: this.formatScientificNotation(data.p15m),
529
+ openInUsd15m: this.formatScientificNotation(data.oiu15m),
530
+ closeInUsd15m: this.formatScientificNotation(data.ciu15m),
531
+ buys30m: data.b30m,
532
+ sells30m: data.s30m,
533
+ buyers30m: data.be30m,
534
+ sellers30m: data.se30m,
535
+ buyVolumeInUsd30m: this.formatScientificNotation(data.bviu30m),
536
+ sellVolumeInUsd30m: this.formatScientificNotation(data.sviu30m),
537
+ price30m: this.formatScientificNotation(data.p30m),
538
+ openInUsd30m: this.formatScientificNotation(data.oiu30m),
539
+ closeInUsd30m: this.formatScientificNotation(data.ciu30m),
540
+ buys1h: data.b1h,
541
+ sells1h: data.s1h,
542
+ buyers1h: data.be1h,
543
+ sellers1h: data.se1h,
544
+ buyVolumeInUsd1h: this.formatScientificNotation(data.bviu1h),
545
+ sellVolumeInUsd1h: this.formatScientificNotation(data.sviu1h),
546
+ price1h: this.formatScientificNotation(data.p1h),
547
+ openInUsd1h: this.formatScientificNotation(data.oiu1h),
548
+ closeInUsd1h: this.formatScientificNotation(data.ciu1h),
549
+ buys4h: data.b4h,
550
+ sells4h: data.s4h,
551
+ buyers4h: data.be4h,
552
+ sellers4h: data.se4h,
553
+ buyVolumeInUsd4h: this.formatScientificNotation(data.bviu4h),
554
+ sellVolumeInUsd4h: this.formatScientificNotation(data.sviu4h),
555
+ price4h: this.formatScientificNotation(data.p4h),
556
+ openInUsd4h: this.formatScientificNotation(data.oiu4h),
557
+ closeInUsd4h: this.formatScientificNotation(data.ciu4h),
558
+ buys24h: data.b24h,
559
+ sells24h: data.s24h,
560
+ buyers24h: data.be24h,
561
+ sellers24h: data.se24h,
562
+ buyVolumeInUsd24h: this.formatScientificNotation(data.bviu24h),
563
+ sellVolumeInUsd24h: this.formatScientificNotation(data.sviu24h),
564
+ price24h: this.formatScientificNotation(data.p24h),
565
+ openInUsd24h: this.formatScientificNotation(data.oiu24h),
566
+ closeInUsd24h: this.formatScientificNotation(data.ciu24h),
567
+ price: this.formatScientificNotation(data.p)
568
+ }),
569
+ filter,
570
+ "subscribeTokenStats"
571
+ );
546
572
  }
547
573
  subscribeTokenHolders({
548
574
  chain,
@@ -551,59 +577,64 @@ var StreamApi = class {
551
577
  filter
552
578
  }) {
553
579
  const channel = `dex-token-holding:${chain}_${tokenAddress}`;
554
- return this.subscribe(channel, (data) => callback({
555
- tokenAddress: data.a,
556
- holders: data.h,
557
- top100HoldersAmount: this.formatScientificNotation(data.t100a),
558
- top50HoldersAmount: this.formatScientificNotation(data.t50a),
559
- top10HoldersAmount: this.formatScientificNotation(data.t10a),
560
- top100Holders: data.t100h,
561
- top50Holders: data.t50h,
562
- top10Holders: data.t10h,
563
- top100HoldersRatio: this.formatScientificNotation(data.t100r),
564
- top50HoldersRatio: this.formatScientificNotation(data.t50r),
565
- top10HoldersRatio: this.formatScientificNotation(data.t10r),
566
- creatorsHolders: data.ch,
567
- creatorsAmount: this.formatScientificNotation(data.ca),
568
- creatorsRatio: this.formatScientificNotation(data.cr),
569
- balanceTagFreshHolders: data.btfh,
570
- balanceTagFreshAmount: this.formatScientificNotation(data.btfa),
571
- balanceTagFreshRatio: this.formatScientificNotation(data.btfr),
572
- balanceTagSandwichHolders: data.btsh,
573
- balanceTagSandwichAmount: this.formatScientificNotation(data.btsa),
574
- balanceTagSandwichRatio: this.formatScientificNotation(data.btsr),
575
- balanceTagBundleHolders: data.btbh,
576
- balanceTagBundleAmount: this.formatScientificNotation(data.btba),
577
- balanceTagBundleRatio: this.formatScientificNotation(data.btbr),
578
- balanceTagSniperHolders: data.btsnh,
579
- balanceTagSniperAmount: this.formatScientificNotation(data.btsna),
580
- balanceTagSniperRatio: this.formatScientificNotation(data.btsnr),
581
- balanceTagDevHolders: data.btdh,
582
- balanceTagDevAmount: this.formatScientificNotation(data.btda),
583
- balanceTagDevRatio: this.formatScientificNotation(data.btdr),
584
- balanceTagProHolders: data.btph,
585
- balanceTagProAmount: this.formatScientificNotation(data.btpa),
586
- balanceTagProRatio: this.formatScientificNotation(data.btpr),
587
- balanceTagInsiderHolders: data.btih,
588
- balanceTagInsiderAmount: this.formatScientificNotation(data.btia),
589
- balanceTagInsiderRatio: this.formatScientificNotation(data.btir),
590
- balanceTagSmartHolders: data.btsmh,
591
- balanceTagSmartAmount: this.formatScientificNotation(data.btsma),
592
- balanceTagSmartRatio: this.formatScientificNotation(data.btsmr),
593
- balanceTagKolHolders: data.btkh,
594
- balanceTagKolAmount: this.formatScientificNotation(data.btka),
595
- balanceTagKolRatio: this.formatScientificNotation(data.btkr),
596
- balanceTagPhishingHolders: data.btphh,
597
- balanceTagPhishingAmount: this.formatScientificNotation(data.btpha),
598
- balanceTagPhishingRatio: this.formatScientificNotation(data.btphr),
599
- balanceTagBluechipHolders: data.btblh,
600
- balanceTagBluechipAmount: this.formatScientificNotation(data.btbla),
601
- balanceTagBluechipRatio: this.formatScientificNotation(data.btblr),
602
- balanceTagRatHolders: data.btrh,
603
- balanceTagRatAmount: this.formatScientificNotation(data.btra),
604
- balanceTagRatRatio: this.formatScientificNotation(data.btrr),
605
- timestamp: data.ts
606
- }), filter, "subscribeTokenHolders");
580
+ return this.subscribe(
581
+ channel,
582
+ (data) => callback({
583
+ tokenAddress: data.a,
584
+ holders: data.h,
585
+ top100HoldersAmount: this.formatScientificNotation(data.t100a),
586
+ top50HoldersAmount: this.formatScientificNotation(data.t50a),
587
+ top10HoldersAmount: this.formatScientificNotation(data.t10a),
588
+ top100Holders: data.t100h,
589
+ top50Holders: data.t50h,
590
+ top10Holders: data.t10h,
591
+ top100HoldersRatio: this.formatScientificNotation(data.t100r),
592
+ top50HoldersRatio: this.formatScientificNotation(data.t50r),
593
+ top10HoldersRatio: this.formatScientificNotation(data.t10r),
594
+ creatorsHolders: data.ch,
595
+ creatorsAmount: this.formatScientificNotation(data.ca),
596
+ creatorsRatio: this.formatScientificNotation(data.cr),
597
+ balanceTagFreshHolders: data.btfh,
598
+ balanceTagFreshAmount: this.formatScientificNotation(data.btfa),
599
+ balanceTagFreshRatio: this.formatScientificNotation(data.btfr),
600
+ balanceTagSandwichHolders: data.btsh,
601
+ balanceTagSandwichAmount: this.formatScientificNotation(data.btsa),
602
+ balanceTagSandwichRatio: this.formatScientificNotation(data.btsr),
603
+ balanceTagBundleHolders: data.btbh,
604
+ balanceTagBundleAmount: this.formatScientificNotation(data.btba),
605
+ balanceTagBundleRatio: this.formatScientificNotation(data.btbr),
606
+ balanceTagSniperHolders: data.btsnh,
607
+ balanceTagSniperAmount: this.formatScientificNotation(data.btsna),
608
+ balanceTagSniperRatio: this.formatScientificNotation(data.btsnr),
609
+ balanceTagDevHolders: data.btdh,
610
+ balanceTagDevAmount: this.formatScientificNotation(data.btda),
611
+ balanceTagDevRatio: this.formatScientificNotation(data.btdr),
612
+ balanceTagProHolders: data.btph,
613
+ balanceTagProAmount: this.formatScientificNotation(data.btpa),
614
+ balanceTagProRatio: this.formatScientificNotation(data.btpr),
615
+ balanceTagInsiderHolders: data.btih,
616
+ balanceTagInsiderAmount: this.formatScientificNotation(data.btia),
617
+ balanceTagInsiderRatio: this.formatScientificNotation(data.btir),
618
+ balanceTagSmartHolders: data.btsmh,
619
+ balanceTagSmartAmount: this.formatScientificNotation(data.btsma),
620
+ balanceTagSmartRatio: this.formatScientificNotation(data.btsmr),
621
+ balanceTagKolHolders: data.btkh,
622
+ balanceTagKolAmount: this.formatScientificNotation(data.btka),
623
+ balanceTagKolRatio: this.formatScientificNotation(data.btkr),
624
+ balanceTagPhishingHolders: data.btphh,
625
+ balanceTagPhishingAmount: this.formatScientificNotation(data.btpha),
626
+ balanceTagPhishingRatio: this.formatScientificNotation(data.btphr),
627
+ balanceTagBluechipHolders: data.btblh,
628
+ balanceTagBluechipAmount: this.formatScientificNotation(data.btbla),
629
+ balanceTagBluechipRatio: this.formatScientificNotation(data.btblr),
630
+ balanceTagRatHolders: data.btrh,
631
+ balanceTagRatAmount: this.formatScientificNotation(data.btra),
632
+ balanceTagRatRatio: this.formatScientificNotation(data.btrr),
633
+ timestamp: data.ts
634
+ }),
635
+ filter,
636
+ "subscribeTokenHolders"
637
+ );
607
638
  }
608
639
  subscribeNewToken({
609
640
  chain,
@@ -611,30 +642,36 @@ var StreamApi = class {
611
642
  filter
612
643
  }) {
613
644
  const channel = `dex-new-token:${chain}`;
614
- return this.subscribe(channel, (data) => {
615
- const result = {
616
- tokenAddress: data.a,
617
- name: data.n,
618
- symbol: data.s,
619
- createdAtMs: data.cts
620
- };
621
- if (data.dec) {
622
- result.decimals = data.dec;
623
- }
624
- if (data.lf) {
625
- result.launchFrom = {};
626
- if (data.lf.pa) {
627
- result.launchFrom.programAddress = data.lf.pa;
628
- }
629
- if (data.lf.pf) {
630
- result.launchFrom.protocolFamily = data.lf.pf;
645
+ return this.subscribe(
646
+ channel,
647
+ (data) => {
648
+ const result = {
649
+ tokenAddress: data.a,
650
+ name: data.n,
651
+ symbol: data.s,
652
+ createdAtMs: data.cts
653
+ };
654
+ if (data.dec) {
655
+ result.decimals = data.dec;
631
656
  }
632
- if (data.lf.pn) {
633
- result.launchFrom.protocolName = data.lf.pn;
657
+ if (data.lf) {
658
+ const lf = data.lf;
659
+ result.launchFrom = {};
660
+ if (lf.pa) {
661
+ result.launchFrom.programAddress = lf.pa;
662
+ }
663
+ if (lf.pf) {
664
+ result.launchFrom.protocolFamily = lf.pf;
665
+ }
666
+ if (lf.pn) {
667
+ result.launchFrom.protocolName = lf.pn;
668
+ }
634
669
  }
635
- }
636
- callback(result);
637
- }, filter, "subscribeNewToken");
670
+ callback(result);
671
+ },
672
+ filter,
673
+ "subscribeNewToken"
674
+ );
638
675
  }
639
676
  subscribeNewTokensMetadata({
640
677
  chain,
@@ -644,85 +681,36 @@ var StreamApi = class {
644
681
  return this.subscribe(
645
682
  channel,
646
683
  (data) => callback(
647
- data.map(
648
- (it) => ({
649
- tokenAddress: it.a,
650
- name: it.n,
651
- symbol: it.s,
652
- imageUrl: it.iu,
653
- description: it.de,
654
- socialMedia: (() => {
655
- const socialMedia = {};
656
- if (it.sm?.tw) {
657
- socialMedia.twitter = it.sm.tw;
658
- }
659
- if (it.sm?.tg) {
660
- socialMedia.telegram = it.sm.tg;
661
- }
662
- if (it.sm?.w) {
663
- socialMedia.website = it.sm.w;
664
- }
665
- if (it.sm?.tt) {
666
- socialMedia.tiktok = it.sm.tt;
667
- }
668
- if (it.sm?.dc) {
669
- socialMedia.discord = it.sm.dc;
670
- }
671
- if (it.sm?.fb) {
672
- socialMedia.facebook = it.sm.fb;
673
- }
674
- if (it.sm?.gh) {
675
- socialMedia.github = it.sm.gh;
676
- }
677
- if (it.sm?.ig) {
678
- socialMedia.instagram = it.sm.ig;
679
- }
680
- if (it.sm?.li) {
681
- socialMedia.linkedin = it.sm.li;
682
- }
683
- if (it.sm?.md) {
684
- socialMedia.medium = it.sm.md;
685
- }
686
- if (it.sm?.rd) {
687
- socialMedia.reddit = it.sm.rd;
688
- }
689
- if (it.sm?.yt) {
690
- socialMedia.youtube = it.sm.yt;
691
- }
692
- if (it.sm?.bb) {
693
- socialMedia.bitbucket = it.sm.bb;
694
- }
695
- return socialMedia;
696
- })(),
697
- createdAtMs: it.cts
698
- })
699
- )
684
+ data.map((it) => ({
685
+ tokenAddress: it.a,
686
+ name: it.n,
687
+ symbol: it.s,
688
+ imageUrl: it.iu,
689
+ description: it.de,
690
+ socialMedia: (() => {
691
+ const sm = it.sm;
692
+ if (!sm) return void 0;
693
+ return {
694
+ twitter: sm.tw,
695
+ telegram: sm.tg,
696
+ website: sm.w,
697
+ tiktok: sm.tt,
698
+ discord: sm.dc,
699
+ facebook: sm.fb,
700
+ github: sm.gh,
701
+ instagram: sm.ig,
702
+ linkedin: sm.li,
703
+ medium: sm.md,
704
+ reddit: sm.rd,
705
+ youtube: sm.yt,
706
+ bitbucket: sm.bb
707
+ };
708
+ })(),
709
+ createdAtMs: it.cts
710
+ }))
700
711
  )
701
712
  );
702
713
  }
703
- // subscribeNewTokens({
704
- // chain,
705
- // callback,
706
- // }: {
707
- // chain: string;
708
- // callback: (data: NewToken[]) => void;
709
- // }): Unsubscrible {
710
- // const channel = `dex-new-tokens:${chain}`;
711
- // return this.subscribe(channel, (data: any[]) =>
712
- // callback(
713
- // data.map(
714
- // (it: any) =>
715
- // ({
716
- // tokenAddress: it.a,
717
- // name: it.n,
718
- // symbol: it.s,
719
- // description: it.de,
720
- // createdAtMs: it.cts,
721
- // }) as NewToken
722
- // )
723
- // )
724
- // );
725
- // }
726
714
  subscribeTokenSupply({
727
715
  chain,
728
716
  tokenAddress,
@@ -730,12 +718,17 @@ var StreamApi = class {
730
718
  filter
731
719
  }) {
732
720
  const channel = `dex-token-supply:${chain}_${tokenAddress}`;
733
- return this.subscribe(channel, (data) => callback({
734
- tokenAddress: data.a,
735
- supply: data.s,
736
- marketCapInUsd: data.mc,
737
- timestamp: data.ts
738
- }), filter, "subscribeTokenSupply");
721
+ return this.subscribe(
722
+ channel,
723
+ (data) => callback({
724
+ tokenAddress: data.a,
725
+ supply: data.s,
726
+ marketCapInUsd: data.mc,
727
+ timestamp: data.ts
728
+ }),
729
+ filter,
730
+ "subscribeTokenSupply"
731
+ );
739
732
  }
740
733
  subscribeTokenLiquidity({
741
734
  chain,
@@ -744,12 +737,67 @@ var StreamApi = class {
744
737
  filter
745
738
  }) {
746
739
  const channel = `dex-token-general-stat-num:${chain}_${tokenAddress}`;
747
- return this.subscribe(channel, (data) => callback({
748
- tokenAddress: data.a,
749
- metricType: data.t,
750
- value: data.v,
751
- timestamp: data.ts
752
- }), filter, "subscribeTokenLiquidity");
740
+ return this.subscribe(
741
+ channel,
742
+ (data) => callback({
743
+ tokenAddress: data.a,
744
+ metricType: data.t,
745
+ value: data.v,
746
+ timestamp: data.ts
747
+ }),
748
+ filter,
749
+ "subscribeTokenLiquidity"
750
+ );
751
+ }
752
+ /**
753
+ * Subscribe to token max liquidity updates
754
+ * Pushes the max liquidity info of a token in a single pool
755
+ * Channel: dex-token-liquidity:{chain}_{token_address}
756
+ */
757
+ subscribeTokenMaxLiquidity({
758
+ chain,
759
+ tokenAddress,
760
+ callback,
761
+ filter
762
+ }) {
763
+ const channel = `dex-token-liquidity:${chain}_${tokenAddress}`;
764
+ return this.subscribe(
765
+ channel,
766
+ (data) => callback({
767
+ tokenAddress: data.a,
768
+ poolAddress: data.p,
769
+ liquidityInUsd: data.liu,
770
+ liquidityInNative: data.lin,
771
+ timestamp: data.ts
772
+ }),
773
+ filter,
774
+ "subscribeTokenMaxLiquidity"
775
+ );
776
+ }
777
+ /**
778
+ * Subscribe to token total liquidity updates
779
+ * Pushes the total liquidity info of a token across all pools
780
+ * Channel: dex-token-total-liquidity:{chain}_{token_address}
781
+ */
782
+ subscribeTokenTotalLiquidity({
783
+ chain,
784
+ tokenAddress,
785
+ callback,
786
+ filter
787
+ }) {
788
+ const channel = `dex-token-total-liquidity:${chain}_${tokenAddress}`;
789
+ return this.subscribe(
790
+ channel,
791
+ (data) => callback({
792
+ tokenAddress: data.a,
793
+ liquidityInUsd: data.liu,
794
+ liquidityInNative: data.lin,
795
+ poolCount: data.pc,
796
+ timestamp: data.ts
797
+ }),
798
+ filter,
799
+ "subscribeTokenTotalLiquidity"
800
+ );
753
801
  }
754
802
  subscribeRankingTokensLiquidity({
755
803
  chain,
@@ -760,14 +808,12 @@ var StreamApi = class {
760
808
  return this.subscribe(
761
809
  channel,
762
810
  (data) => callback(
763
- data?.map(
764
- (it) => ({
765
- tokenAddress: it.a,
766
- metricType: it.t,
767
- value: it.v,
768
- timestamp: it.ts
769
- })
770
- )
811
+ data?.map((it) => ({
812
+ tokenAddress: it.a,
813
+ metricType: it.t,
814
+ value: it.v,
815
+ timestamp: it.ts
816
+ }))
771
817
  )
772
818
  );
773
819
  }
@@ -783,465 +829,185 @@ var StreamApi = class {
783
829
  (data) => callback(
784
830
  data?.map((item) => {
785
831
  const result = {};
786
- if (item.t) {
832
+ const t = item.t;
833
+ const bc = item.bc;
834
+ const h = item.h;
835
+ const s = item.s;
836
+ const ts = item.ts;
837
+ if (t) {
787
838
  result.metadata = {
788
- tokenAddress: item.t.a
839
+ tokenAddress: t.a
789
840
  };
790
- if (item.t.n) {
791
- result.metadata.name = item.t.n;
841
+ if (t.n) {
842
+ result.metadata.name = t.n;
792
843
  }
793
- if (item.t.s) {
794
- result.metadata.symbol = item.t.s;
844
+ if (t.s) {
845
+ result.metadata.symbol = t.s;
795
846
  }
796
- if (item.t.iu) {
797
- result.metadata.imageUrl = item.t.iu;
847
+ if (t.iu) {
848
+ result.metadata.imageUrl = t.iu;
798
849
  }
799
- if (item.t.de) {
800
- result.metadata.description = item.t.de;
850
+ if (t.de) {
851
+ result.metadata.description = t.de;
801
852
  }
802
- if (item.t.d) {
803
- result.metadata.decimals = item.t.dec;
853
+ if (t.dec) {
854
+ result.metadata.decimals = t.dec;
804
855
  }
805
- if (item.t.cts) {
806
- result.metadata.createdAtMs = item.t.cts;
856
+ if (t.cts) {
857
+ result.metadata.createdAtMs = t.cts;
807
858
  }
808
- if (item.t.lf) {
859
+ if (t.lf) {
860
+ const lf = t.lf;
809
861
  result.metadata.launchFrom = {};
810
- if (item.t.lf.pa) {
811
- result.metadata.launchFrom.programAddress = item.t.lf.pa;
862
+ if (lf.pa) {
863
+ result.metadata.launchFrom.programAddress = lf.pa;
812
864
  }
813
- if (item.t.lf.pf) {
814
- result.metadata.launchFrom.protocolFamily = item.t.lf.pf;
865
+ if (lf.pf) {
866
+ result.metadata.launchFrom.protocolFamily = lf.pf;
815
867
  }
816
- if (item.t.lf.pn) {
817
- result.metadata.launchFrom.protocolName = item.t.lf.pn;
868
+ if (lf.pn) {
869
+ result.metadata.launchFrom.protocolName = lf.pn;
818
870
  }
819
871
  }
820
- if (item.t.mt) {
872
+ if (t.mt) {
873
+ const mt = t.mt;
821
874
  result.metadata.migratedTo = {};
822
- if (item.t.mt.pa) {
823
- result.metadata.migratedTo.programAddress = item.t.mt.pa;
875
+ if (mt.pa) {
876
+ result.metadata.migratedTo.programAddress = mt.pa;
824
877
  }
825
- if (item.t.mt.pf) {
826
- result.metadata.migratedTo.protocolFamily = item.t.mt.pf;
878
+ if (mt.pf) {
879
+ result.metadata.migratedTo.protocolFamily = mt.pf;
827
880
  }
828
- if (item.t.mt.pn) {
829
- result.metadata.migratedTo.protocolName = item.t.mt.pn;
881
+ if (mt.pn) {
882
+ result.metadata.migratedTo.protocolName = mt.pn;
830
883
  }
831
884
  }
832
- if (item.t.sm) {
885
+ if (t.sm) {
886
+ const sm = t.sm;
833
887
  result.metadata.socialMedia = {};
834
- if (item.t.sm.tw) {
835
- result.metadata.socialMedia.twitter = item.t.sm.tw;
888
+ if (sm.tw) {
889
+ result.metadata.socialMedia.twitter = sm.tw;
836
890
  }
837
- if (item.t.sm.tg) {
838
- result.metadata.socialMedia.telegram = item.t.sm.tg;
891
+ if (sm.tg) {
892
+ result.metadata.socialMedia.telegram = sm.tg;
839
893
  }
840
- if (item.t.sm.w) {
841
- result.metadata.socialMedia.website = item.t.sm.w;
894
+ if (sm.w) {
895
+ result.metadata.socialMedia.website = sm.w;
842
896
  }
843
- if (item.t.sm.tt) {
844
- result.metadata.socialMedia.tiktok = item.t.sm.tt;
897
+ if (sm.tt) {
898
+ result.metadata.socialMedia.tiktok = sm.tt;
845
899
  }
846
- if (item.t.sm.dc) {
847
- result.metadata.socialMedia.discord = item.t.sm.dc;
900
+ if (sm.dc) {
901
+ result.metadata.socialMedia.discord = sm.dc;
848
902
  }
849
- if (item.t.sm.fb) {
850
- result.metadata.socialMedia.facebook = item.t.sm.fb;
903
+ if (sm.fb) {
904
+ result.metadata.socialMedia.facebook = sm.fb;
851
905
  }
852
- if (item.t.sm.gh) {
853
- result.metadata.socialMedia.github = item.t.sm.gh;
906
+ if (sm.gh) {
907
+ result.metadata.socialMedia.github = sm.gh;
854
908
  }
855
- if (item.t.sm.ig) {
856
- result.metadata.socialMedia.instagram = item.t.sm.ig;
909
+ if (sm.ig) {
910
+ result.metadata.socialMedia.instagram = sm.ig;
857
911
  }
858
- if (item.t.sm.li) {
859
- result.metadata.socialMedia.linkedin = item.t.sm.li;
912
+ if (sm.li) {
913
+ result.metadata.socialMedia.linkedin = sm.li;
860
914
  }
861
- if (item.t.sm.md) {
862
- result.metadata.socialMedia.medium = item.t.sm.md;
915
+ if (sm.md) {
916
+ result.metadata.socialMedia.medium = sm.md;
863
917
  }
864
- if (item.t.sm.rd) {
865
- result.metadata.socialMedia.reddit = item.t.sm.rd;
918
+ if (sm.rd) {
919
+ result.metadata.socialMedia.reddit = sm.rd;
866
920
  }
867
- if (item.t.sm.yt) {
868
- result.metadata.socialMedia.youtube = item.t.sm.yt;
921
+ if (sm.yt) {
922
+ result.metadata.socialMedia.youtube = sm.yt;
869
923
  }
870
- if (item.t.sm.bb) {
871
- result.metadata.socialMedia.bitbucket = item.t.sm.bb;
924
+ if (sm.bb) {
925
+ result.metadata.socialMedia.bitbucket = sm.bb;
872
926
  }
873
927
  }
874
- if (item.t.cts) {
875
- result.metadata.createdAtMs = item.t.cts;
876
- }
877
928
  }
878
- if (item.bc) {
929
+ if (bc) {
879
930
  result.bondingCurve = {};
880
- if (item.bc.pr) {
881
- result.bondingCurve.progressRatio = this.formatScientificNotation(item.bc.pr);
931
+ if (bc.pr) {
932
+ result.bondingCurve.progressRatio = this.formatScientificNotation(bc.pr);
882
933
  }
883
934
  }
884
- if (item.h) {
935
+ if (h) {
885
936
  result.holder = {
886
- tokenAddress: item.h.a,
887
- timestamp: item.h.ts || 0
937
+ tokenAddress: h.a,
938
+ timestamp: h.ts || 0
888
939
  };
889
- if (item.h.h) {
890
- result.holder.holders = item.h.h;
891
- }
892
- if (item.h.t100a) {
893
- result.holder.top100HoldersAmount = this.formatScientificNotation(item.h.t100a);
894
- }
895
- if (item.h.t50a) {
896
- result.holder.top50HoldersAmount = this.formatScientificNotation(item.h.t50a);
897
- }
898
- if (item.h.t10a) {
899
- result.holder.top10HoldersAmount = this.formatScientificNotation(item.h.t10a);
900
- }
901
- if (item.h.t100h) {
902
- result.holder.top100Holders = item.h.t100h;
903
- }
904
- if (item.h.t50h) {
905
- result.holder.top50Holders = item.h.t50h;
906
- }
907
- if (item.h.t10h) {
908
- result.holder.top10Holders = item.h.t10h;
909
- }
910
- if (item.h.t100r) {
911
- result.holder.top100HoldersRatio = this.formatScientificNotation(item.h.t100r);
912
- }
913
- if (item.h.t50r) {
914
- result.holder.top50HoldersRatio = this.formatScientificNotation(item.h.t50r);
915
- }
916
- if (item.h.t10r) {
917
- result.holder.top10HoldersRatio = this.formatScientificNotation(item.h.t10r);
918
- }
919
- if (item.h.ch) {
920
- result.holder.creatorsHolders = item.h.ch;
921
- }
922
- if (item.h.ca) {
923
- result.holder.creatorsAmount = this.formatScientificNotation(item.h.ca);
924
- }
925
- if (item.h.cr) {
926
- result.holder.creatorsRatio = this.formatScientificNotation(item.h.cr);
927
- }
928
- if (item.h.btfh) {
929
- result.holder.balanceTagFreshHolders = item.h.btfh;
930
- }
931
- if (item.h.btfa) {
932
- result.holder.balanceTagFreshAmount = this.formatScientificNotation(item.h.btfa);
933
- }
934
- if (item.h.btfr) {
935
- result.holder.balanceTagFreshRatio = this.formatScientificNotation(item.h.btfr);
936
- }
937
- if (item.h.btsh) {
938
- result.holder.balanceTagSandwichHolders = item.h.btsh;
939
- }
940
- if (item.h.btsa) {
941
- result.holder.balanceTagSandwichAmount = this.formatScientificNotation(item.h.btsa);
942
- }
943
- if (item.h.btsr) {
944
- result.holder.balanceTagSandwichRatio = this.formatScientificNotation(item.h.btsr);
945
- }
946
- if (item.h.btbh) {
947
- result.holder.balanceTagBundleHolders = item.h.btbh;
948
- }
949
- if (item.h.btba) {
950
- result.holder.balanceTagBundleAmount = this.formatScientificNotation(item.h.btba);
951
- }
952
- if (item.h.btbr) {
953
- result.holder.balanceTagBundleRatio = this.formatScientificNotation(item.h.btbr);
954
- }
955
- if (item.h.btsnh) {
956
- result.holder.balanceTagSniperHolders = item.h.btsnh;
940
+ if (h.h) {
941
+ result.holder.holders = h.h;
957
942
  }
958
- if (item.h.btsna) {
959
- result.holder.balanceTagSniperAmount = this.formatScientificNotation(item.h.btsna);
943
+ if (h.t100a) {
944
+ result.holder.top100HoldersAmount = this.formatScientificNotation(h.t100a);
960
945
  }
961
- if (item.h.btsnr) {
962
- result.holder.balanceTagSniperRatio = this.formatScientificNotation(item.h.btsnr);
946
+ if (h.t50a) {
947
+ result.holder.top50HoldersAmount = this.formatScientificNotation(h.t50a);
963
948
  }
964
- if (item.h.btdh) {
965
- result.holder.balanceTagDevHolders = item.h.btdh;
949
+ if (h.t10a) {
950
+ result.holder.top10HoldersAmount = this.formatScientificNotation(h.t10a);
966
951
  }
967
- if (item.h.btda) {
968
- result.holder.balanceTagDevAmount = this.formatScientificNotation(item.h.btda);
952
+ if (h.t100h) {
953
+ result.holder.top100Holders = h.t100h;
969
954
  }
970
- if (item.h.btdr) {
971
- result.holder.balanceTagDevRatio = this.formatScientificNotation(item.h.btdr);
955
+ if (h.t50h) {
956
+ result.holder.top50Holders = h.t50h;
972
957
  }
973
- if (item.h.btph) {
974
- result.holder.balanceTagProHolders = item.h.btph;
958
+ if (h.t10h) {
959
+ result.holder.top10Holders = h.t10h;
975
960
  }
976
- if (item.h.btpa) {
977
- result.holder.balanceTagProAmount = this.formatScientificNotation(item.h.btpa);
961
+ if (h.t100r) {
962
+ result.holder.top100HoldersRatio = this.formatScientificNotation(h.t100r);
978
963
  }
979
- if (item.h.btpr) {
980
- result.holder.balanceTagProRatio = this.formatScientificNotation(item.h.btpr);
964
+ if (h.t50r) {
965
+ result.holder.top50HoldersRatio = this.formatScientificNotation(h.t50r);
981
966
  }
982
- if (item.h.btih) {
983
- result.holder.balanceTagInsiderHolders = item.h.btih;
984
- }
985
- if (item.h.btia) {
986
- result.holder.balanceTagInsiderAmount = this.formatScientificNotation(item.h.btia);
987
- }
988
- if (item.h.btir) {
989
- result.holder.balanceTagInsiderRatio = this.formatScientificNotation(item.h.btir);
990
- }
991
- if (item.h.btsmh) {
992
- result.holder.balanceTagSmartHolders = item.h.btsmh;
993
- }
994
- if (item.h.btsma) {
995
- result.holder.balanceTagSmartAmount = this.formatScientificNotation(item.h.btsma);
996
- }
997
- if (item.h.btsmr) {
998
- result.holder.balanceTagSmartRatio = this.formatScientificNotation(item.h.btsmr);
999
- }
1000
- if (item.h.btkh) {
1001
- result.holder.balanceTagKolHolders = item.h.btkh;
1002
- }
1003
- if (item.h.btka) {
1004
- result.holder.balanceTagKolAmount = this.formatScientificNotation(item.h.btka);
1005
- }
1006
- if (item.h.btkr) {
1007
- result.holder.balanceTagKolRatio = this.formatScientificNotation(item.h.btkr);
1008
- }
1009
- if (item.h.btphh) {
1010
- result.holder.balanceTagPhishingHolders = item.h.btphh;
1011
- }
1012
- if (item.h.btpha) {
1013
- result.holder.balanceTagPhishingAmount = this.formatScientificNotation(item.h.btpha);
1014
- }
1015
- if (item.h.btphr) {
1016
- result.holder.balanceTagPhishingRatio = this.formatScientificNotation(item.h.btphr);
1017
- }
1018
- if (item.h.btblh) {
1019
- result.holder.balanceTagBluechipHolders = item.h.btblh;
1020
- }
1021
- if (item.h.btbla) {
1022
- result.holder.balanceTagBluechipAmount = this.formatScientificNotation(item.h.btbla);
1023
- }
1024
- if (item.h.btblr) {
1025
- result.holder.balanceTagBluechipRatio = this.formatScientificNotation(item.h.btblr);
1026
- }
1027
- if (item.h.btrh) {
1028
- result.holder.balanceTagRatHolders = item.h.btrh;
1029
- }
1030
- if (item.h.btra) {
1031
- result.holder.balanceTagRatAmount = this.formatScientificNotation(item.h.btra);
1032
- }
1033
- if (item.h.btrr) {
1034
- result.holder.balanceTagRatRatio = this.formatScientificNotation(item.h.btrr);
967
+ if (h.t10r) {
968
+ result.holder.top10HoldersRatio = this.formatScientificNotation(h.t10r);
1035
969
  }
1036
970
  }
1037
- if (item.s) {
971
+ if (s) {
1038
972
  result.supply = {
1039
- tokenAddress: item.s.a,
1040
- timestamp: item.s.ts || 0
973
+ tokenAddress: s.a,
974
+ timestamp: s.ts || 0
1041
975
  };
1042
- if (item.s.s) {
1043
- result.supply.supply = item.s.s;
976
+ if (s.s) {
977
+ result.supply.supply = s.s;
1044
978
  }
1045
- if (item.s.mc) {
1046
- result.supply.marketCapInUsd = item.s.mc;
979
+ if (s.mc) {
980
+ result.supply.marketCapInUsd = s.mc;
1047
981
  }
1048
982
  }
1049
- if (item.ts) {
983
+ if (ts) {
1050
984
  result.stat = {
1051
- address: item.ts.a,
1052
- timestamp: item.ts.t || 0
985
+ address: ts.a,
986
+ timestamp: ts.t || 0
1053
987
  };
1054
- if (item.ts.b1m) {
1055
- result.stat.buys1m = item.ts.b1m;
1056
- }
1057
- if (item.ts.s1m) {
1058
- result.stat.sells1m = item.ts.s1m;
1059
- }
1060
- if (item.ts.be1m) {
1061
- result.stat.buyers1m = item.ts.be1m;
1062
- }
1063
- if (item.ts.se1m) {
1064
- result.stat.sellers1m = item.ts.se1m;
1065
- }
1066
- if (item.ts.bviu1m) {
1067
- result.stat.buyVolumeInUsd1m = this.formatScientificNotation(item.ts.bviu1m);
1068
- }
1069
- if (item.ts.sviu1m) {
1070
- result.stat.sellVolumeInUsd1m = this.formatScientificNotation(item.ts.sviu1m);
1071
- }
1072
- if (item.ts.p1m) {
1073
- result.stat.price1m = this.formatScientificNotation(item.ts.p1m);
1074
- }
1075
- if (item.ts.oiu1m) {
1076
- result.stat.openInUsd1m = this.formatScientificNotation(item.ts.oiu1m);
1077
- }
1078
- if (item.ts.ciu1m) {
1079
- result.stat.closeInUsd1m = this.formatScientificNotation(item.ts.ciu1m);
1080
- }
1081
- if (item.ts.b5m) {
1082
- result.stat.buys5m = item.ts.b5m;
1083
- }
1084
- if (item.ts.s5m) {
1085
- result.stat.sells5m = item.ts.s5m;
1086
- }
1087
- if (item.ts.be5m) {
1088
- result.stat.buyers5m = item.ts.be5m;
1089
- }
1090
- if (item.ts.se5m) {
1091
- result.stat.sellers5m = item.ts.se5m;
1092
- }
1093
- if (item.ts.bviu5m) {
1094
- result.stat.buyVolumeInUsd5m = this.formatScientificNotation(item.ts.bviu5m);
1095
- }
1096
- if (item.ts.sviu5m) {
1097
- result.stat.sellVolumeInUsd5m = this.formatScientificNotation(item.ts.sviu5m);
1098
- }
1099
- if (item.ts.p5m) {
1100
- result.stat.price5m = this.formatScientificNotation(item.ts.p5m);
1101
- }
1102
- if (item.ts.oiu5m) {
1103
- result.stat.openInUsd5m = this.formatScientificNotation(item.ts.oiu5m);
1104
- }
1105
- if (item.ts.ciu5m) {
1106
- result.stat.closeInUsd5m = this.formatScientificNotation(item.ts.ciu5m);
1107
- }
1108
- if (item.ts.b15m) {
1109
- result.stat.buys15m = item.ts.b15m;
1110
- }
1111
- if (item.ts.s15m) {
1112
- result.stat.sells15m = item.ts.s15m;
1113
- }
1114
- if (item.ts.be15m) {
1115
- result.stat.buyers15m = item.ts.be15m;
1116
- }
1117
- if (item.ts.se15m) {
1118
- result.stat.sellers15m = item.ts.se15m;
1119
- }
1120
- if (item.ts.bviu15m) {
1121
- result.stat.buyVolumeInUsd15m = this.formatScientificNotation(item.ts.bviu15m);
1122
- }
1123
- if (item.ts.sviu15m) {
1124
- result.stat.sellVolumeInUsd15m = this.formatScientificNotation(item.ts.sviu15m);
1125
- }
1126
- if (item.ts.p15m) {
1127
- result.stat.price15m = this.formatScientificNotation(item.ts.p15m);
1128
- }
1129
- if (item.ts.oiu15m) {
1130
- result.stat.openInUsd15m = this.formatScientificNotation(item.ts.oiu15m);
1131
- }
1132
- if (item.ts.ciu15m) {
1133
- result.stat.closeInUsd15m = this.formatScientificNotation(item.ts.ciu15m);
1134
- }
1135
- if (item.ts.b30m) {
1136
- result.stat.buys30m = item.ts.b30m;
1137
- }
1138
- if (item.ts.s30m) {
1139
- result.stat.sells30m = item.ts.s30m;
1140
- }
1141
- if (item.ts.be30m) {
1142
- result.stat.buyers30m = item.ts.be30m;
1143
- }
1144
- if (item.ts.se30m) {
1145
- result.stat.sellers30m = item.ts.se30m;
1146
- }
1147
- if (item.ts.bviu30m) {
1148
- result.stat.buyVolumeInUsd30m = this.formatScientificNotation(item.ts.bviu30m);
1149
- }
1150
- if (item.ts.sviu30m) {
1151
- result.stat.sellVolumeInUsd30m = this.formatScientificNotation(item.ts.sviu30m);
1152
- }
1153
- if (item.ts.p30m) {
1154
- result.stat.price30m = this.formatScientificNotation(item.ts.p30m);
1155
- }
1156
- if (item.ts.oiu30m) {
1157
- result.stat.openInUsd30m = this.formatScientificNotation(item.ts.oiu30m);
1158
- }
1159
- if (item.ts.ciu30m) {
1160
- result.stat.closeInUsd30m = this.formatScientificNotation(item.ts.ciu30m);
1161
- }
1162
- if (item.ts.b1h) {
1163
- result.stat.buys1h = item.ts.b1h;
1164
- }
1165
- if (item.ts.s1h) {
1166
- result.stat.sells1h = item.ts.s1h;
1167
- }
1168
- if (item.ts.be1h) {
1169
- result.stat.buyers1h = item.ts.be1h;
988
+ if (ts.b1m) {
989
+ result.stat.buys1m = ts.b1m;
1170
990
  }
1171
- if (item.ts.se1h) {
1172
- result.stat.sellers1h = item.ts.se1h;
991
+ if (ts.s1m) {
992
+ result.stat.sells1m = ts.s1m;
1173
993
  }
1174
- if (item.ts.bviu1h) {
1175
- result.stat.buyVolumeInUsd1h = this.formatScientificNotation(item.ts.bviu1h);
994
+ if (ts.be1m) {
995
+ result.stat.buyers1m = ts.be1m;
1176
996
  }
1177
- if (item.ts.sviu1h) {
1178
- result.stat.sellVolumeInUsd1h = this.formatScientificNotation(item.ts.sviu1h);
997
+ if (ts.se1m) {
998
+ result.stat.sellers1m = ts.se1m;
1179
999
  }
1180
- if (item.ts.p1h) {
1181
- result.stat.price1h = this.formatScientificNotation(item.ts.p1h);
1000
+ if (ts.bviu1m) {
1001
+ result.stat.buyVolumeInUsd1m = this.formatScientificNotation(ts.bviu1m);
1182
1002
  }
1183
- if (item.ts.oiu1h) {
1184
- result.stat.openInUsd1h = this.formatScientificNotation(item.ts.oiu1h);
1003
+ if (ts.sviu1m) {
1004
+ result.stat.sellVolumeInUsd1m = this.formatScientificNotation(ts.sviu1m);
1185
1005
  }
1186
- if (item.ts.ciu1h) {
1187
- result.stat.closeInUsd1h = this.formatScientificNotation(item.ts.ciu1h);
1006
+ if (ts.p1m) {
1007
+ result.stat.price1m = this.formatScientificNotation(ts.p1m);
1188
1008
  }
1189
- if (item.ts.b4h) {
1190
- result.stat.buys4h = item.ts.b4h;
1191
- }
1192
- if (item.ts.s4h) {
1193
- result.stat.sells4h = item.ts.s4h;
1194
- }
1195
- if (item.ts.be4h) {
1196
- result.stat.buyers4h = item.ts.be4h;
1197
- }
1198
- if (item.ts.se4h) {
1199
- result.stat.sellers4h = item.ts.se4h;
1200
- }
1201
- if (item.ts.bviu4h) {
1202
- result.stat.buyVolumeInUsd4h = this.formatScientificNotation(item.ts.bviu4h);
1203
- }
1204
- if (item.ts.sviu4h) {
1205
- result.stat.sellVolumeInUsd4h = this.formatScientificNotation(item.ts.sviu4h);
1206
- }
1207
- if (item.ts.p4h) {
1208
- result.stat.price4h = this.formatScientificNotation(item.ts.p4h);
1209
- }
1210
- if (item.ts.oiu4h) {
1211
- result.stat.openInUsd4h = this.formatScientificNotation(item.ts.oiu4h);
1212
- }
1213
- if (item.ts.ciu4h) {
1214
- result.stat.closeInUsd4h = this.formatScientificNotation(item.ts.ciu4h);
1215
- }
1216
- if (item.ts.b24h) {
1217
- result.stat.buys24h = item.ts.b24h;
1218
- }
1219
- if (item.ts.s24h) {
1220
- result.stat.sells24h = item.ts.s24h;
1221
- }
1222
- if (item.ts.be24h) {
1223
- result.stat.buyers24h = item.ts.be24h;
1224
- }
1225
- if (item.ts.se24h) {
1226
- result.stat.sellers24h = item.ts.se24h;
1227
- }
1228
- if (item.ts.bviu24h) {
1229
- result.stat.buyVolumeInUsd24h = this.formatScientificNotation(item.ts.bviu24h);
1230
- }
1231
- if (item.ts.sviu24h) {
1232
- result.stat.sellVolumeInUsd24h = this.formatScientificNotation(item.ts.sviu24h);
1233
- }
1234
- if (item.ts.p24h) {
1235
- result.stat.price24h = this.formatScientificNotation(item.ts.p24h);
1236
- }
1237
- if (item.ts.oiu24h) {
1238
- result.stat.openInUsd24h = this.formatScientificNotation(item.ts.oiu24h);
1239
- }
1240
- if (item.ts.ciu24h) {
1241
- result.stat.closeInUsd24h = this.formatScientificNotation(item.ts.ciu24h);
1242
- }
1243
- if (item.ts.p) {
1244
- result.stat.price = this.formatScientificNotation(item.ts.p);
1009
+ if (ts.p) {
1010
+ result.stat.price = this.formatScientificNotation(ts.p);
1245
1011
  }
1246
1012
  }
1247
1013
  return result;
@@ -1280,52 +1046,7 @@ var StreamApi = class {
1280
1046
  price5m: this.formatScientificNotation(it.p5m),
1281
1047
  openInUsd5m: this.formatScientificNotation(it.oiu5m),
1282
1048
  closeInUsd5m: this.formatScientificNotation(it.ciu5m),
1283
- buys15m: it.b15m,
1284
- sells15m: it.s15m,
1285
- buyers15m: it.be15m,
1286
- sellers15m: it.se15m,
1287
- buyVolumeInUsd15m: this.formatScientificNotation(it.bviu15m),
1288
- sellVolumeInUsd15m: this.formatScientificNotation(it.sviu15m),
1289
- price15m: this.formatScientificNotation(it.p15m),
1290
- openInUsd15m: this.formatScientificNotation(it.oiu15m),
1291
- closeInUsd15m: this.formatScientificNotation(it.ciu15m),
1292
- buys30m: it.b30m,
1293
- sells30m: it.s30m,
1294
- buyers30m: it.be30m,
1295
- sellers30m: it.se30m,
1296
- buyVolumeInUsd30m: this.formatScientificNotation(it.bviu30m),
1297
- sellVolumeInUsd30m: this.formatScientificNotation(it.sviu30m),
1298
- price30m: this.formatScientificNotation(it.p30m),
1299
- openInUsd30m: this.formatScientificNotation(it.oiu30m),
1300
- closeInUsd30m: this.formatScientificNotation(it.ciu30m),
1301
- buys1h: it.b1h,
1302
- sells1h: it.s1h,
1303
- buyers1h: it.be1h,
1304
- sellers1h: it.se1h,
1305
- buyVolumeInUsd1h: this.formatScientificNotation(it.bviu1h),
1306
- sellVolumeInUsd1h: this.formatScientificNotation(it.sviu1h),
1307
- price1h: this.formatScientificNotation(it.p1h),
1308
- openInUsd1h: this.formatScientificNotation(it.oiu1h),
1309
- closeInUsd1h: this.formatScientificNotation(it.ciu1h),
1310
- buys4h: it.b4h,
1311
- sells4h: it.s4h,
1312
- buyers4h: it.be4h,
1313
- sellers4h: it.se4h,
1314
- buyVolumeInUsd4h: this.formatScientificNotation(it.bviu4h),
1315
- sellVolumeInUsd4h: this.formatScientificNotation(it.sviu4h),
1316
- price4h: this.formatScientificNotation(it.p4h),
1317
- openInUsd4h: this.formatScientificNotation(it.oiu4h),
1318
- closeInUsd4h: this.formatScientificNotation(it.ciu4h),
1319
- buys24h: it.b24h,
1320
- sells24h: it.s24h,
1321
- buyers24h: it.be24h,
1322
- sellers24h: it.se24h,
1323
- buyVolumeInUsd24h: this.formatScientificNotation(it.bviu24h),
1324
- sellVolumeInUsd24h: this.formatScientificNotation(it.sviu24h),
1325
- price24h: this.formatScientificNotation(it.p24h),
1326
- price: this.formatScientificNotation(it.p),
1327
- openInUsd24h: this.formatScientificNotation(it.oiu24h),
1328
- closeInUsd24h: this.formatScientificNotation(it.ciu24h)
1049
+ price: this.formatScientificNotation(it.p)
1329
1050
  })
1330
1051
  )
1331
1052
  )
@@ -1353,45 +1074,6 @@ var StreamApi = class {
1353
1074
  top100HoldersRatio: this.formatScientificNotation(it.t100r),
1354
1075
  top50HoldersRatio: this.formatScientificNotation(it.t50r),
1355
1076
  top10HoldersRatio: this.formatScientificNotation(it.t10r),
1356
- creatorsHolders: it.ch,
1357
- creatorsAmount: this.formatScientificNotation(it.ca),
1358
- creatorsRatio: this.formatScientificNotation(it.cr),
1359
- balanceTagFreshHolders: it.btfh,
1360
- balanceTagFreshAmount: this.formatScientificNotation(it.btfa),
1361
- balanceTagFreshRatio: this.formatScientificNotation(it.btfr),
1362
- balanceTagSandwichHolders: it.btsh,
1363
- balanceTagSandwichAmount: this.formatScientificNotation(it.btsa),
1364
- balanceTagSandwichRatio: this.formatScientificNotation(it.btsr),
1365
- balanceTagBundleHolders: it.btbh,
1366
- balanceTagBundleAmount: this.formatScientificNotation(it.btba),
1367
- balanceTagBundleRatio: this.formatScientificNotation(it.btbr),
1368
- balanceTagSniperHolders: it.btsnh,
1369
- balanceTagSniperAmount: this.formatScientificNotation(it.btsna),
1370
- balanceTagSniperRatio: this.formatScientificNotation(it.btsnr),
1371
- balanceTagDevHolders: it.btdh,
1372
- balanceTagDevAmount: this.formatScientificNotation(it.btda),
1373
- balanceTagDevRatio: this.formatScientificNotation(it.btdr),
1374
- balanceTagProHolders: it.btph,
1375
- balanceTagProAmount: this.formatScientificNotation(it.btpa),
1376
- balanceTagProRatio: this.formatScientificNotation(it.btpr),
1377
- balanceTagInsiderHolders: it.btih,
1378
- balanceTagInsiderAmount: this.formatScientificNotation(it.btia),
1379
- balanceTagInsiderRatio: this.formatScientificNotation(it.btir),
1380
- balanceTagSmartHolders: it.btsmh,
1381
- balanceTagSmartAmount: this.formatScientificNotation(it.btsma),
1382
- balanceTagSmartRatio: this.formatScientificNotation(it.btsmr),
1383
- balanceTagKolHolders: it.btkh,
1384
- balanceTagKolAmount: this.formatScientificNotation(it.btka),
1385
- balanceTagKolRatio: this.formatScientificNotation(it.btkr),
1386
- balanceTagPhishingHolders: it.btphh,
1387
- balanceTagPhishingAmount: this.formatScientificNotation(it.btpha),
1388
- balanceTagPhishingRatio: this.formatScientificNotation(it.btphr),
1389
- balanceTagBluechipHolders: it.btblh,
1390
- balanceTagBluechipAmount: this.formatScientificNotation(it.btbla),
1391
- balanceTagBluechipRatio: this.formatScientificNotation(it.btblr),
1392
- balanceTagRatHolders: it.btrh,
1393
- balanceTagRatAmount: this.formatScientificNotation(it.btra),
1394
- balanceTagRatRatio: this.formatScientificNotation(it.btrr),
1395
1077
  timestamp: it.ts
1396
1078
  })
1397
1079
  )
@@ -1407,14 +1089,12 @@ var StreamApi = class {
1407
1089
  return this.subscribe(
1408
1090
  channel,
1409
1091
  (data) => callback(
1410
- data?.map(
1411
- (it) => ({
1412
- tokenAddress: it.a,
1413
- supply: it.s,
1414
- marketCapInUsd: it.mc,
1415
- timestamp: it.ts
1416
- })
1417
- )
1092
+ data?.map((it) => ({
1093
+ tokenAddress: it.a,
1094
+ supply: it.s,
1095
+ marketCapInUsd: it.mc,
1096
+ timestamp: it.ts
1097
+ }))
1418
1098
  )
1419
1099
  );
1420
1100
  }
@@ -1426,48 +1106,13 @@ var StreamApi = class {
1426
1106
  return this.subscribe(
1427
1107
  channel,
1428
1108
  (data) => callback(
1429
- data?.map(
1430
- (it) => ({
1431
- tokenAddress: it.a,
1432
- progressRatio: it.pr
1433
- })
1434
- )
1109
+ data?.map((it) => ({
1110
+ tokenAddress: it.a,
1111
+ progressRatio: it.pr
1112
+ }))
1435
1113
  )
1436
1114
  );
1437
1115
  }
1438
- // subscribeTokenTrades({
1439
- // chain,
1440
- // tokenAddress,
1441
- // callback,
1442
- // }: {
1443
- // chain: string;
1444
- // tokenAddress: string;
1445
- // callback: (data: TradeEvent[]) => void;
1446
- // }): Unsubscrible {
1447
- // const channel = `dex-trades:${chain}_${tokenAddress}`;
1448
- // return this.subscribe(channel, (data: any[]) =>
1449
- // callback(
1450
- // data?.map(
1451
- // (it: any) =>
1452
- // ({
1453
- // maker: it.bwa,
1454
- // baseAmount: it.ba,
1455
- // quoteAmount: it.sa,
1456
- // // quoteSymbol: ,
1457
- // quoteAddress: it.swa,
1458
- // amountInUsd: it.baiu,
1459
- // timestamp: it.t,
1460
- // event: it.k,
1461
- // txHash: it.h,
1462
- // // priceInUsd: ,
1463
- // // id: ,
1464
- // // buyCostUsd: it.,
1465
- // tokenAddress: it.a,
1466
- // }) as TradeEvent
1467
- // )
1468
- // )
1469
- // );
1470
- // }
1471
1116
  subscribeWalletBalance({
1472
1117
  chain,
1473
1118
  walletAddress,
@@ -1475,15 +1120,20 @@ var StreamApi = class {
1475
1120
  filter
1476
1121
  }) {
1477
1122
  const channel = `dex-wallet-balance:${chain}_${walletAddress}`;
1478
- return this.subscribe(channel, (data) => callback([
1479
- {
1480
- walletAddress: data.a,
1481
- tokenAddress: data.ta,
1482
- tokenPriceInUsd: data.tpiu,
1483
- balance: data.b,
1484
- timestamp: data.t
1485
- }
1486
- ]), filter, "subscribeWalletBalance");
1123
+ return this.subscribe(
1124
+ channel,
1125
+ (data) => callback([
1126
+ {
1127
+ walletAddress: data.a,
1128
+ tokenAddress: data.ta,
1129
+ tokenPriceInUsd: data.tpiu,
1130
+ balance: data.b,
1131
+ timestamp: data.t
1132
+ }
1133
+ ]),
1134
+ filter,
1135
+ "subscribeWalletBalance"
1136
+ );
1487
1137
  }
1488
1138
  subscribeWalletPnl({
1489
1139
  chain,
@@ -1492,34 +1142,39 @@ var StreamApi = class {
1492
1142
  filter
1493
1143
  }) {
1494
1144
  const channel = `dex-wallet-token-pnl:${chain}_${walletAddress}`;
1495
- return this.subscribe(channel, (data) => callback({
1496
- walletAddress: data.a,
1497
- tokenAddress: data.ta,
1498
- tokenPriceInUsd: data.tpiu,
1499
- timestamp: data.t,
1500
- opentime: data.ot,
1501
- lasttime: data.lt,
1502
- closetime: data.ct,
1503
- buyAmount: data.ba,
1504
- buyAmountInUsd: data.baiu,
1505
- buyCount: data.bs,
1506
- buyCount30d: data.bs30d,
1507
- buyCount7d: data.bs7d,
1508
- sellAmount: data.sa,
1509
- sellAmountInUsd: data.saiu,
1510
- sellCount: data.ss,
1511
- sellCount30d: data.ss30d,
1512
- sellCount7d: data.ss7d,
1513
- heldDurationTimestamp: data.hdts,
1514
- averageBuyPriceInUsd: data.abpiu,
1515
- averageSellPriceInUsd: data.aspiu,
1516
- unrealizedProfitInUsd: data.upiu,
1517
- unrealizedProfitRatio: data.upr,
1518
- realizedProfitInUsd: data.rpiu,
1519
- realizedProfitRatio: data.rpr,
1520
- totalRealizedProfitInUsd: data.trpiu,
1521
- totalRealizedProfitRatio: data.trr
1522
- }), filter, "subscribeWalletPnl");
1145
+ return this.subscribe(
1146
+ channel,
1147
+ (data) => callback({
1148
+ walletAddress: data.a,
1149
+ tokenAddress: data.ta,
1150
+ tokenPriceInUsd: data.tpiu,
1151
+ timestamp: data.t,
1152
+ opentime: data.ot,
1153
+ lasttime: data.lt,
1154
+ closetime: data.ct,
1155
+ buyAmount: data.ba,
1156
+ buyAmountInUsd: data.baiu,
1157
+ buyCount: data.bs,
1158
+ buyCount30d: data.bs30d,
1159
+ buyCount7d: data.bs7d,
1160
+ sellAmount: data.sa,
1161
+ sellAmountInUsd: data.saiu,
1162
+ sellCount: data.ss,
1163
+ sellCount30d: data.ss30d,
1164
+ sellCount7d: data.ss7d,
1165
+ heldDurationTimestamp: data.hdts,
1166
+ averageBuyPriceInUsd: data.abpiu,
1167
+ averageSellPriceInUsd: data.aspiu,
1168
+ unrealizedProfitInUsd: data.upiu,
1169
+ unrealizedProfitRatio: data.upr,
1170
+ realizedProfitInUsd: data.rpiu,
1171
+ realizedProfitRatio: data.rpr,
1172
+ totalRealizedProfitInUsd: data.trpiu,
1173
+ totalRealizedProfitRatio: data.trr
1174
+ }),
1175
+ filter,
1176
+ "subscribeWalletPnl"
1177
+ );
1523
1178
  }
1524
1179
  subscribeWalletPnlList({
1525
1180
  chain,
@@ -1561,24 +1216,29 @@ var StreamApi = class {
1561
1216
  filter
1562
1217
  }) {
1563
1218
  const channel = `dex-trade:${chain}_${tokenAddress}`;
1564
- return this.subscribe(channel, (data) => callback({
1565
- tokenAddress: data.a,
1566
- timestamp: data.t,
1567
- kind: data.k,
1568
- buyAmount: data.ba,
1569
- buyAmountInUsd: data.baiu,
1570
- buyTokenAddress: data.btma,
1571
- buyTokenName: data.btn,
1572
- buyTokenSymbol: data.bts,
1573
- buyWalletAddress: data.bwa,
1574
- sellAmount: data.sa,
1575
- sellAmountInUsd: data.saiu,
1576
- sellTokenAddress: data.stma,
1577
- sellTokenName: data.stn,
1578
- sellTokenSymbol: data.sts,
1579
- sellWalletAddress: data.swa,
1580
- txHash: data.h
1581
- }), filter, "subscribeTokenTrades");
1219
+ return this.subscribe(
1220
+ channel,
1221
+ (data) => callback({
1222
+ tokenAddress: data.a,
1223
+ timestamp: data.t,
1224
+ kind: data.k,
1225
+ buyAmount: data.ba,
1226
+ buyAmountInUsd: data.baiu,
1227
+ buyTokenAddress: data.btma,
1228
+ buyTokenName: data.btn,
1229
+ buyTokenSymbol: data.bts,
1230
+ buyWalletAddress: data.bwa,
1231
+ sellAmount: data.sa,
1232
+ sellAmountInUsd: data.saiu,
1233
+ sellTokenAddress: data.stma,
1234
+ sellTokenName: data.stn,
1235
+ sellTokenSymbol: data.sts,
1236
+ sellWalletAddress: data.swa,
1237
+ txHash: data.h
1238
+ }),
1239
+ filter,
1240
+ "subscribeTokenTrades"
1241
+ );
1582
1242
  }
1583
1243
  subscribeWalletTrade({
1584
1244
  chain,
@@ -1587,24 +1247,29 @@ var StreamApi = class {
1587
1247
  filter
1588
1248
  }) {
1589
1249
  const channel = `dex-wallet-trade:${chain}_${walletAddress}`;
1590
- return this.subscribe(channel, (data) => callback({
1591
- tokenAddress: data.a,
1592
- timestamp: data.t,
1593
- kind: data.k,
1594
- buyAmount: data.ba,
1595
- buyAmountInUsd: data.baiu,
1596
- buyTokenAddress: data.btma,
1597
- buyTokenName: data.btn,
1598
- buyTokenSymbol: data.bts,
1599
- buyWalletAddress: data.bwa,
1600
- sellAmount: data.sa,
1601
- sellAmountInUsd: data.saiu,
1602
- sellTokenAddress: data.stma,
1603
- sellTokenName: data.stn,
1604
- sellTokenSymbol: data.sts,
1605
- sellWalletAddress: data.swa,
1606
- txHash: data.h
1607
- }), filter, "subscribeTokenTrades");
1250
+ return this.subscribe(
1251
+ channel,
1252
+ (data) => callback({
1253
+ tokenAddress: data.a,
1254
+ timestamp: data.t,
1255
+ kind: data.k,
1256
+ buyAmount: data.ba,
1257
+ buyAmountInUsd: data.baiu,
1258
+ buyTokenAddress: data.btma,
1259
+ buyTokenName: data.btn,
1260
+ buyTokenSymbol: data.bts,
1261
+ buyWalletAddress: data.bwa,
1262
+ sellAmount: data.sa,
1263
+ sellAmountInUsd: data.saiu,
1264
+ sellTokenAddress: data.stma,
1265
+ sellTokenName: data.stn,
1266
+ sellTokenSymbol: data.sts,
1267
+ sellWalletAddress: data.swa,
1268
+ txHash: data.h
1269
+ }),
1270
+ filter,
1271
+ "subscribeTokenTrades"
1272
+ );
1608
1273
  }
1609
1274
  subscribeDexPoolBalance({
1610
1275
  chain,
@@ -1624,7 +1289,7 @@ var StreamApi = class {
1624
1289
  );
1625
1290
  }
1626
1291
  };
1627
- var StreamUnsubscrible = class {
1292
+ var StreamUnsubscribable = class {
1628
1293
  constructor(streamApi, channel, fn) {
1629
1294
  this.streamApi = streamApi;
1630
1295
  this.channel = channel;
@@ -1636,51 +1301,51 @@ var StreamUnsubscrible = class {
1636
1301
  };
1637
1302
 
1638
1303
  // src/stream/stream.model.ts
1639
- var TokenActivityType = /* @__PURE__ */ ((TokenActivityType2) => {
1640
- TokenActivityType2["Sell"] = "sell";
1641
- TokenActivityType2["Buy"] = "buy";
1642
- TokenActivityType2["AddLiquidity"] = "add_liquidity";
1643
- TokenActivityType2["RemoveLiquidity"] = "remove_liquidity";
1644
- return TokenActivityType2;
1645
- })(TokenActivityType || {});
1646
- var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
1647
- ChannelType2["New"] = "new";
1648
- ChannelType2["HOT"] = "trending";
1649
- ChannelType2["US_STOCKS"] = "us_stocks";
1650
- ChannelType2["COMPLETED"] = "completed";
1651
- ChannelType2["GRADUATED"] = "graduated";
1652
- return ChannelType2;
1653
- })(ChannelType || {});
1654
- var MetricType = /* @__PURE__ */ ((MetricType2) => {
1655
- MetricType2["LIQUIDITY_IN_USD"] = "liquidity_in_usd";
1656
- MetricType2["MIGRATED_RATIO"] = "migrated_ratio";
1657
- return MetricType2;
1658
- })(MetricType || {});
1659
- var RankingType = /* @__PURE__ */ ((RankingType2) => {
1660
- RankingType2["NEW"] = "new";
1661
- RankingType2["HOT"] = "trending";
1662
- RankingType2["STOCKS"] = "stocks";
1663
- RankingType2["FINALSTRETCH"] = "completed";
1664
- RankingType2["MIGRATED"] = "graduated";
1665
- return RankingType2;
1666
- })(RankingType || {});
1667
- var Dex = /* @__PURE__ */ ((Dex2) => {
1668
- Dex2["PUMP_FUN"] = "pump_fun";
1669
- Dex2["RAYDIUM_LAUNCHPAD"] = "raydium_launchpad";
1670
- Dex2["METEOR_DYNAMIC_BOUNDING_CURVE"] = "meteora_dynamic_bounding_curve";
1671
- Dex2["BONK_FUN"] = "bonk_fun";
1672
- Dex2["BOOP_FUN"] = "boop_fun";
1673
- Dex2["MOONIT_FUN"] = "moonit_fun";
1674
- return Dex2;
1675
- })(Dex || {});
1304
+ var WsTokenActivityType = /* @__PURE__ */ ((WsTokenActivityType2) => {
1305
+ WsTokenActivityType2["Sell"] = "sell";
1306
+ WsTokenActivityType2["Buy"] = "buy";
1307
+ WsTokenActivityType2["AddLiquidity"] = "add_liquidity";
1308
+ WsTokenActivityType2["RemoveLiquidity"] = "remove_liquidity";
1309
+ return WsTokenActivityType2;
1310
+ })(WsTokenActivityType || {});
1311
+ var WsChannelType = /* @__PURE__ */ ((WsChannelType2) => {
1312
+ WsChannelType2["New"] = "new";
1313
+ WsChannelType2["HOT"] = "trending";
1314
+ WsChannelType2["US_STOCKS"] = "us_stocks";
1315
+ WsChannelType2["COMPLETED"] = "completed";
1316
+ WsChannelType2["GRADUATED"] = "graduated";
1317
+ return WsChannelType2;
1318
+ })(WsChannelType || {});
1319
+ var WsMetricType = /* @__PURE__ */ ((WsMetricType2) => {
1320
+ WsMetricType2["LIQUIDITY_IN_USD"] = "liquidity_in_usd";
1321
+ WsMetricType2["MIGRATED_RATIO"] = "migrated_ratio";
1322
+ return WsMetricType2;
1323
+ })(WsMetricType || {});
1324
+ var WsRankingType = /* @__PURE__ */ ((WsRankingType2) => {
1325
+ WsRankingType2["NEW"] = "new";
1326
+ WsRankingType2["HOT"] = "trending";
1327
+ WsRankingType2["STOCKS"] = "stocks";
1328
+ WsRankingType2["FINALSTRETCH"] = "completed";
1329
+ WsRankingType2["MIGRATED"] = "graduated";
1330
+ return WsRankingType2;
1331
+ })(WsRankingType || {});
1332
+ var WsDex = /* @__PURE__ */ ((WsDex2) => {
1333
+ WsDex2["PUMP_FUN"] = "pump_fun";
1334
+ WsDex2["RAYDIUM_LAUNCHPAD"] = "raydium_launchpad";
1335
+ WsDex2["METEOR_DYNAMIC_BOUNDING_CURVE"] = "meteora_dynamic_bounding_curve";
1336
+ WsDex2["BONK_FUN"] = "bonk_fun";
1337
+ WsDex2["BOOP_FUN"] = "boop_fun";
1338
+ WsDex2["MOONIT_FUN"] = "moonit_fun";
1339
+ return WsDex2;
1340
+ })(WsDex || {});
1676
1341
  export {
1677
1342
  CEL_FIELD_MAPPINGS,
1678
- ChannelType,
1679
- Dex,
1680
- MetricType,
1681
- RankingType,
1682
1343
  StreamApi,
1683
- TokenActivityType,
1344
+ WsChannelType,
1345
+ WsDex,
1346
+ WsMetricType,
1347
+ WsRankingType,
1348
+ WsTokenActivityType,
1684
1349
  getAvailableFields,
1685
1350
  getFieldMappings,
1686
1351
  replaceFilterFields