@chainstream-io/sdk 0.0.2 → 0.0.4
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.
- package/dist/api/stream.d.ts +44 -43
- package/dist/api/stream.js +206 -196
- package/dist/api/stream.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/openapi/apis/DexPoolApi.d.ts +0 -2
- package/dist/openapi/apis/DexPoolApi.js +0 -47
- package/dist/openapi/apis/DexPoolApi.js.map +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js.map +1 -1
- package/dist/openapi/models/ObjectSerializer.d.ts +3 -1
- package/dist/openapi/models/ObjectSerializer.js +9 -3
- package/dist/openapi/models/ObjectSerializer.js.map +1 -1
- package/dist/openapi/models/RankingToken.d.ts +2 -0
- package/dist/openapi/models/RankingToken.js +6 -0
- package/dist/openapi/models/RankingToken.js.map +1 -1
- package/dist/openapi/models/RankingTokenStat.d.ts +10 -0
- package/dist/openapi/models/RankingTokenStat.js +60 -0
- package/dist/openapi/models/RankingTokenStat.js.map +1 -1
- package/dist/openapi/models/Token.d.ts +6 -4
- package/dist/openapi/models/Token.js +5 -5
- package/dist/openapi/models/Token.js.map +1 -1
- package/dist/openapi/models/TokenCreatorsDTO.d.ts +22 -0
- package/dist/openapi/models/TokenCreatorsDTO.js +34 -0
- package/dist/openapi/models/TokenCreatorsDTO.js.map +1 -0
- package/dist/openapi/models/TokenExtraDTO.d.ts +35 -0
- package/dist/openapi/models/TokenExtraDTO.js +112 -0
- package/dist/openapi/models/TokenExtraDTO.js.map +1 -0
- package/dist/openapi/models/TokenMarketData.d.ts +2 -2
- package/dist/openapi/models/TokenMarketData.js +4 -4
- package/dist/openapi/models/TokenMarketData.js.map +1 -1
- package/dist/openapi/models/TokenMetadata.d.ts +6 -4
- package/dist/openapi/models/TokenMetadata.js +5 -5
- package/dist/openapi/models/TokenMetadata.js.map +1 -1
- package/dist/openapi/models/TokenSocialMediasDTO.d.ts +32 -0
- package/dist/openapi/models/TokenSocialMediasDTO.js +94 -0
- package/dist/openapi/models/TokenSocialMediasDTO.js.map +1 -0
- package/dist/openapi/models/all.d.ts +3 -1
- package/dist/openapi/models/all.js +3 -1
- package/dist/openapi/models/all.js.map +1 -1
- package/dist/openapi/types/ObjectParamAPI.d.ts +0 -7
- package/dist/openapi/types/ObjectParamAPI.js +0 -6
- package/dist/openapi/types/ObjectParamAPI.js.map +1 -1
- package/dist/openapi/types/ObservableAPI.d.ts +0 -2
- package/dist/openapi/types/ObservableAPI.js +0 -18
- package/dist/openapi/types/ObservableAPI.js.map +1 -1
- package/dist/openapi/types/PromiseAPI.d.ts +0 -2
- package/dist/openapi/types/PromiseAPI.js +0 -8
- package/dist/openapi/types/PromiseAPI.js.map +1 -1
- package/package.json +1 -1
- package/src/api/stream.ts +441 -422
- package/src/index.ts +7 -1
- package/src/openapi/.openapi-generator/FILES +3 -1
- package/src/openapi/apis/DexPoolApi.ts +0 -85
- package/src/openapi/index.ts +1 -1
- package/src/openapi/models/ObjectSerializer.ts +9 -3
- package/src/openapi/models/RankingToken.ts +11 -0
- package/src/openapi/models/RankingTokenStat.ts +100 -0
- package/src/openapi/models/Token.ts +11 -9
- package/src/openapi/models/TokenCreatorsDTO.ts +59 -0
- package/src/openapi/models/{TokenExtraJsonDTO.ts → TokenExtraDTO.ts} +2 -2
- package/src/openapi/models/TokenMarketData.ts +6 -6
- package/src/openapi/models/TokenMetadata.ts +11 -9
- package/src/openapi/models/TokenSocialMediasDTO.ts +159 -0
- package/src/openapi/models/all.ts +3 -1
- package/src/openapi/types/ObjectParamAPI.ts +3 -43
- package/src/openapi/types/ObservableAPI.ts +3 -38
- package/src/openapi/types/PromiseAPI.ts +3 -25
package/dist/api/stream.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class StreamApi {
|
|
|
12
12
|
startBatching(): void;
|
|
13
13
|
stopBatching(): void;
|
|
14
14
|
batchSubscribe(batchFunction: () => Unsubscrible[]): Unsubscrible[];
|
|
15
|
+
batchUnsubscribe(unsubscribles: Unsubscrible[]): void;
|
|
15
16
|
subscribe<T = any>(channel: string, fn: (data: T) => void, filter?: string, methodName?: string): Unsubscrible;
|
|
16
17
|
unsubscribe<T = any>(channel: string, fn: (data: T) => void): void;
|
|
17
18
|
private formatScientificNotation;
|
|
@@ -28,86 +29,81 @@ export declare class StreamApi {
|
|
|
28
29
|
callback: (data: TokenStat) => void;
|
|
29
30
|
filter?: string;
|
|
30
31
|
}): Unsubscrible;
|
|
31
|
-
subscribeRankingTokensStats({ chain, channelType, callback, }: {
|
|
32
|
-
chain: string;
|
|
33
|
-
channelType: ChannelType;
|
|
34
|
-
callback: (data: TokenStat[]) => void;
|
|
35
|
-
}): Unsubscrible;
|
|
36
32
|
subscribeTokenHolders({ chain, tokenAddress, callback, filter, }: {
|
|
37
33
|
chain: string;
|
|
38
34
|
tokenAddress: string;
|
|
39
35
|
callback: (data: TokenHolder) => void;
|
|
40
36
|
filter?: string;
|
|
41
37
|
}): Unsubscrible;
|
|
42
|
-
|
|
38
|
+
subscribeNewToken({ chain, callback, filter, }: {
|
|
43
39
|
chain: string;
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
callback: (data: NewToken) => void;
|
|
41
|
+
filter?: string;
|
|
46
42
|
}): Unsubscrible;
|
|
47
|
-
|
|
43
|
+
subscribeNewTokensMetadata({ chain, callback, }: {
|
|
48
44
|
chain: string;
|
|
49
|
-
|
|
50
|
-
callback: (data: TradeActivity) => void;
|
|
51
|
-
filter?: string;
|
|
45
|
+
callback: (data: TokenMetadata[]) => void;
|
|
52
46
|
}): Unsubscrible;
|
|
53
|
-
|
|
47
|
+
subscribeTokenSupply({ chain, tokenAddress, callback, filter, }: {
|
|
54
48
|
chain: string;
|
|
55
|
-
|
|
56
|
-
callback: (data:
|
|
49
|
+
tokenAddress: string;
|
|
50
|
+
callback: (data: TokenSupply) => void;
|
|
57
51
|
filter?: string;
|
|
58
52
|
}): Unsubscrible;
|
|
59
|
-
|
|
53
|
+
subscribeTokenLiquidity({ chain, tokenAddress, callback, filter, }: {
|
|
60
54
|
chain: string;
|
|
61
|
-
|
|
62
|
-
callback: (data:
|
|
55
|
+
tokenAddress: string;
|
|
56
|
+
callback: (data: TokenLiquidity) => void;
|
|
63
57
|
filter?: string;
|
|
64
58
|
}): Unsubscrible;
|
|
65
|
-
|
|
59
|
+
subscribeRankingTokensLiquidity({ chain, channelType, callback, }: {
|
|
66
60
|
chain: string;
|
|
67
|
-
|
|
68
|
-
callback: (data:
|
|
61
|
+
channelType: ChannelType;
|
|
62
|
+
callback: (data: TokenLiquidity[]) => void;
|
|
69
63
|
}): Unsubscrible;
|
|
70
|
-
|
|
64
|
+
subscribeRankingTokensList({ chain, ranking_type, dex, callback, }: {
|
|
71
65
|
chain: string;
|
|
72
|
-
|
|
66
|
+
ranking_type: RankingType;
|
|
67
|
+
dex?: Dex;
|
|
68
|
+
callback: (data: RankingTokenList[]) => void;
|
|
73
69
|
}): Unsubscrible;
|
|
74
|
-
|
|
70
|
+
subscribeRankingTokensStats({ chain, channelType, callback, }: {
|
|
75
71
|
chain: string;
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
channelType: ChannelType;
|
|
73
|
+
callback: (data: TokenStat[]) => void;
|
|
78
74
|
}): Unsubscrible;
|
|
79
|
-
|
|
75
|
+
subscribeRankingTokensHolders({ chain, channelType, callback, }: {
|
|
80
76
|
chain: string;
|
|
81
|
-
|
|
82
|
-
callback: (data:
|
|
83
|
-
filter?: string;
|
|
77
|
+
channelType: ChannelType;
|
|
78
|
+
callback: (data: TokenHolder[]) => void;
|
|
84
79
|
}): Unsubscrible;
|
|
85
80
|
subscribeRankingTokensSupply({ chain, channelType, callback, }: {
|
|
86
81
|
chain: string;
|
|
87
82
|
channelType: ChannelType;
|
|
88
83
|
callback: (data: TokenSupply[]) => void;
|
|
89
84
|
}): Unsubscrible;
|
|
90
|
-
|
|
85
|
+
subscribeWalletBalance({ chain, walletAddress, callback, filter, }: {
|
|
91
86
|
chain: string;
|
|
92
|
-
|
|
93
|
-
callback: (data:
|
|
87
|
+
walletAddress: string;
|
|
88
|
+
callback: (data: WalletBalance[]) => void;
|
|
89
|
+
filter?: string;
|
|
94
90
|
}): Unsubscrible;
|
|
95
|
-
|
|
91
|
+
subscribeWalletPnl({ chain, walletAddress, callback, filter, }: {
|
|
96
92
|
chain: string;
|
|
97
|
-
|
|
98
|
-
callback: (data:
|
|
93
|
+
walletAddress: string;
|
|
94
|
+
callback: (data: WalletTokenPnl) => void;
|
|
99
95
|
filter?: string;
|
|
100
96
|
}): Unsubscrible;
|
|
101
|
-
|
|
97
|
+
subscribeWalletPnlList({ chain, walletAddress, callback, }: {
|
|
102
98
|
chain: string;
|
|
103
|
-
|
|
104
|
-
callback: (data:
|
|
99
|
+
walletAddress: string;
|
|
100
|
+
callback: (data: WalletPnl[]) => void;
|
|
105
101
|
}): Unsubscrible;
|
|
106
|
-
|
|
102
|
+
subscribeTokenTrade({ chain, tokenAddress, callback, filter, }: {
|
|
107
103
|
chain: string;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
tokenAddress: string;
|
|
105
|
+
callback: (data: TradeActivity) => void;
|
|
106
|
+
filter?: string;
|
|
111
107
|
}): Unsubscrible;
|
|
112
108
|
subscribeWalletTrade({ chain, walletAddress, callback, filter, }: {
|
|
113
109
|
chain: string;
|
|
@@ -115,4 +111,9 @@ export declare class StreamApi {
|
|
|
115
111
|
callback: (data: TradeActivity) => void;
|
|
116
112
|
filter?: string;
|
|
117
113
|
}): Unsubscrible;
|
|
114
|
+
subscribeDexPoolBalance({ chain, poolAddress, callback, }: {
|
|
115
|
+
chain: string;
|
|
116
|
+
poolAddress: string;
|
|
117
|
+
callback: (data: DexPoolBalance) => void;
|
|
118
|
+
}): Unsubscrible;
|
|
118
119
|
}
|
package/dist/api/stream.js
CHANGED
|
@@ -49,6 +49,16 @@ class StreamApi {
|
|
|
49
49
|
this.stopBatching();
|
|
50
50
|
return unsubscribles;
|
|
51
51
|
}
|
|
52
|
+
batchUnsubscribe(unsubscribles) {
|
|
53
|
+
if (!unsubscribles || unsubscribles.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
unsubscribles.forEach((unsub) => {
|
|
57
|
+
if (unsub && typeof unsub.unsubscribe === "function") {
|
|
58
|
+
unsub.unsubscribe();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
52
62
|
subscribe(channel, fn, filter, methodName) {
|
|
53
63
|
let sub = this.realtimeClient.getSubscription(channel);
|
|
54
64
|
let listeners = this.listenersMap.get(channel);
|
|
@@ -188,77 +198,6 @@ class StreamApi {
|
|
|
188
198
|
price: this.formatScientificNotation(data.p),
|
|
189
199
|
}), filter, "subscribeTokenStats");
|
|
190
200
|
}
|
|
191
|
-
subscribeRankingTokensStats({ chain, channelType, callback, }) {
|
|
192
|
-
const channel = `dex-ranking-token-stats-list:${chain}_${channelType}`;
|
|
193
|
-
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
194
|
-
address: it.a,
|
|
195
|
-
timestamp: it.t,
|
|
196
|
-
buys1m: it.b1m,
|
|
197
|
-
sells1m: it.s1m,
|
|
198
|
-
buyers1m: it.be1m,
|
|
199
|
-
sellers1m: it.se1m,
|
|
200
|
-
buyVolumeInUsd1m: this.formatScientificNotation(it.bviu1m),
|
|
201
|
-
sellVolumeInUsd1m: this.formatScientificNotation(it.sviu1m),
|
|
202
|
-
price1m: this.formatScientificNotation(it.p1m),
|
|
203
|
-
openInUsd1m: this.formatScientificNotation(it.oiu1m),
|
|
204
|
-
closeInUsd1m: this.formatScientificNotation(it.ciu1m),
|
|
205
|
-
buys5m: it.b5m,
|
|
206
|
-
sells5m: it.s5m,
|
|
207
|
-
buyers5m: it.be5m,
|
|
208
|
-
sellers5m: it.se5m,
|
|
209
|
-
buyVolumeInUsd5m: this.formatScientificNotation(it.bviu5m),
|
|
210
|
-
sellVolumeInUsd5m: this.formatScientificNotation(it.sviu5m),
|
|
211
|
-
price5m: this.formatScientificNotation(it.p5m),
|
|
212
|
-
openInUsd5m: this.formatScientificNotation(it.oiu5m),
|
|
213
|
-
closeInUsd5m: this.formatScientificNotation(it.ciu5m),
|
|
214
|
-
buys15m: it.b15m,
|
|
215
|
-
sells15m: it.s15m,
|
|
216
|
-
buyers15m: it.be15m,
|
|
217
|
-
sellers15m: it.se15m,
|
|
218
|
-
buyVolumeInUsd15m: this.formatScientificNotation(it.bviu15m),
|
|
219
|
-
sellVolumeInUsd15m: this.formatScientificNotation(it.sviu15m),
|
|
220
|
-
price15m: this.formatScientificNotation(it.p15m),
|
|
221
|
-
openInUsd15m: this.formatScientificNotation(it.oiu15m),
|
|
222
|
-
closeInUsd15m: this.formatScientificNotation(it.ciu15m),
|
|
223
|
-
buys30m: it.b30m,
|
|
224
|
-
sells30m: it.s30m,
|
|
225
|
-
buyers30m: it.be30m,
|
|
226
|
-
sellers30m: it.se30m,
|
|
227
|
-
buyVolumeInUsd30m: this.formatScientificNotation(it.bviu30m),
|
|
228
|
-
sellVolumeInUsd30m: this.formatScientificNotation(it.sviu30m),
|
|
229
|
-
price30m: this.formatScientificNotation(it.p30m),
|
|
230
|
-
openInUsd30m: this.formatScientificNotation(it.oiu30m),
|
|
231
|
-
closeInUsd30m: this.formatScientificNotation(it.ciu30m),
|
|
232
|
-
buys1h: it.b1h,
|
|
233
|
-
sells1h: it.s1h,
|
|
234
|
-
buyers1h: it.be1h,
|
|
235
|
-
sellers1h: it.se1h,
|
|
236
|
-
buyVolumeInUsd1h: this.formatScientificNotation(it.bviu1h),
|
|
237
|
-
sellVolumeInUsd1h: this.formatScientificNotation(it.sviu1h),
|
|
238
|
-
price1h: this.formatScientificNotation(it.p1h),
|
|
239
|
-
openInUsd1h: this.formatScientificNotation(it.oiu1h),
|
|
240
|
-
closeInUsd1h: this.formatScientificNotation(it.ciu1h),
|
|
241
|
-
buys4h: it.b4h,
|
|
242
|
-
sells4h: it.s4h,
|
|
243
|
-
buyers4h: it.be4h,
|
|
244
|
-
sellers4h: it.se4h,
|
|
245
|
-
buyVolumeInUsd4h: this.formatScientificNotation(it.bviu4h),
|
|
246
|
-
sellVolumeInUsd4h: this.formatScientificNotation(it.sviu4h),
|
|
247
|
-
price4h: this.formatScientificNotation(it.p4h),
|
|
248
|
-
openInUsd4h: this.formatScientificNotation(it.oiu4h),
|
|
249
|
-
closeInUsd4h: this.formatScientificNotation(it.ciu4h),
|
|
250
|
-
buys24h: it.b24h,
|
|
251
|
-
sells24h: it.s24h,
|
|
252
|
-
buyers24h: it.be24h,
|
|
253
|
-
sellers24h: it.se24h,
|
|
254
|
-
buyVolumeInUsd24h: this.formatScientificNotation(it.bviu24h),
|
|
255
|
-
sellVolumeInUsd24h: this.formatScientificNotation(it.sviu24h),
|
|
256
|
-
price24h: this.formatScientificNotation(it.p24h),
|
|
257
|
-
price: this.formatScientificNotation(it.p),
|
|
258
|
-
openInUsd24h: this.formatScientificNotation(it.oiu24h),
|
|
259
|
-
closeInUsd24h: this.formatScientificNotation(it.ciu24h),
|
|
260
|
-
}))));
|
|
261
|
-
}
|
|
262
201
|
subscribeTokenHolders({ chain, tokenAddress, callback, filter, }) {
|
|
263
202
|
const channel = `dex-token-holding:${chain}_${tokenAddress}`;
|
|
264
203
|
return this.subscribe(channel, (data) => callback({
|
|
@@ -273,105 +212,14 @@ class StreamApi {
|
|
|
273
212
|
timestamp: data.ts,
|
|
274
213
|
}), filter, "subscribeTokenHolders");
|
|
275
214
|
}
|
|
276
|
-
|
|
277
|
-
const channel = `dex-
|
|
278
|
-
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
279
|
-
tokenAddress: it.a,
|
|
280
|
-
holders: it.h,
|
|
281
|
-
top100Amount: this.formatScientificNotation(it.t100a),
|
|
282
|
-
top10Amount: this.formatScientificNotation(it.t10a),
|
|
283
|
-
top100Holders: it.t100h,
|
|
284
|
-
top10Holders: it.t10h,
|
|
285
|
-
top100Ratio: this.formatScientificNotation(it.t100r),
|
|
286
|
-
top10Ratio: this.formatScientificNotation(it.t10r),
|
|
287
|
-
timestamp: it.ts,
|
|
288
|
-
}))));
|
|
289
|
-
}
|
|
290
|
-
subscribeTokenTrades({ chain, tokenAddress, callback, filter, }) {
|
|
291
|
-
const channel = `dex-trade:${chain}_${tokenAddress}`;
|
|
215
|
+
subscribeNewToken({ chain, callback, filter, }) {
|
|
216
|
+
const channel = `dex-new-token:${chain}`;
|
|
292
217
|
return this.subscribe(channel, (data) => callback({
|
|
293
218
|
tokenAddress: data.a,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
buyTokenAddress: data.btma,
|
|
299
|
-
buyTokenName: data.btn,
|
|
300
|
-
buyTokenSymbol: data.bts,
|
|
301
|
-
buyWalletAddress: data.bwa,
|
|
302
|
-
sellAmount: data.sa,
|
|
303
|
-
sellAmountInUsd: data.saiu,
|
|
304
|
-
sellTokenAddress: data.stma,
|
|
305
|
-
sellTokenName: data.stn,
|
|
306
|
-
sellTokenSymbol: data.sts,
|
|
307
|
-
sellWalletAddress: data.swa,
|
|
308
|
-
txHash: data.h,
|
|
309
|
-
}), filter, "subscribeTokenTrades");
|
|
310
|
-
}
|
|
311
|
-
subscribeWalletBalance({ chain, walletAddress, callback, filter, }) {
|
|
312
|
-
const channel = `dex-wallet-balance:${chain}_${walletAddress}`;
|
|
313
|
-
return this.subscribe(channel, (data) => callback([
|
|
314
|
-
{
|
|
315
|
-
walletAddress: data.a,
|
|
316
|
-
tokenAddress: data.ta,
|
|
317
|
-
tokenPriceInUsd: data.tpiu,
|
|
318
|
-
balance: data.b,
|
|
319
|
-
timestamp: data.t,
|
|
320
|
-
},
|
|
321
|
-
]), filter, "subscribeWalletBalance");
|
|
322
|
-
}
|
|
323
|
-
subscribeWalletPnl({ chain, walletAddress, callback, filter, }) {
|
|
324
|
-
const channel = `dex-wallet-token-pnl:${chain}_${walletAddress}`;
|
|
325
|
-
return this.subscribe(channel, (data) => callback({
|
|
326
|
-
walletAddress: data.a,
|
|
327
|
-
tokenAddress: data.ta,
|
|
328
|
-
tokenPriceInUsd: data.tpiu,
|
|
329
|
-
timestamp: data.t,
|
|
330
|
-
opentime: data.ot,
|
|
331
|
-
lasttime: data.lt,
|
|
332
|
-
closetime: data.ct,
|
|
333
|
-
buyAmount: data.ba,
|
|
334
|
-
buyAmountInUsd: data.baiu,
|
|
335
|
-
buyCount: data.bs,
|
|
336
|
-
buyCount30d: data.bs30d,
|
|
337
|
-
buyCount7d: data.bs7d,
|
|
338
|
-
sellAmount: data.sa,
|
|
339
|
-
sellAmountInUsd: data.saiu,
|
|
340
|
-
sellCount: data.ss,
|
|
341
|
-
sellCount30d: data.ss30d,
|
|
342
|
-
sellCount7d: data.ss7d,
|
|
343
|
-
heldDurationTimestamp: data.hdts,
|
|
344
|
-
averageBuyPriceInUsd: data.abpiu,
|
|
345
|
-
averageSellPriceInUsd: data.aspiu,
|
|
346
|
-
unrealizedProfitInUsd: data.upiu,
|
|
347
|
-
unrealizedProfitRatio: data.upr,
|
|
348
|
-
realizedProfitInUsd: data.rpiu,
|
|
349
|
-
realizedProfitRatio: data.rpr,
|
|
350
|
-
totalRealizedProfitInUsd: data.trpiu,
|
|
351
|
-
totalRealizedProfitRatio: data.trr,
|
|
352
|
-
}), filter, "subscribeWalletPnl");
|
|
353
|
-
}
|
|
354
|
-
subscribeWalletPnlList({ chain, walletAddress, callback, }) {
|
|
355
|
-
const channel = `dex-wallet-pnl-list:${chain}_${walletAddress}`;
|
|
356
|
-
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
357
|
-
walletAddress: it.a,
|
|
358
|
-
buys: it.bs,
|
|
359
|
-
buyAmount: it.ba,
|
|
360
|
-
buyAmountInUsd: it.baiu,
|
|
361
|
-
averageBuyPriceInUsd: it.abpiu,
|
|
362
|
-
sellAmount: it.sa,
|
|
363
|
-
sellAmountInUsd: it.saiu,
|
|
364
|
-
sells: it.ss,
|
|
365
|
-
wins: it.ws,
|
|
366
|
-
winRatio: it.wr,
|
|
367
|
-
pnlInUsd: it.piu,
|
|
368
|
-
averagePnlInUsd: it.apiu,
|
|
369
|
-
pnlRatio: it.pr,
|
|
370
|
-
profitableDays: it.pd,
|
|
371
|
-
losingDays: it.ld,
|
|
372
|
-
tokens: it.ts,
|
|
373
|
-
resolution: it.r,
|
|
374
|
-
}))));
|
|
219
|
+
name: data.n,
|
|
220
|
+
symbol: data.s,
|
|
221
|
+
createdAtMs: data.cts,
|
|
222
|
+
}), filter, "subscribeNewToken");
|
|
375
223
|
}
|
|
376
224
|
subscribeNewTokensMetadata({ chain, callback, }) {
|
|
377
225
|
const channel = `dex-new-tokens-metadata:${chain}`;
|
|
@@ -428,15 +276,6 @@ class StreamApi {
|
|
|
428
276
|
createdAtMs: it.cts,
|
|
429
277
|
}))));
|
|
430
278
|
}
|
|
431
|
-
subscribeNewToken({ chain, callback, filter, }) {
|
|
432
|
-
const channel = `dex-new-token:${chain}`;
|
|
433
|
-
return this.subscribe(channel, (data) => callback({
|
|
434
|
-
tokenAddress: data.a,
|
|
435
|
-
name: data.n,
|
|
436
|
-
symbol: data.s,
|
|
437
|
-
createdAtMs: data.cts,
|
|
438
|
-
}), filter, "subscribeNewToken");
|
|
439
|
-
}
|
|
440
279
|
subscribeTokenSupply({ chain, tokenAddress, callback, filter, }) {
|
|
441
280
|
const channel = `dex-token-supply:${chain}_${tokenAddress}`;
|
|
442
281
|
return this.subscribe(channel, (data) => callback({
|
|
@@ -446,25 +285,6 @@ class StreamApi {
|
|
|
446
285
|
timestamp: data.ts,
|
|
447
286
|
}), filter, "subscribeTokenSupply");
|
|
448
287
|
}
|
|
449
|
-
subscribeRankingTokensSupply({ chain, channelType, callback, }) {
|
|
450
|
-
const channel = `dex-ranking-token-supply-list:${chain}_${channelType}`;
|
|
451
|
-
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
452
|
-
tokenAddress: it.a,
|
|
453
|
-
supply: it.s,
|
|
454
|
-
marketCapInUsd: it.mc,
|
|
455
|
-
timestamp: it.ts,
|
|
456
|
-
}))));
|
|
457
|
-
}
|
|
458
|
-
subscribeDexPoolBalance({ chain, poolAddress, callback, }) {
|
|
459
|
-
const channel = `dex-pool-balance:${chain}_${poolAddress}`;
|
|
460
|
-
return this.subscribe(channel, (data) => callback({
|
|
461
|
-
poolAddress: data.a,
|
|
462
|
-
tokenAAddress: data.taa,
|
|
463
|
-
tokenALiquidityInUsd: data.taliu,
|
|
464
|
-
tokenBAddress: data.tba,
|
|
465
|
-
tokenBLiquidityInUsd: data.tbliu,
|
|
466
|
-
}));
|
|
467
|
-
}
|
|
468
288
|
subscribeTokenLiquidity({ chain, tokenAddress, callback, filter, }) {
|
|
469
289
|
const channel = `dex-token-general-stat-num:${chain}_${tokenAddress}`;
|
|
470
290
|
return this.subscribe(channel, (data) => callback({
|
|
@@ -795,6 +615,186 @@ class StreamApi {
|
|
|
795
615
|
return result;
|
|
796
616
|
})));
|
|
797
617
|
}
|
|
618
|
+
subscribeRankingTokensStats({ chain, channelType, callback, }) {
|
|
619
|
+
const channel = `dex-ranking-token-stats-list:${chain}_${channelType}`;
|
|
620
|
+
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
621
|
+
address: it.a,
|
|
622
|
+
timestamp: it.t,
|
|
623
|
+
buys1m: it.b1m,
|
|
624
|
+
sells1m: it.s1m,
|
|
625
|
+
buyers1m: it.be1m,
|
|
626
|
+
sellers1m: it.se1m,
|
|
627
|
+
buyVolumeInUsd1m: this.formatScientificNotation(it.bviu1m),
|
|
628
|
+
sellVolumeInUsd1m: this.formatScientificNotation(it.sviu1m),
|
|
629
|
+
price1m: this.formatScientificNotation(it.p1m),
|
|
630
|
+
openInUsd1m: this.formatScientificNotation(it.oiu1m),
|
|
631
|
+
closeInUsd1m: this.formatScientificNotation(it.ciu1m),
|
|
632
|
+
buys5m: it.b5m,
|
|
633
|
+
sells5m: it.s5m,
|
|
634
|
+
buyers5m: it.be5m,
|
|
635
|
+
sellers5m: it.se5m,
|
|
636
|
+
buyVolumeInUsd5m: this.formatScientificNotation(it.bviu5m),
|
|
637
|
+
sellVolumeInUsd5m: this.formatScientificNotation(it.sviu5m),
|
|
638
|
+
price5m: this.formatScientificNotation(it.p5m),
|
|
639
|
+
openInUsd5m: this.formatScientificNotation(it.oiu5m),
|
|
640
|
+
closeInUsd5m: this.formatScientificNotation(it.ciu5m),
|
|
641
|
+
buys15m: it.b15m,
|
|
642
|
+
sells15m: it.s15m,
|
|
643
|
+
buyers15m: it.be15m,
|
|
644
|
+
sellers15m: it.se15m,
|
|
645
|
+
buyVolumeInUsd15m: this.formatScientificNotation(it.bviu15m),
|
|
646
|
+
sellVolumeInUsd15m: this.formatScientificNotation(it.sviu15m),
|
|
647
|
+
price15m: this.formatScientificNotation(it.p15m),
|
|
648
|
+
openInUsd15m: this.formatScientificNotation(it.oiu15m),
|
|
649
|
+
closeInUsd15m: this.formatScientificNotation(it.ciu15m),
|
|
650
|
+
buys30m: it.b30m,
|
|
651
|
+
sells30m: it.s30m,
|
|
652
|
+
buyers30m: it.be30m,
|
|
653
|
+
sellers30m: it.se30m,
|
|
654
|
+
buyVolumeInUsd30m: this.formatScientificNotation(it.bviu30m),
|
|
655
|
+
sellVolumeInUsd30m: this.formatScientificNotation(it.sviu30m),
|
|
656
|
+
price30m: this.formatScientificNotation(it.p30m),
|
|
657
|
+
openInUsd30m: this.formatScientificNotation(it.oiu30m),
|
|
658
|
+
closeInUsd30m: this.formatScientificNotation(it.ciu30m),
|
|
659
|
+
buys1h: it.b1h,
|
|
660
|
+
sells1h: it.s1h,
|
|
661
|
+
buyers1h: it.be1h,
|
|
662
|
+
sellers1h: it.se1h,
|
|
663
|
+
buyVolumeInUsd1h: this.formatScientificNotation(it.bviu1h),
|
|
664
|
+
sellVolumeInUsd1h: this.formatScientificNotation(it.sviu1h),
|
|
665
|
+
price1h: this.formatScientificNotation(it.p1h),
|
|
666
|
+
openInUsd1h: this.formatScientificNotation(it.oiu1h),
|
|
667
|
+
closeInUsd1h: this.formatScientificNotation(it.ciu1h),
|
|
668
|
+
buys4h: it.b4h,
|
|
669
|
+
sells4h: it.s4h,
|
|
670
|
+
buyers4h: it.be4h,
|
|
671
|
+
sellers4h: it.se4h,
|
|
672
|
+
buyVolumeInUsd4h: this.formatScientificNotation(it.bviu4h),
|
|
673
|
+
sellVolumeInUsd4h: this.formatScientificNotation(it.sviu4h),
|
|
674
|
+
price4h: this.formatScientificNotation(it.p4h),
|
|
675
|
+
openInUsd4h: this.formatScientificNotation(it.oiu4h),
|
|
676
|
+
closeInUsd4h: this.formatScientificNotation(it.ciu4h),
|
|
677
|
+
buys24h: it.b24h,
|
|
678
|
+
sells24h: it.s24h,
|
|
679
|
+
buyers24h: it.be24h,
|
|
680
|
+
sellers24h: it.se24h,
|
|
681
|
+
buyVolumeInUsd24h: this.formatScientificNotation(it.bviu24h),
|
|
682
|
+
sellVolumeInUsd24h: this.formatScientificNotation(it.sviu24h),
|
|
683
|
+
price24h: this.formatScientificNotation(it.p24h),
|
|
684
|
+
price: this.formatScientificNotation(it.p),
|
|
685
|
+
openInUsd24h: this.formatScientificNotation(it.oiu24h),
|
|
686
|
+
closeInUsd24h: this.formatScientificNotation(it.ciu24h),
|
|
687
|
+
}))));
|
|
688
|
+
}
|
|
689
|
+
subscribeRankingTokensHolders({ chain, channelType, callback, }) {
|
|
690
|
+
const channel = `dex-ranking-token-holding-list:${chain}_${channelType}`;
|
|
691
|
+
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
692
|
+
tokenAddress: it.a,
|
|
693
|
+
holders: it.h,
|
|
694
|
+
top100Amount: this.formatScientificNotation(it.t100a),
|
|
695
|
+
top10Amount: this.formatScientificNotation(it.t10a),
|
|
696
|
+
top100Holders: it.t100h,
|
|
697
|
+
top10Holders: it.t10h,
|
|
698
|
+
top100Ratio: this.formatScientificNotation(it.t100r),
|
|
699
|
+
top10Ratio: this.formatScientificNotation(it.t10r),
|
|
700
|
+
timestamp: it.ts,
|
|
701
|
+
}))));
|
|
702
|
+
}
|
|
703
|
+
subscribeRankingTokensSupply({ chain, channelType, callback, }) {
|
|
704
|
+
const channel = `dex-ranking-token-supply-list:${chain}_${channelType}`;
|
|
705
|
+
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
706
|
+
tokenAddress: it.a,
|
|
707
|
+
supply: it.s,
|
|
708
|
+
marketCapInUsd: it.mc,
|
|
709
|
+
timestamp: it.ts,
|
|
710
|
+
}))));
|
|
711
|
+
}
|
|
712
|
+
subscribeWalletBalance({ chain, walletAddress, callback, filter, }) {
|
|
713
|
+
const channel = `dex-wallet-balance:${chain}_${walletAddress}`;
|
|
714
|
+
return this.subscribe(channel, (data) => callback([
|
|
715
|
+
{
|
|
716
|
+
walletAddress: data.a,
|
|
717
|
+
tokenAddress: data.ta,
|
|
718
|
+
tokenPriceInUsd: data.tpiu,
|
|
719
|
+
balance: data.b,
|
|
720
|
+
timestamp: data.t,
|
|
721
|
+
},
|
|
722
|
+
]), filter, "subscribeWalletBalance");
|
|
723
|
+
}
|
|
724
|
+
subscribeWalletPnl({ chain, walletAddress, callback, filter, }) {
|
|
725
|
+
const channel = `dex-wallet-token-pnl:${chain}_${walletAddress}`;
|
|
726
|
+
return this.subscribe(channel, (data) => callback({
|
|
727
|
+
walletAddress: data.a,
|
|
728
|
+
tokenAddress: data.ta,
|
|
729
|
+
tokenPriceInUsd: data.tpiu,
|
|
730
|
+
timestamp: data.t,
|
|
731
|
+
opentime: data.ot,
|
|
732
|
+
lasttime: data.lt,
|
|
733
|
+
closetime: data.ct,
|
|
734
|
+
buyAmount: data.ba,
|
|
735
|
+
buyAmountInUsd: data.baiu,
|
|
736
|
+
buyCount: data.bs,
|
|
737
|
+
buyCount30d: data.bs30d,
|
|
738
|
+
buyCount7d: data.bs7d,
|
|
739
|
+
sellAmount: data.sa,
|
|
740
|
+
sellAmountInUsd: data.saiu,
|
|
741
|
+
sellCount: data.ss,
|
|
742
|
+
sellCount30d: data.ss30d,
|
|
743
|
+
sellCount7d: data.ss7d,
|
|
744
|
+
heldDurationTimestamp: data.hdts,
|
|
745
|
+
averageBuyPriceInUsd: data.abpiu,
|
|
746
|
+
averageSellPriceInUsd: data.aspiu,
|
|
747
|
+
unrealizedProfitInUsd: data.upiu,
|
|
748
|
+
unrealizedProfitRatio: data.upr,
|
|
749
|
+
realizedProfitInUsd: data.rpiu,
|
|
750
|
+
realizedProfitRatio: data.rpr,
|
|
751
|
+
totalRealizedProfitInUsd: data.trpiu,
|
|
752
|
+
totalRealizedProfitRatio: data.trr,
|
|
753
|
+
}), filter, "subscribeWalletPnl");
|
|
754
|
+
}
|
|
755
|
+
subscribeWalletPnlList({ chain, walletAddress, callback, }) {
|
|
756
|
+
const channel = `dex-wallet-pnl-list:${chain}_${walletAddress}`;
|
|
757
|
+
return this.subscribe(channel, (data) => callback(data === null || data === void 0 ? void 0 : data.map((it) => ({
|
|
758
|
+
walletAddress: it.a,
|
|
759
|
+
buys: it.bs,
|
|
760
|
+
buyAmount: it.ba,
|
|
761
|
+
buyAmountInUsd: it.baiu,
|
|
762
|
+
averageBuyPriceInUsd: it.abpiu,
|
|
763
|
+
sellAmount: it.sa,
|
|
764
|
+
sellAmountInUsd: it.saiu,
|
|
765
|
+
sells: it.ss,
|
|
766
|
+
wins: it.ws,
|
|
767
|
+
winRatio: it.wr,
|
|
768
|
+
pnlInUsd: it.piu,
|
|
769
|
+
averagePnlInUsd: it.apiu,
|
|
770
|
+
pnlRatio: it.pr,
|
|
771
|
+
profitableDays: it.pd,
|
|
772
|
+
losingDays: it.ld,
|
|
773
|
+
tokens: it.ts,
|
|
774
|
+
resolution: it.r,
|
|
775
|
+
}))));
|
|
776
|
+
}
|
|
777
|
+
subscribeTokenTrade({ chain, tokenAddress, callback, filter, }) {
|
|
778
|
+
const channel = `dex-trade:${chain}_${tokenAddress}`;
|
|
779
|
+
return this.subscribe(channel, (data) => callback({
|
|
780
|
+
tokenAddress: data.a,
|
|
781
|
+
timestamp: data.t,
|
|
782
|
+
kind: data.k,
|
|
783
|
+
buyAmount: data.ba,
|
|
784
|
+
buyAmountInUsd: data.baiu,
|
|
785
|
+
buyTokenAddress: data.btma,
|
|
786
|
+
buyTokenName: data.btn,
|
|
787
|
+
buyTokenSymbol: data.bts,
|
|
788
|
+
buyWalletAddress: data.bwa,
|
|
789
|
+
sellAmount: data.sa,
|
|
790
|
+
sellAmountInUsd: data.saiu,
|
|
791
|
+
sellTokenAddress: data.stma,
|
|
792
|
+
sellTokenName: data.stn,
|
|
793
|
+
sellTokenSymbol: data.sts,
|
|
794
|
+
sellWalletAddress: data.swa,
|
|
795
|
+
txHash: data.h,
|
|
796
|
+
}), filter, "subscribeTokenTrades");
|
|
797
|
+
}
|
|
798
798
|
subscribeWalletTrade({ chain, walletAddress, callback, filter, }) {
|
|
799
799
|
const channel = `dex-wallet-trade:${chain}_${walletAddress}`;
|
|
800
800
|
return this.subscribe(channel, (data) => callback({
|
|
@@ -816,6 +816,16 @@ class StreamApi {
|
|
|
816
816
|
txHash: data.h,
|
|
817
817
|
}), filter, "subscribeTokenTrades");
|
|
818
818
|
}
|
|
819
|
+
subscribeDexPoolBalance({ chain, poolAddress, callback, }) {
|
|
820
|
+
const channel = `dex-pool-balance:${chain}_${poolAddress}`;
|
|
821
|
+
return this.subscribe(channel, (data) => callback({
|
|
822
|
+
poolAddress: data.a,
|
|
823
|
+
tokenAAddress: data.taa,
|
|
824
|
+
tokenALiquidityInUsd: data.taliu,
|
|
825
|
+
tokenBAddress: data.tba,
|
|
826
|
+
tokenBLiquidityInUsd: data.tbliu,
|
|
827
|
+
}));
|
|
828
|
+
}
|
|
819
829
|
}
|
|
820
830
|
exports.StreamApi = StreamApi;
|
|
821
831
|
class StreamUnsubscrible {
|