@chainstream-io/sdk 0.2.5 → 0.2.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.
- package/dist/{chainstream-BD-x5_ck.d.cts → chainstream-kxqV2g1Q.d.cts} +147 -8
- package/dist/{chainstream-BD-x5_ck.d.ts → chainstream-kxqV2g1Q.d.ts} +147 -8
- package/dist/chainstream.cjs +90 -16
- package/dist/chainstream.cjs.map +1 -1
- package/dist/chainstream.d.cts +1 -1
- package/dist/chainstream.d.ts +1 -1
- package/dist/chainstream.mjs +90 -16
- package/dist/chainstream.mjs.map +1 -1
- package/dist/index.cjs +129 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +123 -18
- package/dist/index.mjs.map +1 -1
- package/dist/stream/index.cjs +74 -14
- package/dist/stream/index.cjs.map +1 -1
- package/dist/stream/index.d.cts +1 -1
- package/dist/stream/index.d.ts +1 -1
- package/dist/stream/index.mjs +74 -14
- package/dist/stream/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/chainstream.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as ChainStreamClient,
|
|
1
|
+
export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, fS as PostOptions, T as TokenProvider } from './chainstream-kxqV2g1Q.cjs';
|
|
2
2
|
import 'axios';
|
package/dist/chainstream.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as ChainStreamClient,
|
|
1
|
+
export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, fS as PostOptions, T as TokenProvider } from './chainstream-kxqV2g1Q.js';
|
|
2
2
|
import 'axios';
|
package/dist/chainstream.mjs
CHANGED
|
@@ -549,32 +549,92 @@ var StreamApi = class {
|
|
|
549
549
|
}
|
|
550
550
|
return strValue;
|
|
551
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* Parse candle data from WebSocket message
|
|
554
|
+
*/
|
|
555
|
+
parseCandleData(data) {
|
|
556
|
+
return {
|
|
557
|
+
address: data.a,
|
|
558
|
+
open: data.o,
|
|
559
|
+
close: data.c,
|
|
560
|
+
high: data.h,
|
|
561
|
+
low: data.l,
|
|
562
|
+
volume: data.v,
|
|
563
|
+
resolution: data.r,
|
|
564
|
+
time: data.t,
|
|
565
|
+
number: data.n
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Subscribe to token candles (K-line)
|
|
570
|
+
* Channel: dex-candle:{chain}_{tokenAddress}_{resolution} (USD)
|
|
571
|
+
* Channel: dex-candle-in-native:{chain}_{tokenAddress}_{resolution} (Native)
|
|
572
|
+
* @param priceType - "usd" (default) or "native"
|
|
573
|
+
*/
|
|
552
574
|
subscribeTokenCandles({
|
|
553
575
|
chain,
|
|
554
576
|
tokenAddress,
|
|
555
577
|
resolution,
|
|
556
578
|
callback,
|
|
557
|
-
filter
|
|
579
|
+
filter,
|
|
580
|
+
priceType = "usd"
|
|
558
581
|
}) {
|
|
559
|
-
const
|
|
582
|
+
const prefix = priceType === "native" ? "dex-candle-in-native" : "dex-candle";
|
|
583
|
+
const channel = `${prefix}:${chain}_${tokenAddress}_${resolution}`;
|
|
560
584
|
return this.subscribe(
|
|
561
585
|
channel,
|
|
562
|
-
(data) =>
|
|
563
|
-
callback({
|
|
564
|
-
open: data.o,
|
|
565
|
-
close: data.c,
|
|
566
|
-
high: data.h,
|
|
567
|
-
low: data.l,
|
|
568
|
-
volume: data.v,
|
|
569
|
-
resolution: data.r,
|
|
570
|
-
time: data.t,
|
|
571
|
-
number: data.n
|
|
572
|
-
});
|
|
573
|
-
},
|
|
586
|
+
(data) => callback(this.parseCandleData(data)),
|
|
574
587
|
filter,
|
|
575
588
|
"subscribeTokenCandles"
|
|
576
589
|
);
|
|
577
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* Subscribe to pool candles (K-line)
|
|
593
|
+
* Channel: dex-pool-candle:{chain}_{poolAddress}_{resolution} (USD)
|
|
594
|
+
* Channel: dex-pool-candle-in-native:{chain}_{poolAddress}_{resolution} (Native)
|
|
595
|
+
* @param priceType - "usd" (default) or "native"
|
|
596
|
+
*/
|
|
597
|
+
subscribePoolCandles({
|
|
598
|
+
chain,
|
|
599
|
+
poolAddress,
|
|
600
|
+
resolution,
|
|
601
|
+
callback,
|
|
602
|
+
filter,
|
|
603
|
+
priceType = "usd"
|
|
604
|
+
}) {
|
|
605
|
+
const prefix = priceType === "native" ? "dex-pool-candle-in-native" : "dex-pool-candle";
|
|
606
|
+
const channel = `${prefix}:${chain}_${poolAddress}_${resolution}`;
|
|
607
|
+
return this.subscribe(
|
|
608
|
+
channel,
|
|
609
|
+
(data) => callback(this.parseCandleData(data)),
|
|
610
|
+
filter,
|
|
611
|
+
"subscribePoolCandles"
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Subscribe to pair candles (K-line)
|
|
616
|
+
* Channel: dex-pair-candle:{chain}_{pairAddress}_{resolution} (USD)
|
|
617
|
+
* Channel: dex-pair-candle-in-native:{chain}_{pairAddress}_{resolution} (Native)
|
|
618
|
+
* @param pairAddress - format: {tokenA}-{tokenB}
|
|
619
|
+
* @param priceType - "usd" (default) or "native"
|
|
620
|
+
*/
|
|
621
|
+
subscribePairCandles({
|
|
622
|
+
chain,
|
|
623
|
+
pairAddress,
|
|
624
|
+
resolution,
|
|
625
|
+
callback,
|
|
626
|
+
filter,
|
|
627
|
+
priceType = "usd"
|
|
628
|
+
}) {
|
|
629
|
+
const prefix = priceType === "native" ? "dex-pair-candle-in-native" : "dex-pair-candle";
|
|
630
|
+
const channel = `${prefix}:${chain}_${pairAddress}_${resolution}`;
|
|
631
|
+
return this.subscribe(
|
|
632
|
+
channel,
|
|
633
|
+
(data) => callback(this.parseCandleData(data)),
|
|
634
|
+
filter,
|
|
635
|
+
"subscribePairCandles"
|
|
636
|
+
);
|
|
637
|
+
}
|
|
578
638
|
subscribeTokenStats({
|
|
579
639
|
chain,
|
|
580
640
|
tokenAddress,
|
|
@@ -1599,11 +1659,11 @@ __export(jobs_exports, {
|
|
|
1599
1659
|
streaming: () => streaming
|
|
1600
1660
|
});
|
|
1601
1661
|
var get = (id, options) => {
|
|
1602
|
-
return chainstreamApiClient({ url: `/jobs/${id}`, method: "GET" }, options);
|
|
1662
|
+
return chainstreamApiClient({ url: `/v1/jobs/${id}`, method: "GET" }, options);
|
|
1603
1663
|
};
|
|
1604
1664
|
var streaming = (id, options) => {
|
|
1605
1665
|
return chainstreamApiClient(
|
|
1606
|
-
{ url: `/jobs/${id}/streaming`, method: "GET" },
|
|
1666
|
+
{ url: `/v1/jobs/${id}/streaming`, method: "GET" },
|
|
1607
1667
|
options
|
|
1608
1668
|
);
|
|
1609
1669
|
};
|
|
@@ -1852,6 +1912,8 @@ __export(token_exports, {
|
|
|
1852
1912
|
getMetadata: () => getMetadata,
|
|
1853
1913
|
getMetadataMulti: () => getMetadataMulti,
|
|
1854
1914
|
getMintAndBurn: () => getMintAndBurn,
|
|
1915
|
+
getPairCandles: () => getPairCandles,
|
|
1916
|
+
getPoolCandles: () => getPoolCandles,
|
|
1855
1917
|
getPools: () => getPools,
|
|
1856
1918
|
getPriceByTime: () => getPriceByTime,
|
|
1857
1919
|
getPrices: () => getPrices,
|
|
@@ -1932,6 +1994,18 @@ var getCandles = (chain, tokenAddress, params, options) => {
|
|
|
1932
1994
|
options
|
|
1933
1995
|
);
|
|
1934
1996
|
};
|
|
1997
|
+
var getPoolCandles = (chain, poolAddress, params, options) => {
|
|
1998
|
+
return chainstreamApiClient(
|
|
1999
|
+
{ url: `/v1/token/${chain}/pool/${poolAddress}/candles`, method: "GET", params },
|
|
2000
|
+
options
|
|
2001
|
+
);
|
|
2002
|
+
};
|
|
2003
|
+
var getPairCandles = (chain, pair, params, options) => {
|
|
2004
|
+
return chainstreamApiClient(
|
|
2005
|
+
{ url: `/v1/token/${chain}/pair/${pair}/candles`, method: "GET", params },
|
|
2006
|
+
options
|
|
2007
|
+
);
|
|
2008
|
+
};
|
|
1935
2009
|
var getTopHolders = (chain, tokenAddress, options) => {
|
|
1936
2010
|
return chainstreamApiClient(
|
|
1937
2011
|
{ url: `/v1/token/${chain}/${tokenAddress}/topHolders`, method: "GET" },
|