@chainstream-io/sdk 0.1.5 → 0.1.7

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 (147) hide show
  1. package/README.md +46 -0
  2. package/dist/esm/index.d.ts +1 -1
  3. package/dist/esm/index.js +76 -60
  4. package/dist/esm/openapi/apis/BlockchainApi.js +61 -44
  5. package/dist/esm/openapi/apis/DefiSolanaMoonshotApi.js +67 -50
  6. package/dist/esm/openapi/apis/DefiSolanaPumpfunApi.js +38 -25
  7. package/dist/esm/openapi/apis/DexApi.js +205 -176
  8. package/dist/esm/openapi/apis/DexPoolApi.js +41 -28
  9. package/dist/esm/openapi/apis/EndpointApi.js +212 -175
  10. package/dist/esm/openapi/apis/IpfsApi.js +38 -25
  11. package/dist/esm/openapi/apis/JobsApi.js +65 -48
  12. package/dist/esm/openapi/apis/RankingApi.js +278 -249
  13. package/dist/esm/openapi/apis/RedPacketApi.js +294 -253
  14. package/dist/esm/openapi/apis/TokenApi.js +1145 -1056
  15. package/dist/esm/openapi/apis/TradeApi.js +233 -208
  16. package/dist/esm/openapi/apis/TransactionApi.js +42 -29
  17. package/dist/esm/openapi/apis/WalletApi.js +148 -123
  18. package/dist/esm/openapi/apis/WatchlistApi.js +41 -28
  19. package/dist/esm/openapi/runtime.js +81 -69
  20. package/dist/esm/stream/index.d.ts +3 -0
  21. package/dist/esm/stream/index.js +3 -0
  22. package/dist/esm/{api → stream}/stream.js +36 -29
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +75 -59
  25. package/dist/openapi/apis/BlockchainApi.js +62 -78
  26. package/dist/openapi/apis/DefiSolanaMoonshotApi.js +68 -84
  27. package/dist/openapi/apis/DefiSolanaPumpfunApi.js +39 -59
  28. package/dist/openapi/apis/DexApi.js +206 -210
  29. package/dist/openapi/apis/DexPoolApi.js +42 -62
  30. package/dist/openapi/apis/EndpointApi.js +213 -209
  31. package/dist/openapi/apis/IpfsApi.js +39 -59
  32. package/dist/openapi/apis/JobsApi.js +66 -82
  33. package/dist/openapi/apis/RankingApi.js +279 -283
  34. package/dist/openapi/apis/RedPacketApi.js +295 -287
  35. package/dist/openapi/apis/TokenApi.js +1146 -1090
  36. package/dist/openapi/apis/TradeApi.js +234 -242
  37. package/dist/openapi/apis/TransactionApi.js +43 -63
  38. package/dist/openapi/apis/WalletApi.js +149 -157
  39. package/dist/openapi/apis/WatchlistApi.js +42 -62
  40. package/dist/openapi/runtime.js +81 -69
  41. package/dist/stream/index.d.ts +3 -0
  42. package/dist/stream/index.js +19 -0
  43. package/dist/{api → stream}/stream.js +36 -29
  44. package/package.json +29 -26
  45. package/src/api/stream.fields.ts +0 -271
  46. package/src/api/stream.model.ts +0 -307
  47. package/src/api/stream.ts +0 -1086
  48. package/src/index.ts +0 -188
  49. package/src/openapi/apis/BlockchainApi.ts +0 -140
  50. package/src/openapi/apis/DefiSolanaMoonshotApi.ts +0 -145
  51. package/src/openapi/apis/DefiSolanaPumpfunApi.ts +0 -86
  52. package/src/openapi/apis/DexApi.ts +0 -490
  53. package/src/openapi/apis/DexPoolApi.ts +0 -107
  54. package/src/openapi/apis/EndpointApi.ts +0 -421
  55. package/src/openapi/apis/IpfsApi.ts +0 -66
  56. package/src/openapi/apis/JobsApi.ts +0 -135
  57. package/src/openapi/apis/RankingApi.ts +0 -939
  58. package/src/openapi/apis/RedPacketApi.ts +0 -621
  59. package/src/openapi/apis/TokenApi.ts +0 -2569
  60. package/src/openapi/apis/TradeApi.ts +0 -596
  61. package/src/openapi/apis/TransactionApi.ts +0 -95
  62. package/src/openapi/apis/WalletApi.ts +0 -365
  63. package/src/openapi/apis/WatchlistApi.ts +0 -107
  64. package/src/openapi/apis/index.ts +0 -17
  65. package/src/openapi/index.ts +0 -5
  66. package/src/openapi/models/BlockchainDTO.ts +0 -93
  67. package/src/openapi/models/BlockchainLatestBlockDTO.ts +0 -75
  68. package/src/openapi/models/BooleanResultDTO.ts +0 -66
  69. package/src/openapi/models/CalculatePnlInput.ts +0 -65
  70. package/src/openapi/models/Candle.ts +0 -130
  71. package/src/openapi/models/ClaimRedPacketInput.ts +0 -90
  72. package/src/openapi/models/CreateEndpointInput.ts +0 -121
  73. package/src/openapi/models/CreateRedPacketInput.ts +0 -124
  74. package/src/openapi/models/CreateRedPacketReply.ts +0 -75
  75. package/src/openapi/models/CreateTokenInput.ts +0 -139
  76. package/src/openapi/models/CreateTokenReply.ts +0 -75
  77. package/src/openapi/models/DexDTO.ts +0 -90
  78. package/src/openapi/models/DexPage.ts +0 -114
  79. package/src/openapi/models/DexPoolDTO.ts +0 -141
  80. package/src/openapi/models/EndpointListResponse.ts +0 -97
  81. package/src/openapi/models/EndpointOperationResponse.ts +0 -65
  82. package/src/openapi/models/EndpointResponse.ts +0 -145
  83. package/src/openapi/models/EndpointSecretResponse.ts +0 -65
  84. package/src/openapi/models/FilterCondition.ts +0 -135
  85. package/src/openapi/models/GainersAndLosersDTO.ts +0 -93
  86. package/src/openapi/models/GainersAndLosersPage.ts +0 -114
  87. package/src/openapi/models/JobDTO.ts +0 -75
  88. package/src/openapi/models/JobStreamingDTO.ts +0 -75
  89. package/src/openapi/models/Link.ts +0 -88
  90. package/src/openapi/models/MoonshotCreateTokenInput.ts +0 -182
  91. package/src/openapi/models/MoonshotCreateTokenReply.ts +0 -75
  92. package/src/openapi/models/MoonshotSubmitCreateToken200Response.ts +0 -73
  93. package/src/openapi/models/MoonshotSubmitCreateTokenInput.ts +0 -74
  94. package/src/openapi/models/PumpCreateTokenInput.ts +0 -180
  95. package/src/openapi/models/PumpCreateTokenReply.ts +0 -74
  96. package/src/openapi/models/QuoteResponse.ts +0 -105
  97. package/src/openapi/models/RedPacketClaimDTO.ts +0 -148
  98. package/src/openapi/models/RedPacketClaimsPage.ts +0 -110
  99. package/src/openapi/models/RedPacketDTO.ts +0 -229
  100. package/src/openapi/models/RedPacketReply.ts +0 -66
  101. package/src/openapi/models/RedPacketSendTxInput.ts +0 -66
  102. package/src/openapi/models/RedPacketSendTxResponse.ts +0 -66
  103. package/src/openapi/models/RedPacketsPage.ts +0 -110
  104. package/src/openapi/models/Resolution.ts +0 -61
  105. package/src/openapi/models/SendTxInput.ts +0 -93
  106. package/src/openapi/models/SendTxResponse.ts +0 -84
  107. package/src/openapi/models/SwapInput.ts +0 -157
  108. package/src/openapi/models/SwapReply.ts +0 -75
  109. package/src/openapi/models/SwapRouteInput.ts +0 -186
  110. package/src/openapi/models/SwapRouteResponse.ts +0 -101
  111. package/src/openapi/models/Token.ts +0 -251
  112. package/src/openapi/models/TokenCreationDTO.ts +0 -131
  113. package/src/openapi/models/TokenCreationPage.ts +0 -114
  114. package/src/openapi/models/TokenCreatorsDTO.ts +0 -81
  115. package/src/openapi/models/TokenExtraDTO.ts +0 -225
  116. package/src/openapi/models/TokenHolder.ts +0 -93
  117. package/src/openapi/models/TokenHolderPage.ts +0 -114
  118. package/src/openapi/models/TokenListPage.ts +0 -114
  119. package/src/openapi/models/TokenMarketData.ts +0 -190
  120. package/src/openapi/models/TokenMetadata.ts +0 -188
  121. package/src/openapi/models/TokenPage.ts +0 -122
  122. package/src/openapi/models/TokenPriceDTO.ts +0 -93
  123. package/src/openapi/models/TokenPricePage.ts +0 -114
  124. package/src/openapi/models/TokenSocialMediasDTO.ts +0 -161
  125. package/src/openapi/models/TokenStat.ts +0 -1152
  126. package/src/openapi/models/TopTradersDTO.ts +0 -164
  127. package/src/openapi/models/TopTradersPage.ts +0 -114
  128. package/src/openapi/models/TradeDetailDTO.ts +0 -282
  129. package/src/openapi/models/TradeEvent.ts +0 -184
  130. package/src/openapi/models/TradePage.ts +0 -114
  131. package/src/openapi/models/TradeType.ts +0 -53
  132. package/src/openapi/models/UpdateEndpointInput.ts +0 -129
  133. package/src/openapi/models/WalletBalanceDetailDTO.ts +0 -282
  134. package/src/openapi/models/WalletBalancesDTO.ts +0 -92
  135. package/src/openapi/models/WalletPnlDTO.ts +0 -264
  136. package/src/openapi/models/index.ts +0 -72
  137. package/src/openapi/runtime.ts +0 -432
  138. /package/dist/{api → esm/stream}/stream.d.ts +0 -0
  139. /package/dist/{api → esm/stream}/stream.fields.d.ts +0 -0
  140. /package/dist/esm/{api → stream}/stream.fields.js +0 -0
  141. /package/dist/{api → esm/stream}/stream.model.d.ts +0 -0
  142. /package/dist/esm/{api → stream}/stream.model.js +0 -0
  143. /package/dist/{esm/api → stream}/stream.d.ts +0 -0
  144. /package/dist/{esm/api → stream}/stream.fields.d.ts +0 -0
  145. /package/dist/{api → stream}/stream.fields.js +0 -0
  146. /package/dist/{esm/api → stream}/stream.model.d.ts +0 -0
  147. /package/dist/{api → stream}/stream.model.js +0 -0
