@0xarchive/sdk 0.8.1 → 0.8.2

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/README.md CHANGED
@@ -700,6 +700,7 @@ const ws = new OxArchiveWs({
700
700
  |---------|-------------|---------------|-------------------|
701
701
  | `hip3_orderbook` | HIP-3 L2 order book snapshots | Yes | Yes |
702
702
  | `hip3_trades` | HIP-3 trade/fill updates | Yes | Yes |
703
+ | `hip3_candles` | HIP-3 OHLCV candle data | Yes | Yes |
703
704
 
704
705
  > **Note:** HIP-3 coins are case-sensitive (e.g., `km:US500`, `xyz:XYZ100`). Do not uppercase them.
705
706
 
@@ -754,6 +755,14 @@ ws.stream('hip3_trades', 'xyz:XYZ100', {
754
755
  end: Date.now(),
755
756
  batchSize: 1000,
756
757
  });
758
+
759
+ // HIP-3 candles
760
+ ws.replay('hip3_candles', 'km:US500', {
761
+ start: Date.now() - 86400000,
762
+ end: Date.now(),
763
+ speed: 100,
764
+ interval: '1h'
765
+ });
757
766
  ```
758
767
 
759
768
  ### WebSocket Connection States
package/dist/index.d.mts CHANGED
@@ -356,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
356
356
  interval?: CandleInterval;
357
357
  }
358
358
  /** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
359
- type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades';
359
+ type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades' | 'hip3_candles';
360
360
  /** Subscribe message from client */
361
361
  interface WsSubscribe {
362
362
  op: 'subscribe';
@@ -1591,7 +1591,8 @@ declare class OpenInterestResource {
1591
1591
  declare class CandlesResource {
1592
1592
  private http;
1593
1593
  private basePath;
1594
- constructor(http: HttpClient, basePath?: string);
1594
+ private coinTransform;
1595
+ constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
1595
1596
  /**
1596
1597
  * Get historical OHLCV candle data with cursor-based pagination
1597
1598
  *
@@ -1878,7 +1879,7 @@ declare class HyperliquidClient {
1878
1879
  */
1879
1880
  readonly liquidations: LiquidationsResource;
1880
1881
  /**
1881
- * HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
1882
+ * HIP-3 builder-deployed perpetuals (February 2026+)
1882
1883
  */
1883
1884
  readonly hip3: Hip3Client;
1884
1885
  constructor(http: HttpClient);
@@ -1887,7 +1888,7 @@ declare class HyperliquidClient {
1887
1888
  * HIP-3 builder-deployed perpetuals client
1888
1889
  *
1889
1890
  * Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
1890
- * Requires Pro tier or higher.
1891
+ * Free: km:US500 only. Build+: all coins. Orderbook: Pro+.
1891
1892
  *
1892
1893
  * @example
1893
1894
  * ```typescript
@@ -1917,6 +1918,10 @@ declare class Hip3Client {
1917
1918
  * Open interest
1918
1919
  */
1919
1920
  readonly openInterest: OpenInterestResource;
1921
+ /**
1922
+ * OHLCV candle data
1923
+ */
1924
+ readonly candles: CandlesResource;
1920
1925
  constructor(http: HttpClient);
1921
1926
  }
1922
1927
  /**
package/dist/index.d.ts CHANGED
@@ -356,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
356
356
  interval?: CandleInterval;
357
357
  }
358
358
  /** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
359
- type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades';
359
+ type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades' | 'hip3_candles';
360
360
  /** Subscribe message from client */
361
361
  interface WsSubscribe {
362
362
  op: 'subscribe';
@@ -1591,7 +1591,8 @@ declare class OpenInterestResource {
1591
1591
  declare class CandlesResource {
1592
1592
  private http;
1593
1593
  private basePath;
1594
- constructor(http: HttpClient, basePath?: string);
1594
+ private coinTransform;
1595
+ constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
1595
1596
  /**
1596
1597
  * Get historical OHLCV candle data with cursor-based pagination
1597
1598
  *
@@ -1878,7 +1879,7 @@ declare class HyperliquidClient {
1878
1879
  */
1879
1880
  readonly liquidations: LiquidationsResource;
1880
1881
  /**
1881
- * HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
1882
+ * HIP-3 builder-deployed perpetuals (February 2026+)
1882
1883
  */
1883
1884
  readonly hip3: Hip3Client;
1884
1885
  constructor(http: HttpClient);
@@ -1887,7 +1888,7 @@ declare class HyperliquidClient {
1887
1888
  * HIP-3 builder-deployed perpetuals client
1888
1889
  *
1889
1890
  * Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
1890
- * Requires Pro tier or higher.
1891
+ * Free: km:US500 only. Build+: all coins. Orderbook: Pro+.
1891
1892
  *
1892
1893
  * @example
1893
1894
  * ```typescript
@@ -1917,6 +1918,10 @@ declare class Hip3Client {
1917
1918
  * Open interest
1918
1919
  */
1919
1920
  readonly openInterest: OpenInterestResource;
1921
+ /**
1922
+ * OHLCV candle data
1923
+ */
1924
+ readonly candles: CandlesResource;
1920
1925
  constructor(http: HttpClient);
1921
1926
  }
1922
1927
  /**
package/dist/index.js CHANGED
@@ -1087,9 +1087,10 @@ var OpenInterestResource = class {
1087
1087
 
1088
1088
  // src/resources/candles.ts
1089
1089
  var CandlesResource = class {
1090
- constructor(http, basePath = "/v1") {
1090
+ constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
1091
1091
  this.http = http;
1092
1092
  this.basePath = basePath;
1093
+ this.coinTransform = coinTransform;
1093
1094
  }
1094
1095
  /**
1095
1096
  * Get historical OHLCV candle data with cursor-based pagination
@@ -1100,7 +1101,7 @@ var CandlesResource = class {
1100
1101
  */
1101
1102
  async history(coin, params) {
1102
1103
  const response = await this.http.get(
1103
- `${this.basePath}/candles/${coin.toUpperCase()}`,
1104
+ `${this.basePath}/candles/${this.coinTransform(coin)}`,
1104
1105
  params,
1105
1106
  this.http.validationEnabled ? CandleArrayResponseSchema : void 0
1106
1107
  );
@@ -1385,7 +1386,7 @@ var HyperliquidClient = class {
1385
1386
  */
1386
1387
  liquidations;
1387
1388
  /**
1388
- * HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
1389
+ * HIP-3 builder-deployed perpetuals (February 2026+)
1389
1390
  */
1390
1391
  hip3;
1391
1392
  constructor(http) {
@@ -1421,6 +1422,10 @@ var Hip3Client = class {
1421
1422
  * Open interest
1422
1423
  */
1423
1424
  openInterest;
1425
+ /**
1426
+ * OHLCV candle data
1427
+ */
1428
+ candles;
1424
1429
  constructor(http) {
1425
1430
  const basePath = "/v1/hyperliquid/hip3";
1426
1431
  const coinTransform = (c) => c;
@@ -1429,6 +1434,7 @@ var Hip3Client = class {
1429
1434
  this.trades = new TradesResource(http, basePath, coinTransform);
1430
1435
  this.funding = new FundingResource(http, basePath, coinTransform);
1431
1436
  this.openInterest = new OpenInterestResource(http, basePath, coinTransform);
1437
+ this.candles = new CandlesResource(http, basePath, coinTransform);
1432
1438
  }
1433
1439
  };
1434
1440
  var LighterClient = class {