@0xarchive/sdk 0.9.1 → 1.2.0
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 +296 -111
- package/dist/index.d.mts +446 -64
- package/dist/index.d.ts +446 -64
- package/dist/index.js +468 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +468 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -136,6 +136,14 @@ var HttpClient = class {
|
|
|
136
136
|
get validationEnabled() {
|
|
137
137
|
return this.validate;
|
|
138
138
|
}
|
|
139
|
+
/** Base URL for raw requests (used by web3 subscribe) */
|
|
140
|
+
getBaseUrl() {
|
|
141
|
+
return this.baseUrl;
|
|
142
|
+
}
|
|
143
|
+
/** Timeout in ms for raw requests (used by web3 subscribe) */
|
|
144
|
+
getTimeout() {
|
|
145
|
+
return this.timeout;
|
|
146
|
+
}
|
|
139
147
|
/**
|
|
140
148
|
* Make a GET request to the API
|
|
141
149
|
*
|
|
@@ -206,6 +214,66 @@ var HttpClient = class {
|
|
|
206
214
|
);
|
|
207
215
|
}
|
|
208
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Make a POST request to the API
|
|
219
|
+
*
|
|
220
|
+
* @param path - API endpoint path
|
|
221
|
+
* @param body - JSON request body
|
|
222
|
+
* @param schema - Optional Zod schema for validation (used when validation is enabled)
|
|
223
|
+
*/
|
|
224
|
+
async post(path, body, schema) {
|
|
225
|
+
const url = `${this.baseUrl}${path}`;
|
|
226
|
+
const controller = new AbortController();
|
|
227
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
228
|
+
try {
|
|
229
|
+
const response = await fetch(url, {
|
|
230
|
+
method: "POST",
|
|
231
|
+
headers: {
|
|
232
|
+
"X-API-Key": this.apiKey,
|
|
233
|
+
"Content-Type": "application/json"
|
|
234
|
+
},
|
|
235
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
236
|
+
signal: controller.signal
|
|
237
|
+
});
|
|
238
|
+
clearTimeout(timeoutId);
|
|
239
|
+
const rawData = await response.json();
|
|
240
|
+
const data = transformKeys(rawData);
|
|
241
|
+
if (!response.ok) {
|
|
242
|
+
const error = data;
|
|
243
|
+
const apiResponse = data;
|
|
244
|
+
throw new OxArchiveError(
|
|
245
|
+
error.error || `Request failed with status ${response.status}`,
|
|
246
|
+
response.status,
|
|
247
|
+
apiResponse.meta?.requestId
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
if (this.validate && schema) {
|
|
251
|
+
const result = schema.safeParse(data);
|
|
252
|
+
if (!result.success) {
|
|
253
|
+
const apiResponse = data;
|
|
254
|
+
throw new OxArchiveError(
|
|
255
|
+
`Response validation failed: ${result.error.message}`,
|
|
256
|
+
422,
|
|
257
|
+
apiResponse.meta?.requestId
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
return result.data;
|
|
261
|
+
}
|
|
262
|
+
return data;
|
|
263
|
+
} catch (error) {
|
|
264
|
+
clearTimeout(timeoutId);
|
|
265
|
+
if (error instanceof OxArchiveError) {
|
|
266
|
+
throw error;
|
|
267
|
+
}
|
|
268
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
269
|
+
throw new OxArchiveError(`Request timeout after ${this.timeout}ms`, 408);
|
|
270
|
+
}
|
|
271
|
+
throw new OxArchiveError(
|
|
272
|
+
error instanceof Error ? error.message : "Unknown error",
|
|
273
|
+
500
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
209
277
|
};
|
|
210
278
|
|
|
211
279
|
// src/schemas.ts
|
|
@@ -704,15 +772,15 @@ var OrderBookResource = class {
|
|
|
704
772
|
this.coinTransform = coinTransform;
|
|
705
773
|
}
|
|
706
774
|
/**
|
|
707
|
-
* Get order book snapshot for a
|
|
775
|
+
* Get order book snapshot for a symbol
|
|
708
776
|
*
|
|
709
|
-
* @param
|
|
777
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
710
778
|
* @param params - Optional parameters
|
|
711
779
|
* @returns Order book snapshot
|
|
712
780
|
*/
|
|
713
|
-
async get(
|
|
781
|
+
async get(symbol, params) {
|
|
714
782
|
const response = await this.http.get(
|
|
715
|
-
`${this.basePath}/orderbook/${this.coinTransform(
|
|
783
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}`,
|
|
716
784
|
params,
|
|
717
785
|
this.http.validationEnabled ? OrderBookResponseSchema : void 0
|
|
718
786
|
);
|
|
@@ -721,7 +789,7 @@ var OrderBookResource = class {
|
|
|
721
789
|
/**
|
|
722
790
|
* Get historical order book snapshots with cursor-based pagination
|
|
723
791
|
*
|
|
724
|
-
* @param
|
|
792
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
725
793
|
* @param params - Time range and cursor pagination parameters (start and end are required)
|
|
726
794
|
* @returns CursorResponse with order book snapshots and nextCursor for pagination
|
|
727
795
|
*
|
|
@@ -745,9 +813,9 @@ var OrderBookResource = class {
|
|
|
745
813
|
* }
|
|
746
814
|
* ```
|
|
747
815
|
*/
|
|
748
|
-
async history(
|
|
816
|
+
async history(symbol, params) {
|
|
749
817
|
const response = await this.http.get(
|
|
750
|
-
`${this.basePath}/orderbook/${this.coinTransform(
|
|
818
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}/history`,
|
|
751
819
|
params,
|
|
752
820
|
this.http.validationEnabled ? OrderBookArrayResponseSchema : void 0
|
|
753
821
|
);
|
|
@@ -765,7 +833,7 @@ var OrderBookResource = class {
|
|
|
765
833
|
*
|
|
766
834
|
* For automatic reconstruction, use `historyReconstructed()` instead.
|
|
767
835
|
*
|
|
768
|
-
* @param
|
|
836
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
769
837
|
* @param params - Time range parameters
|
|
770
838
|
* @returns Tick data with checkpoint and deltas
|
|
771
839
|
*
|
|
@@ -785,9 +853,9 @@ var OrderBookResource = class {
|
|
|
785
853
|
* }
|
|
786
854
|
* ```
|
|
787
855
|
*/
|
|
788
|
-
async historyTick(
|
|
856
|
+
async historyTick(symbol, params) {
|
|
789
857
|
const response = await this.http.get(
|
|
790
|
-
`${this.basePath}/orderbook/${this.coinTransform(
|
|
858
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}/history`,
|
|
791
859
|
{
|
|
792
860
|
...params,
|
|
793
861
|
granularity: "tick"
|
|
@@ -812,7 +880,7 @@ var OrderBookResource = class {
|
|
|
812
880
|
* For large time ranges, consider using `historyTick()` with the
|
|
813
881
|
* `OrderBookReconstructor.iterate()` method for memory efficiency.
|
|
814
882
|
*
|
|
815
|
-
* @param
|
|
883
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
816
884
|
* @param params - Time range parameters
|
|
817
885
|
* @param options - Reconstruction options
|
|
818
886
|
* @returns Array of reconstructed orderbook snapshots
|
|
@@ -836,8 +904,8 @@ var OrderBookResource = class {
|
|
|
836
904
|
* );
|
|
837
905
|
* ```
|
|
838
906
|
*/
|
|
839
|
-
async historyReconstructed(
|
|
840
|
-
const tickData = await this.historyTick(
|
|
907
|
+
async historyReconstructed(symbol, params, options = {}) {
|
|
908
|
+
const tickData = await this.historyTick(symbol, params);
|
|
841
909
|
const reconstructor = new OrderBookReconstructor();
|
|
842
910
|
return reconstructor.reconstructAll(tickData.checkpoint, tickData.deltas, options);
|
|
843
911
|
}
|
|
@@ -877,7 +945,7 @@ var OrderBookResource = class {
|
|
|
877
945
|
* per API request and yielding reconstructed orderbook snapshots one at a time.
|
|
878
946
|
* Memory-efficient for processing large time ranges.
|
|
879
947
|
*
|
|
880
|
-
* @param
|
|
948
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
881
949
|
* @param params - Time range parameters
|
|
882
950
|
* @param depth - Maximum price levels to include in output snapshots
|
|
883
951
|
* @yields Reconstructed orderbook snapshots
|
|
@@ -900,7 +968,7 @@ var OrderBookResource = class {
|
|
|
900
968
|
* }
|
|
901
969
|
* ```
|
|
902
970
|
*/
|
|
903
|
-
async *iterateTickHistory(
|
|
971
|
+
async *iterateTickHistory(symbol, params, depth) {
|
|
904
972
|
const startTs = typeof params.start === "string" ? new Date(params.start).getTime() : params.start;
|
|
905
973
|
const endTs = typeof params.end === "string" ? new Date(params.end).getTime() : params.end;
|
|
906
974
|
let cursor = startTs;
|
|
@@ -908,7 +976,7 @@ var OrderBookResource = class {
|
|
|
908
976
|
const MAX_DELTAS_PER_PAGE = 1e3;
|
|
909
977
|
let isFirstPage = true;
|
|
910
978
|
while (cursor < endTs) {
|
|
911
|
-
const tickData = await this.historyTick(
|
|
979
|
+
const tickData = await this.historyTick(symbol, {
|
|
912
980
|
start: cursor,
|
|
913
981
|
end: endTs,
|
|
914
982
|
depth: params.depth
|
|
@@ -946,12 +1014,12 @@ var TradesResource = class {
|
|
|
946
1014
|
this.coinTransform = coinTransform;
|
|
947
1015
|
}
|
|
948
1016
|
/**
|
|
949
|
-
* Get trade history for a
|
|
1017
|
+
* Get trade history for a symbol using cursor-based pagination
|
|
950
1018
|
*
|
|
951
1019
|
* Uses cursor-based pagination by default, which is more efficient for large datasets.
|
|
952
1020
|
* Use the `nextCursor` from the response as the `cursor` parameter to get the next page.
|
|
953
1021
|
*
|
|
954
|
-
* @param
|
|
1022
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
955
1023
|
* @param params - Time range and cursor pagination parameters (start and end are required)
|
|
956
1024
|
* @returns Object with trades array and nextCursor for pagination
|
|
957
1025
|
*
|
|
@@ -975,9 +1043,9 @@ var TradesResource = class {
|
|
|
975
1043
|
* }
|
|
976
1044
|
* ```
|
|
977
1045
|
*/
|
|
978
|
-
async list(
|
|
1046
|
+
async list(symbol, params) {
|
|
979
1047
|
const response = await this.http.get(
|
|
980
|
-
`${this.basePath}/trades/${this.coinTransform(
|
|
1048
|
+
`${this.basePath}/trades/${this.coinTransform(symbol)}`,
|
|
981
1049
|
params,
|
|
982
1050
|
this.http.validationEnabled ? TradeArrayResponseSchema : void 0
|
|
983
1051
|
);
|
|
@@ -987,20 +1055,20 @@ var TradesResource = class {
|
|
|
987
1055
|
};
|
|
988
1056
|
}
|
|
989
1057
|
/**
|
|
990
|
-
* Get most recent trades for a
|
|
1058
|
+
* Get most recent trades for a symbol.
|
|
991
1059
|
*
|
|
992
1060
|
* Note: This method is available for Lighter (client.lighter.trades.recent())
|
|
993
1061
|
* and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
|
|
994
1062
|
* ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
|
|
995
1063
|
* for Hyperliquid.
|
|
996
1064
|
*
|
|
997
|
-
* @param
|
|
1065
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
998
1066
|
* @param limit - Number of trades to return (default: 100)
|
|
999
1067
|
* @returns Array of recent trades
|
|
1000
1068
|
*/
|
|
1001
|
-
async recent(
|
|
1069
|
+
async recent(symbol, limit) {
|
|
1002
1070
|
const response = await this.http.get(
|
|
1003
|
-
`${this.basePath}/trades/${this.coinTransform(
|
|
1071
|
+
`${this.basePath}/trades/${this.coinTransform(symbol)}/recent`,
|
|
1004
1072
|
{ limit },
|
|
1005
1073
|
this.http.validationEnabled ? TradeArrayResponseSchema : void 0
|
|
1006
1074
|
);
|
|
@@ -1112,15 +1180,15 @@ var FundingResource = class {
|
|
|
1112
1180
|
this.coinTransform = coinTransform;
|
|
1113
1181
|
}
|
|
1114
1182
|
/**
|
|
1115
|
-
* Get funding rate history for a
|
|
1183
|
+
* Get funding rate history for a symbol with cursor-based pagination
|
|
1116
1184
|
*
|
|
1117
|
-
* @param
|
|
1185
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1118
1186
|
* @param params - Time range and cursor pagination parameters (start and end are required)
|
|
1119
1187
|
* @returns CursorResponse with funding rate records and nextCursor for pagination
|
|
1120
1188
|
*/
|
|
1121
|
-
async history(
|
|
1189
|
+
async history(symbol, params) {
|
|
1122
1190
|
const response = await this.http.get(
|
|
1123
|
-
`${this.basePath}/funding/${this.coinTransform(
|
|
1191
|
+
`${this.basePath}/funding/${this.coinTransform(symbol)}`,
|
|
1124
1192
|
params,
|
|
1125
1193
|
this.http.validationEnabled ? FundingRateArrayResponseSchema : void 0
|
|
1126
1194
|
);
|
|
@@ -1130,14 +1198,14 @@ var FundingResource = class {
|
|
|
1130
1198
|
};
|
|
1131
1199
|
}
|
|
1132
1200
|
/**
|
|
1133
|
-
* Get current funding rate for a
|
|
1201
|
+
* Get current funding rate for a symbol
|
|
1134
1202
|
*
|
|
1135
|
-
* @param
|
|
1203
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1136
1204
|
* @returns Current funding rate
|
|
1137
1205
|
*/
|
|
1138
|
-
async current(
|
|
1206
|
+
async current(symbol) {
|
|
1139
1207
|
const response = await this.http.get(
|
|
1140
|
-
`${this.basePath}/funding/${this.coinTransform(
|
|
1208
|
+
`${this.basePath}/funding/${this.coinTransform(symbol)}/current`,
|
|
1141
1209
|
void 0,
|
|
1142
1210
|
this.http.validationEnabled ? FundingRateResponseSchema : void 0
|
|
1143
1211
|
);
|
|
@@ -1153,15 +1221,15 @@ var OpenInterestResource = class {
|
|
|
1153
1221
|
this.coinTransform = coinTransform;
|
|
1154
1222
|
}
|
|
1155
1223
|
/**
|
|
1156
|
-
* Get open interest history for a
|
|
1224
|
+
* Get open interest history for a symbol with cursor-based pagination
|
|
1157
1225
|
*
|
|
1158
|
-
* @param
|
|
1226
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1159
1227
|
* @param params - Time range and cursor pagination parameters (start and end are required)
|
|
1160
1228
|
* @returns CursorResponse with open interest records and nextCursor for pagination
|
|
1161
1229
|
*/
|
|
1162
|
-
async history(
|
|
1230
|
+
async history(symbol, params) {
|
|
1163
1231
|
const response = await this.http.get(
|
|
1164
|
-
`${this.basePath}/openinterest/${this.coinTransform(
|
|
1232
|
+
`${this.basePath}/openinterest/${this.coinTransform(symbol)}`,
|
|
1165
1233
|
params,
|
|
1166
1234
|
this.http.validationEnabled ? OpenInterestArrayResponseSchema : void 0
|
|
1167
1235
|
);
|
|
@@ -1171,14 +1239,14 @@ var OpenInterestResource = class {
|
|
|
1171
1239
|
};
|
|
1172
1240
|
}
|
|
1173
1241
|
/**
|
|
1174
|
-
* Get current open interest for a
|
|
1242
|
+
* Get current open interest for a symbol
|
|
1175
1243
|
*
|
|
1176
|
-
* @param
|
|
1244
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1177
1245
|
* @returns Current open interest
|
|
1178
1246
|
*/
|
|
1179
|
-
async current(
|
|
1247
|
+
async current(symbol) {
|
|
1180
1248
|
const response = await this.http.get(
|
|
1181
|
-
`${this.basePath}/openinterest/${this.coinTransform(
|
|
1249
|
+
`${this.basePath}/openinterest/${this.coinTransform(symbol)}/current`,
|
|
1182
1250
|
void 0,
|
|
1183
1251
|
this.http.validationEnabled ? OpenInterestResponseSchema : void 0
|
|
1184
1252
|
);
|
|
@@ -1196,13 +1264,13 @@ var CandlesResource = class {
|
|
|
1196
1264
|
/**
|
|
1197
1265
|
* Get historical OHLCV candle data with cursor-based pagination
|
|
1198
1266
|
*
|
|
1199
|
-
* @param
|
|
1267
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1200
1268
|
* @param params - Time range, interval, and cursor pagination parameters (start and end are required)
|
|
1201
1269
|
* @returns CursorResponse with candle records and nextCursor for pagination
|
|
1202
1270
|
*/
|
|
1203
|
-
async history(
|
|
1271
|
+
async history(symbol, params) {
|
|
1204
1272
|
const response = await this.http.get(
|
|
1205
|
-
`${this.basePath}/candles/${this.coinTransform(
|
|
1273
|
+
`${this.basePath}/candles/${this.coinTransform(symbol)}`,
|
|
1206
1274
|
params,
|
|
1207
1275
|
this.http.validationEnabled ? CandleArrayResponseSchema : void 0
|
|
1208
1276
|
);
|
|
@@ -1215,20 +1283,21 @@ var CandlesResource = class {
|
|
|
1215
1283
|
|
|
1216
1284
|
// src/resources/liquidations.ts
|
|
1217
1285
|
var LiquidationsResource = class {
|
|
1218
|
-
constructor(http, basePath = "/v1") {
|
|
1286
|
+
constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
|
|
1219
1287
|
this.http = http;
|
|
1220
1288
|
this.basePath = basePath;
|
|
1289
|
+
this.coinTransform = coinTransform;
|
|
1221
1290
|
}
|
|
1222
1291
|
/**
|
|
1223
|
-
* Get liquidation history for a
|
|
1292
|
+
* Get liquidation history for a symbol with cursor-based pagination
|
|
1224
1293
|
*
|
|
1225
|
-
* @param
|
|
1294
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1226
1295
|
* @param params - Time range and cursor pagination parameters (start and end are required)
|
|
1227
1296
|
* @returns CursorResponse with liquidation records and nextCursor for pagination
|
|
1228
1297
|
*/
|
|
1229
|
-
async history(
|
|
1298
|
+
async history(symbol, params) {
|
|
1230
1299
|
const response = await this.http.get(
|
|
1231
|
-
`${this.basePath}/liquidations/${
|
|
1300
|
+
`${this.basePath}/liquidations/${this.coinTransform(symbol)}`,
|
|
1232
1301
|
params,
|
|
1233
1302
|
this.http.validationEnabled ? LiquidationArrayResponseSchema : void 0
|
|
1234
1303
|
);
|
|
@@ -1265,13 +1334,13 @@ var LiquidationsResource = class {
|
|
|
1265
1334
|
* Returns pre-aggregated data with total/long/short USD volumes per bucket,
|
|
1266
1335
|
* reducing data transfer by 100-1000x compared to individual liquidation records.
|
|
1267
1336
|
*
|
|
1268
|
-
* @param
|
|
1337
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1269
1338
|
* @param params - Time range, cursor, and interval parameters
|
|
1270
1339
|
* @returns CursorResponse with liquidation volume buckets
|
|
1271
1340
|
*/
|
|
1272
|
-
async volume(
|
|
1341
|
+
async volume(symbol, params) {
|
|
1273
1342
|
const response = await this.http.get(
|
|
1274
|
-
`${this.basePath}/liquidations/${
|
|
1343
|
+
`${this.basePath}/liquidations/${this.coinTransform(symbol)}/volume`,
|
|
1275
1344
|
params,
|
|
1276
1345
|
this.http.validationEnabled ? LiquidationVolumeArrayResponseSchema : void 0
|
|
1277
1346
|
);
|
|
@@ -1477,6 +1546,286 @@ var DataQualityResource = class {
|
|
|
1477
1546
|
}
|
|
1478
1547
|
};
|
|
1479
1548
|
|
|
1549
|
+
// src/resources/web3.ts
|
|
1550
|
+
var Web3Resource = class {
|
|
1551
|
+
constructor(http) {
|
|
1552
|
+
this.http = http;
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Get a SIWE challenge message to sign.
|
|
1556
|
+
*
|
|
1557
|
+
* @param address - Ethereum wallet address
|
|
1558
|
+
* @returns SIWE message and nonce. Sign the message with personal_sign (EIP-191).
|
|
1559
|
+
*/
|
|
1560
|
+
async challenge(address) {
|
|
1561
|
+
return this.http.post("/v1/auth/web3/challenge", { address });
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Create a free-tier account and get an API key.
|
|
1565
|
+
*
|
|
1566
|
+
* @param message - The SIWE message from {@link challenge}
|
|
1567
|
+
* @param signature - Hex-encoded signature from personal_sign
|
|
1568
|
+
* @returns API key, tier, and wallet address
|
|
1569
|
+
*/
|
|
1570
|
+
async signup(message, signature) {
|
|
1571
|
+
return this.http.post("/v1/web3/signup", { message, signature });
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* List all API keys for the authenticated wallet.
|
|
1575
|
+
*
|
|
1576
|
+
* @param message - The SIWE message from {@link challenge}
|
|
1577
|
+
* @param signature - Hex-encoded signature from personal_sign
|
|
1578
|
+
* @returns List of API keys and wallet address
|
|
1579
|
+
*/
|
|
1580
|
+
async listKeys(message, signature) {
|
|
1581
|
+
return this.http.post("/v1/web3/keys", { message, signature });
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Revoke a specific API key.
|
|
1585
|
+
*
|
|
1586
|
+
* @param message - The SIWE message from {@link challenge}
|
|
1587
|
+
* @param signature - Hex-encoded signature from personal_sign
|
|
1588
|
+
* @param keyId - UUID of the key to revoke
|
|
1589
|
+
* @returns Confirmation message and wallet address
|
|
1590
|
+
*/
|
|
1591
|
+
async revokeKey(message, signature, keyId) {
|
|
1592
|
+
return this.http.post("/v1/web3/keys/revoke", {
|
|
1593
|
+
message,
|
|
1594
|
+
signature,
|
|
1595
|
+
key_id: keyId
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Get pricing info for a paid subscription (x402 flow, step 1).
|
|
1600
|
+
*
|
|
1601
|
+
* Returns the payment details needed to sign a USDC transfer on Base.
|
|
1602
|
+
* After signing, pass the payment signature to {@link subscribe}.
|
|
1603
|
+
*
|
|
1604
|
+
* @param tier - Subscription tier: 'build' ($49/mo) or 'pro' ($199/mo)
|
|
1605
|
+
* @returns Payment details (amount, asset, network, pay-to address)
|
|
1606
|
+
*/
|
|
1607
|
+
async subscribeQuote(tier) {
|
|
1608
|
+
const url = `${this.http.getBaseUrl()}/v1/web3/subscribe`;
|
|
1609
|
+
const timeout = this.http.getTimeout();
|
|
1610
|
+
const controller = new AbortController();
|
|
1611
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1612
|
+
try {
|
|
1613
|
+
const response = await fetch(url, {
|
|
1614
|
+
method: "POST",
|
|
1615
|
+
headers: { "Content-Type": "application/json" },
|
|
1616
|
+
body: JSON.stringify({ tier }),
|
|
1617
|
+
signal: controller.signal
|
|
1618
|
+
});
|
|
1619
|
+
clearTimeout(timeoutId);
|
|
1620
|
+
const rawData = await response.json();
|
|
1621
|
+
const data = transformKeys(rawData);
|
|
1622
|
+
if (response.status === 402) {
|
|
1623
|
+
return data.payment;
|
|
1624
|
+
}
|
|
1625
|
+
throw new OxArchiveError(
|
|
1626
|
+
data.error || `Unexpected status ${response.status}`,
|
|
1627
|
+
response.status
|
|
1628
|
+
);
|
|
1629
|
+
} catch (error) {
|
|
1630
|
+
clearTimeout(timeoutId);
|
|
1631
|
+
if (error instanceof OxArchiveError) throw error;
|
|
1632
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
1633
|
+
throw new OxArchiveError(`Request timeout after ${timeout}ms`, 408);
|
|
1634
|
+
}
|
|
1635
|
+
throw new OxArchiveError(
|
|
1636
|
+
error instanceof Error ? error.message : "Unknown error",
|
|
1637
|
+
500
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Complete a paid subscription with a signed x402 payment (step 2).
|
|
1643
|
+
*
|
|
1644
|
+
* Requires a payment signature from signing a USDC transfer (EIP-3009)
|
|
1645
|
+
* for the amount returned by {@link subscribeQuote}.
|
|
1646
|
+
*
|
|
1647
|
+
* @param tier - Subscription tier: 'build' or 'pro'
|
|
1648
|
+
* @param paymentSignature - Signed x402 payment (from EIP-3009 USDC transfer on Base)
|
|
1649
|
+
* @returns API key, tier, expiration, and wallet address
|
|
1650
|
+
*/
|
|
1651
|
+
async subscribe(tier, paymentSignature) {
|
|
1652
|
+
const url = `${this.http.getBaseUrl()}/v1/web3/subscribe`;
|
|
1653
|
+
const timeout = this.http.getTimeout();
|
|
1654
|
+
const controller = new AbortController();
|
|
1655
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1656
|
+
try {
|
|
1657
|
+
const response = await fetch(url, {
|
|
1658
|
+
method: "POST",
|
|
1659
|
+
headers: {
|
|
1660
|
+
"Content-Type": "application/json",
|
|
1661
|
+
"payment-signature": paymentSignature
|
|
1662
|
+
},
|
|
1663
|
+
body: JSON.stringify({ tier }),
|
|
1664
|
+
signal: controller.signal
|
|
1665
|
+
});
|
|
1666
|
+
clearTimeout(timeoutId);
|
|
1667
|
+
const rawData = await response.json();
|
|
1668
|
+
const data = transformKeys(rawData);
|
|
1669
|
+
if (!response.ok) {
|
|
1670
|
+
throw new OxArchiveError(
|
|
1671
|
+
data.error || "Subscribe failed",
|
|
1672
|
+
response.status
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
return data;
|
|
1676
|
+
} catch (error) {
|
|
1677
|
+
clearTimeout(timeoutId);
|
|
1678
|
+
if (error instanceof OxArchiveError) throw error;
|
|
1679
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
1680
|
+
throw new OxArchiveError(`Request timeout after ${timeout}ms`, 408);
|
|
1681
|
+
}
|
|
1682
|
+
throw new OxArchiveError(
|
|
1683
|
+
error instanceof Error ? error.message : "Unknown error",
|
|
1684
|
+
500
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
// src/resources/orders.ts
|
|
1691
|
+
var OrdersResource = class {
|
|
1692
|
+
constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
|
|
1693
|
+
this.http = http;
|
|
1694
|
+
this.basePath = basePath;
|
|
1695
|
+
this.coinTransform = coinTransform;
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Get order history for a symbol with cursor-based pagination
|
|
1699
|
+
*
|
|
1700
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1701
|
+
* @param params - Time range, cursor pagination, and filter parameters
|
|
1702
|
+
* @returns CursorResponse with order records and nextCursor for pagination
|
|
1703
|
+
*/
|
|
1704
|
+
async history(symbol, params) {
|
|
1705
|
+
const response = await this.http.get(
|
|
1706
|
+
`${this.basePath}/orders/${this.coinTransform(symbol)}/history`,
|
|
1707
|
+
params
|
|
1708
|
+
);
|
|
1709
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Get order flow for a symbol
|
|
1713
|
+
*
|
|
1714
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1715
|
+
* @param params - Time range and interval parameters
|
|
1716
|
+
* @returns CursorResponse with order flow records
|
|
1717
|
+
*/
|
|
1718
|
+
async flow(symbol, params) {
|
|
1719
|
+
const response = await this.http.get(
|
|
1720
|
+
`${this.basePath}/orders/${this.coinTransform(symbol)}/flow`,
|
|
1721
|
+
params
|
|
1722
|
+
);
|
|
1723
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Get TP/SL orders for a symbol with cursor-based pagination
|
|
1727
|
+
*
|
|
1728
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1729
|
+
* @param params - Time range, cursor pagination, and filter parameters
|
|
1730
|
+
* @returns CursorResponse with TP/SL order records
|
|
1731
|
+
*/
|
|
1732
|
+
async tpsl(symbol, params) {
|
|
1733
|
+
const response = await this.http.get(
|
|
1734
|
+
`${this.basePath}/orders/${this.coinTransform(symbol)}/tpsl`,
|
|
1735
|
+
params
|
|
1736
|
+
);
|
|
1737
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
// src/resources/l4-orderbook.ts
|
|
1742
|
+
var L4OrderBookResource = class {
|
|
1743
|
+
constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
|
|
1744
|
+
this.http = http;
|
|
1745
|
+
this.basePath = basePath;
|
|
1746
|
+
this.coinTransform = coinTransform;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Get L4 order book snapshot for a symbol
|
|
1750
|
+
*
|
|
1751
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1752
|
+
* @param params - Optional parameters (timestamp, depth)
|
|
1753
|
+
* @returns L4 order book snapshot
|
|
1754
|
+
*/
|
|
1755
|
+
async get(symbol, params) {
|
|
1756
|
+
const response = await this.http.get(
|
|
1757
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}/l4`,
|
|
1758
|
+
params
|
|
1759
|
+
);
|
|
1760
|
+
return response.data;
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Get L4 order book diffs with cursor-based pagination
|
|
1764
|
+
*
|
|
1765
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1766
|
+
* @param params - Time range and cursor pagination parameters
|
|
1767
|
+
* @returns CursorResponse with L4 orderbook diffs and nextCursor for pagination
|
|
1768
|
+
*/
|
|
1769
|
+
async diffs(symbol, params) {
|
|
1770
|
+
const response = await this.http.get(
|
|
1771
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}/l4/diffs`,
|
|
1772
|
+
params
|
|
1773
|
+
);
|
|
1774
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Get L4 order book history with cursor-based pagination
|
|
1778
|
+
*
|
|
1779
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1780
|
+
* @param params - Time range and cursor pagination parameters
|
|
1781
|
+
* @returns CursorResponse with L4 orderbook snapshots and nextCursor for pagination
|
|
1782
|
+
*/
|
|
1783
|
+
async history(symbol, params) {
|
|
1784
|
+
const response = await this.http.get(
|
|
1785
|
+
`${this.basePath}/orderbook/${this.coinTransform(symbol)}/l4/history`,
|
|
1786
|
+
params
|
|
1787
|
+
);
|
|
1788
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1789
|
+
}
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1792
|
+
// src/resources/l3-orderbook.ts
|
|
1793
|
+
var L3OrderBookResource = class {
|
|
1794
|
+
constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
|
|
1795
|
+
this.http = http;
|
|
1796
|
+
this.basePath = basePath;
|
|
1797
|
+
this.coinTransform = coinTransform;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Get L3 order book snapshot for a symbol
|
|
1801
|
+
*
|
|
1802
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1803
|
+
* @param params - Optional parameters (timestamp, depth)
|
|
1804
|
+
* @returns L3 order book snapshot
|
|
1805
|
+
*/
|
|
1806
|
+
async get(symbol, params) {
|
|
1807
|
+
const response = await this.http.get(
|
|
1808
|
+
`${this.basePath}/l3orderbook/${this.coinTransform(symbol)}`,
|
|
1809
|
+
params
|
|
1810
|
+
);
|
|
1811
|
+
return response.data;
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Get L3 order book history with cursor-based pagination
|
|
1815
|
+
*
|
|
1816
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1817
|
+
* @param params - Time range and cursor pagination parameters
|
|
1818
|
+
* @returns CursorResponse with L3 orderbook snapshots and nextCursor for pagination
|
|
1819
|
+
*/
|
|
1820
|
+
async history(symbol, params) {
|
|
1821
|
+
const response = await this.http.get(
|
|
1822
|
+
`${this.basePath}/l3orderbook/${this.coinTransform(symbol)}/history`,
|
|
1823
|
+
params
|
|
1824
|
+
);
|
|
1825
|
+
return { data: response.data, nextCursor: response.meta.nextCursor };
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1480
1829
|
// src/exchanges.ts
|
|
1481
1830
|
var HyperliquidClient = class {
|
|
1482
1831
|
/**
|
|
@@ -1507,6 +1856,14 @@ var HyperliquidClient = class {
|
|
|
1507
1856
|
* Liquidation events (May 2025+)
|
|
1508
1857
|
*/
|
|
1509
1858
|
liquidations;
|
|
1859
|
+
/**
|
|
1860
|
+
* Order history, flow, and TP/SL
|
|
1861
|
+
*/
|
|
1862
|
+
orders;
|
|
1863
|
+
/**
|
|
1864
|
+
* L4 order book (snapshots, diffs, history)
|
|
1865
|
+
*/
|
|
1866
|
+
l4Orderbook;
|
|
1510
1867
|
/**
|
|
1511
1868
|
* HIP-3 builder-deployed perpetuals (February 2026+)
|
|
1512
1869
|
*/
|
|
@@ -1522,17 +1879,19 @@ var HyperliquidClient = class {
|
|
|
1522
1879
|
this.openInterest = new OpenInterestResource(http, basePath);
|
|
1523
1880
|
this.candles = new CandlesResource(http, basePath);
|
|
1524
1881
|
this.liquidations = new LiquidationsResource(http, basePath);
|
|
1882
|
+
this.orders = new OrdersResource(http, basePath);
|
|
1883
|
+
this.l4Orderbook = new L4OrderBookResource(http, basePath);
|
|
1525
1884
|
this.hip3 = new Hip3Client(http);
|
|
1526
1885
|
}
|
|
1527
1886
|
/**
|
|
1528
|
-
* Get per-
|
|
1887
|
+
* Get per-symbol data freshness across all data types
|
|
1529
1888
|
*
|
|
1530
|
-
* @param
|
|
1531
|
-
* @returns Per-
|
|
1889
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1890
|
+
* @returns Per-symbol freshness with last_updated and lag_ms for each data type
|
|
1532
1891
|
*/
|
|
1533
|
-
async freshness(
|
|
1892
|
+
async freshness(symbol) {
|
|
1534
1893
|
const response = await this.http.get(
|
|
1535
|
-
`/v1/hyperliquid/freshness/${
|
|
1894
|
+
`/v1/hyperliquid/freshness/${symbol.toUpperCase()}`,
|
|
1536
1895
|
void 0,
|
|
1537
1896
|
this.http.validationEnabled ? CoinFreshnessResponseSchema : void 0
|
|
1538
1897
|
);
|
|
@@ -1541,12 +1900,12 @@ var HyperliquidClient = class {
|
|
|
1541
1900
|
/**
|
|
1542
1901
|
* Get combined market summary (price, funding, OI, volume, liquidations) in one call
|
|
1543
1902
|
*
|
|
1544
|
-
* @param
|
|
1903
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1545
1904
|
* @returns Combined market summary
|
|
1546
1905
|
*/
|
|
1547
|
-
async summary(
|
|
1906
|
+
async summary(symbol) {
|
|
1548
1907
|
const response = await this.http.get(
|
|
1549
|
-
`/v1/hyperliquid/summary/${
|
|
1908
|
+
`/v1/hyperliquid/summary/${symbol.toUpperCase()}`,
|
|
1550
1909
|
void 0,
|
|
1551
1910
|
this.http.validationEnabled ? CoinSummaryResponseSchema : void 0
|
|
1552
1911
|
);
|
|
@@ -1555,13 +1914,13 @@ var HyperliquidClient = class {
|
|
|
1555
1914
|
/**
|
|
1556
1915
|
* Get mark/oracle/mid price history (projected from OI data)
|
|
1557
1916
|
*
|
|
1558
|
-
* @param
|
|
1917
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1559
1918
|
* @param params - Time range, cursor, and interval parameters
|
|
1560
1919
|
* @returns CursorResponse with price snapshots
|
|
1561
1920
|
*/
|
|
1562
|
-
async priceHistory(
|
|
1921
|
+
async priceHistory(symbol, params) {
|
|
1563
1922
|
const response = await this.http.get(
|
|
1564
|
-
`/v1/hyperliquid/prices/${
|
|
1923
|
+
`/v1/hyperliquid/prices/${symbol.toUpperCase()}`,
|
|
1565
1924
|
params,
|
|
1566
1925
|
this.http.validationEnabled ? PriceSnapshotArrayResponseSchema : void 0
|
|
1567
1926
|
);
|
|
@@ -1596,6 +1955,18 @@ var Hip3Client = class {
|
|
|
1596
1955
|
* OHLCV candle data
|
|
1597
1956
|
*/
|
|
1598
1957
|
candles;
|
|
1958
|
+
/**
|
|
1959
|
+
* Liquidation events
|
|
1960
|
+
*/
|
|
1961
|
+
liquidations;
|
|
1962
|
+
/**
|
|
1963
|
+
* Order history, flow, and TP/SL
|
|
1964
|
+
*/
|
|
1965
|
+
orders;
|
|
1966
|
+
/**
|
|
1967
|
+
* L4 order book (snapshots, diffs, history)
|
|
1968
|
+
*/
|
|
1969
|
+
l4Orderbook;
|
|
1599
1970
|
http;
|
|
1600
1971
|
constructor(http) {
|
|
1601
1972
|
this.http = http;
|
|
@@ -1607,16 +1978,19 @@ var Hip3Client = class {
|
|
|
1607
1978
|
this.funding = new FundingResource(http, basePath, coinTransform);
|
|
1608
1979
|
this.openInterest = new OpenInterestResource(http, basePath, coinTransform);
|
|
1609
1980
|
this.candles = new CandlesResource(http, basePath, coinTransform);
|
|
1981
|
+
this.liquidations = new LiquidationsResource(http, basePath, coinTransform);
|
|
1982
|
+
this.orders = new OrdersResource(http, basePath, coinTransform);
|
|
1983
|
+
this.l4Orderbook = new L4OrderBookResource(http, basePath, coinTransform);
|
|
1610
1984
|
}
|
|
1611
1985
|
/**
|
|
1612
|
-
* Get per-
|
|
1986
|
+
* Get per-symbol data freshness across all data types
|
|
1613
1987
|
*
|
|
1614
|
-
* @param
|
|
1615
|
-
* @returns Per-
|
|
1988
|
+
* @param symbol - The symbol (case-sensitive, e.g., 'km:US500')
|
|
1989
|
+
* @returns Per-symbol freshness with last_updated and lag_ms for each data type
|
|
1616
1990
|
*/
|
|
1617
|
-
async freshness(
|
|
1991
|
+
async freshness(symbol) {
|
|
1618
1992
|
const response = await this.http.get(
|
|
1619
|
-
`/v1/hyperliquid/hip3/freshness/${
|
|
1993
|
+
`/v1/hyperliquid/hip3/freshness/${symbol}`,
|
|
1620
1994
|
void 0,
|
|
1621
1995
|
this.http.validationEnabled ? CoinFreshnessResponseSchema : void 0
|
|
1622
1996
|
);
|
|
@@ -1625,12 +1999,12 @@ var Hip3Client = class {
|
|
|
1625
1999
|
/**
|
|
1626
2000
|
* Get combined market summary (price, funding, OI) in one call
|
|
1627
2001
|
*
|
|
1628
|
-
* @param
|
|
2002
|
+
* @param symbol - The symbol (case-sensitive, e.g., 'km:US500')
|
|
1629
2003
|
* @returns Combined market summary
|
|
1630
2004
|
*/
|
|
1631
|
-
async summary(
|
|
2005
|
+
async summary(symbol) {
|
|
1632
2006
|
const response = await this.http.get(
|
|
1633
|
-
`/v1/hyperliquid/hip3/summary/${
|
|
2007
|
+
`/v1/hyperliquid/hip3/summary/${symbol}`,
|
|
1634
2008
|
void 0,
|
|
1635
2009
|
this.http.validationEnabled ? CoinSummaryResponseSchema : void 0
|
|
1636
2010
|
);
|
|
@@ -1639,13 +2013,13 @@ var Hip3Client = class {
|
|
|
1639
2013
|
/**
|
|
1640
2014
|
* Get mark/oracle/mid price history (projected from OI data)
|
|
1641
2015
|
*
|
|
1642
|
-
* @param
|
|
2016
|
+
* @param symbol - The symbol (case-sensitive, e.g., 'km:US500')
|
|
1643
2017
|
* @param params - Time range, cursor, and interval parameters
|
|
1644
2018
|
* @returns CursorResponse with price snapshots
|
|
1645
2019
|
*/
|
|
1646
|
-
async priceHistory(
|
|
2020
|
+
async priceHistory(symbol, params) {
|
|
1647
2021
|
const response = await this.http.get(
|
|
1648
|
-
`/v1/hyperliquid/hip3/prices/${
|
|
2022
|
+
`/v1/hyperliquid/hip3/prices/${symbol}`,
|
|
1649
2023
|
params,
|
|
1650
2024
|
this.http.validationEnabled ? PriceSnapshotArrayResponseSchema : void 0
|
|
1651
2025
|
);
|
|
@@ -1680,6 +2054,10 @@ var LighterClient = class {
|
|
|
1680
2054
|
* OHLCV candle data
|
|
1681
2055
|
*/
|
|
1682
2056
|
candles;
|
|
2057
|
+
/**
|
|
2058
|
+
* L3 order book (Lighter only)
|
|
2059
|
+
*/
|
|
2060
|
+
l3Orderbook;
|
|
1683
2061
|
http;
|
|
1684
2062
|
constructor(http) {
|
|
1685
2063
|
this.http = http;
|
|
@@ -1690,16 +2068,17 @@ var LighterClient = class {
|
|
|
1690
2068
|
this.funding = new FundingResource(http, basePath);
|
|
1691
2069
|
this.openInterest = new OpenInterestResource(http, basePath);
|
|
1692
2070
|
this.candles = new CandlesResource(http, basePath);
|
|
2071
|
+
this.l3Orderbook = new L3OrderBookResource(http, basePath);
|
|
1693
2072
|
}
|
|
1694
2073
|
/**
|
|
1695
|
-
* Get per-
|
|
2074
|
+
* Get per-symbol data freshness across all data types
|
|
1696
2075
|
*
|
|
1697
|
-
* @param
|
|
1698
|
-
* @returns Per-
|
|
2076
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
2077
|
+
* @returns Per-symbol freshness with last_updated and lag_ms for each data type
|
|
1699
2078
|
*/
|
|
1700
|
-
async freshness(
|
|
2079
|
+
async freshness(symbol) {
|
|
1701
2080
|
const response = await this.http.get(
|
|
1702
|
-
`/v1/lighter/freshness/${
|
|
2081
|
+
`/v1/lighter/freshness/${symbol.toUpperCase()}`,
|
|
1703
2082
|
void 0,
|
|
1704
2083
|
this.http.validationEnabled ? CoinFreshnessResponseSchema : void 0
|
|
1705
2084
|
);
|
|
@@ -1708,12 +2087,12 @@ var LighterClient = class {
|
|
|
1708
2087
|
/**
|
|
1709
2088
|
* Get combined market summary (price, funding, OI) in one call
|
|
1710
2089
|
*
|
|
1711
|
-
* @param
|
|
2090
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1712
2091
|
* @returns Combined market summary
|
|
1713
2092
|
*/
|
|
1714
|
-
async summary(
|
|
2093
|
+
async summary(symbol) {
|
|
1715
2094
|
const response = await this.http.get(
|
|
1716
|
-
`/v1/lighter/summary/${
|
|
2095
|
+
`/v1/lighter/summary/${symbol.toUpperCase()}`,
|
|
1717
2096
|
void 0,
|
|
1718
2097
|
this.http.validationEnabled ? CoinSummaryResponseSchema : void 0
|
|
1719
2098
|
);
|
|
@@ -1722,13 +2101,13 @@ var LighterClient = class {
|
|
|
1722
2101
|
/**
|
|
1723
2102
|
* Get mark/oracle price history (projected from OI data)
|
|
1724
2103
|
*
|
|
1725
|
-
* @param
|
|
2104
|
+
* @param symbol - The symbol (e.g., 'BTC', 'ETH')
|
|
1726
2105
|
* @param params - Time range, cursor, and interval parameters
|
|
1727
2106
|
* @returns CursorResponse with price snapshots
|
|
1728
2107
|
*/
|
|
1729
|
-
async priceHistory(
|
|
2108
|
+
async priceHistory(symbol, params) {
|
|
1730
2109
|
const response = await this.http.get(
|
|
1731
|
-
`/v1/lighter/prices/${
|
|
2110
|
+
`/v1/lighter/prices/${symbol.toUpperCase()}`,
|
|
1732
2111
|
params,
|
|
1733
2112
|
this.http.validationEnabled ? PriceSnapshotArrayResponseSchema : void 0
|
|
1734
2113
|
);
|
|
@@ -1756,6 +2135,10 @@ var OxArchive = class {
|
|
|
1756
2135
|
* Data quality metrics: status, coverage, incidents, latency, SLA
|
|
1757
2136
|
*/
|
|
1758
2137
|
dataQuality;
|
|
2138
|
+
/**
|
|
2139
|
+
* Wallet-based auth: get API keys via SIWE signature
|
|
2140
|
+
*/
|
|
2141
|
+
web3;
|
|
1759
2142
|
/**
|
|
1760
2143
|
* @deprecated Use client.hyperliquid.orderbook instead
|
|
1761
2144
|
*/
|
|
@@ -1794,6 +2177,7 @@ var OxArchive = class {
|
|
|
1794
2177
|
this.hyperliquid = new HyperliquidClient(this.http);
|
|
1795
2178
|
this.lighter = new LighterClient(this.http);
|
|
1796
2179
|
this.dataQuality = new DataQualityResource(this.http);
|
|
2180
|
+
this.web3 = new Web3Resource(this.http);
|
|
1797
2181
|
const legacyBase = "/v1/hyperliquid";
|
|
1798
2182
|
this.orderbook = new OrderBookResource(this.http, legacyBase);
|
|
1799
2183
|
this.trades = new TradesResource(this.http, legacyBase);
|