@@ -12,6 +12,15 @@
12
12
  * https://openapi-generator.tech
13
13
  * Do not edit the class manually.
14
14
  */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
15
24
  Object.defineProperty(exports, "__esModule", { value: true });
16
25
  exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
17
26
  exports.querystring = querystring;
@@ -54,7 +63,7 @@ class Configuration {
54
63
  get accessToken() {
55
64
  const accessToken = this.configuration.accessToken;
56
65
  if (accessToken) {
57
- return typeof accessToken === 'function' ? accessToken : async () => accessToken;
66
+ return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
58
67
  }
59
68
  return undefined;
60
69
  }
@@ -73,30 +82,27 @@ exports.DefaultConfig = new Configuration();
73
82
  class BaseAPI {
74
83
  constructor(configuration = exports.DefaultConfig) {
75
84
  this.configuration = configuration;
76
- this.fetchApi = async (url, init) => {
85
+ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
77
86
  let fetchParams = { url, init };
78
87
  for (const middleware of this.middleware) {
79
88
  if (middleware.pre) {
80
- fetchParams = await middleware.pre({
81
- fetch: this.fetchApi,
82
- ...fetchParams,
83
- }) || fetchParams;
89
+ fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
84
90
  }
85
91
  }
86
92
  let response = undefined;
87
93
  try {
88
- response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
94
+ response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
89
95
  }
90
96
  catch (e) {
91
97
  for (const middleware of this.middleware) {
92
98
  if (middleware.onError) {
93
- response = await middleware.onError({
99
+ response = (yield middleware.onError({
94
100
  fetch: this.fetchApi,
95
101
  url: fetchParams.url,
96
102
  init: fetchParams.init,
97
103
  error: e,
98
104
  response: response ? response.clone() : undefined,
99
- }) || response;
105
+ })) || response;
100
106
  }
101
107
  }
102
108
  if (response === undefined) {
@@ -110,16 +116,16 @@ class BaseAPI {
110
116
  }
111
117
  for (const middleware of this.middleware) {
112
118
  if (middleware.post) {
113
- response = await middleware.post({
119
+ response = (yield middleware.post({
114
120
  fetch: this.fetchApi,
115
121
  url: fetchParams.url,
116
122
  init: fetchParams.init,
117
123
  response: response.clone(),
118
- }) || response;
124
+ })) || response;
119
125
  }
120
126
  }
121
127
  return response;
122
- };
128
+ });
123
129
  this.middleware = configuration.middleware;
124
130
  }
125
131
  withMiddleware(...middlewares) {
@@ -151,57 +157,55 @@ class BaseAPI {
151
157
  }
152
158
  return BaseAPI.jsonRegex.test(mime);
153
159
  }
154
- async request(context, initOverrides) {
155
- const { url, init } = await this.createFetchParams(context, initOverrides);
156
- const response = await this.fetchApi(url, init);
157
- if (response && (response.status >= 200 && response.status < 300)) {
158
- return response;
159
- }
160
- throw new ResponseError(response, 'Response returned an error code');
161
- }
162
- async createFetchParams(context, initOverrides) {
163
- let url = this.configuration.basePath + context.path;
164
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
165
- // only add the querystring to the URL if there are query parameters.
166
- // this is done to avoid urls ending with a "?" character which buggy webservers
167
- // do not handle correctly sometimes.
168
- url += '?' + this.configuration.queryParamsStringify(context.query);
169
- }
170
- const headers = Object.assign({}, this.configuration.headers, context.headers);
171
- Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
172
- const initOverrideFn = typeof initOverrides === "function"
173
- ? initOverrides
174
- : async () => initOverrides;
175
- const initParams = {
176
- method: context.method,
177
- headers,
178
- body: context.body,
179
- credentials: this.configuration.credentials,
180
- };
181
- const overriddenInit = {
182
- ...initParams,
183
- ...(await initOverrideFn({
160
+ request(context, initOverrides) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const { url, init } = yield this.createFetchParams(context, initOverrides);
163
+ const response = yield this.fetchApi(url, init);
164
+ if (response && (response.status >= 200 && response.status < 300)) {
165
+ return response;
166
+ }
167
+ throw new ResponseError(response, 'Response returned an error code');
168
+ });
169
+ }
170
+ createFetchParams(context, initOverrides) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ let url = this.configuration.basePath + context.path;
173
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
174
+ // only add the querystring to the URL if there are query parameters.
175
+ // this is done to avoid urls ending with a "?" character which buggy webservers
176
+ // do not handle correctly sometimes.
177
+ url += '?' + this.configuration.queryParamsStringify(context.query);
178
+ }
179
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
180
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
181
+ const initOverrideFn = typeof initOverrides === "function"
182
+ ? initOverrides
183
+ : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
184
+ const initParams = {
185
+ method: context.method,
186
+ headers,
187
+ body: context.body,
188
+ credentials: this.configuration.credentials,
189
+ };
190
+ const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
184
191
  init: initParams,
185
192
  context,
186
- }))
187
- };
188
- let body;
189
- if (isFormData(overriddenInit.body)
190
- || (overriddenInit.body instanceof URLSearchParams)
191
- || isBlob(overriddenInit.body)) {
192
- body = overriddenInit.body;
193
- }
194
- else if (this.isJsonMime(headers['Content-Type'])) {
195
- body = JSON.stringify(overriddenInit.body);
196
- }
197
- else {
198
- body = overriddenInit.body;
199
- }
200
- const init = {
201
- ...overriddenInit,
202
- body
203
- };
204
- return { url, init };
193
+ })));
194
+ let body;
195
+ if (isFormData(overriddenInit.body)
196
+ || (overriddenInit.body instanceof URLSearchParams)
197
+ || isBlob(overriddenInit.body)) {
198
+ body = overriddenInit.body;
199
+ }
200
+ else if (this.isJsonMime(headers['Content-Type'])) {
201
+ body = JSON.stringify(overriddenInit.body);
202
+ }
203
+ else {
204
+ body = overriddenInit.body;
205
+ }
206
+ const init = Object.assign(Object.assign({}, overriddenInit), { body });
207
+ return { url, init };
208
+ });
205
209
  }
