@predictasiax/api 2.0.0 → 2.1.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/dist/index.d.cts CHANGED
@@ -580,6 +580,74 @@ declare class AccountResource extends Resource {
580
580
  trades(params?: ListTradesParams, opts?: RequestOptions): PagePromise<Trade>;
581
581
  }
582
582
 
583
+ /**
584
+ * Fees resource — pre-trade 5-actor split estimator.
585
+ *
586
+ * GET /v1/fees/estimate estimate()
587
+ *
588
+ * v2.1+ — Polymarket has no equivalent. Returns identical shape to the `fee`
589
+ * block on post-trade responses (same 5-actor `splits` + `attribution` +
590
+ * `breakdown` + `ledger_preview`). Powered server-side by `lib/fiveActorFees`
591
+ * so env-tunable bps flow through automatically without SDK bumps.
592
+ */
593
+
594
+ interface FeeEstimateParams {
595
+ marketId?: string;
596
+ side?: "YES" | "NO";
597
+ action?: "BUY" | "SELL";
598
+ size: Decimal | number;
599
+ price: Decimal | number;
600
+ /** VIP discount, 0..0.55 (0 = no discount). */
601
+ vipDiscount?: number;
602
+ /** Sharp multiplier, 1..1.5 (1 = neutral). */
603
+ sharpMultiplier?: number;
604
+ isMintTaker?: boolean;
605
+ isAmmMaker?: boolean;
606
+ /** Override actors for "what if" scenarios. Defaults to caller's key + env. */
607
+ acquisitionBuilderId?: string;
608
+ executionBuilderId?: string;
609
+ operatorId?: string;
610
+ marketCreatorId?: string;
611
+ }
612
+ interface FeeEstimate {
613
+ input: Record<string, unknown>;
614
+ fee: {
615
+ taker_fee_bps: number;
616
+ effective_bps: number;
617
+ taker_fee_total: number;
618
+ maker_rebate: number;
619
+ platform_take: number;
620
+ splits: {
621
+ acquisition_builder: number;
622
+ execution_builder: number;
623
+ operator: number;
624
+ market_creator: number;
625
+ lp: number;
626
+ platform_net: number;
627
+ };
628
+ attribution: {
629
+ acquisition_builder_id: string | null;
630
+ execution_builder_id: string | null;
631
+ operator_id: string | null;
632
+ market_creator_id: string | null;
633
+ unfilled_roles: string[];
634
+ };
635
+ breakdown: {
636
+ notional: number;
637
+ taker_fee_bps: number;
638
+ effective_bps: number;
639
+ vip_discount: number;
640
+ sharp_multiplier: number;
641
+ };
642
+ ledger_preview: Array<Record<string, unknown>>;
643
+ disclosure_version: string;
644
+ };
645
+ note: string;
646
+ }
647
+ declare class FeesResource extends Resource {
648
+ estimate(params: FeeEstimateParams, opts?: RequestOptions): APIPromise<FeeEstimate>;
649
+ }
650
+
583
651
  /**
584
652
  * Grants resource — Builder Program token grants (PAX-denominated) with
585
653
  * cliff + linear vest. Callers use `pax.grants` to view their grants and
@@ -687,11 +755,13 @@ declare class MarketsResource extends Resource {
687
755
  }
688
756
 
689
757
  /**
690
- * Orders resource — your orders.
758
+ * Orders resource — your orders (single + batch).
691
759
  *
692
760
  * POST /v1/orders place()
693
761
  * DELETE /v1/orders/{id} cancel()
694
762
  * GET /v1/account/orders list()
763
+ * POST /v1/orders/batch placeBatch() — v2.1+, up to 25 orders
764
+ * DELETE /v1/orders/batch cancelBatch() — v2.1+, up to 50 orders
695
765
  */
696
766
 
