@chainstream-io/sdk 0.1.26 → 0.2.2

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