@0xarchive/sdk 0.3.11 → 0.4.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.js CHANGED
@@ -25,10 +25,12 @@ __export(index_exports, {
25
25
  FundingRateArrayResponseSchema: () => FundingRateArrayResponseSchema,
26
26
  FundingRateResponseSchema: () => FundingRateResponseSchema,
27
27
  FundingRateSchema: () => FundingRateSchema,
28
+ HyperliquidClient: () => HyperliquidClient,
28
29
  InstrumentArrayResponseSchema: () => InstrumentArrayResponseSchema,
29
30
  InstrumentResponseSchema: () => InstrumentResponseSchema,
30
31
  InstrumentSchema: () => InstrumentSchema,
31
32
  InstrumentTypeSchema: () => InstrumentTypeSchema,
33
+ LighterClient: () => LighterClient,
32
34
  OpenInterestArrayResponseSchema: () => OpenInterestArrayResponseSchema,
33
35
  OpenInterestResponseSchema: () => OpenInterestResponseSchema,
34
36
  OpenInterestSchema: () => OpenInterestSchema,
@@ -378,8 +380,9 @@ var OpenInterestArrayResponseSchema = ApiResponseSchema(import_zod.z.array(OpenI
378
380
 
379
381
  // src/resources/orderbook.ts
380
382
  var OrderBookResource = class {
381
- constructor(http) {
383
+ constructor(http, basePath = "/v1") {
382
384
  this.http = http;
385
+ this.basePath = basePath;
383
386
  }
384
387
  /**
385
388
  * Get order book snapshot for a coin
@@ -390,7 +393,7 @@ var OrderBookResource = class {
390
393
  */
391
394
  async get(coin, params) {
392
395
  const response = await this.http.get(
393
- `/v1/orderbook/${coin.toUpperCase()}`,
396
+ `${this.basePath}/orderbook/${coin.toUpperCase()}`,
394
397
  params,
395
398
  this.http.validationEnabled ? OrderBookResponseSchema : void 0
396
399
  );
@@ -438,8 +441,9 @@ var OrderBookResource = class {
438
441
 
439
442
  // src/resources/trades.ts
440
443
  var TradesResource = class {
441
- constructor(http) {
444
+ constructor(http, basePath = "/v1") {
442
445
  this.http = http;
446
+ this.basePath = basePath;
443
447
  }
444
448
  /**
445
449
  * Get trade history for a coin using cursor-based pagination
@@ -473,7 +477,7 @@ var TradesResource = class {
473
477
  */
474
478
  async list(coin, params) {
475
479
  const response = await this.http.get(
476
- `/v1/trades/${coin.toUpperCase()}`,
480
+ `${this.basePath}/trades/${coin.toUpperCase()}`,
477
481
  params,
478
482
  this.http.validationEnabled ? TradeArrayResponseSchema : void 0
479
483
  );
@@ -501,8 +505,9 @@ var TradesResource = class {
501
505
 
502
506
  // src/resources/instruments.ts
503
507
  var InstrumentsResource = class {
504
- constructor(http) {
508
+ constructor(http, basePath = "/v1") {
505
509
  this.http = http;
510
+ this.basePath = basePath;
506
511
  }
507
512
  /**
508
513
  * List all available trading instruments
@@ -511,7 +516,7 @@ var InstrumentsResource = class {
511
516
  */
512
517
  async list() {
513
518
  const response = await this.http.get(
514
- "/v1/instruments",
519
+ `${this.basePath}/instruments`,
515
520
  void 0,
516
521
  this.http.validationEnabled ? InstrumentArrayResponseSchema : void 0
517
522
  );
@@ -525,7 +530,7 @@ var InstrumentsResource = class {
525
530
  */
526
531
  async get(coin) {
527
532
  const response = await this.http.get(
528
- `/v1/instruments/${coin.toUpperCase()}`,
533
+ `${this.basePath}/instruments/${coin.toUpperCase()}`,
529
534
  void 0,
530
535
  this.http.validationEnabled ? InstrumentResponseSchema : void 0
531
536
  );
@@ -535,8 +540,9 @@ var InstrumentsResource = class {
535
540
 
536
541
  // src/resources/funding.ts
537
542
  var FundingResource = class {
538
- constructor(http) {
543
+ constructor(http, basePath = "/v1") {
539
544
  this.http = http;
545
+ this.basePath = basePath;
540
546
  }
541
547
  /**
542
548
  * Get funding rate history for a coin with cursor-based pagination
@@ -547,7 +553,7 @@ var FundingResource = class {
547
553
  */
548
554
  async history(coin, params) {
549
555
  const response = await this.http.get(
550
- `/v1/funding/${coin.toUpperCase()}`,
556
+ `${this.basePath}/funding/${coin.toUpperCase()}`,
551
557
  params,
552
558
  this.http.validationEnabled ? FundingRateArrayResponseSchema : void 0
553
559
  );
@@ -574,8 +580,9 @@ var FundingResource = class {
574
580
 
575
581
  // src/resources/openinterest.ts
576
582
  var OpenInterestResource = class {
577
- constructor(http) {
583
+ constructor(http, basePath = "/v1") {
578
584
  this.http = http;
585
+ this.basePath = basePath;
579
586
  }
580
587
  /**
581
588
  * Get open interest history for a coin with cursor-based pagination
@@ -586,7 +593,7 @@ var OpenInterestResource = class {
586
593
  */
587
594
  async history(coin, params) {
588
595
  const response = await this.http.get(
589
- `/v1/openinterest/${coin.toUpperCase()}`,
596
+ `${this.basePath}/openinterest/${coin.toUpperCase()}`,
590
597
  params,
591
598
  this.http.validationEnabled ? OpenInterestArrayResponseSchema : void 0
592
599
  );
@@ -611,11 +618,8 @@ var OpenInterestResource = class {
611
618
  }
612
619
  };
613
620
 
614
- // src/client.ts
615
- var DEFAULT_BASE_URL = "https://api.0xarchive.io";
616
- var DEFAULT_TIMEOUT = 3e4;
617
- var OxArchive = class {
618
- http;
621
+ // src/exchanges.ts
622
+ var HyperliquidClient = class {
619
623
  /**
620
624
  * Order book data (L2 snapshots from April 2023)
621
625
  */
@@ -636,6 +640,79 @@ var OxArchive = class {
636
640
  * Open interest
637
641
  */
638
642
  openInterest;
643
+ constructor(http) {
644
+ const basePath = "/v1/hyperliquid";
645
+ this.orderbook = new OrderBookResource(http, basePath);
646
+ this.trades = new TradesResource(http, basePath);
647
+ this.instruments = new InstrumentsResource(http, basePath);
648
+ this.funding = new FundingResource(http, basePath);
649
+ this.openInterest = new OpenInterestResource(http, basePath);
650
+ }
651
+ };
652
+ var LighterClient = class {
653
+ /**
654
+ * Order book data (L2 snapshots)
655
+ */
656
+ orderbook;
657
+ /**
658
+ * Trade/fill history
659
+ */
660
+ trades;
661
+ /**
662
+ * Trading instruments metadata
663
+ */
664
+ instruments;
665
+ /**
666
+ * Funding rates
667
+ */
668
+ funding;
669
+ /**
670
+ * Open interest
671
+ */
672
+ openInterest;
673
+ constructor(http) {
674
+ const basePath = "/v1/lighter";
675
+ this.orderbook = new OrderBookResource(http, basePath);
676
+ this.trades = new TradesResource(http, basePath);
677
+ this.instruments = new InstrumentsResource(http, basePath);
678
+ this.funding = new FundingResource(http, basePath);
679
+ this.openInterest = new OpenInterestResource(http, basePath);
680
+ }
681
+ };
682
+
683
+ // src/client.ts
684
+ var DEFAULT_BASE_URL = "https://api.0xarchive.io";
685
+ var DEFAULT_TIMEOUT = 3e4;
686
+ var OxArchive = class {
687
+ http;
688
+ /**
689
+ * Hyperliquid exchange data (orderbook, trades, funding, OI from April 2023)
690
+ */
691
+ hyperliquid;
692
+ /**
693
+ * Lighter.xyz exchange data (August 2025+)
694
+ */
695
+ lighter;
696
+ /**
697
+ * @deprecated Use client.hyperliquid.orderbook instead
698
+ */
699
+ orderbook;
700
+ /**
701
+ * @deprecated Use client.hyperliquid.trades instead
702
+ */
703
+ trades;
704
+ /**
705
+ * @deprecated Use client.hyperliquid.instruments instead
706
+ */
707
+ instruments;
708
+ /**
709
+ * @deprecated Use client.hyperliquid.funding instead
710
+ */
711
+ funding;
712
+ /**
713
+ * @deprecated Use client.hyperliquid.openInterest instead
714
+ */
715
+ openInterest;
639
716
  /**
640
717
  * Create a new 0xarchive client
641
718
  *
@@ -651,11 +728,14 @@ var OxArchive = class {
651
728
  timeout: options.timeout ?? DEFAULT_TIMEOUT,
652
729
  validate: options.validate ?? false
653
730
  });
654
- this.orderbook = new OrderBookResource(this.http);
655
- this.trades = new TradesResource(this.http);
656
- this.instruments = new InstrumentsResource(this.http);
657
- this.funding = new FundingResource(this.http);
658
- this.openInterest = new OpenInterestResource(this.http);
731
+ this.hyperliquid = new HyperliquidClient(this.http);
732
+ this.lighter = new LighterClient(this.http);
733
+ const legacyBase = "/v1/hyperliquid";
734
+ this.orderbook = new OrderBookResource(this.http, legacyBase);
735
+ this.trades = new TradesResource(this.http, legacyBase);
736
+ this.instruments = new InstrumentsResource(this.http, legacyBase);
737
+ this.funding = new FundingResource(this.http, legacyBase);
738
+ this.openInterest = new OpenInterestResource(this.http, legacyBase);
659
739
  }
660
740
  };
661
741
 
@@ -1189,10 +1269,12 @@ var OxArchiveWs = class {
1189
1269
  FundingRateArrayResponseSchema,
1190
1270
  FundingRateResponseSchema,
1191
1271
  FundingRateSchema,
1272
+ HyperliquidClient,
1192
1273
  InstrumentArrayResponseSchema,
1193
1274
  InstrumentResponseSchema,
1194
1275
  InstrumentSchema,
1195
1276
  InstrumentTypeSchema,
1277
+ LighterClient,
1196
1278
  OpenInterestArrayResponseSchema,
1197
1279
  OpenInterestResponseSchema,
1198
1280
  OpenInterestSchema,