697
767
  interface PlaceOrderParams {
@@ -709,10 +779,75 @@ interface ListOrdersParams {
709
779
  cursor?: string;
710
780
  limit?: number;
711
781
  }
782
+ /** Per-item result inside a batch response — one entry per input order. */
783
+ interface BatchOrderResultItem {
784
+ ok: boolean;
785
+ index: number;
786
+ client_order_id: string | null;
787
+ data?: unknown;
788
+ attribution?: {
789
+ execution_builder_id?: string;
790
+ acquisition_builder_id?: string | null;
791
+ order_id?: string | null;
792
+ write?: {
793
+ ok: boolean;
794
+ rowCount?: number;
795
+ reason?: string;
796
+ };
797
+ };
798
+ error?: {
799
+ code: string;
800
+ message: string;
801
+ };
802
+ }
803
+ interface BatchOrderSummary {
804
+ submitted: number;
805
+ succeeded: number;
806
+ failed: number;
807
+ duration_ms: number;
808
+ }
809
+ interface BatchOrdersResult {
810
+ results: BatchOrderResultItem[];
811
+ summary: BatchOrderSummary;
812
+ }
813
+ interface BatchCancelResultItem {
814
+ ok: boolean;
815
+ index: number;
816
+ order_id?: string;
817
+ data?: unknown;
818
+ error?: {
819
+ code: string;
820
+ message: string;
821
+ };
822
+ }
823
+ interface BatchCancelResult {
824
+ results: BatchCancelResultItem[];
825
+ summary: BatchOrderSummary;
826
+ }
712
827
  declare class OrdersResource extends Resource {
713
828
  place(params: PlaceOrderParams, opts?: RequestOptions): APIPromise<Order>;
714
829
  cancel(orderId: string, opts?: RequestOptions): APIPromise<Order>;
715
830
  list(params?: ListOrdersParams, opts?: RequestOptions): PagePromise<Order>;
831
+ /**
832
+ * Place multiple orders in a single request (up to 25 per batch).
833
+ *
834
+ * Each order is processed sequentially by the CLOB engine (single-writer per
835
+ * market). Response contains a `results` array with one entry per input order
836
+ * (indexed) plus a `summary` with counts + duration. One bad order does not
837
+ * fail the whole batch — inspect `results[i].ok` per item.
838
+ *
839
+ * Batch cap is env-tunable server-side (BATCH_ORDERS_MAX, default 25). Exceeding
840
+ * returns `413 BATCH_TOO_LARGE`.
841
+ */
842
+ placeBatch(orders: PlaceOrderParams[], opts?: RequestOptions): APIPromise<BatchOrdersResult>;
843
+ /**
844
+ * Cancel multiple orders in a single request (up to 50 per batch).
845
+ *
846
+ * Each cancel is processed sequentially by the CLOB engine. Response mirrors
847
+ * `placeBatch` shape — inspect `results[i].ok` per item. Batch cap env-tunable
848
+ * server-side (BATCH_CANCEL_MAX, default 50).
849
+ */
850
+ cancelBatch(orderIds: string[], opts?: RequestOptions): APIPromise<BatchCancelResult>;
716
851
  }
717
852
 
718
853
  /**
@@ -825,7 +960,7 @@ declare class TemplatesResource extends Resource {
825
960
  * }, { idempotencyKey: "ord_1" }).withResponse();
826
961
  */
827
962
 
828
- declare const VERSION = "2.0.0";
963
+ declare const VERSION = "2.1.0";
829
964
  type PaxClientOptions = HttpClientOptions;
830
965
  declare class PaxClient {
831
966
  private readonly _http;
@@ -838,6 +973,7 @@ declare class PaxClient {
838
973
  readonly sandboxKeys: SandboxKeysResource;
839
974
  readonly apply: ApplyResource;
840
975
  readonly grants: GrantsResource;
976
+ readonly fees: FeesResource;
841
977
  constructor(opts: PaxClientOptions);
842
978
  get baseUrl(): string;
843
979
  get userAgent(): string;
@@ -1079,4 +1215,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1079
1215
  onRetry?: (attempt: number, error: Error) => void;
1080
1216
  }): Promise<T>;
1081
1217
 
1082
- export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type Candle, type CandleInterval, type CandlesParams, type Category, type CreateKeyParams, type CreateMarketParams, CursorPage, type CursorPageInit, type CursorPageParams, type Decimal, type Env, type Envelope, type GrantClaimResult, type GrantEvent, type GrantEventType, type GrantPhase, type GrantTier, type GrantVesting, GrantsResource, type HealthStatus, type HmacHeaders, type HttpClientOptions, type KeyScope, KeysResource, type ListEnvelope, type ListMarketsParams, type ListOrdersParams, type ListTemplatesParams, type ListTradesParams, type Market, type MarketStatus, type MarketTemplate, type MarketTradesParams, type MarketType, MarketsResource, type Order, type OrderStatus, type OrderType, type Orderbook, type OrderbookLevel, type OrderbookParams, OrdersResource, type Outcome, PagePromise, PaxAuthError, PaxCircuitBreakerError, PaxClient, type PaxClientOptions, PaxConflictError, PaxError, type PaxErrorDetails, type PaxErrorPayload, PaxNotFoundError, PaxRateLimitError, PaxReadOnlyModeError, PaxSandboxOnlyError, PaxServerError, PaxValidationError, PaxWSClient, type PaxWSClientOptions, PaxWrongEnvKeyError, type PlaceOrderParams, type Position, type RequestOptions, type ResponseMeta, type SandboxKeyMintParams, type SandboxKeyResult, SandboxKeysResource, SandboxResource, type Side, type SignInput, TemplatesResource, type Tier, type TierLimits, type TimeInForce, type TokenGrant, type Trade, VERSION, type WithResponseResult, type WsEvent, type WsHandler, buildError, buildMessage, computeBackoff, runWithRetry, signRequest };
1218
+ export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type BatchCancelResult, type BatchCancelResultItem, type BatchOrderResultItem, type BatchOrderSummary, type BatchOrdersResult, type Candle, type CandleInterval, type CandlesParams, type Category, type CreateKeyParams, type CreateMarketParams, CursorPage, type CursorPageInit, type CursorPageParams, type Decimal, type Env, type Envelope, type FeeEstimate, type FeeEstimateParams, FeesResource, type GrantClaimResult, type GrantEvent, type GrantEventType, type GrantPhase, type GrantTier, type GrantVesting, GrantsResource, type HealthStatus, type HmacHeaders, type HttpClientOptions, type KeyScope, KeysResource, type ListEnvelope, type ListMarketsParams, type ListOrdersParams, type ListTemplatesParams, type ListTradesParams, type Market, type MarketStatus, type MarketTemplate, type MarketTradesParams, type MarketType, MarketsResource, type Order, type OrderStatus, type OrderType, type Orderbook, type OrderbookLevel, type OrderbookParams, OrdersResource, type Outcome, PagePromise, PaxAuthError, PaxCircuitBreakerError, PaxClient, type PaxClientOptions, PaxConflictError, PaxError, type PaxErrorDetails, type PaxErrorPayload, PaxNotFoundError, PaxRateLimitError, PaxReadOnlyModeError, PaxSandboxOnlyError, PaxServerError, PaxValidationError, PaxWSClient, type PaxWSClientOptions, PaxWrongEnvKeyError, type PlaceOrderParams, type Position, type RequestOptions, type ResponseMeta, type SandboxKeyMintParams, type SandboxKeyResult, SandboxKeysResource, SandboxResource, type Side, type SignInput, TemplatesResource, type Tier, type TierLimits, type TimeInForce, type TokenGrant, type Trade, VERSION, type WithResponseResult, type WsEvent, type WsHandler, buildError, buildMessage, computeBackoff, runWithRetry, signRequest };
package/dist/index.d.ts CHANGED
@@ -580,6 +580,74 @@ declare class AccountResource extends Resource {
580
580
  trades(params?: ListTradesParams, opts?: RequestOptions): PagePromise<Trade>;
581
581
  }
