@0xarchive/sdk 0.7.0 → 0.8.1

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/dist/index.mjs CHANGED
@@ -516,9 +516,10 @@ function reconstructFinal(tickData, depth) {
516
516
 
517
517
  // src/resources/orderbook.ts
518
518
  var OrderBookResource = class {
519
- constructor(http, basePath = "/v1") {
519
+ constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
520
520
  this.http = http;
521
521
  this.basePath = basePath;
522
+ this.coinTransform = coinTransform;
522
523
  }
523
524
  /**
524
525
  * Get order book snapshot for a coin
@@ -529,7 +530,7 @@ var OrderBookResource = class {
529
530
  */
530
531
  async get(coin, params) {
531
532
  const response = await this.http.get(
532
- `${this.basePath}/orderbook/${coin.toUpperCase()}`,
533
+ `${this.basePath}/orderbook/${this.coinTransform(coin)}`,
533
534
  params,
534
535
  this.http.validationEnabled ? OrderBookResponseSchema : void 0
535
536
  );
@@ -564,7 +565,7 @@ var OrderBookResource = class {
564
565
  */
565
566
  async history(coin, params) {
566
567
  const response = await this.http.get(
567
- `${this.basePath}/orderbook/${coin.toUpperCase()}/history`,
568
+ `${this.basePath}/orderbook/${this.coinTransform(coin)}/history`,
568
569
  params,
569
570
  this.http.validationEnabled ? OrderBookArrayResponseSchema : void 0
570
571
  );
@@ -604,7 +605,7 @@ var OrderBookResource = class {
604
605
  */
605
606
  async historyTick(coin, params) {
606
607
  const response = await this.http.get(
607
- `${this.basePath}/orderbook/${coin.toUpperCase()}/history`,
608
+ `${this.basePath}/orderbook/${this.coinTransform(coin)}/history`,
608
609
  {
609
610
  ...params,
610
611
  granularity: "tick"
@@ -757,9 +758,10 @@ var OrderBookResource = class {
757
758
 
758
759
  // src/resources/trades.ts
759
760
  var TradesResource = class {
760
- constructor(http, basePath = "/v1") {
761
+ constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
761
762
  this.http = http;
762
763
  this.basePath = basePath;
764
+ this.coinTransform = coinTransform;
763
765
  }
764
766
  /**
765
767
  * Get trade history for a coin using cursor-based pagination
@@ -793,7 +795,7 @@ var TradesResource = class {
793
795
  */
794
796
  async list(coin, params) {
795
797
  const response = await this.http.get(
796
- `${this.basePath}/trades/${coin.toUpperCase()}`,
798
+ `${this.basePath}/trades/${this.coinTransform(coin)}`,
797
799
  params,
798
800
  this.http.validationEnabled ? TradeArrayResponseSchema : void 0
799
801
  );
@@ -805,9 +807,10 @@ var TradesResource = class {
805
807
  /**
806
808
  * Get most recent trades for a coin.
807
809
  *
808
- * Note: This method is only available for Lighter (client.lighter.trades.recent())
809
- * which has real-time data ingestion. Hyperliquid uses hourly backfill so this
810
- * endpoint is not available for Hyperliquid.
810
+ * Note: This method is available for Lighter (client.lighter.trades.recent())
811
+ * and HIP-3 (client.hyperliquid.hip3.trades.recent()) which have real-time data
812
+ * ingestion. Hyperliquid uses hourly backfill so this endpoint is not available
813
+ * for Hyperliquid.
811
814
  *
812
815
  * @param coin - The coin symbol (e.g., 'BTC', 'ETH')
813
816
  * @param limit - Number of trades to return (default: 100)
@@ -815,7 +818,7 @@ var TradesResource = class {
815
818
  */
816
819
  async recent(coin, limit) {
817
820
  const response = await this.http.get(
818
- `${this.basePath}/trades/${coin.toUpperCase()}/recent`,
821
+ `${this.basePath}/trades/${this.coinTransform(coin)}/recent`,
819
822
  { limit },
820
823
  this.http.validationEnabled ? TradeArrayResponseSchema : void 0
821
824
  );
@@ -886,12 +889,45 @@ var LighterInstrumentsResource = class {
886
889
  return response.data;
887
890
  }
888
891
  };
892
+ var Hip3InstrumentsResource = class {
893
+ constructor(http, basePath = "/v1/hyperliquid/hip3", coinTransform) {
894
+ this.http = http;
895
+ this.basePath = basePath;
896
+ this.coinTransform = coinTransform || ((c) => c);
897
+ }
898
+ coinTransform;
899
+ /**
900
+ * List all available HIP-3 instruments with latest market data
901
+ *
902
+ * @returns Array of HIP-3 instruments
903
+ */
904
+ async list() {
905
+ const response = await this.http.get(
906
+ `${this.basePath}/instruments`
907
+ );
908
+ return response.data;
909
+ }
910
+ /**
911
+ * Get a specific HIP-3 instrument by coin name
912
+ *
913
+ * @param coin - The coin name (e.g., 'km:US500', 'xyz:XYZ100'). Case-sensitive.
914
+ * @returns HIP-3 instrument details with latest market data
915
+ */
916
+ async get(coin) {
917
+ coin = this.coinTransform(coin);
918
+ const response = await this.http.get(
919
+ `${this.basePath}/instruments/${coin}`
920
+ );
921
+ return response.data;
922
+ }
923
+ };
889
924
 
890
925
  // src/resources/funding.ts
891
926
  var FundingResource = class {
892
- constructor(http, basePath = "/v1") {
927
+ constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
893
928
  this.http = http;
894
929
  this.basePath = basePath;
930
+ this.coinTransform = coinTransform;
895
931
  }
896
932
  /**
897
933
  * Get funding rate history for a coin with cursor-based pagination
@@ -902,7 +938,7 @@ var FundingResource = class {
902
938
  */
903
939
  async history(coin, params) {
904
940
  const response = await this.http.get(
905
- `${this.basePath}/funding/${coin.toUpperCase()}`,
941
+ `${this.basePath}/funding/${this.coinTransform(coin)}`,
906
942
  params,
907
943
  this.http.validationEnabled ? FundingRateArrayResponseSchema : void 0
908
944
  );
@@ -919,7 +955,7 @@ var FundingResource = class {
919
955
  */
920
956
  async current(coin) {
921
957
  const response = await this.http.get(
922
- `/v1/funding/${coin.toUpperCase()}/current`,
958
+ `${this.basePath}/funding/${this.coinTransform(coin)}/current`,
923
959
  void 0,
924
960
  this.http.validationEnabled ? FundingRateResponseSchema : void 0
925
961
  );
@@ -929,9 +965,10 @@ var FundingResource = class {
929
965
 
930
966
  // src/resources/openinterest.ts
931
967
  var OpenInterestResource = class {
932
- constructor(http, basePath = "/v1") {
968
+ constructor(http, basePath = "/v1", coinTransform = (c) => c.toUpperCase()) {
933
969
  this.http = http;
934
970
  this.basePath = basePath;
971
+ this.coinTransform = coinTransform;
935
972
  }
936
973
  /**
937
974
  * Get open interest history for a coin with cursor-based pagination
@@ -942,7 +979,7 @@ var OpenInterestResource = class {
942
979
  */
943
980
  async history(coin, params) {
944
981
  const response = await this.http.get(
945
- `${this.basePath}/openinterest/${coin.toUpperCase()}`,
982
+ `${this.basePath}/openinterest/${this.coinTransform(coin)}`,
946
983
  params,
947
984
  this.http.validationEnabled ? OpenInterestArrayResponseSchema : void 0
948
985
  );
@@ -959,7 +996,7 @@ var OpenInterestResource = class {
959
996
  */
960
997
  async current(coin) {
961
998
  const response = await this.http.get(
962
- `/v1/openinterest/${coin.toUpperCase()}/current`,
999
+ `${this.basePath}/openinterest/${this.coinTransform(coin)}/current`,
963
1000
  void 0,
964
1001
  this.http.validationEnabled ? OpenInterestResponseSchema : void 0
965
1002
  );
@@ -1093,7 +1130,7 @@ var DataQualityResource = class {
1093
1130
  /**
1094
1131
  * Get data coverage for a specific exchange
1095
1132
  *
1096
- * @param exchange - Exchange name ('hyperliquid' or 'lighter')
1133
+ * @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
1097
1134
  * @returns ExchangeCoverage with coverage info for all data types on this exchange
1098
1135
  *
1099
1136
  * @example
@@ -1113,8 +1150,8 @@ var DataQualityResource = class {
1113
1150
  * Includes gap detection, empirical data cadence, and hour-level historical coverage.
1114
1151
  * Supports optional time bounds for gap detection (default: last 30 days).
1115
1152
  *
1116
- * @param exchange - Exchange name ('hyperliquid' or 'lighter')
1117
- * @param symbol - Symbol name (e.g., 'BTC', 'ETH')
1153
+ * @param exchange - Exchange name ('hyperliquid', 'lighter', or 'hip3')
1154
+ * @param symbol - Symbol name (e.g., 'BTC', 'ETH', or HIP3 coins like 'xyz:XYZ100')
1118
1155
  * @param options - Optional time bounds for gap detection window
1119
1156
  * @returns SymbolCoverageResponse with per-data-type coverage including gaps, cadence, and historical coverage
1120
1157
  *
@@ -1266,6 +1303,10 @@ var HyperliquidClient = class {
1266
1303
  * Liquidation events (May 2025+)
1267
1304
  */
1268
1305
  liquidations;
1306
+ /**
1307
+ * HIP-3 builder-deployed perpetuals (Pro+ only, February 2026+)
1308
+ */
1309
+ hip3;
1269
1310
  constructor(http) {
1270
1311
  const basePath = "/v1/hyperliquid";
1271
1312
  this.orderbook = new OrderBookResource(http, basePath);
@@ -1275,6 +1316,38 @@ var HyperliquidClient = class {
1275
1316
  this.openInterest = new OpenInterestResource(http, basePath);
1276
1317
  this.candles = new CandlesResource(http, basePath);
1277
1318
  this.liquidations = new LiquidationsResource(http, basePath);
1319
+ this.hip3 = new Hip3Client(http);
1320
+ }
1321
+ };
1322
+ var Hip3Client = class {
1323
+ /**
1324
+ * HIP-3 instruments with latest market data
1325
+ */
1326
+ instruments;
1327
+ /**
1328
+ * Order book snapshots (February 2026+)
1329
+ */
1330
+ orderbook;
1331
+ /**
1332
+ * Trade/fill history
1333
+ */
1334
+ trades;
1335
+ /**
1336
+ * Funding rates
1337
+ */
1338
+ funding;
1339
+ /**
1340
+ * Open interest
1341
+ */
1342
+ openInterest;
1343
+ constructor(http) {
1344
+ const basePath = "/v1/hyperliquid/hip3";
1345
+ const coinTransform = (c) => c;
1346
+ this.instruments = new Hip3InstrumentsResource(http, basePath, coinTransform);
1347
+ this.orderbook = new OrderBookResource(http, basePath, coinTransform);
1348
+ this.trades = new TradesResource(http, basePath, coinTransform);
1349
+ this.funding = new FundingResource(http, basePath, coinTransform);
1350
+ this.openInterest = new OpenInterestResource(http, basePath, coinTransform);
1278
1351
  }
1279
1352
  };
1280
1353
  var LighterClient = class {
@@ -1956,6 +2029,7 @@ export {
1956
2029
  FundingRateArrayResponseSchema,
1957
2030
  FundingRateResponseSchema,
1958
2031
  FundingRateSchema,
2032
+ Hip3Client,
1959
2033
  HyperliquidClient,
1960
2034
  InstrumentArrayResponseSchema,
1961
2035
  InstrumentResponseSchema,