206
210
  /**
207
211
  * Create a shallow clone of `this` by constructing a new instance
@@ -302,8 +306,10 @@ class JSONApiResponse {
302
306
  this.raw = raw;
303
307
  this.transformer = transformer;
304
308
  }
305
- async value() {
306
- return this.transformer(await this.raw.json());
309
+ value() {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ return this.transformer(yield this.raw.json());
312
+ });
307
313
  }
308
314
  }
309
315
  exports.JSONApiResponse = JSONApiResponse;
@@ -311,8 +317,10 @@ class VoidApiResponse {
311
317
  constructor(raw) {
312
318
  this.raw = raw;
313
319
  }
314
- async value() {
315
- return undefined;
320
+ value() {
321
+ return __awaiter(this, void 0, void 0, function* () {
322
+ return undefined;
323
+ });
316
324
  }
317
325
  }
318
326
  exports.VoidApiResponse = VoidApiResponse;
@@ -320,8 +328,10 @@ class BlobApiResponse {
320
328
  constructor(raw) {
321
329
  this.raw = raw;
322
330
  }
323
- async value() {
324
- return await this.raw.blob();
331
+ value() {
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ return yield this.raw.blob();
334
+ });
325
335
  }
326
336
  ;
327
337
  }
@@ -330,8 +340,10 @@ class TextApiResponse {
330
340
  constructor(raw) {
331
341
  this.raw = raw;
332
342
  }
333
- async value() {
334
- return await this.raw.text();
343
+ value() {
344
+ return __awaiter(this, void 0, void 0, function* () {
345
+ return yield this.raw.text();
346
+ });
335
347
  }
336
348
  ;
337
349
  }
@@ -0,0 +1,3 @@
1
+ export * from './stream';
2
+ export * from './stream.fields';
3
+ export * from './stream.model';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./stream"), exports);
18
+ __exportStar(require("./stream.fields"), exports);
19
+ __exportStar(require("./stream.model"), exports);
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.StreamApi = void 0;
4
13
  const centrifuge_1 = require("@chainstream-io/centrifuge");
@@ -7,11 +16,11 @@ class StreamApi {
7
16
  constructor(context) {
8
17
  const realtimeEndpoint = context.streamUrl;
9
18
  this.realtimeClient = new centrifuge_1.Centrifuge(realtimeEndpoint, {
10
- getToken: async (_ctx) => {
19
+ getToken: (_ctx) => __awaiter(this, void 0, void 0, function* () {
11
20
  return typeof context.accessToken === "string"
12
21
  ? context.accessToken
13
- : await context.accessToken.getToken();
14
- },
22
+ : yield context.accessToken.getToken();
23
+ }),
15
24
  });
16
25
  this.realtimeClient
17
26
  .on("connected", () => {
@@ -82,10 +91,7 @@ class StreamApi {
82
91
  console.log("[xrealtime] create new sub: ", channel);
83
92
  // Process filter expression with method-specific field mappings
84
93
  const processedFilter = filter && methodName ? (0, stream_fields_1.replaceFilterFields)(filter, methodName) : filter;
85
- sub = this.realtimeClient.newSubscription(channel, {
86
- delta: "fossil",
87
- ...(processedFilter && { filter: processedFilter }),
88
- });
94
+ sub = this.realtimeClient.newSubscription(channel, Object.assign({ delta: "fossil" }, (processedFilter && { filter: processedFilter })));
89
95
  sub
90
96
  .on("subscribed", () => {
91
97
  console.log("[xrealtime] subscribed", channel);
@@ -95,11 +101,11 @@ class StreamApi {
95
101
  })
96
102
  .on("publication", (ctx) => {
97
103
  // console.log('[xrealtime] publication, ctx.data: ', ctx.data);
98
- listeners?.forEach((it) => it(ctx.data));
104
+ listeners === null || listeners === void 0 ? void 0 : listeners.forEach((it) => it(ctx.data));
99
105
  })
100
106
  .subscribe();
101
107
  }
102
- listeners?.add(fn);
108
+ listeners === null || listeners === void 0 ? void 0 : listeners.add(fn);
103
109
  return new StreamUnsubscrible(this, channel, fn);
104
110
  }
105
111
  unsubscribe(channel, fn) {
@@ -270,44 +276,45 @@ class StreamApi {
270
276
  imageUrl: it.iu,
271
277
  description: it.de,
272
278
  socialMedia: (() => {
279
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
273
280
  const socialMedia = {};
274
- if (it.sm?.tw) {
281
+ if ((_a = it.sm) === null || _a === void 0 ? void 0 : _a.tw) {
275
282
  socialMedia.twitter = it.sm.tw;
276
283
  }
277
- if (it.sm?.tg) {
284
+ if ((_b = it.sm) === null || _b === void 0 ? void 0 : _b.tg) {
278
285
  socialMedia.telegram = it.sm.tg;
279
286
  }
280
- if (it.sm?.w) {
287
+ if ((_c = it.sm) === null || _c === void 0 ? void 0 : _c.w) {
281
288
  socialMedia.website = it.sm.w;
282
289
  }
283
- if (it.sm?.tt) {
290
+ if ((_d = it.sm) === null || _d === void 0 ? void 0 : _d.tt) {
284
291
  socialMedia.tiktok = it.sm.tt;
285
292
  }
286
- if (it.sm?.dc) {
293
+ if ((_e = it.sm) === null || _e === void 0 ? void 0 : _e.dc) {
287
294
  socialMedia.discord = it.sm.dc;
288
295
  }
289
- if (it.sm?.fb) {
296
+ if ((_f = it.sm) === null || _f === void 0 ? void 0 : _f.fb) {
290
297
  socialMedia.facebook = it.sm.fb;
291
298
  }
292
- if (it.sm?.gh) {
299
+ if ((_g = it.sm) === null || _g === void 0 ? void 0 : _g.gh) {
293
300
  socialMedia.github = it.sm.gh;
294
301
  }
295
- if (it.sm?.ig) {
302
+ if ((_h = it.sm) === null || _h === void 0 ? void 0 : _h.ig) {
296
303
  socialMedia.instagram = it.sm.ig;
297
304
  }
298
- if (it.sm?.li) {
305
+ if ((_j = it.sm) === null || _j === void 0 ? void 0 : _j.li) {
299
306
  socialMedia.linkedin = it.sm.li;
300
307
  }
301
- if (it.sm?.md) {
308
+ if ((_k = it.sm) === null || _k === void 0 ? void 0 : _k.md) {
302
309
  socialMedia.medium = it.sm.md;
303
310
  }
304
- if (it.sm?.rd) {
311
+ if ((_l = it.sm) === null || _l === void 0 ? void 0 : _l.rd) {
305
312
  socialMedia.reddit = it.sm.rd;
306
313
  }
307
- if (it.sm?.yt) {
314
+ if ((_m = it.sm) === null || _m === void 0 ? void 0 : _m.yt) {
308
315
  socialMedia.youtube = it.sm.yt;
309
316
  }
310
- if (it.sm?.bb) {
317
+ if ((_o = it.sm) === null || _o === void 0 ? void 0 : _o.bb) {
311
318
  socialMedia.bitbucket = it.sm.bb;
312
319
  }
313
320
  return socialMedia;
@@ -358,7 +365,7 @@ class StreamApi {
358
365
  }
359
366
  subscribeRankingTokensLiquidity({ chain, channelType, callback, }) {
360
367
  const channel = `dex-ranking-token-general_stat_num-list:${chain}_${channelType}`;
361
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
368
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
362
369
  tokenAddress: it.a,
363
370
  metricType: it.t,
364
371
  value: it.v,
@@ -369,7 +376,7 @@ class StreamApi {
369
376
  const channel = dex
370
377
  ? `dex-ranking-list:${chain}_${ranking_type}_${dex}`
371
378
  : `dex-ranking-list:${chain}_${ranking_type}`;
372
- return this.subscribe(channel, (data) => callback(data?.map((item) => {
379
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((item) => {
373
380
  const result = {};
374
381
  // TokenMetadata (t)
375
382
  if (item.t) {
@@ -724,7 +731,7 @@ class StreamApi {
724
731
  }
725
732
  subscribeRankingTokensStats({ chain, channelType, callback, }) {
726
733
  const channel = `dex-ranking-token-stats-list:${chain}_${channelType}`;
727
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
734
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
728
735
  address: it.a,
729
736
  timestamp: it.t,
730
737
  buys1m: it.b1m,
@@ -795,7 +802,7 @@ class StreamApi {
795
802
  }
796
803
  subscribeRankingTokensHolders({ chain, channelType, callback, }) {
797
804
  const channel = `dex-ranking-token-holding-list:${chain}_${channelType}`;
798
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
805
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
799
806
  tokenAddress: it.a,
800
807
  holders: it.h,
801
808
  top100Amount: this.formatScientificNotation(it.t100a),
@@ -809,7 +816,7 @@ class StreamApi {
809
816
  }
810
817
  subscribeRankingTokensSupply({ chain, channelType, callback, }) {
811
818
  const channel = `dex-ranking-token-supply-list:${chain}_${channelType}`;
812
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
819
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
813
820
  tokenAddress: it.a,
814
821
  supply: it.s,
815
822
  marketCapInUsd: it.mc,
@@ -818,7 +825,7 @@ class StreamApi {
818
825
  }
819
826
  subscribeRankingTokensBondingCurve({ chain, callback, }) {
820
827
  const channel = `dex-ranking-token-bounding-curve-list:${chain}_new`;
821
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
828
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
822
829
  tokenAddress: it.a,
823
830
  progressRatio: it.pr,
824
831
  }))));
@@ -901,7 +908,7 @@ class StreamApi {
901
908
  }
902
909
  subscribeWalletPnlList({ chain, walletAddress, callback, }) {
903
910
  const channel = `dex-wallet-pnl-list:${chain}_${walletAddress}`;
904
- return this.subscribe(channel, (data) => callback(data?.map((it) => ({
911
+ return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
905
912
  walletAddress: it.a,
906
913
  buys: it.bs,
907
914
  buyAmount: it.ba,
package/package.json CHANGED
@@ -1,7 +1,20 @@
1
1
  {
2
2
  "name": "@chainstream-io/sdk",
3
- "version": "0.1.5",
4
- "description": "Dex API client and webhook verification library",
3
+ "version": "0.1.7",
4
+ "description": "API and Stream client for ChainStream",
5
+ "author": "ChainStream",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/chainstream-io/openapi-sdk-generator.git"
9
+ },
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "chainstream",
13
+ "websocket",
14
+ "dex",
15
+ "defi",
16
+ "blockchain"
17
+ ],
5
18
  "main": "./dist/index.js",
6
19
  "types": "./dist/index.d.ts",
7
20
  "module": "./dist/esm/index.js",
@@ -10,14 +23,24 @@
10
23
  "import": "./dist/esm/index.js",
11
24
  "require": "./dist/index.js",
12
25
  "types": "./dist/index.d.ts"
26
+ },
27
+ "openapi": {
28
+ "import": "./dist/esm/openapi/index.js",
29
+ "require": "./dist/openapi/index.js",
30
+ "types": "./dist/openapi/index.d.ts"
31
+ },
32
+ "stream": {
33
+ "import": "./dist/esm/stream/index.js",
34
+ "require": "./dist/stream/index.js",
35
+ "types": "./dist/stream/index.d.ts"
13
36
  }
14
37
  },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "sideEffects": false,
15
42
  "scripts": {
16
43
  "build": "tsc && tsc -p tsconfig.esm.json",
17
- "test": "jest",
18
- "test:watch": "jest --watch",
19
- "test:coverage": "jest --coverage",
20
- "test:specific": "jest --testNamePattern",
21
44
  "prepare": "yarn build"
22
45
  },
23
46
  "dependencies": {
@@ -26,28 +49,8 @@
26
49
  },
27
50
  "devDependencies": {
28
51
  "@types/event-source-polyfill": "^1.0.5",
29
- "@types/jest": "^29.0.0",
30
- "@types/node": "^20.0.0",
31
- "jest": "^29.0.0",
32
- "ts-jest": "^29.0.0",
33
- "tsx": "^4.0.0",
34
52
  "typescript": "^5.0.0"
35
53
  },
36
- "author": "Chainstream",
37
- "license": "MIT",
38
- "keywords": [
39
- "chainstream",
40
- "api",
41
- "sdk",
42
- "websocket",
43
- "dex",
44
- "defi",
45
- "blockchain"
46
- ],
47
- "files": [
48
- "src",
49
- "dist/**/*"
50
- ],
51
54
  "publishConfig": {
52
55
  "access": "public"
53
56
  }