582
582
 
583
+ /**
584
+ * Fees resource — pre-trade 5-actor split estimator.
585
+ *
586
+ * GET /v1/fees/estimate estimate()
587
+ *
588
+ * v2.1+ — Polymarket has no equivalent. Returns identical shape to the `fee`
589
+ * block on post-trade responses (same 5-actor `splits` + `attribution` +
590
+ * `breakdown` + `ledger_preview`). Powered server-side by `lib/fiveActorFees`
591
+ * so env-tunable bps flow through automatically without SDK bumps.
592
+ */
593
+
594
+ interface FeeEstimateParams {
595
+ marketId?: string;
596
+ side?: "YES" | "NO";
597
+ action?: "BUY" | "SELL";
598
+ size: Decimal | number;
599
+ price: Decimal | number;
600
+ /** VIP discount, 0..0.55 (0 = no discount). */
601
+ vipDiscount?: number;
602
+ /** Sharp multiplier, 1..1.5 (1 = neutral). */
603
+ sharpMultiplier?: number;
604
+ isMintTaker?: boolean;
605
+ isAmmMaker?: boolean;
606
+ /** Override actors for "what if" scenarios. Defaults to caller's key + env. */
607
+ acquisitionBuilderId?: string;
608
+ executionBuilderId?: string;
609
+ operatorId?: string;
610
+ marketCreatorId?: string;
611
+ }
612
+ interface FeeEstimate {
613
+ input: Record<string, unknown>;
614
+ fee: {
615
+ taker_fee_bps: number;
616
+ effective_bps: number;
617
+ taker_fee_total: number;
618
+ maker_rebate: number;
619
+ platform_take: number;
620
+ splits: {
621
+ acquisition_builder: number;
622
+ execution_builder: number;
623
+ operator: number;
624
+ market_creator: number;
625
+ lp: number;
626
+ platform_net: number;
627
+ };
628
+ attribution: {
629
+ acquisition_builder_id: string | null;
630
+ execution_builder_id: string | null;
631
+ operator_id: string | null;
632
+ market_creator_id: string | null;
633
+ unfilled_roles: string[];
634
+ };
635
+ breakdown: {
636
+ notional: number;
637
+ taker_fee_bps: number;
638
+ effective_bps: number;
639
+ vip_discount: number;
640
+ sharp_multiplier: number;
641
+ };
642
+ ledger_preview: Array<Record<string, unknown>>;
643
+ disclosure_version: string;
644
+ };
645
+ note: string;
646
+ }
647
+ declare class FeesResource extends Resource {
648
+ estimate(params: FeeEstimateParams, opts?: RequestOptions): APIPromise<FeeEstimate>;
649
+ }
650
+
583
651
  /**
584
652
  * Grants resource — Builder Program token grants (PAX-denominated) with
585
653
  * cliff + linear vest. Callers use `pax.grants` to view their grants and
@@ -687,11 +755,13 @@ declare class MarketsResource extends Resource {
687
755
  }
688
756
 
689
757
  /**
690
- * Orders resource — your orders.
758
+ * Orders resource — your orders (single + batch).
691
759
  *
692
760
  * POST /v1/orders place()
693
761
  * DELETE /v1/orders/{id} cancel()
694
762
  * GET /v1/account/orders list()
763
+ * POST /v1/orders/batch placeBatch() — v2.1+, up to 25 orders
764
+ * DELETE /v1/orders/batch cancelBatch() — v2.1+, up to 50 orders
695
765
  */
