@chainstream-io/sdk 0.2.7 → 0.2.9

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.
@@ -1,2 +1,2 @@
1
- export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, fS as PostOptions, T as TokenProvider } from './chainstream-kxqV2g1Q.cjs';
1
+ export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, h4 as PostOptions, T as TokenProvider } from './chainstream-B9uaC_fe.cjs';
2
2
  import 'axios';
@@ -1,2 +1,2 @@
1
- export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, fS as PostOptions, T as TokenProvider } from './chainstream-kxqV2g1Q.js';
1
+ export { C as ChainStreamClient, y as ChainStreamClientOptions, z as ChainStreamRequestContext, h4 as PostOptions, T as TokenProvider } from './chainstream-B9uaC_fe.js';
2
2
  import 'axios';
@@ -635,6 +635,35 @@ var StreamApi = class {
635
635
  "subscribePairCandles"
636
636
  );
637
637
  }
638
+ /**
639
+ * Parse token stat data for a specific time window
640
+ * @param data - Raw WebSocket data
641
+ * @param suffix - Time window suffix (e.g., "1m", "5m", "1h", "1W", "1M")
642
+ */
643
+ parseTokenStatWindow(data, suffix) {
644
+ return {
645
+ [`buys${suffix}`]: data[`b${suffix}`],
646
+ [`sells${suffix}`]: data[`s${suffix}`],
647
+ [`buyers${suffix}`]: data[`be${suffix}`],
648
+ [`sellers${suffix}`]: data[`se${suffix}`],
649
+ [`buyVolumeInUsd${suffix}`]: this.formatScientificNotation(data[`bviu${suffix}`]),
650
+ [`sellVolumeInUsd${suffix}`]: this.formatScientificNotation(data[`sviu${suffix}`]),
651
+ [`price${suffix}`]: this.formatScientificNotation(data[`p${suffix}`]),
652
+ [`openInUsd${suffix}`]: this.formatScientificNotation(data[`oiu${suffix}`]),
653
+ [`closeInUsd${suffix}`]: this.formatScientificNotation(data[`ciu${suffix}`]),
654
+ [`volumeChangeRatio${suffix}`]: this.formatScientificNotation(data[`vpc${suffix}`]),
655
+ [`trades${suffix}`]: data[`tr${suffix}`],
656
+ [`dappProgramCount${suffix}`]: data[`dpc${suffix}`],
657
+ [`poolCount${suffix}`]: data[`pc${suffix}`],
658
+ [`liquidityInUsd${suffix}`]: this.formatScientificNotation(data[`liq${suffix}`]),
659
+ [`liquidityChangeRatio${suffix}`]: this.formatScientificNotation(data[`lpc${suffix}`])
660
+ };
661
+ }
662
+ /**
663
+ * Subscribe to token trade statistics
664
+ * Channel: dex-token-stats:{chain}_{tokenAddress}
665
+ * Time windows: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 24h, 1W, 1M
666
+ */
638
667
  subscribeTokenStats({
639
668
  chain,
640
669
  tokenAddress,
@@ -642,76 +671,24 @@ var StreamApi = class {
642
671
  filter
643
672
  }) {
644
673
  const channel = `dex-token-stats:${chain}_${tokenAddress}`;
674
+ const timeWindows = ["1m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "24h", "1W", "1M"];
645
675
  return this.subscribe(
646
676
  channel,
647
- (data) => callback({
648
- address: data.a,
649
- timestamp: data.t,
650
- buys1m: data.b1m,
651
- sells1m: data.s1m,
652
- buyers1m: data.be1m,
653
- sellers1m: data.se1m,
654
- buyVolumeInUsd1m: this.formatScientificNotation(data.bviu1m),
655
- sellVolumeInUsd1m: this.formatScientificNotation(data.sviu1m),
656
- price1m: this.formatScientificNotation(data.p1m),
657
- openInUsd1m: this.formatScientificNotation(data.oiu1m),
658
- closeInUsd1m: this.formatScientificNotation(data.ciu1m),
659
- buys5m: data.b5m,
660
- sells5m: data.s5m,
661
- buyers5m: data.be5m,
662
- sellers5m: data.se5m,
663
- buyVolumeInUsd5m: this.formatScientificNotation(data.bviu5m),
664
- sellVolumeInUsd5m: this.formatScientificNotation(data.sviu5m),
665
- price5m: this.formatScientificNotation(data.p5m),
666
- openInUsd5m: this.formatScientificNotation(data.oiu5m),
667
- closeInUsd5m: this.formatScientificNotation(data.ciu5m),
668
- buys15m: data.b15m,
669
- sells15m: data.s15m,
670
- buyers15m: data.be15m,
671
- sellers15m: data.se15m,
672
- buyVolumeInUsd15m: this.formatScientificNotation(data.bviu15m),
673
- sellVolumeInUsd15m: this.formatScientificNotation(data.sviu15m),
674
- price15m: this.formatScientificNotation(data.p15m),
675
- openInUsd15m: this.formatScientificNotation(data.oiu15m),
676
- closeInUsd15m: this.formatScientificNotation(data.ciu15m),
677
- buys30m: data.b30m,
678
- sells30m: data.s30m,
679
- buyers30m: data.be30m,
680
- sellers30m: data.se30m,
681
- buyVolumeInUsd30m: this.formatScientificNotation(data.bviu30m),
682
- sellVolumeInUsd30m: this.formatScientificNotation(data.sviu30m),
683
- price30m: this.formatScientificNotation(data.p30m),
684
- openInUsd30m: this.formatScientificNotation(data.oiu30m),
685
- closeInUsd30m: this.formatScientificNotation(data.ciu30m),
686
- buys1h: data.b1h,
687
- sells1h: data.s1h,
688
- buyers1h: data.be1h,
689
- sellers1h: data.se1h,
690
- buyVolumeInUsd1h: this.formatScientificNotation(data.bviu1h),
691
- sellVolumeInUsd1h: this.formatScientificNotation(data.sviu1h),
692
- price1h: this.formatScientificNotation(data.p1h),
693
- openInUsd1h: this.formatScientificNotation(data.oiu1h),
694
- closeInUsd1h: this.formatScientificNotation(data.ciu1h),
695
- buys4h: data.b4h,
696
- sells4h: data.s4h,
697
- buyers4h: data.be4h,
698
- sellers4h: data.se4h,
699
- buyVolumeInUsd4h: this.formatScientificNotation(data.bviu4h),
700
- sellVolumeInUsd4h: this.formatScientificNotation(data.sviu4h),
701
- price4h: this.formatScientificNotation(data.p4h),
702
- openInUsd4h: this.formatScientificNotation(data.oiu4h),
703
- closeInUsd4h: this.formatScientificNotation(data.ciu4h),
704
- buys24h: data.b24h,
705
- sells24h: data.s24h,
706
- buyers24h: data.be24h,
707
- sellers24h: data.se24h,
708
- buyVolumeInUsd24h: this.formatScientificNotation(data.bviu24h),
709
- sellVolumeInUsd24h: this.formatScientificNotation(data.sviu24h),
710
- price24h: this.formatScientificNotation(data.p24h),
711
- openInUsd24h: this.formatScientificNotation(data.oiu24h),
712
- closeInUsd24h: this.formatScientificNotation(data.ciu24h),
713
- price: this.formatScientificNotation(data.p)
714
- }),
677
+ (data) => {
678
+ const windowData = timeWindows.reduce(
679
+ (acc, suffix) => ({
680
+ ...acc,
681
+ ...this.parseTokenStatWindow(data, suffix)
682
+ }),
683
+ {}
684
+ );
685
+ callback({
686
+ address: data.a,
687
+ timestamp: data.t,
688
+ price: this.formatScientificNotation(data.p),
689
+ ...windowData
690
+ });
691
+ },
715
692
  filter,
716
693
  "subscribeTokenStats"
717
694
  );
@@ -1923,6 +1900,8 @@ __export(token_exports, {
1923
1900
  getToken: () => getToken,
1924
1901
  getTokenLiquiditySnapshots: () => getTokenLiquiditySnapshots,
1925
1902
  getTokenTraders: () => getTokenTraders,
1903
+ getTokenTransferTotal: () => getTokenTransferTotal,
1904
+ getTokenTransfers: () => getTokenTransfers,
1926
1905
  getTokens: () => getTokens,
1927
1906
  getTopHolders: () => getTopHolders,
1928
1907
  listToken: () => listToken,
@@ -2078,12 +2057,25 @@ var getTokenLiquiditySnapshots = (chain, tokenAddress, params, options) => {
2078
2057
  options
2079
2058
  );
2080
2059
  };
2060
+ var getTokenTransfers = (chain, tokenAddress, params, options) => {
2061
+ return chainstreamApiClient(
2062
+ { url: `/v1/token/${chain}/${tokenAddress}/transfers`, method: "GET", params },
2063
+ options
2064
+ );
2065
+ };
2066
+ var getTokenTransferTotal = (chain, tokenAddress, params, options) => {
2067
+ return chainstreamApiClient(
2068
+ { url: `/v1/token/${chain}/${tokenAddress}/transfer-total`, method: "GET", params },
2069
+ options
2070
+ );
2071
+ };
2081
2072
 
2082
2073
  // src/openapi-client/generated/trade/trade.ts
2083
2074
  var trade_exports = {};
2084
2075
  __export(trade_exports, {
2085
2076
  getActivities: () => getActivities,
2086
2077
  getTopTraders: () => getTopTraders,
2078
+ getTraderGainersLosers: () => getTraderGainersLosers,
2087
2079
  getTrades: () => getTrades
2088
2080
  });
2089
2081
  var getTrades = (chain, params, options) => {
@@ -2104,6 +2096,12 @@ var getTopTraders = (chain, params, options) => {
2104
2096
  options
2105
2097
  );
2106
2098
  };
2099
+ var getTraderGainersLosers = (chain, params, options) => {
2100
+ return chainstreamApiClient(
2101
+ { url: `/v1/trade/${chain}/trader-gainers-losers`, method: "GET", params },
2102
+ options
2103
+ );
2104
+ };
2107
2105
 
2108
2106
  // src/openapi-client/generated/transaction/transaction.ts
2109
2107
  var transaction_exports = {};
@@ -2145,26 +2143,35 @@ var getGasLimit = (chain, estimateGasLimitInput, options) => {
2145
2143
  var wallet_exports = {};
2146
2144
  __export(wallet_exports, {
2147
2145
  calculatePnl: () => calculatePnl,
2148
- getBalance: () => getBalance,
2149
2146
  getBalanceUpdates: () => getBalanceUpdates,
2147
+ getNetWorth: () => getNetWorth,
2148
+ getNetWorthChart: () => getNetWorthChart,
2149
+ getNetWorthDetails: () => getNetWorthDetails,
2150
+ getNetWorthSummary: () => getNetWorthSummary,
2150
2151
  getPnl: () => getPnl,
2151
- getPnlStats: () => getPnlStats
2152
+ getPnlByToken: () => getPnlByToken,
2153
+ getPnlByWallet: () => getPnlByWallet,
2154
+ getPnlDetails: () => getPnlDetails,
2155
+ getTokensBalance: () => getTokensBalance,
2156
+ getWalletFirstTx: () => getWalletFirstTx,
2157
+ getWalletTransferTotal: () => getWalletTransferTotal,
2158
+ getWalletTransfers: () => getWalletTransfers
2152
2159
  });
2153
- var getPnl = (chain, walletAddress, params, options) => {
2160
+ var getNetWorthSummary = (chain, params, options) => {
2154
2161
  return chainstreamApiClient(
2155
- { url: `/v1/wallet/${chain}/${walletAddress}/pnl`, method: "GET", params },
2162
+ { url: `/v1/wallet/${chain}/net-worth-summary`, method: "GET", params },
2156
2163
  options
2157
2164
  );
2158
2165
  };
2159
- var getPnlStats = (chain, walletAddress, options) => {
2166
+ var getPnlByWallet = (chain, params, options) => {
2160
2167
  return chainstreamApiClient(
2161
- { url: `/v1/wallet/${chain}/${walletAddress}/stats`, method: "GET" },
2168
+ { url: `/v1/wallet/${chain}/pnl-by-wallet`, method: "GET", params },
2162
2169
  options
2163
2170
  );
2164
2171
  };
2165
- var getBalance = (chain, walletAddress, params, options) => {
2172
+ var getWalletFirstTx = (chain, params, options) => {
2166
2173
  return chainstreamApiClient(
2167
- { url: `/v1/wallet/${chain}/${walletAddress}/balance`, method: "GET", params },
2174
+ { url: `/v1/wallet/${chain}/first-tx`, method: "GET", params },
2168
2175
  options
2169
2176
  );
2170
2177
  };
@@ -2179,6 +2186,60 @@ var calculatePnl = (chain, walletAddress, calculatePnlInput, options) => {
2179
2186
  options
2180
2187
  );
2181
2188
  };
2189
+ var getNetWorth = (chain, walletAddress, params, options) => {
2190
+ return chainstreamApiClient(
2191
+ { url: `/v1/wallet/${chain}/${walletAddress}/net-worth`, method: "GET", params },
2192
+ options
2193
+ );
2194
+ };
2195
+ var getTokensBalance = (chain, walletAddress, params, options) => {
2196
+ return chainstreamApiClient(
2197
+ { url: `/v1/wallet/${chain}/${walletAddress}/tokens-balance`, method: "GET", params },
2198
+ options
2199
+ );
2200
+ };
2201
+ var getNetWorthChart = (chain, walletAddress, params, options) => {
2202
+ return chainstreamApiClient(
2203
+ { url: `/v1/wallet/${chain}/${walletAddress}/net-worth-chart`, method: "GET", params },
2204
+ options
2205
+ );
2206
+ };
2207
+ var getNetWorthDetails = (chain, walletAddress, params, options) => {
2208
+ return chainstreamApiClient(
2209
+ { url: `/v1/wallet/${chain}/${walletAddress}/net-worth-details`, method: "GET", params },
2210
+ options
2211
+ );
2212
+ };
2213
+ var getPnl = (chain, walletAddress, params, options) => {
2214
+ return chainstreamApiClient(
2215
+ { url: `/v1/wallet/${chain}/${walletAddress}/pnl`, method: "GET", params },
2216
+ options
2217
+ );
2218
+ };
2219
+ var getPnlDetails = (chain, walletAddress, params, options) => {
2220
+ return chainstreamApiClient(
2221
+ { url: `/v1/wallet/${chain}/${walletAddress}/pnl-details`, method: "GET", params },
2222
+ options
2223
+ );
2224
+ };
2225
+ var getPnlByToken = (chain, walletAddress, params, options) => {
2226
+ return chainstreamApiClient(
2227
+ { url: `/v1/wallet/${chain}/${walletAddress}/pnl-by-token`, method: "GET", params },
2228
+ options
2229
+ );
2230
+ };
2231
+ var getWalletTransfers = (chain, walletAddress, params, options) => {
2232
+ return chainstreamApiClient(
2233
+ { url: `/v1/wallet/${chain}/${walletAddress}/transfers`, method: "GET", params },
2234
+ options
2235
+ );
2236
+ };
2237
+ var getWalletTransferTotal = (chain, walletAddress, params, options) => {
2238
+ return chainstreamApiClient(
2239
+ { url: `/v1/wallet/${chain}/${walletAddress}/transfer-total`, method: "GET", params },
2240
+ options
2241
+ );
2242
+ };
2182
2243
  var getBalanceUpdates = (chain, walletAddress, params, options) => {
2183
2244
  return chainstreamApiClient(
2184
2245
  { url: `/v1/wallet/${chain}/${walletAddress}/balance-updates`, method: "GET", params },