@0xarchive/sdk 0.4.1 → 0.4.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 +66 -1
- package/dist/index.d.mts +92 -4
- package/dist/index.d.ts +92 -4
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,6 +77,43 @@ const history = await client.hyperliquid.orderbook.history('BTC', {
|
|
|
77
77
|
});
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
#### Lighter Orderbook Granularity
|
|
81
|
+
|
|
82
|
+
Lighter.xyz orderbook history supports a `granularity` parameter for different data resolutions. Tier restrictions apply.
|
|
83
|
+
|
|
84
|
+
| Granularity | Interval | Tier Required | Credit Multiplier |
|
|
85
|
+
|-------------|----------|---------------|-------------------|
|
|
86
|
+
| `checkpoint` | ~60s | Free+ | 1x |
|
|
87
|
+
| `30s` | 30s | Build+ | 2x |
|
|
88
|
+
| `10s` | 10s | Build+ | 3x |
|
|
89
|
+
| `1s` | 1s | Pro+ | 10x |
|
|
90
|
+
| `tick` | tick-level | Enterprise | 20x |
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Get Lighter orderbook history with 10s resolution (Build+ tier)
|
|
94
|
+
const history = await client.lighter.orderbook.history('BTC', {
|
|
95
|
+
start: Date.now() - 86400000,
|
|
96
|
+
end: Date.now(),
|
|
97
|
+
granularity: '10s'
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Get 1-second resolution (Pro+ tier)
|
|
101
|
+
const history = await client.lighter.orderbook.history('BTC', {
|
|
102
|
+
start: Date.now() - 86400000,
|
|
103
|
+
end: Date.now(),
|
|
104
|
+
granularity: '1s'
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Tick-level data (Enterprise tier) - returns checkpoint + raw deltas
|
|
108
|
+
const history = await client.lighter.orderbook.history('BTC', {
|
|
109
|
+
start: Date.now() - 86400000,
|
|
110
|
+
end: Date.now(),
|
|
111
|
+
granularity: 'tick'
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Note:** The `granularity` parameter is ignored for Hyperliquid orderbook history.
|
|
116
|
+
|
|
80
117
|
### Trades
|
|
81
118
|
|
|
82
119
|
The trades API uses cursor-based pagination for efficient retrieval of large datasets.
|
|
@@ -108,13 +145,39 @@ while (result.nextCursor) {
|
|
|
108
145
|
### Instruments
|
|
109
146
|
|
|
110
147
|
```typescript
|
|
111
|
-
// List all trading instruments
|
|
148
|
+
// List all trading instruments (Hyperliquid)
|
|
112
149
|
const instruments = await client.hyperliquid.instruments.list();
|
|
113
150
|
|
|
114
151
|
// Get specific instrument details
|
|
115
152
|
const btc = await client.hyperliquid.instruments.get('BTC');
|
|
153
|
+
console.log(`BTC size decimals: ${btc.szDecimals}`);
|
|
116
154
|
```
|
|
117
155
|
|
|
156
|
+
#### Lighter.xyz Instruments
|
|
157
|
+
|
|
158
|
+
Lighter instruments have a different schema with additional fields for fees, market IDs, and minimum order amounts:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// List Lighter instruments (returns LighterInstrument, not Instrument)
|
|
162
|
+
const lighterInstruments = await client.lighter.instruments.list();
|
|
163
|
+
|
|
164
|
+
// Get specific Lighter instrument
|
|
165
|
+
const eth = await client.lighter.instruments.get('ETH');
|
|
166
|
+
console.log(`ETH taker fee: ${eth.takerFee}`);
|
|
167
|
+
console.log(`ETH maker fee: ${eth.makerFee}`);
|
|
168
|
+
console.log(`ETH market ID: ${eth.marketId}`);
|
|
169
|
+
console.log(`ETH min base amount: ${eth.minBaseAmount}`);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Key differences:**
|
|
173
|
+
| Field | Hyperliquid (`Instrument`) | Lighter (`LighterInstrument`) |
|
|
174
|
+
|-------|---------------------------|------------------------------|
|
|
175
|
+
| Symbol | `name` | `symbol` |
|
|
176
|
+
| Size decimals | `szDecimals` | `sizeDecimals` |
|
|
177
|
+
| Fee info | Not available | `takerFee`, `makerFee`, `liquidationFee` |
|
|
178
|
+
| Market ID | Not available | `marketId` |
|
|
179
|
+
| Min amounts | Not available | `minBaseAmount`, `minQuoteAmount` |
|
|
180
|
+
|
|
118
181
|
### Funding Rates
|
|
119
182
|
|
|
120
183
|
```typescript
|
|
@@ -350,6 +413,8 @@ import type {
|
|
|
350
413
|
PriceLevel,
|
|
351
414
|
Trade,
|
|
352
415
|
Instrument,
|
|
416
|
+
LighterInstrument,
|
|
417
|
+
LighterGranularity,
|
|
353
418
|
FundingRate,
|
|
354
419
|
OpenInterest,
|
|
355
420
|
CursorResponse,
|
package/dist/index.d.mts
CHANGED
|
@@ -68,9 +68,27 @@ interface GetOrderBookParams {
|
|
|
68
68
|
/** Number of price levels to return per side */
|
|
69
69
|
depth?: number;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Lighter orderbook data granularity levels.
|
|
73
|
+
* Controls the resolution of historical orderbook data (Lighter.xyz only).
|
|
74
|
+
*
|
|
75
|
+
* - 'checkpoint': ~60s intervals (default, all tiers)
|
|
76
|
+
* - '30s': 30 second intervals (Build+ tier)
|
|
77
|
+
* - '10s': 10 second intervals (Build+ tier)
|
|
78
|
+
* - '1s': 1 second intervals (Pro+ tier)
|
|
79
|
+
* - 'tick': Checkpoint + raw deltas (Enterprise tier only)
|
|
80
|
+
*/
|
|
81
|
+
type LighterGranularity = 'checkpoint' | '30s' | '10s' | '1s' | 'tick';
|
|
71
82
|
interface OrderBookHistoryParams extends CursorPaginationParams {
|
|
72
83
|
/** Number of price levels to return per side */
|
|
73
84
|
depth?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Data resolution for Lighter orderbook history (Lighter.xyz only, ignored for Hyperliquid).
|
|
87
|
+
* Controls the granularity of returned snapshots. Tier restrictions apply.
|
|
88
|
+
* Credit multipliers: checkpoint=1x, 30s=2x, 10s=3x, 1s=10x, tick=20x.
|
|
89
|
+
* @default 'checkpoint'
|
|
90
|
+
*/
|
|
91
|
+
granularity?: LighterGranularity;
|
|
74
92
|
}
|
|
75
93
|
/** Trade side: 'A' (ask/sell) or 'B' (bid/buy) */
|
|
76
94
|
type TradeSide = 'A' | 'B';
|
|
@@ -148,7 +166,7 @@ interface CursorResponse<T> {
|
|
|
148
166
|
/** Instrument type */
|
|
149
167
|
type InstrumentType = 'perp' | 'spot';
|
|
150
168
|
/**
|
|
151
|
-
* Trading instrument metadata
|
|
169
|
+
* Trading instrument metadata (Hyperliquid)
|
|
152
170
|
*/
|
|
153
171
|
interface Instrument {
|
|
154
172
|
/** Instrument symbol (e.g., BTC) */
|
|
@@ -164,6 +182,40 @@ interface Instrument {
|
|
|
164
182
|
/** Whether the instrument is currently tradeable */
|
|
165
183
|
isActive: boolean;
|
|
166
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Trading instrument metadata (Lighter.xyz)
|
|
187
|
+
*
|
|
188
|
+
* Lighter instruments have a different schema than Hyperliquid with more
|
|
189
|
+
* detailed market configuration including fees and minimum amounts.
|
|
190
|
+
*/
|
|
191
|
+
interface LighterInstrument {
|
|
192
|
+
/** Instrument symbol (e.g., BTC, ETH) */
|
|
193
|
+
symbol: string;
|
|
194
|
+
/** Unique market identifier */
|
|
195
|
+
marketId: number;
|
|
196
|
+
/** Market type (e.g., 'perp') */
|
|
197
|
+
marketType: string;
|
|
198
|
+
/** Market status (e.g., 'active') */
|
|
199
|
+
status: string;
|
|
200
|
+
/** Taker fee rate (e.g., 0.0005 = 0.05%) */
|
|
201
|
+
takerFee: number;
|
|
202
|
+
/** Maker fee rate (e.g., 0.0002 = 0.02%) */
|
|
203
|
+
makerFee: number;
|
|
204
|
+
/** Liquidation fee rate */
|
|
205
|
+
liquidationFee: number;
|
|
206
|
+
/** Minimum order size in base currency */
|
|
207
|
+
minBaseAmount: number;
|
|
208
|
+
/** Minimum order size in quote currency */
|
|
209
|
+
minQuoteAmount: number;
|
|
210
|
+
/** Size decimal precision */
|
|
211
|
+
sizeDecimals: number;
|
|
212
|
+
/** Price decimal precision */
|
|
213
|
+
priceDecimals: number;
|
|
214
|
+
/** Quote currency decimal precision */
|
|
215
|
+
quoteDecimals: number;
|
|
216
|
+
/** Whether the instrument is currently tradeable */
|
|
217
|
+
isActive: boolean;
|
|
218
|
+
}
|
|
167
219
|
/**
|
|
168
220
|
* Funding rate record
|
|
169
221
|
*/
|
|
@@ -628,6 +680,40 @@ declare class InstrumentsResource {
|
|
|
628
680
|
*/
|
|
629
681
|
get(coin: string): Promise<Instrument>;
|
|
630
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Lighter.xyz Instruments API resource
|
|
685
|
+
*
|
|
686
|
+
* Lighter instruments have a different schema than Hyperliquid with more
|
|
687
|
+
* detailed market configuration including fees and minimum amounts.
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```typescript
|
|
691
|
+
* // List all Lighter instruments
|
|
692
|
+
* const instruments = await client.lighter.instruments.list();
|
|
693
|
+
*
|
|
694
|
+
* // Get specific instrument
|
|
695
|
+
* const btc = await client.lighter.instruments.get('BTC');
|
|
696
|
+
* console.log(`Taker fee: ${btc.takerFee}`);
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
declare class LighterInstrumentsResource {
|
|
700
|
+
private http;
|
|
701
|
+
private basePath;
|
|
702
|
+
constructor(http: HttpClient, basePath?: string);
|
|
703
|
+
/**
|
|
704
|
+
* List all available Lighter trading instruments
|
|
705
|
+
*
|
|
706
|
+
* @returns Array of Lighter instruments with full market configuration
|
|
707
|
+
*/
|
|
708
|
+
list(): Promise<LighterInstrument[]>;
|
|
709
|
+
/**
|
|
710
|
+
* Get a specific Lighter instrument by coin symbol
|
|
711
|
+
*
|
|
712
|
+
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
713
|
+
* @returns Lighter instrument details with full market configuration
|
|
714
|
+
*/
|
|
715
|
+
get(coin: string): Promise<LighterInstrument>;
|
|
716
|
+
}
|
|
631
717
|
|
|
632
718
|
/**
|
|
633
719
|
* Funding rates API resource
|
|
@@ -772,6 +858,8 @@ declare class HyperliquidClient {
|
|
|
772
858
|
* const client = new OxArchive({ apiKey: '...' });
|
|
773
859
|
* const orderbook = await client.lighter.orderbook.get('BTC');
|
|
774
860
|
* const trades = await client.lighter.trades.list('ETH', { start, end });
|
|
861
|
+
* const instruments = await client.lighter.instruments.list();
|
|
862
|
+
* console.log(`ETH taker fee: ${instruments[0].takerFee}`);
|
|
775
863
|
* ```
|
|
776
864
|
*/
|
|
777
865
|
declare class LighterClient {
|
|
@@ -784,9 +872,9 @@ declare class LighterClient {
|
|
|
784
872
|
*/
|
|
785
873
|
readonly trades: TradesResource;
|
|
786
874
|
/**
|
|
787
|
-
* Trading instruments metadata
|
|
875
|
+
* Trading instruments metadata (returns LighterInstrument with fees, min amounts, etc.)
|
|
788
876
|
*/
|
|
789
|
-
readonly instruments:
|
|
877
|
+
readonly instruments: LighterInstrumentsResource;
|
|
790
878
|
/**
|
|
791
879
|
* Funding rates
|
|
792
880
|
*/
|
|
@@ -2683,4 +2771,4 @@ type ValidatedFundingRate = z.infer<typeof FundingRateSchema>;
|
|
|
2683
2771
|
type ValidatedOpenInterest = z.infer<typeof OpenInterestSchema>;
|
|
2684
2772
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
2685
2773
|
|
|
2686
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type ClientOptions, type CursorResponse, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, LighterClient, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookResponseSchema, OrderBookSchema, OxArchive, OxArchiveError, OxArchiveWs, type PriceLevel, PriceLevelSchema, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, 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 };
|
|
2774
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type ClientOptions, type CursorResponse, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, LighterClient, type LighterGranularity, type LighterInstrument, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookResponseSchema, OrderBookSchema, OxArchive, OxArchiveError, OxArchiveWs, type PriceLevel, PriceLevelSchema, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -68,9 +68,27 @@ interface GetOrderBookParams {
|
|
|
68
68
|
/** Number of price levels to return per side */
|
|
69
69
|
depth?: number;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Lighter orderbook data granularity levels.
|
|
73
|
+
* Controls the resolution of historical orderbook data (Lighter.xyz only).
|
|
74
|
+
*
|
|
75
|
+
* - 'checkpoint': ~60s intervals (default, all tiers)
|
|
76
|
+
* - '30s': 30 second intervals (Build+ tier)
|
|
77
|
+
* - '10s': 10 second intervals (Build+ tier)
|
|
78
|
+
* - '1s': 1 second intervals (Pro+ tier)
|
|
79
|
+
* - 'tick': Checkpoint + raw deltas (Enterprise tier only)
|
|
80
|
+
*/
|
|
81
|
+
type LighterGranularity = 'checkpoint' | '30s' | '10s' | '1s' | 'tick';
|
|
71
82
|
interface OrderBookHistoryParams extends CursorPaginationParams {
|
|
72
83
|
/** Number of price levels to return per side */
|
|
73
84
|
depth?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Data resolution for Lighter orderbook history (Lighter.xyz only, ignored for Hyperliquid).
|
|
87
|
+
* Controls the granularity of returned snapshots. Tier restrictions apply.
|
|
88
|
+
* Credit multipliers: checkpoint=1x, 30s=2x, 10s=3x, 1s=10x, tick=20x.
|
|
89
|
+
* @default 'checkpoint'
|
|
90
|
+
*/
|
|
91
|
+
granularity?: LighterGranularity;
|
|
74
92
|
}
|
|
75
93
|
/** Trade side: 'A' (ask/sell) or 'B' (bid/buy) */
|
|
76
94
|
type TradeSide = 'A' | 'B';
|
|
@@ -148,7 +166,7 @@ interface CursorResponse<T> {
|
|
|
148
166
|
/** Instrument type */
|
|
149
167
|
type InstrumentType = 'perp' | 'spot';
|
|
150
168
|
/**
|
|
151
|
-
* Trading instrument metadata
|
|
169
|
+
* Trading instrument metadata (Hyperliquid)
|
|
152
170
|
*/
|
|
153
171
|
interface Instrument {
|
|
154
172
|
/** Instrument symbol (e.g., BTC) */
|
|
@@ -164,6 +182,40 @@ interface Instrument {
|
|
|
164
182
|
/** Whether the instrument is currently tradeable */
|
|
165
183
|
isActive: boolean;
|
|
166
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Trading instrument metadata (Lighter.xyz)
|
|
187
|
+
*
|
|
188
|
+
* Lighter instruments have a different schema than Hyperliquid with more
|
|
189
|
+
* detailed market configuration including fees and minimum amounts.
|
|
190
|
+
*/
|
|
191
|
+
interface LighterInstrument {
|
|
192
|
+
/** Instrument symbol (e.g., BTC, ETH) */
|
|
193
|
+
symbol: string;
|
|
194
|
+
/** Unique market identifier */
|
|
195
|
+
marketId: number;
|
|
196
|
+
/** Market type (e.g., 'perp') */
|
|
197
|
+
marketType: string;
|
|
198
|
+
/** Market status (e.g., 'active') */
|
|
199
|
+
status: string;
|
|
200
|
+
/** Taker fee rate (e.g., 0.0005 = 0.05%) */
|
|
201
|
+
takerFee: number;
|
|
202
|
+
/** Maker fee rate (e.g., 0.0002 = 0.02%) */
|
|
203
|
+
makerFee: number;
|
|
204
|
+
/** Liquidation fee rate */
|
|
205
|
+
liquidationFee: number;
|
|
206
|
+
/** Minimum order size in base currency */
|
|
207
|
+
minBaseAmount: number;
|
|
208
|
+
/** Minimum order size in quote currency */
|
|
209
|
+
minQuoteAmount: number;
|
|
210
|
+
/** Size decimal precision */
|
|
211
|
+
sizeDecimals: number;
|
|
212
|
+
/** Price decimal precision */
|
|
213
|
+
priceDecimals: number;
|
|
214
|
+
/** Quote currency decimal precision */
|
|
215
|
+
quoteDecimals: number;
|
|
216
|
+
/** Whether the instrument is currently tradeable */
|
|
217
|
+
isActive: boolean;
|
|
218
|
+
}
|
|
167
219
|
/**
|
|
168
220
|
* Funding rate record
|
|
169
221
|
*/
|
|
@@ -628,6 +680,40 @@ declare class InstrumentsResource {
|
|
|
628
680
|
*/
|
|
629
681
|
get(coin: string): Promise<Instrument>;
|
|
630
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Lighter.xyz Instruments API resource
|
|
685
|
+
*
|
|
686
|
+
* Lighter instruments have a different schema than Hyperliquid with more
|
|
687
|
+
* detailed market configuration including fees and minimum amounts.
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```typescript
|
|
691
|
+
* // List all Lighter instruments
|
|
692
|
+
* const instruments = await client.lighter.instruments.list();
|
|
693
|
+
*
|
|
694
|
+
* // Get specific instrument
|
|
695
|
+
* const btc = await client.lighter.instruments.get('BTC');
|
|
696
|
+
* console.log(`Taker fee: ${btc.takerFee}`);
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
declare class LighterInstrumentsResource {
|
|
700
|
+
private http;
|
|
701
|
+
private basePath;
|
|
702
|
+
constructor(http: HttpClient, basePath?: string);
|
|
703
|
+
/**
|
|
704
|
+
* List all available Lighter trading instruments
|
|
705
|
+
*
|
|
706
|
+
* @returns Array of Lighter instruments with full market configuration
|
|
707
|
+
*/
|
|
708
|
+
list(): Promise<LighterInstrument[]>;
|
|
709
|
+
/**
|
|
710
|
+
* Get a specific Lighter instrument by coin symbol
|
|
711
|
+
*
|
|
712
|
+
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
713
|
+
* @returns Lighter instrument details with full market configuration
|
|
714
|
+
*/
|
|
715
|
+
get(coin: string): Promise<LighterInstrument>;
|
|
716
|
+
}
|
|
631
717
|
|
|
632
718
|
/**
|
|
633
719
|
* Funding rates API resource
|
|
@@ -772,6 +858,8 @@ declare class HyperliquidClient {
|
|
|
772
858
|
* const client = new OxArchive({ apiKey: '...' });
|
|
773
859
|
* const orderbook = await client.lighter.orderbook.get('BTC');
|
|
774
860
|
* const trades = await client.lighter.trades.list('ETH', { start, end });
|
|
861
|
+
* const instruments = await client.lighter.instruments.list();
|
|
862
|
+
* console.log(`ETH taker fee: ${instruments[0].takerFee}`);
|
|
775
863
|
* ```
|
|
776
864
|
*/
|
|
777
865
|
declare class LighterClient {
|
|
@@ -784,9 +872,9 @@ declare class LighterClient {
|
|
|
784
872
|
*/
|
|
785
873
|
readonly trades: TradesResource;
|
|
786
874
|
/**
|
|
787
|
-
* Trading instruments metadata
|
|
875
|
+
* Trading instruments metadata (returns LighterInstrument with fees, min amounts, etc.)
|
|
788
876
|
*/
|
|
789
|
-
readonly instruments:
|
|
877
|
+
readonly instruments: LighterInstrumentsResource;
|
|
790
878
|
/**
|
|
791
879
|
* Funding rates
|
|
792
880
|
*/
|
|
@@ -2683,4 +2771,4 @@ type ValidatedFundingRate = z.infer<typeof FundingRateSchema>;
|
|
|
2683
2771
|
type ValidatedOpenInterest = z.infer<typeof OpenInterestSchema>;
|
|
2684
2772
|
type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
|
|
2685
2773
|
|
|
2686
|
-
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type ClientOptions, type CursorResponse, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, LighterClient, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookResponseSchema, OrderBookSchema, OxArchive, OxArchiveError, OxArchiveWs, type PriceLevel, PriceLevelSchema, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, 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 };
|
|
2774
|
+
export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type ClientOptions, type CursorResponse, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesCursorParams, HyperliquidClient, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, LighterClient, type LighterGranularity, type LighterInstrument, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookResponseSchema, OrderBookSchema, OxArchive, OxArchiveError, OxArchiveWs, type PriceLevel, PriceLevelSchema, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, 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 };
|
package/dist/index.js
CHANGED
|
@@ -428,7 +428,7 @@ var OrderBookResource = class {
|
|
|
428
428
|
*/
|
|
429
429
|
async history(coin, params) {
|
|
430
430
|
const response = await this.http.get(
|
|
431
|
-
|
|
431
|
+
`${this.basePath}/orderbook/${coin.toUpperCase()}/history`,
|
|
432
432
|
params,
|
|
433
433
|
this.http.validationEnabled ? OrderBookArrayResponseSchema : void 0
|
|
434
434
|
);
|
|
@@ -537,6 +537,35 @@ var InstrumentsResource = class {
|
|
|
537
537
|
return response.data;
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
+
var LighterInstrumentsResource = class {
|
|
541
|
+
constructor(http, basePath = "/v1/lighter") {
|
|
542
|
+
this.http = http;
|
|
543
|
+
this.basePath = basePath;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* List all available Lighter trading instruments
|
|
547
|
+
*
|
|
548
|
+
* @returns Array of Lighter instruments with full market configuration
|
|
549
|
+
*/
|
|
550
|
+
async list() {
|
|
551
|
+
const response = await this.http.get(
|
|
552
|
+
`${this.basePath}/instruments`
|
|
553
|
+
);
|
|
554
|
+
return response.data;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Get a specific Lighter instrument by coin symbol
|
|
558
|
+
*
|
|
559
|
+
* @param coin - The coin symbol (e.g., 'BTC', 'ETH')
|
|
560
|
+
* @returns Lighter instrument details with full market configuration
|
|
561
|
+
*/
|
|
562
|
+
async get(coin) {
|
|
563
|
+
const response = await this.http.get(
|
|
564
|
+
`${this.basePath}/instruments/${coin.toUpperCase()}`
|
|
565
|
+
);
|
|
566
|
+
return response.data;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
540
569
|
|
|
541
570
|
// src/resources/funding.ts
|
|
542
571
|
var FundingResource = class {
|
|
@@ -659,7 +688,7 @@ var LighterClient = class {
|
|
|
659
688
|
*/
|
|
660
689
|
trades;
|
|
661
690
|
/**
|
|
662
|
-
* Trading instruments metadata
|
|
691
|
+
* Trading instruments metadata (returns LighterInstrument with fees, min amounts, etc.)
|
|
663
692
|
*/
|
|
664
693
|
instruments;
|
|
665
694
|
/**
|
|
@@ -674,7 +703,7 @@ var LighterClient = class {
|
|
|
674
703
|
const basePath = "/v1/lighter";
|
|
675
704
|
this.orderbook = new OrderBookResource(http, basePath);
|
|
676
705
|
this.trades = new TradesResource(http, basePath);
|
|
677
|
-
this.instruments = new
|
|
706
|
+
this.instruments = new LighterInstrumentsResource(http, basePath);
|
|
678
707
|
this.funding = new FundingResource(http, basePath);
|
|
679
708
|
this.openInterest = new OpenInterestResource(http, basePath);
|
|
680
709
|
}
|