@chainstream-io/sdk 0.1.6 → 0.1.8

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.
Files changed (114) hide show
  1. package/README.md +2 -2
  2. package/dist/esm/index.js +74 -73
  3. package/dist/esm/openapi/apis/BlockchainApi.js +44 -61
  4. package/dist/esm/openapi/apis/DefiSolanaMoonshotApi.js +50 -67
  5. package/dist/esm/openapi/apis/DefiSolanaPumpfunApi.js +25 -38
  6. package/dist/esm/openapi/apis/DexApi.js +176 -205
  7. package/dist/esm/openapi/apis/DexPoolApi.js +28 -41
  8. package/dist/esm/openapi/apis/EndpointApi.js +175 -212
  9. package/dist/esm/openapi/apis/IpfsApi.js +25 -38
  10. package/dist/esm/openapi/apis/JobsApi.js +48 -65
  11. package/dist/esm/openapi/apis/RankingApi.js +249 -278
  12. package/dist/esm/openapi/apis/RedPacketApi.js +253 -294
  13. package/dist/esm/openapi/apis/TokenApi.js +1056 -1145
  14. package/dist/esm/openapi/apis/TradeApi.js +208 -233
  15. package/dist/esm/openapi/apis/TransactionApi.js +29 -42
  16. package/dist/esm/openapi/apis/WalletApi.js +123 -148
  17. package/dist/esm/openapi/apis/WatchlistApi.js +28 -41
  18. package/dist/esm/openapi/runtime.js +118 -119
  19. package/dist/esm/stream/stream.js +34 -36
  20. package/dist/index.js +96 -99
  21. package/dist/openapi/apis/BlockchainApi.js +48 -69
  22. package/dist/openapi/apis/DefiSolanaMoonshotApi.js +53 -74
  23. package/dist/openapi/apis/DefiSolanaPumpfunApi.js +28 -45
  24. package/dist/openapi/apis/DexApi.js +184 -217
  25. package/dist/openapi/apis/DexPoolApi.js +32 -49
  26. package/dist/openapi/apis/EndpointApi.js +179 -220
  27. package/dist/openapi/apis/IpfsApi.js +27 -44
  28. package/dist/openapi/apis/JobsApi.js +51 -72
  29. package/dist/openapi/apis/RankingApi.js +273 -306
  30. package/dist/openapi/apis/RedPacketApi.js +260 -305
  31. package/dist/openapi/apis/TokenApi.js +1089 -1182
  32. package/dist/openapi/apis/TradeApi.js +227 -256
  33. package/dist/openapi/apis/TransactionApi.js +32 -49
  34. package/dist/openapi/apis/WalletApi.js +130 -159
  35. package/dist/openapi/apis/WatchlistApi.js +32 -49
  36. package/dist/openapi/apis/index.js +15 -31
  37. package/dist/openapi/index.js +3 -19
  38. package/dist/openapi/models/BlockchainDTO.js +5 -12
  39. package/dist/openapi/models/BlockchainLatestBlockDTO.js +5 -12
  40. package/dist/openapi/models/BooleanResultDTO.js +5 -12
  41. package/dist/openapi/models/CalculatePnlInput.js +5 -12
  42. package/dist/openapi/models/Candle.js +8 -15
  43. package/dist/openapi/models/ClaimRedPacketInput.js +5 -12
  44. package/dist/openapi/models/CreateEndpointInput.js +5 -12
  45. package/dist/openapi/models/CreateRedPacketInput.js +5 -12
  46. package/dist/openapi/models/CreateRedPacketReply.js +5 -12
  47. package/dist/openapi/models/CreateTokenInput.js +6 -14
  48. package/dist/openapi/models/CreateTokenReply.js +5 -12
  49. package/dist/openapi/models/DexDTO.js +5 -12
  50. package/dist/openapi/models/DexPage.js +8 -15
  51. package/dist/openapi/models/DexPoolDTO.js +5 -12
  52. package/dist/openapi/models/EndpointListResponse.js +8 -15
  53. package/dist/openapi/models/EndpointOperationResponse.js +5 -12
  54. package/dist/openapi/models/EndpointResponse.js +5 -12
  55. package/dist/openapi/models/EndpointSecretResponse.js +5 -12
  56. package/dist/openapi/models/FilterCondition.js +6 -14
  57. package/dist/openapi/models/GainersAndLosersDTO.js +5 -12
  58. package/dist/openapi/models/GainersAndLosersPage.js +8 -15
  59. package/dist/openapi/models/JobDTO.js +5 -12
  60. package/dist/openapi/models/JobStreamingDTO.js +5 -12
  61. package/dist/openapi/models/Link.js +6 -14
  62. package/dist/openapi/models/MoonshotCreateTokenInput.js +10 -18
  63. package/dist/openapi/models/MoonshotCreateTokenReply.js +5 -12
  64. package/dist/openapi/models/MoonshotSubmitCreateToken200Response.js +5 -12
  65. package/dist/openapi/models/MoonshotSubmitCreateTokenInput.js +5 -12
  66. package/dist/openapi/models/PumpCreateTokenInput.js +7 -15
  67. package/dist/openapi/models/PumpCreateTokenReply.js +5 -12
  68. package/dist/openapi/models/QuoteResponse.js +5 -12
  69. package/dist/openapi/models/RedPacketClaimDTO.js +6 -14
  70. package/dist/openapi/models/RedPacketClaimsPage.js +8 -15
  71. package/dist/openapi/models/RedPacketDTO.js +6 -14
  72. package/dist/openapi/models/RedPacketReply.js +5 -12
  73. package/dist/openapi/models/RedPacketSendTxInput.js +5 -12
  74. package/dist/openapi/models/RedPacketSendTxResponse.js +5 -12
  75. package/dist/openapi/models/RedPacketsPage.js +8 -15
  76. package/dist/openapi/models/Resolution.js +9 -17
  77. package/dist/openapi/models/SendTxInput.js +6 -14
  78. package/dist/openapi/models/SendTxResponse.js +5 -12
  79. package/dist/openapi/models/SwapInput.js +7 -15
  80. package/dist/openapi/models/SwapReply.js +5 -12
  81. package/dist/openapi/models/SwapRouteInput.js +7 -15
  82. package/dist/openapi/models/SwapRouteResponse.js +8 -15
  83. package/dist/openapi/models/Token.js +23 -30
  84. package/dist/openapi/models/TokenCreationDTO.js +6 -14
  85. package/dist/openapi/models/TokenCreationPage.js +8 -15
  86. package/dist/openapi/models/TokenCreatorsDTO.js +5 -12
  87. package/dist/openapi/models/TokenExtraDTO.js +5 -12
  88. package/dist/openapi/models/TokenHolder.js +5 -12
  89. package/dist/openapi/models/TokenHolderPage.js +8 -15
  90. package/dist/openapi/models/TokenListPage.js +8 -15
  91. package/dist/openapi/models/TokenMarketData.js +5 -12
  92. package/dist/openapi/models/TokenMetadata.js +14 -21
  93. package/dist/openapi/models/TokenPage.js +8 -15
  94. package/dist/openapi/models/TokenPriceDTO.js +5 -12
  95. package/dist/openapi/models/TokenPricePage.js +8 -15
  96. package/dist/openapi/models/TokenSocialMediasDTO.js +5 -12
  97. package/dist/openapi/models/TokenStat.js +5 -12
  98. package/dist/openapi/models/TopTradersDTO.js +5 -12
  99. package/dist/openapi/models/TopTradersPage.js +8 -15
  100. package/dist/openapi/models/TradeDetailDTO.js +5 -12
  101. package/dist/openapi/models/TradeEvent.js +8 -15
  102. package/dist/openapi/models/TradePage.js +8 -15
  103. package/dist/openapi/models/TradeType.js +9 -17
  104. package/dist/openapi/models/UpdateEndpointInput.js +5 -12
  105. package/dist/openapi/models/WalletBalanceDetailDTO.js +5 -12
  106. package/dist/openapi/models/WalletBalancesDTO.js +8 -15
  107. package/dist/openapi/models/WalletPnlDTO.js +5 -12
  108. package/dist/openapi/models/index.js +70 -86
  109. package/dist/openapi/runtime.js +136 -153
  110. package/dist/stream/index.js +3 -19
  111. package/dist/stream/stream.fields.js +5 -11
  112. package/dist/stream/stream.js +39 -45
  113. package/dist/stream/stream.model.js +10 -13
  114. package/package.json +4 -1
