@0xarchive/sdk 0.8.0 → 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 +73 -3
- package/dist/index.d.mts +69 -5
- package/dist/index.d.ts +69 -5
- package/dist/index.js +46 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,9 +32,10 @@ console.log(`Hyperliquid BTC mid price: ${hlOrderbook.midPrice}`);
|
|
|
32
32
|
const lighterOrderbook = await client.lighter.orderbook.get('BTC');
|
|
33
33
|
console.log(`Lighter BTC mid price: ${lighterOrderbook.midPrice}`);
|
|
34
34
|
|
|
35
|
-
// HIP-3 builder perps (
|
|
36
|
-
const
|
|
37
|
-
const
|
|
35
|
+
// HIP-3 builder perps (February 2026+)
|
|
36
|
+
const hip3Instruments = await client.hyperliquid.hip3.instruments.list();
|
|
37
|
+
const hip3Orderbook = await client.hyperliquid.hip3.orderbook.get('km:US500');
|
|
38
|
+
const hip3Trades = await client.hyperliquid.hip3.trades.recent('km:US500');
|
|
38
39
|
const hip3Funding = await client.hyperliquid.hip3.funding.current('xyz:XYZ100');
|
|
39
40
|
const hip3Oi = await client.hyperliquid.hip3.openInterest.current('xyz:XYZ100');
|
|
40
41
|
|
|
@@ -269,6 +270,28 @@ console.log(`ETH min base amount: ${eth.minBaseAmount}`);
|
|
|
269
270
|
| Market ID | Not available | `marketId` |
|
|
270
271
|
| Min amounts | Not available | `minBaseAmount`, `minQuoteAmount` |
|
|
271
272
|
|
|
273
|
+
#### HIP-3 Instruments
|
|
274
|
+
|
|
275
|
+
HIP-3 instruments are derived from live market data and include mark price, open interest, and mid price:
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// List all HIP-3 instruments (no tier restriction)
|
|
279
|
+
const hip3Instruments = await client.hyperliquid.hip3.instruments.list();
|
|
280
|
+
for (const inst of hip3Instruments) {
|
|
281
|
+
console.log(`${inst.coin} (${inst.namespace}:${inst.ticker}): mark=${inst.markPrice}, OI=${inst.openInterest}`);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Get specific HIP-3 instrument (case-sensitive)
|
|
285
|
+
const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
286
|
+
console.log(`Mark price: ${us500.markPrice}`);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Available HIP-3 Coins:**
|
|
290
|
+
| Builder | Coins |
|
|
291
|
+
|---------|-------|
|
|
292
|
+
| xyz (Hyperliquid) | `xyz:XYZ100` |
|
|
293
|
+
| km (Kinetiq Markets) | `km:US500`, `km:SMALL2000`, `km:GOOGL`, `km:USBOND`, `km:GOLD`, `km:USTECH`, `km:NVDA`, `km:SILVER`, `km:BABA` |
|
|
294
|
+
|
|
272
295
|
### Funding Rates
|
|
273
296
|
|
|
274
297
|
```typescript
|
|
@@ -660,6 +683,8 @@ const ws = new OxArchiveWs({
|
|
|
660
683
|
|
|
661
684
|
### Available Channels
|
|
662
685
|
|
|
686
|
+
#### Hyperliquid Channels
|
|
687
|
+
|
|
663
688
|
| Channel | Description | Requires Coin | Historical Support |
|
|
664
689
|
|---------|-------------|---------------|-------------------|
|
|
665
690
|
| `orderbook` | L2 order book updates | Yes | Yes |
|
|
@@ -669,6 +694,24 @@ const ws = new OxArchiveWs({
|
|
|
669
694
|
| `ticker` | Price and 24h volume | Yes | Real-time only |
|
|
670
695
|
| `all_tickers` | All market tickers | No | Real-time only |
|
|
671
696
|
|
|
697
|
+
#### HIP-3 Builder Perps Channels
|
|
698
|
+
|
|
699
|
+
| Channel | Description | Requires Coin | Historical Support |
|
|
700
|
+
|---------|-------------|---------------|-------------------|
|
|
701
|
+
| `hip3_orderbook` | HIP-3 L2 order book snapshots | Yes | Yes |
|
|
702
|
+
| `hip3_trades` | HIP-3 trade/fill updates | Yes | Yes |
|
|
703
|
+
| `hip3_candles` | HIP-3 OHLCV candle data | Yes | Yes |
|
|
704
|
+
|
|
705
|
+
> **Note:** HIP-3 coins are case-sensitive (e.g., `km:US500`, `xyz:XYZ100`). Do not uppercase them.
|
|
706
|
+
|
|
707
|
+
#### Lighter.xyz Channels
|
|
708
|
+
|
|
709
|
+
| Channel | Description | Requires Coin | Historical Support |
|
|
710
|
+
|---------|-------------|---------------|-------------------|
|
|
711
|
+
| `lighter_orderbook` | Lighter L2 order book (reconstructed) | Yes | Yes |
|
|
712
|
+
| `lighter_trades` | Lighter trade/fill updates | Yes | Yes |
|
|
713
|
+
| `lighter_candles` | Lighter OHLCV candle data | Yes | Yes |
|
|
714
|
+
|
|
672
715
|
#### Candle Replay/Stream
|
|
673
716
|
|
|
674
717
|
```typescript
|
|
@@ -696,6 +739,32 @@ ws.replay('lighter_candles', 'BTC', {
|
|
|
696
739
|
});
|
|
697
740
|
```
|
|
698
741
|
|
|
742
|
+
#### HIP-3 Replay/Stream
|
|
743
|
+
|
|
744
|
+
```typescript
|
|
745
|
+
// Replay HIP-3 orderbook at 50x speed
|
|
746
|
+
ws.replay('hip3_orderbook', 'km:US500', {
|
|
747
|
+
start: Date.now() - 3600000,
|
|
748
|
+
end: Date.now(),
|
|
749
|
+
speed: 50,
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// Bulk stream HIP-3 trades
|
|
753
|
+
ws.stream('hip3_trades', 'xyz:XYZ100', {
|
|
754
|
+
start: Date.now() - 86400000,
|
|
755
|
+
end: Date.now(),
|
|
756
|
+
batchSize: 1000,
|
|
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
|
+
});
|
|
766
|
+
```
|
|
767
|
+
|
|
699
768
|
### WebSocket Connection States
|
|
700
769
|
|
|
701
770
|
```typescript
|
|
@@ -756,6 +825,7 @@ import type {
|
|
|
756
825
|
Candle,
|
|
757
826
|
Instrument,
|
|
758
827
|
LighterInstrument,
|
|
828
|
+
Hip3Instrument,
|
|
759
829
|
LighterGranularity,
|
|
760
830
|
FundingRate,
|
|
761
831
|
OpenInterest,
|
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,26 @@ interface LighterInstrument {
|
|
|
216
216
|
/** Whether the instrument is currently tradeable */
|
|
217
217
|
isActive: boolean;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* HIP-3 Builder Perps instrument with latest market data.
|
|
221
|
+
* Derived from live open interest data.
|
|
222
|
+
*/
|
|
223
|
+
interface Hip3Instrument {
|
|
224
|
+
/** Full coin name (e.g., km:US500, xyz:XYZ100) */
|
|
225
|
+
coin: string;
|
|
226
|
+
/** Builder namespace (e.g., km, xyz) */
|
|
227
|
+
namespace: string;
|
|
228
|
+
/** Ticker within the namespace (e.g., US500, XYZ100) */
|
|
229
|
+
ticker: string;
|
|
230
|
+
/** Latest mark price */
|
|
231
|
+
markPrice?: number;
|
|
232
|
+
/** Latest open interest */
|
|
233
|
+
openInterest?: number;
|
|
234
|
+
/** Latest mid price */
|
|
235
|
+
midPrice?: number;
|
|
236
|
+
/** Timestamp of latest data point */
|
|
237
|
+
latestTimestamp?: string;
|
|
238
|
+
}
|
|
219
239
|
/**
|
|
220
240
|
* Funding rate record
|
|
221
241
|
*/
|
|
@@ -336,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
|
|
|
336
356
|
interval?: CandleInterval;
|
|
337
357
|
}
|
|
338
358
|
/** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
|
|
339
|
-
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers';
|
|
359
|
+
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades' | 'hip3_candles';
|
|
340
360
|
/** Subscribe message from client */
|
|
341
361
|
interface WsSubscribe {
|
|
342
362
|
op: 'subscribe';
|
|
@@ -1400,6 +1420,41 @@ declare class LighterInstrumentsResource {
|
|
|
1400
1420
|
*/
|
|
1401
1421
|
get(coin: string): Promise<LighterInstrument>;
|
|
1402
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* HIP-3 Builder Perps Instruments API resource
|
|
1425
|
+
*
|
|
1426
|
+
* HIP-3 instruments are derived from live market data and include
|
|
1427
|
+
* mark price, open interest, and mid price context.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // List all HIP-3 instruments
|
|
1432
|
+
* const instruments = await client.hyperliquid.hip3.instruments.list();
|
|
1433
|
+
*
|
|
1434
|
+
* // Get specific instrument
|
|
1435
|
+
* const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
1436
|
+
* console.log(`Mark price: ${us500.markPrice}`);
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
declare class Hip3InstrumentsResource {
|
|
1440
|
+
private http;
|
|
1441
|
+
private basePath;
|
|
1442
|
+
private coinTransform;
|
|
1443
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (c: string) => string);
|
|
1444
|
+
/**
|
|
1445
|
+
* List all available HIP-3 instruments with latest market data
|
|
1446
|
+
*
|
|
1447
|
+
* @returns Array of HIP-3 instruments
|
|
1448
|
+
*/
|
|
1449
|
+
list(): Promise<Hip3Instrument[]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Get a specific HIP-3 instrument by coin name
|
|
1452
|
+
*
|
|
1453
|
+
* @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
|
|
1454
|
+
* @returns HIP-3 instrument details with latest market data
|
|
1455
|
+
*/
|
|
1456
|
+
get(coin: string): Promise<Hip3Instrument>;
|
|
1457
|
+
}
|
|
1403
1458
|
|
|
1404
1459
|
/**
|
|
1405
1460
|
* Funding rates API resource
|
|
@@ -1536,7 +1591,8 @@ declare class OpenInterestResource {
|
|
|
1536
1591
|
declare class CandlesResource {
|
|
1537
1592
|
private http;
|
|
1538
1593
|
private basePath;
|
|
1539
|
-
|
|
1594
|
+
private coinTransform;
|
|
1595
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1540
1596
|
/**
|
|
1541
1597
|
* Get historical OHLCV candle data with cursor-based pagination
|
|
1542
1598
|
*
|
|
@@ -1823,7 +1879,7 @@ declare class HyperliquidClient {
|
|
|
1823
1879
|
*/
|
|
1824
1880
|
readonly liquidations: LiquidationsResource;
|
|
1825
1881
|
/**
|
|
1826
|
-
* HIP-3 builder-deployed perpetuals (
|
|
1882
|
+
* HIP-3 builder-deployed perpetuals (February 2026+)
|
|
1827
1883
|
*/
|
|
1828
1884
|
readonly hip3: Hip3Client;
|
|
1829
1885
|
constructor(http: HttpClient);
|
|
@@ -1832,7 +1888,7 @@ declare class HyperliquidClient {
|
|
|
1832
1888
|
* HIP-3 builder-deployed perpetuals client
|
|
1833
1889
|
*
|
|
1834
1890
|
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1835
|
-
*
|
|
1891
|
+
* Free: km:US500 only. Build+: all coins. Orderbook: Pro+.
|
|
1836
1892
|
*
|
|
1837
1893
|
* @example
|
|
1838
1894
|
* ```typescript
|
|
@@ -1842,6 +1898,10 @@ declare class HyperliquidClient {
|
|
|
1842
1898
|
* ```
|
|
1843
1899
|
*/
|
|
1844
1900
|
declare class Hip3Client {
|
|
1901
|
+
/**
|
|
1902
|
+
* HIP-3 instruments with latest market data
|
|
1903
|
+
*/
|
|
1904
|
+
readonly instruments: Hip3InstrumentsResource;
|
|
1845
1905
|
/**
|
|
1846
1906
|
* Order book snapshots (February 2026+)
|
|
1847
1907
|
*/
|
|
@@ -1858,6 +1918,10 @@ declare class Hip3Client {
|
|
|
1858
1918
|
* Open interest
|
|
1859
1919
|
*/
|
|
1860
1920
|
readonly openInterest: OpenInterestResource;
|
|
1921
|
+
/**
|
|
1922
|
+
* OHLCV candle data
|
|
1923
|
+
*/
|
|
1924
|
+
readonly candles: CandlesResource;
|
|
1861
1925
|
constructor(http: HttpClient);
|
|
1862
1926
|
}
|
|
1863
1927
|
/**
|
|
@@ -4070,4 +4134,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
4070
4134
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
4071
4135
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
4072
4136
|
|
|
4073
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
|
4137
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, type Hip3Instrument, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,6 +216,26 @@ interface LighterInstrument {
|
|
|
216
216
|
/** Whether the instrument is currently tradeable */
|
|
217
217
|
isActive: boolean;
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* HIP-3 Builder Perps instrument with latest market data.
|
|
221
|
+
* Derived from live open interest data.
|
|
222
|
+
*/
|
|
223
|
+
interface Hip3Instrument {
|
|
224
|
+
/** Full coin name (e.g., km:US500, xyz:XYZ100) */
|
|
225
|
+
coin: string;
|
|
226
|
+
/** Builder namespace (e.g., km, xyz) */
|
|
227
|
+
namespace: string;
|
|
228
|
+
/** Ticker within the namespace (e.g., US500, XYZ100) */
|
|
229
|
+
ticker: string;
|
|
230
|
+
/** Latest mark price */
|
|
231
|
+
markPrice?: number;
|
|
232
|
+
/** Latest open interest */
|
|
233
|
+
openInterest?: number;
|
|
234
|
+
/** Latest mid price */
|
|
235
|
+
midPrice?: number;
|
|
236
|
+
/** Timestamp of latest data point */
|
|
237
|
+
latestTimestamp?: string;
|
|
238
|
+
}
|
|
219
239
|
/**
|
|
220
240
|
* Funding rate record
|
|
221
241
|
*/
|
|
@@ -336,7 +356,7 @@ interface CandleHistoryParams extends CursorPaginationParams {
|
|
|
336
356
|
interval?: CandleInterval;
|
|
337
357
|
}
|
|
338
358
|
/** WebSocket channel types. Note: ticker/all_tickers are real-time only. Liquidations is historical only (May 2025+). */
|
|
339
|
-
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers';
|
|
359
|
+
type WsChannel = 'orderbook' | 'trades' | 'candles' | 'liquidations' | 'ticker' | 'all_tickers' | 'lighter_orderbook' | 'lighter_trades' | 'lighter_candles' | 'hip3_orderbook' | 'hip3_trades' | 'hip3_candles';
|
|
340
360
|
/** Subscribe message from client */
|
|
341
361
|
interface WsSubscribe {
|
|
342
362
|
op: 'subscribe';
|
|
@@ -1400,6 +1420,41 @@ declare class LighterInstrumentsResource {
|
|
|
1400
1420
|
*/
|
|
1401
1421
|
get(coin: string): Promise<LighterInstrument>;
|
|
1402
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* HIP-3 Builder Perps Instruments API resource
|
|
1425
|
+
*
|
|
1426
|
+
* HIP-3 instruments are derived from live market data and include
|
|
1427
|
+
* mark price, open interest, and mid price context.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // List all HIP-3 instruments
|
|
1432
|
+
* const instruments = await client.hyperliquid.hip3.instruments.list();
|
|
1433
|
+
*
|
|
1434
|
+
* // Get specific instrument
|
|
1435
|
+
* const us500 = await client.hyperliquid.hip3.instruments.get('km:US500');
|
|
1436
|
+
* console.log(`Mark price: ${us500.markPrice}`);
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
declare class Hip3InstrumentsResource {
|
|
1440
|
+
private http;
|
|
1441
|
+
private basePath;
|
|
1442
|
+
private coinTransform;
|
|
1443
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (c: string) => string);
|
|
1444
|
+
/**
|
|
1445
|
+
* List all available HIP-3 instruments with latest market data
|
|
1446
|
+
*
|
|
1447
|
+
* @returns Array of HIP-3 instruments
|
|
1448
|
+
*/
|
|
1449
|
+
list(): Promise<Hip3Instrument[]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* Get a specific HIP-3 instrument by coin name
|
|
1452
|
+
*
|
|
1453
|
+
* @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
|
|
1454
|
+
* @returns HIP-3 instrument details with latest market data
|
|
1455
|
+
*/
|
|
1456
|
+
get(coin: string): Promise<Hip3Instrument>;
|
|
1457
|
+
}
|
|
1403
1458
|
|
|
1404
1459
|
/**
|
|
1405
1460
|
* Funding rates API resource
|
|
@@ -1536,7 +1591,8 @@ declare class OpenInterestResource {
|
|
|
1536
1591
|
declare class CandlesResource {
|
|
1537
1592
|
private http;
|
|
1538
1593
|
private basePath;
|
|
1539
|
-
|
|
1594
|
+
private coinTransform;
|
|
1595
|
+
constructor(http: HttpClient, basePath?: string, coinTransform?: (coin: string) => string);
|
|
1540
1596
|
/**
|
|
1541
1597
|
* Get historical OHLCV candle data with cursor-based pagination
|
|
1542
1598
|
*
|
|
@@ -1823,7 +1879,7 @@ declare class HyperliquidClient {
|
|
|
1823
1879
|
*/
|
|
1824
1880
|
readonly liquidations: LiquidationsResource;
|
|
1825
1881
|
/**
|
|
1826
|
-
* HIP-3 builder-deployed perpetuals (
|
|
1882
|
+
* HIP-3 builder-deployed perpetuals (February 2026+)
|
|
1827
1883
|
*/
|
|
1828
1884
|
readonly hip3: Hip3Client;
|
|
1829
1885
|
constructor(http: HttpClient);
|
|
@@ -1832,7 +1888,7 @@ declare class HyperliquidClient {
|
|
|
1832
1888
|
* HIP-3 builder-deployed perpetuals client
|
|
1833
1889
|
*
|
|
1834
1890
|
* Access Hyperliquid HIP-3 builder perps data through the 0xarchive API.
|
|
1835
|
-
*
|
|
1891
|
+
* Free: km:US500 only. Build+: all coins. Orderbook: Pro+.
|
|
1836
1892
|
*
|
|
1837
1893
|
* @example
|
|
1838
1894
|
* ```typescript
|
|
@@ -1842,6 +1898,10 @@ declare class HyperliquidClient {
|
|
|
1842
1898
|
* ```
|
|
1843
1899
|
*/
|
|
1844
1900
|
declare class Hip3Client {
|
|
1901
|
+
/**
|
|
1902
|
+
* HIP-3 instruments with latest market data
|
|
1903
|
+
*/
|
|
1904
|
+
readonly instruments: Hip3InstrumentsResource;
|
|
1845
1905
|
/**
|
|
1846
1906
|
* Order book snapshots (February 2026+)
|
|
1847
1907
|
*/
|
|
@@ -1858,6 +1918,10 @@ declare class Hip3Client {
|
|
|
1858
1918
|
* Open interest
|
|
1859
1919
|
*/
|
|
1860
1920
|
readonly openInterest: OpenInterestResource;
|
|
1921
|
+
/**
|
|
1922
|
+
* OHLCV candle data
|
|
1923
|
+
*/
|
|
1924
|
+
readonly candles: CandlesResource;
|
|
1861
1925
|
constructor(http: HttpClient);
|
|
1862
1926
|
}
|
|
1863
1927
|
/**
|
|
@@ -4070,4 +4134,4 @@ type ValidatedCandle = z.infer<typeof CandleSchema>;
|
|
|
4070
4134
|
type ValidatedLiquidation = z.infer<typeof LiquidationSchema>;
|
|
4071
4135
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
4072
4136
|
|
|
4073
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
|
4137
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type Candle, CandleArrayResponseSchema, type CandleHistoryParams, type CandleInterval, CandleIntervalSchema, CandleSchema, type ClientOptions, type CompletenessMetrics, type CoverageGap, type CoverageResponse, type CursorResponse, type DataCadence, type DataFreshness, type DataTypeCoverage, type DataTypeStatus, type ExchangeCoverage, type ExchangeLatency, type ExchangeStatus, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, Hip3Client, type Hip3Instrument, HyperliquidClient, type Incident, type IncidentSeverityValue, type IncidentStatusValue, type IncidentsResponse, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type LatencyResponse, LighterClient, type LighterGranularity, type LighterInstrument, type Liquidation, LiquidationArrayResponseSchema, type LiquidationHistoryParams, LiquidationSchema, LiquidationSideSchema, type LiquidationsByUserParams, type ListIncidentsParams, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookReconstructor, OrderBookResponseSchema, OrderBookSchema, type OrderbookDelta, OxArchive, OxArchiveError, OxArchiveWs, type Pagination, type PriceLevel, PriceLevelSchema, type ReconstructOptions, type ReconstructedOrderBook, type RestApiLatency, type SlaActual, type SlaParams, type SlaResponse, type SlaTargets, type StatusResponse, type SymbolCoverageOptions, type SymbolCoverageResponse, type SymbolDataTypeCoverage, type SystemStatusValue, type TickData, type TickHistoryParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedCandle, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedLiquidation, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WebSocketLatency, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsHistoricalTickData, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default, reconstructFinal, reconstructOrderBook };
|
package/dist/index.js
CHANGED
|
@@ -970,6 +970,38 @@ var LighterInstrumentsResource = class {
|
|
|
970
970
|
return response.data;
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
+
var Hip3InstrumentsResource = class {
|
|
974
|
+
constructor(http, basePath = "/v1/hyperliquid/hip3", coinTransform) {
|
|
975
|
+
this.http = http;
|
|
976
|
+
this.basePath = basePath;
|
|
977
|
+
this.coinTransform = coinTransform || ((c) => c);
|
|
978
|
+
}
|
|
979
|
+
coinTransform;
|
|
980
|
+
/**
|
|
981
|
+
* List all available HIP-3 instruments with latest market data
|
|
982
|
+
*
|
|
983
|
+
* @returns Array of HIP-3 instruments
|
|
984
|
+
*/
|
|
985
|
+
async list() {
|
|
986
|
+
const response = await this.http.get(
|
|
987
|
+
`${this.basePath}/instruments`
|
|
988
|
+
);
|
|
989
|
+
return response.data;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Get a specific HIP-3 instrument by coin name
|
|
993
|
+
*
|
|
994
|
+
* @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
|
|
995
|
+
* @returns HIP-3 instrument details with latest market data
|
|
996
|
+
*/
|
|
997
|
+
async get(coin) {
|
|
998
|
+
coin = this.coinTransform(coin);
|
|
999
|
+
const response = await this.http.get(
|
|
1000
|
+
`${this.basePath}/instruments/${coin}`
|
|
1001
|
+
);
|
|
1002
|
+
return response.data;
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
973
1005
|
|
|
974
1006
|
// src/resources/funding.ts
|
|
975
1007
|
var FundingResource = class {
|
|
@@ -1055,9 +1087,10 @@ var OpenInterestResource = class {
|
|
|
1055
1087
|
|
|
1056
1088
|
// src/resources/candles.ts
|
|
1057
1089
|
var CandlesResource = class {
|
|
1058
|
-
constructor(http, basePath = "/v1") {
|
|
1090
|
+
constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
|
|
1059
1091
|
this.http = http;
|
|
1060
1092
|
this.basePath = basePath;
|
|
1093
|
+
this.coinTransform = coinTransform;
|
|
1061
1094
|
}
|
|
1062
1095
|
/**
|
|
1063
1096
|
* Get historical OHLCV candle data with cursor-based pagination
|
|
@@ -1068,7 +1101,7 @@ var CandlesResource = class {
|
|
|
1068
1101
|
*/
|
|
1069
1102
|
async history(coin, params) {
|
|
1070
1103
|
const response = await this.http.get(
|
|
1071
|
-
`${this.basePath}/candles/${
|
|
1104
|
+
`${this.basePath}/candles/${this.coinTransform(coin)}`,
|
|
1072
1105
|
params,
|
|
1073
1106
|
this.http.validationEnabled ? CandleArrayResponseSchema : void 0
|
|
1074
1107
|
);
|
|
@@ -1353,7 +1386,7 @@ var HyperliquidClient = class {
|
|
|
1353
1386
|
*/
|
|
1354
1387
|
liquidations;
|
|
1355
1388
|
/**
|
|
1356
|
-
* HIP-3 builder-deployed perpetuals (
|
|
1389
|
+
* HIP-3 builder-deployed perpetuals (February 2026+)
|
|
1357
1390
|
*/
|
|
1358
1391
|
hip3;
|
|
1359
1392
|
constructor(http) {
|
|
@@ -1369,6 +1402,10 @@ var HyperliquidClient = class {
|
|
|
1369
1402
|
}
|
|
1370
1403
|
};
|
|
1371
1404
|
var Hip3Client = class {
|
|
1405
|
+
/**
|
|
1406
|
+
* HIP-3 instruments with latest market data
|
|
1407
|
+
*/
|
|
1408
|
+
instruments;
|
|
1372
1409
|
/**
|
|
1373
1410
|
* Order book snapshots (February 2026+)
|
|
1374
1411
|
*/
|
|
@@ -1385,13 +1422,19 @@ var Hip3Client = class {
|
|
|
1385
1422
|
* Open interest
|
|
1386
1423
|
*/
|
|
1387
1424
|
openInterest;
|
|
1425
|
+
/**
|
|
1426
|
+
* OHLCV candle data
|
|
1427
|
+
*/
|
|
1428
|
+
candles;
|
|
1388
1429
|
constructor(http) {
|
|
1389
1430
|
const basePath = "/v1/hyperliquid/hip3";
|
|
1390
1431
|
const coinTransform = (c) => c;
|
|
1432
|
+
this.instruments = new Hip3InstrumentsResource(http, basePath, coinTransform);
|
|
1391
1433
|
this.orderbook = new OrderBookResource(http, basePath, coinTransform);
|
|
1392
1434
|
this.trades = new TradesResource(http, basePath, coinTransform);
|
|
1393
1435
|
this.funding = new FundingResource(http, basePath, coinTransform);
|
|
1394
1436
|
this.openInterest = new OpenInterestResource(http, basePath, coinTransform);
|
|
1437
|
+
this.candles = new CandlesResource(http, basePath, coinTransform);
|
|
1395
1438
|
}
|
|
1396
1439
|
};
|
|
1397
1440
|
var LighterClient = class {
|