pmxtjs 2.43.0 → 2.43.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.
@@ -156,7 +156,7 @@ export declare abstract class Exchange {
156
156
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
157
157
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
158
158
  fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
159
- fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook>;
159
+ fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook | OrderBook[]>;
160
160
  fetchOrderBooks(outcomeIds: (string | MarketOutcome)[]): Promise<Record<string, OrderBook>>;
161
161
  submitOrder(built: BuiltOrder): Promise<Order>;
162
162
  cancelOrder(orderId: string): Promise<Order>;
@@ -637,8 +637,11 @@ export class Exchange {
637
637
  args.push(resolveOutcomeId(outcomeId));
638
638
  if (limit !== undefined)
639
639
  args.push(limit);
640
- if (params !== undefined)
640
+ if (params !== undefined) {
641
+ if (limit === undefined)
642
+ args.push(null);
641
643
  args.push(params);
644
+ }
642
645
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBook`, {
643
646
  method: 'POST',
644
647
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -653,6 +656,9 @@ export class Exchange {
653
656
  }
654
657
  const json = await response.json();
655
658
  const data = this.handleResponse(json);
659
+ if (Array.isArray(data)) {
660
+ return data.map(convertOrderBook);
661
+ }
656
662
  return convertOrderBook(data);
657
663
  }
658
664
  catch (error) {
@@ -156,7 +156,7 @@ export declare abstract class Exchange {
156
156
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
157
157
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
158
158
  fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
159
- fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook>;
159
+ fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook | OrderBook[]>;
160
160
  fetchOrderBooks(outcomeIds: (string | MarketOutcome)[]): Promise<Record<string, OrderBook>>;
161
161
  submitOrder(built: BuiltOrder): Promise<Order>;
162
162
  cancelOrder(orderId: string): Promise<Order>;
@@ -640,8 +640,11 @@ class Exchange {
640
640
  args.push(resolveOutcomeId(outcomeId));
641
641
  if (limit !== undefined)
642
642
  args.push(limit);
643
- if (params !== undefined)
643
+ if (params !== undefined) {
644
+ if (limit === undefined)
645
+ args.push(null);
644
646
  args.push(params);
647
+ }
645
648
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBook`, {
646
649
  method: 'POST',
647
650
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -656,6 +659,9 @@ class Exchange {
656
659
  }
657
660
  const json = await response.json();
658
661
  const data = this.handleResponse(json);
662
+ if (Array.isArray(data)) {
663
+ return data.map(convertOrderBook);
664
+ }
659
665
  return convertOrderBook(data);
660
666
  }
661
667
  catch (error) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.43.0",
3
+ "version": "2.43.1",
4
4
  "description": "OpenAPI client for pmxtjs",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.43.0",
3
+ "version": "2.43.1",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "unified"
44
44
  ],
45
45
  "dependencies": {
46
- "pmxt-core": "2.43.0",
46
+ "pmxt-core": "2.43.1",
47
47
  "ws": "^8.18.0"
48
48
  },
49
49
  "devDependencies": {
package/pmxt/client.ts CHANGED
@@ -766,13 +766,16 @@ export abstract class Exchange {
766
766
  }
767
767
  }
768
768
 
769
- async fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook> {
769
+ async fetchOrderBook(outcomeId: string | MarketOutcome, limit?: number, params?: Record<string, any>): Promise<OrderBook | OrderBook[]> {
770
770
  await this.initPromise;
771
771
  try {
772
772
  const args: any[] = [];
773
773
  args.push(resolveOutcomeId(outcomeId));
774
774
  if (limit !== undefined) args.push(limit);
775
- if (params !== undefined) args.push(params);
775
+ if (params !== undefined) {
776
+ if (limit === undefined) args.push(null);
777
+ args.push(params);
778
+ }
776
779
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBook`, {
777
780
  method: 'POST',
778
781
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -787,6 +790,9 @@ export abstract class Exchange {
787
790
  }
788
791
  const json = await response.json();
789
792
  const data = this.handleResponse(json);
793
+ if (Array.isArray(data)) {
794
+ return data.map(convertOrderBook);
795
+ }
790
796
  return convertOrderBook(data);
791
797
  } catch (error) {
792
798
  if (error instanceof PmxtError) throw error;