@0xarchive/sdk 0.8.1 → 0.8.3

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
@@ -22,7 +22,7 @@ pnpm add @0xarchive/sdk
22
22
  ```typescript
23
23
  import { OxArchive } from '@0xarchive/sdk';
24
24
 
25
- const client = new OxArchive({ apiKey: 'ox_your_api_key' });
25
+ const client = new OxArchive({ apiKey: '0xa_your_api_key' });
26
26
 
27
27
  // Hyperliquid data
28
28
  const hlOrderbook = await client.hyperliquid.orderbook.get('BTC');
@@ -51,7 +51,7 @@ const history = await client.hyperliquid.orderbook.history('ETH', {
51
51
 
52
52
  ```typescript
53
53
  const client = new OxArchive({
54
- apiKey: 'ox_your_api_key', // Required
54
+ apiKey: '0xa_your_api_key', // Required
55
55
  baseUrl: 'https://api.0xarchive.io', // Optional
56
56
  timeout: 30000, // Optional, request timeout in ms (default: 30000)
57
57
  validate: false, // Optional, enable Zod schema validation
@@ -489,7 +489,7 @@ console.log(`API P99: ${sla.actual.apiLatencyP99Ms}ms (${sla.actual.latencyStatu
489
489
 
490
490
  ```typescript
491
491
  const client = new OxArchive({
492
- apiKey: 'ox_your_api_key',
492
+ apiKey: '0xa_your_api_key',
493
493
  timeout: 60000 // 60 seconds for data quality endpoints
494
494
  });
495
495
  ```
@@ -513,7 +513,7 @@ The WebSocket client supports three modes: real-time streaming, historical repla
513
513
  ```typescript
514
514
  import { OxArchiveWs } from '@0xarchive/sdk';
515
515
 
516
- const ws = new OxArchiveWs({ apiKey: 'ox_your_api_key' });
516
+ const ws = new OxArchiveWs({ apiKey: '0xa_your_api_key' });
517
517
  ```
518
518
 
519
519
  ### Real-time Streaming
@@ -672,7 +672,7 @@ Gap thresholds vary by channel:
672
672
 
673
673
  ```typescript
674
674
  const ws = new OxArchiveWs({
675
- apiKey: 'ox_your_api_key', // Required
675
+ apiKey: '0xa_your_api_key', // Required
676
676
  wsUrl: 'wss://api.0xarchive.io/ws', // Optional
677
677
  autoReconnect: true, // Auto-reconnect on disconnect (default: true)
678
678
  reconnectDelay: 1000, // Initial reconnect delay in ms (default: 1000)
@@ -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
@@ -843,7 +852,7 @@ Enable Zod schema validation for API responses:
843
852
 
844
853
  ```typescript
845
854
  const client = new OxArchive({
846
- apiKey: 'ox_your_api_key',
855
+ apiKey: '0xa_your_api_key',
847
856
  validate: true // Enable runtime validation
848
857
  });
849
858
  ```
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
  /**
@@ -1972,7 +1977,7 @@ declare class LighterClient {
1972
1977
  * ```typescript
1973
1978
  * import { OxArchive } from '@0xarchive/sdk';
1974
1979
  *
1975
- * const client = new OxArchive({ apiKey: 'ox_your_api_key' });
1980
+ * const client = new OxArchive({ apiKey: '0xa_your_api_key' });
1976
1981
  *
1977
1982
  * // Hyperliquid data
1978
1983
  * const hlOrderbook = await client.hyperliquid.orderbook.get('BTC');
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
  /**
@@ -1972,7 +1977,7 @@ declare class LighterClient {
1972
1977
  * ```typescript
1973
1978
  * import { OxArchive } from '@0xarchive/sdk';
1974
1979
  *
1975
- * const client = new OxArchive({ apiKey: 'ox_your_api_key' });
1980
+ * const client = new OxArchive({ apiKey: '0xa_your_api_key' });
1976
1981
  *
1977
1982
  * // Hyperliquid data
1978
1983
  * const hlOrderbook = await client.hyperliquid.orderbook.get('BTC');
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 {