696
766
 
697
767
  interface PlaceOrderParams {
@@ -709,10 +779,75 @@ interface ListOrdersParams {
709
779
  cursor?: string;
710
780
  limit?: number;
711
781
  }
782
+ /** Per-item result inside a batch response — one entry per input order. */
783
+ interface BatchOrderResultItem {
784
+ ok: boolean;
785
+ index: number;
786
+ client_order_id: string | null;
787
+ data?: unknown;
788
+ attribution?: {
789
+ execution_builder_id?: string;
790
+ acquisition_builder_id?: string | null;
791
+ order_id?: string | null;
792
+ write?: {
793
+ ok: boolean;
794
+ rowCount?: number;
795
+ reason?: string;
796
+ };
797
+ };
798
+ error?: {
799
+ code: string;
800
+ message: string;
801
+ };
802
+ }
803
+ interface BatchOrderSummary {
804
+ submitted: number;
805
+ succeeded: number;
806
+ failed: number;
807
+ duration_ms: number;
808
+ }
809
+ interface BatchOrdersResult {
810
+ results: BatchOrderResultItem[];
811
+ summary: BatchOrderSummary;
812
+ }
813
+ interface BatchCancelResultItem {
814
+ ok: boolean;
815
+ index: number;
816
+ order_id?: string;
817
+ data?: unknown;
818
+ error?: {
819
+ code: string;
820
+ message: string;
821
+ };
822
+ }
823
+ interface BatchCancelResult {
824
+ results: BatchCancelResultItem[];
825
+ summary: BatchOrderSummary;
826
+ }
712
827
  declare class OrdersResource extends Resource {
713
828
  place(params: PlaceOrderParams, opts?: RequestOptions): APIPromise<Order>;
714
829
  cancel(orderId: string, opts?: RequestOptions): APIPromise<Order>;
715
830
  list(params?: ListOrdersParams, opts?: RequestOptions): PagePromise<Order>;
831
+ /**
832
+ * Place multiple orders in a single request (up to 25 per batch).
833
+ *
834
+ * Each order is processed sequentially by the CLOB engine (single-writer per
835
+ * market). Response contains a `results` array with one entry per input order
836
+ * (indexed) plus a `summary` with counts + duration. One bad order does not
837
+ * fail the whole batch — inspect `results[i].ok` per item.
838
+ *
839
+ * Batch cap is env-tunable server-side (BATCH_ORDERS_MAX, default 25). Exceeding
840
+ * returns `413 BATCH_TOO_LARGE`.
841
+ */
842
+ placeBatch(orders: PlaceOrderParams[], opts?: RequestOptions): APIPromise<BatchOrdersResult>;
843
+ /**
844
+ * Cancel multiple orders in a single request (up to 50 per batch).
845
+ *
846
+ * Each cancel is processed sequentially by the CLOB engine. Response mirrors
847
+ * `placeBatch` shape — inspect `results[i].ok` per item. Batch cap env-tunable
848
+ * server-side (BATCH_CANCEL_MAX, default 50).
849
+ */
850
+ cancelBatch(orderIds: string[], opts?: RequestOptions): APIPromise<BatchCancelResult>;
716
851
  }
717
852
 
718
853
  /**
@@ -825,7 +960,7 @@ declare class TemplatesResource extends Resource {
825
960
  * }, { idempotencyKey: "ord_1" }).withResponse();
826
961
  */
827
962
 
828
- declare const VERSION = "2.0.0";
963
+ declare const VERSION = "2.1.0";
829
964
  type PaxClientOptions = HttpClientOptions;
830
965
  declare class PaxClient {
831
966
  private readonly _http;
@@ -838,6 +973,7 @@ declare class PaxClient {
838
973
  readonly sandboxKeys: SandboxKeysResource;
839
974
  readonly apply: ApplyResource;
840
975
  readonly grants: GrantsResource;
976
+ readonly fees: FeesResource;
841
977
  constructor(opts: PaxClientOptions);
842
978
  get baseUrl(): string;
843
979
  get userAgent(): string;
@@ -1079,4 +1215,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1079
1215
  onRetry?: (attempt: number, error: Error) => void;
1080
1216
  }): Promise<T>;
1081
1217
 
1082
- export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type Candle, type CandleInterval, type CandlesParams, type Category, type CreateKeyParams, type CreateMarketParams, CursorPage, type CursorPageInit, type CursorPageParams, type Decimal, type Env, type Envelope, type GrantClaimResult, type GrantEvent, type GrantEventType, type GrantPhase, type GrantTier, type GrantVesting, GrantsResource, type HealthStatus, type HmacHeaders, type HttpClientOptions, type KeyScope, KeysResource, type ListEnvelope, type ListMarketsParams, type ListOrdersParams, type ListTemplatesParams, type ListTradesParams, type Market, type MarketStatus, type MarketTemplate, type MarketTradesParams, type MarketType, MarketsResource, type Order, type OrderStatus, type OrderType, type Orderbook, type OrderbookLevel, type OrderbookParams, OrdersResource, type Outcome, PagePromise, PaxAuthError, PaxCircuitBreakerError, PaxClient, type PaxClientOptions, PaxConflictError, PaxError, type PaxErrorDetails, type PaxErrorPayload, PaxNotFoundError, PaxRateLimitError, PaxReadOnlyModeError, PaxSandboxOnlyError, PaxServerError, PaxValidationError, PaxWSClient, type PaxWSClientOptions, PaxWrongEnvKeyError, type PlaceOrderParams, type Position, type RequestOptions, type ResponseMeta, type SandboxKeyMintParams, type SandboxKeyResult, SandboxKeysResource, SandboxResource, type Side, type SignInput, TemplatesResource, type Tier, type TierLimits, type TimeInForce, type TokenGrant, type Trade, VERSION, type WithResponseResult, type WsEvent, type WsHandler, buildError, buildMessage, computeBackoff, runWithRetry, signRequest };
1218
+ export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type BatchCancelResult, type BatchCancelResultItem, type BatchOrderResultItem, type BatchOrderSummary, type BatchOrdersResult, type Candle, type CandleInterval, type CandlesParams, type Category, type CreateKeyParams, type CreateMarketParams, CursorPage, type CursorPageInit, type CursorPageParams, type Decimal, type Env, type Envelope, type FeeEstimate, type FeeEstimateParams, FeesResource, type GrantClaimResult, type GrantEvent, type GrantEventType, type GrantPhase, type GrantTier, type GrantVesting, GrantsResource, type HealthStatus, type HmacHeaders, type HttpClientOptions, type KeyScope, KeysResource, type ListEnvelope, type ListMarketsParams, type ListOrdersParams, type ListTemplatesParams, type ListTradesParams, type Market, type MarketStatus, type MarketTemplate, type MarketTradesParams, type MarketType, MarketsResource, type Order, type OrderStatus, type OrderType, type Orderbook, type OrderbookLevel, type OrderbookParams, OrdersResource, type Outcome, PagePromise, PaxAuthError, PaxCircuitBreakerError, PaxClient, type PaxClientOptions, PaxConflictError, PaxError, type PaxErrorDetails, type PaxErrorPayload, PaxNotFoundError, PaxRateLimitError, PaxReadOnlyModeError, PaxSandboxOnlyError, PaxServerError, PaxValidationError, PaxWSClient, type PaxWSClientOptions, PaxWrongEnvKeyError, type PlaceOrderParams, type Position, type RequestOptions, type ResponseMeta, type SandboxKeyMintParams, type SandboxKeyResult, SandboxKeysResource, SandboxResource, type Side, type SignInput, TemplatesResource, type Tier, type TierLimits, type TimeInForce, type TokenGrant, type Trade, VERSION, type WithResponseResult, type WsEvent, type WsHandler, buildError, buildMessage, computeBackoff, runWithRetry, signRequest };
package/dist/index.js CHANGED
Binary file