@@ -11,17 +11,9 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  export const BASE_PATH = "https://api-dex.chainstream.io".replace(/\/+$/, "");
24
15
  export class Configuration {
16
+ configuration;
25
17
  constructor(configuration = {}) {
26
18
  this.configuration = configuration;
27
19
  }
@@ -56,7 +48,7 @@ export class Configuration {
56
48
  get accessToken() {
57
49
  const accessToken = this.configuration.accessToken;
58
50
  if (accessToken) {
59
- return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
51
+ return typeof accessToken === 'function' ? accessToken : async () => accessToken;
60
52
  }
61
53
  return undefined;
62
54
  }
@@ -72,52 +64,11 @@ export const DefaultConfig = new Configuration();
72
64
  * This is the base class for all generated API classes.
73
65
  */
74
66
  export class BaseAPI {
67
+ configuration;
68
+ static jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
69
+ middleware;
75
70
  constructor(configuration = DefaultConfig) {
76
71
  this.configuration = configuration;
77
- this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
78
- let fetchParams = { url, init };
79
- for (const middleware of this.middleware) {
80
- if (middleware.pre) {
81
- fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
82
- }
83
- }
84
- let response = undefined;
85
- try {
86
- response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
87
- }
88
- catch (e) {
89
- for (const middleware of this.middleware) {
90
- if (middleware.onError) {
91
- response = (yield middleware.onError({
92
- fetch: this.fetchApi,
93
- url: fetchParams.url,
94
- init: fetchParams.init,
95
- error: e,
96
- response: response ? response.clone() : undefined,
97
- })) || response;
98
- }
99
- }
100
- if (response === undefined) {
101
- if (e instanceof Error) {
102
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
103
- }
104
- else {
105
- throw e;
106
- }
107
- }
108
- }
109
- for (const middleware of this.middleware) {
110
- if (middleware.post) {
111
- response = (yield middleware.post({
112
- fetch: this.fetchApi,
113
- url: fetchParams.url,
114
- init: fetchParams.init,
115
- response: response.clone(),
116
- })) || response;
117
- }
118
- }
119
- return response;
120
- });
121
72
  this.middleware = configuration.middleware;
122
73
  }
123
74
  withMiddleware(...middlewares) {
@@ -149,56 +100,105 @@ export class BaseAPI {
149
100
  }
150
101
  return BaseAPI.jsonRegex.test(mime);
151
102
  }
152
- request(context, initOverrides) {
153
- return __awaiter(this, void 0, void 0, function* () {
154
- const { url, init } = yield this.createFetchParams(context, initOverrides);
155
- const response = yield this.fetchApi(url, init);
156
- if (response && (response.status >= 200 && response.status < 300)) {
157
- return response;
158
- }
159
- throw new ResponseError(response, 'Response returned an error code');
160
- });
161
- }
162
- createFetchParams(context, initOverrides) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- let url = this.configuration.basePath + context.path;
165
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
166
- // only add the querystring to the URL if there are query parameters.
167
- // this is done to avoid urls ending with a "?" character which buggy webservers
168
- // do not handle correctly sometimes.
169
- url += '?' + this.configuration.queryParamsStringify(context.query);
170
- }
171
- const headers = Object.assign({}, this.configuration.headers, context.headers);
172
- Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
173
- const initOverrideFn = typeof initOverrides === "function"
174
- ? initOverrides
175
- : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
176
- const initParams = {
177
- method: context.method,
178
- headers,
179
- body: context.body,
180
- credentials: this.configuration.credentials,
181
- };
182
- const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
103
+ async request(context, initOverrides) {
104
+ const { url, init } = await this.createFetchParams(context, initOverrides);
105
+ const response = await this.fetchApi(url, init);
106
+ if (response && (response.status >= 200 && response.status < 300)) {
107
+ return response;
108
+ }
109
+ throw new ResponseError(response, 'Response returned an error code');
110
+ }
111
+ async createFetchParams(context, initOverrides) {
112
+ let url = this.configuration.basePath + context.path;
113
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
114
+ // only add the querystring to the URL if there are query parameters.
115
+ // this is done to avoid urls ending with a "?" character which buggy webservers
116
+ // do not handle correctly sometimes.
117
+ url += '?' + this.configuration.queryParamsStringify(context.query);
118
+ }
119
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
120
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
121
+ const initOverrideFn = typeof initOverrides === "function"
122
+ ? initOverrides
123
+ : async () => initOverrides;
124
+ const initParams = {
125
+ method: context.method,
126
+ headers,
127
+ body: context.body,
128
+ credentials: this.configuration.credentials,
129
+ };
130
+ const overriddenInit = {
131
+ ...initParams,
132
+ ...(await initOverrideFn({
183
133
  init: initParams,
184
134
  context,
185
- })));
186
- let body;
187
- if (isFormData(overriddenInit.body)
188
- || (overriddenInit.body instanceof URLSearchParams)
189
- || isBlob(overriddenInit.body)) {
190
- body = overriddenInit.body;
135
+ }))
136
+ };
137
+ let body;
138
+ if (isFormData(overriddenInit.body)
139
+ || (overriddenInit.body instanceof URLSearchParams)
140
+ || isBlob(overriddenInit.body)) {
141
+ body = overriddenInit.body;
142
+ }
143
+ else if (this.isJsonMime(headers['Content-Type'])) {
144
+ body = JSON.stringify(overriddenInit.body);
145
+ }
146
+ else {
147
+ body = overriddenInit.body;
148
+ }
149
+ const init = {
150
+ ...overriddenInit,
151
+ body
152
+ };
153
+ return { url, init };
154
+ }
155
+ fetchApi = async (url, init) => {
156
+ let fetchParams = { url, init };
157
+ for (const middleware of this.middleware) {
158
+ if (middleware.pre) {
159
+ fetchParams = await middleware.pre({
160
+ fetch: this.fetchApi,
161
+ ...fetchParams,
162
+ }) || fetchParams;
163
+ }
164
+ }
165
+ let response = undefined;
166
+ try {
167
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
168
+ }
169
+ catch (e) {
170
+ for (const middleware of this.middleware) {
171
+ if (middleware.onError) {
172
+ response = await middleware.onError({
173
+ fetch: this.fetchApi,
174
+ url: fetchParams.url,
175
+ init: fetchParams.init,
176
+ error: e,
177
+ response: response ? response.clone() : undefined,
178
+ }) || response;
179
+ }
191
180
  }
192
- else if (this.isJsonMime(headers['Content-Type'])) {
193
- body = JSON.stringify(overriddenInit.body);
181
+ if (response === undefined) {
182
+ if (e instanceof Error) {
183
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
184
+ }
185
+ else {
186
+ throw e;
187
+ }
194
188
  }
195
- else {
196
- body = overriddenInit.body;
189
+ }
190
+ for (const middleware of this.middleware) {
191
+ if (middleware.post) {
192
+ response = await middleware.post({
193
+ fetch: this.fetchApi,
194
+ url: fetchParams.url,
195
+ init: fetchParams.init,
196
+ response: response.clone(),
197
+ }) || response;
197
198
  }
198
- const init = Object.assign(Object.assign({}, overriddenInit), { body });
199
- return { url, init };
200
- });
201
- }
199
+ }
200
+ return response;
201
+ };
202
202
  /**
203
203
  * Create a shallow clone of `this` by constructing a new instance
204
204
  * and then shallow cloning data members.
@@ -210,7 +210,6 @@ export class BaseAPI {
210
210
  return next;
211
211
  }
212
212
  }
213
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
214
213
  ;
215
214
  function isBlob(value) {
216
215
  return typeof Blob !== 'undefined' && value instanceof Blob;
@@ -219,24 +218,27 @@ function isFormData(value) {
219
218
  return typeof FormData !== "undefined" && value instanceof FormData;
220
219
  }
221
220
  export class ResponseError extends Error {
221
+ response;
222
+ name = "ResponseError";
222
223
  constructor(response, msg) {
223
224
  super(msg);
224
225
  this.response = response;
225
- this.name = "ResponseError";
226
226
  }
227
227
  }
228
228
  export class FetchError extends Error {
229
+ cause;
230
+ name = "FetchError";
229
231
  constructor(cause, msg) {
230
232
  super(msg);
231
233
  this.cause = cause;
232
- this.name = "FetchError";
233
234
  }
234
235
  }
235
236
  export class RequiredError extends Error {
237
+ field;
238
+ name = "RequiredError";
236
239
  constructor(field, msg) {
237
240
  super(msg);
238
241
  this.field = field;
239
- this.name = "RequiredError";
240
242
  }
241
243
  }
242
244
  export const COLLECTION_FORMATS = {
@@ -290,45 +292,42 @@ export function canConsumeForm(consumes) {
290
292
  return false;
291
293
  }
292
294
  export class JSONApiResponse {
295
+ raw;
296
+ transformer;
293
297
  constructor(raw, transformer = (jsonValue) => jsonValue) {
294
298
  this.raw = raw;
295
299
  this.transformer = transformer;
296
300
  }
297
- value() {
298
- return __awaiter(this, void 0, void 0, function* () {
299
- return this.transformer(yield this.raw.json());
300
- });
301
+ async value() {
302
+ return this.transformer(await this.raw.json());
301
303
  }
302
304
  }
303
305
  export class VoidApiResponse {
306
+ raw;
304
307
  constructor(raw) {
305
308
  this.raw = raw;
306
309
  }
307
- value() {
308
- return __awaiter(this, void 0, void 0, function* () {
309
- return undefined;
310
- });
310
+ async value() {
311
+ return undefined;
311
312
  }
312
313
  }
313
314
  export class BlobApiResponse {
315
+ raw;
314
316
  constructor(raw) {
315
317
  this.raw = raw;
316
318
  }
317
- value() {
318
- return __awaiter(this, void 0, void 0, function* () {
319
- return yield this.raw.blob();
320
- });
319
+ async value() {
320
+ return await this.raw.blob();
321
321
  }
322
322
  ;
323
323
  }
324
324
  export class TextApiResponse {
325
+ raw;
325
326
  constructor(raw) {
326
327
  this.raw = raw;
327
328
  }
328
- value() {
329
- return __awaiter(this, void 0, void 0, function* () {
330
- return yield this.raw.text();
331
- });
329
+ async value() {
330
+ return await this.raw.text();
332
331
  }
333
332
  ;
334
333
  }
@@ -1,23 +1,16 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { Centrifuge } from "@chainstream-io/centrifuge";
11
2
  import { replaceFilterFields } from "./stream.fields";
12
3
  export class StreamApi {
4
+ realtimeClient;
5
+ listenersMap;
13
6
  constructor(context) {
14
7
  const realtimeEndpoint = context.streamUrl;
15
8
  this.realtimeClient = new Centrifuge(realtimeEndpoint, {
16
- getToken: (_ctx) => __awaiter(this, void 0, void 0, function* () {
9
+ getToken: async (_ctx) => {
17
10
  return typeof context.accessToken === "string"
18
11
  ? context.accessToken
19
- : yield context.accessToken.getToken();
20
- }),
12
+ : await context.accessToken.getToken();
13
+ },
21
14
  });
22
15
  this.realtimeClient
23
16
  .on("connected", () => {
@@ -88,7 +81,10 @@ export class StreamApi {
88
81
  console.log("[xrealtime] create new sub: ", channel);
89
82
  // Process filter expression with method-specific field mappings
90
83
  const processedFilter = filter && methodName ? replaceFilterFields(filter, methodName) : filter;
91
- sub = this.realtimeClient.newSubscription(channel, Object.assign({ delta: "fossil" }, (processedFilter && { filter: processedFilter })));
84
+ sub = this.realtimeClient.newSubscription(channel, {
85
+ delta: "fossil",
86
+ ...(processedFilter && { filter: processedFilter }),
87
+ });
92
88
  sub
93
89
  .on("subscribed", () => {
94
90
  console.log("[xrealtime] subscribed", channel);
@@ -98,11 +94,11 @@ export class StreamApi {
98
94
  })
99
95
  .on("publication", (ctx) => {
100
96
  // console.log('[xrealtime] publication, ctx.data: ', ctx.data);
101
- listeners === null || listeners === void 0 ? void 0 : listeners.forEach((it) => it(ctx.data));
97
+ listeners?.forEach((it) => it(ctx.data));
102
98
  })
103
99
  .subscribe();
104
100
  }
105
- listeners === null || listeners === void 0 ? void 0 : listeners.add(fn);
101
+ listeners?.add(fn);
106
102
  return new StreamUnsubscrible(this, channel, fn);
107
103
  }
108
104
  unsubscribe(channel, fn) {
@@ -273,45 +269,44 @@ export class StreamApi {
273
269
  imageUrl: it.iu,
274
270
  description: it.de,
275
271
  socialMedia: (() => {
276
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
277
272
  const socialMedia = {};
278
- if ((_a = it.sm) === null || _a === void 0 ? void 0 : _a.tw) {
273
+ if (it.sm?.tw) {
279
274
  socialMedia.twitter = it.sm.tw;
280
275
  }
281
- if ((_b = it.sm) === null || _b === void 0 ? void 0 : _b.tg) {
276
+ if (it.sm?.tg) {
282
277
  socialMedia.telegram = it.sm.tg;
283
278
  }
284
- if ((_c = it.sm) === null || _c === void 0 ? void 0 : _c.w) {
279
+ if (it.sm?.w) {
285
280
  socialMedia.website = it.sm.w;
286
281
  }
287
- if ((_d = it.sm) === null || _d === void 0 ? void 0 : _d.tt) {
282
+ if (it.sm?.tt) {
288
283
  socialMedia.tiktok = it.sm.tt;
289
284
  }
290
- if ((_e = it.sm) === null || _e === void 0 ? void 0 : _e.dc) {
285
+ if (it.sm?.dc) {
291
286
  socialMedia.discord = it.sm.dc;
292
287
  }
293
- if ((_f = it.sm) === null || _f === void 0 ? void 0 : _f.fb) {
288
+ if (it.sm?.fb) {
294
289
  socialMedia.facebook = it.sm.fb;
295
290
  }
296
- if ((_g = it.sm) === null || _g === void 0 ? void 0 : _g.gh) {
291
+ if (it.sm?.gh) {
297
292
  socialMedia.github = it.sm.gh;
298
293
  }
299
- if ((_h = it.sm) === null || _h === void 0 ? void 0 : _h.ig) {
294
+ if (it.sm?.ig) {
300
295
  socialMedia.instagram = it.sm.ig;
301
296
  }
302
- if ((_j = it.sm) === null || _j === void 0 ? void 0 : _j.li) {
297
+ if (it.sm?.li) {
303
298
  socialMedia.linkedin = it.sm.li;
304
299
  }
305
- if ((_k = it.sm) === null || _k === void 0 ? void 0 : _k.md) {
300
+ if (it.sm?.md) {
306
301
  socialMedia.medium = it.sm.md;
307
302
  }
308
- if ((_l = it.sm) === null || _l === void 0 ? void 0 : _l.rd) {
303
+ if (it.sm?.rd) {
309
304
  socialMedia.reddit = it.sm.rd;
310
305
  }
311
- if ((_m = it.sm) === null || _m === void 0 ? void 0 : _m.yt) {
306
+ if (it.sm?.yt) {
312
307
  socialMedia.youtube = it.sm.yt;
313
308
  }
314
- if ((_o = it.sm) === null || _o === void 0 ? void 0 : _o.bb) {
309
+ if (it.sm?.bb) {
315
310
  socialMedia.bitbucket = it.sm.bb;
316
311
  }
317
312
  return socialMedia;
@@ -362,7 +357,7 @@ export class StreamApi {
362
357
  }
363
358
  subscribeRankingTokensLiquidity({ chain, channelType, callback, }) {
364
359
  const channel = `dex-ranking-token-general_stat_num-list:${chain}_${channelType}`;
365
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
360
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
366
361
  tokenAddress: it.a,
367
362
  metricType: it.t,
368
363
  value: it.v,
@@ -373,7 +368,7 @@ export class StreamApi {
373
368
  const channel = dex
374
369
  ? `dex-ranking-list:${chain}_${ranking_type}_${dex}`
375
370
  : `dex-ranking-list:${chain}_${ranking_type}`;
376
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((item) => {
371
+ return this.subscribe(channel, (data) => callback(data?.map((item) => {
377
372
  const result = {};
378
373
  // TokenMetadata (t)
379
374
  if (item.t) {
@@ -728,7 +723,7 @@ export class StreamApi {
728
723
  }
729
724
  subscribeRankingTokensStats({ chain, channelType, callback, }) {
730
725
  const channel = `dex-ranking-token-stats-list:${chain}_${channelType}`;
731
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
726
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
732
727
  address: it.a,
733
728
  timestamp: it.t,
734
729
  buys1m: it.b1m,
@@ -799,7 +794,7 @@ export class StreamApi {
799
794
  }
800
795
  subscribeRankingTokensHolders({ chain, channelType, callback, }) {
801
796
  const channel = `dex-ranking-token-holding-list:${chain}_${channelType}`;
802
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
797
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
803
798
  tokenAddress: it.a,
804
799
  holders: it.h,
805
800
  top100Amount: this.formatScientificNotation(it.t100a),
@@ -813,7 +808,7 @@ export class StreamApi {
813
808
  }
814
809
  subscribeRankingTokensSupply({ chain, channelType, callback, }) {
815
810
  const channel = `dex-ranking-token-supply-list:${chain}_${channelType}`;
816
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
811
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
817
812
  tokenAddress: it.a,
818
813
  supply: it.s,
819
814
  marketCapInUsd: it.mc,
@@ -822,7 +817,7 @@ export class StreamApi {
822
817
  }
823
818
  subscribeRankingTokensBondingCurve({ chain, callback, }) {
824
819
  const channel = `dex-ranking-token-bounding-curve-list:${chain}_new`;
825
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
820
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
826
821
  tokenAddress: it.a,
827
822
  progressRatio: it.pr,
828
823
  }))));
@@ -905,7 +900,7 @@ export class StreamApi {
905
900
  }
906
901
  subscribeWalletPnlList({ chain, walletAddress, callback, }) {
907
902
  const channel = `dex-wallet-pnl-list:${chain}_${walletAddress}`;
908
- return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
903
+ return this.subscribe(channel, (data) => callback(data?.map((it) => ({
909
904
  walletAddress: it.a,
910
905
  buys: it.bs,
911
906
  buyAmount: it.ba,
@@ -979,6 +974,9 @@ export class StreamApi {
979
974
  }
980
975
  }
981
976
  class StreamUnsubscrible {
977
+ streamApi;
978
+ channel;
979
+ fn;
982
980
  constructor(streamApi, channel, fn) {
983
981
  this.streamApi = streamApi;
984
982
  this.channel = channel;