@predictasiax/api 2.0.0 → 2.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/dist/index.d.cts CHANGED
@@ -580,6 +580,163 @@ declare class AccountResource extends Resource {
580
580
  trades(params?: ListTradesParams, opts?: RequestOptions): PagePromise<Trade>;
581
581
  }
582
582
 
583
+ /**
584
+ * Audit resource — public no-auth verifier over PAX's hash-chained event
585
+ * log + Merkle-batched anchor chain. Any third party (auditor, investor,
586
+ * external verifier) can independently reconstruct + verify without trusting
587
+ * PAX at all.
588
+ *
589
+ * GET /v1/audit/status status()
590
+ * GET /v1/audit/batches/latest latestBatch()
591
+ * GET /v1/audit/batches/{num} getBatch(num)
592
+ * GET /v1/audit/events/{seq} getEvent(seq)
593
+ * GET /v1/audit/proof/{seq} getProof(seq)
594
+ * GET /v1/audit/anchor/{num} getAnchor(num)
595
+ *
596
+ * v2.2+ — Polymarket has no equivalent surface. Merkle algo is OpenZeppelin
597
+ * sorted-pair sha256, so Solidity `MerkleProof.verify` can verify proofs
598
+ * on-chain without changes.
599
+ */
600
+
601
+ interface AuditStatus {
602
+ events: {
603
+ total: number;
604
+ first_at: string;
605
+ last_at: string;
606
+ };
607
+ batches: {
608
+ total: number;
609
+ anchored: number;
610
+ };
611
+ latest_batch: AuditBatch | null;
612
+ latest_anchor: Pick<AuditBatch, "batch_num" | "anchored_at" | "anchor_target" | "anchor_ref"> | null;
613
+ anchor_lag_seconds: number | null;
614
+ publisher_mode: string;
615
+ verify_docs: string;
616
+ }
617
+ interface AuditBatch {
618
+ batch_num: number;
619
+ batch_id: string;
620
+ first_seq: number;
621
+ last_seq: number;
622
+ event_count: number;
623
+ merkle_root: string;
624
+ prev_batch_hash: string | null;
625
+ created_at: string;
626
+ anchored_at: string | null;
627
+ anchor_target: string | null;
628
+ anchor_ref: string | null;
629
+ anchor_proof: Record<string, unknown> | null;
630
+ anchor_public_url?: string | null;
631
+ }
632
+ interface AuditEvent {
633
+ event_id: string;
634
+ seq: number;
635
+ event_type: string;
636
+ prev_event_hash: string;
637
+ event_hash: string;
638
+ payload: unknown;
639
+ idempotency_key: string;
640
+ created_at: string;
641
+ emitter: string;
642
+ schema_version: number;
643
+ batch_id: string | null;
644
+ batch_seq: number | null;
645
+ }
646
+ interface MerkleProof {
647
+ seq: number;
648
+ event_hash: string;
649
+ batch: Pick<AuditBatch, "batch_num" | "merkle_root" | "first_seq" | "last_seq" | "anchored_at" | "anchor_target" | "anchor_ref">;
650
+ merkle_proof: string[];
651
+ verify_algo: string;
652
+ verify_snippet: string;
653
+ }
654
+ declare class AuditResource extends Resource {
655
+ status(opts?: RequestOptions): APIPromise<AuditStatus>;
656
+ latestBatch(opts?: RequestOptions): APIPromise<AuditBatch>;
657
+ getBatch(batchNum: number, opts?: RequestOptions): APIPromise<AuditBatch>;
658
+ getEvent(seq: number, opts?: RequestOptions): APIPromise<AuditEvent>;
659
+ getProof(seq: number, opts?: RequestOptions): APIPromise<MerkleProof>;
660
+ getAnchor(batchNum: number, opts?: RequestOptions): APIPromise<AuditBatch>;
661
+ /**
662
+ * Verify a Merkle inclusion proof locally (client-side). Mirrors
663
+ * OpenZeppelin's sorted-pair sha256 algorithm — identical logic to the
664
+ * server-side batcher, so callers can independently confirm inclusion
665
+ * without trusting the API response.
666
+ */
667
+ static verifyProof(leaf: string, root: string, proof: string[]): boolean;
668
+ /** Async variant using WebCrypto — works in browsers, Deno, Bun, edge runtimes. */
669
+ static verifyProofAsync(leaf: string, root: string, proof: string[]): Promise<boolean>;
670
+ }
671
+
672
+ /**
673
+ * Fees resource — pre-trade 5-actor split estimator.
674
+ *
675
+ * GET /v1/fees/estimate estimate()
676
+ *
677
+ * v2.1+ — Polymarket has no equivalent. Returns identical shape to the `fee`
678
+ * block on post-trade responses (same 5-actor `splits` + `attribution` +
679
+ * `breakdown` + `ledger_preview`). Powered server-side by `lib/fiveActorFees`
680
+ * so env-tunable bps flow through automatically without SDK bumps.
681
+ */
682
+
683
+ interface FeeEstimateParams {
684
+ marketId?: string;
685
+ side?: "YES" | "NO";
686
+ action?: "BUY" | "SELL";
687
+ size: Decimal | number;
688
+ price: Decimal | number;
689
+ /** VIP discount, 0..0.55 (0 = no discount). */
690
+ vipDiscount?: number;
691
+ /** Sharp multiplier, 1..1.5 (1 = neutral). */
692
+ sharpMultiplier?: number;
693
+ isMintTaker?: boolean;
694
+ isAmmMaker?: boolean;
695
+ /** Override actors for "what if" scenarios. Defaults to caller's key + env. */
696
+ acquisitionBuilderId?: string;
697
+ executionBuilderId?: string;
698
+ operatorId?: string;
699
+ marketCreatorId?: string;
700
+ }
701
+ interface FeeEstimate {
702
+ input: Record<string, unknown>;
703
+ fee: {
704
+ taker_fee_bps: number;
705
+ effective_bps: number;
706
+ taker_fee_total: number;
707
+ maker_rebate: number;
708
+ platform_take: number;
709
+ splits: {
710
+ acquisition_builder: number;
711
+ execution_builder: number;
712
+ operator: number;
713
+ market_creator: number;
714
+ lp: number;
715
+ platform_net: number;
716
+ };
717
+ attribution: {
718
+ acquisition_builder_id: string | null;
719
+ execution_builder_id: string | null;
720
+ operator_id: string | null;
721
+ market_creator_id: string | null;
722
+ unfilled_roles: string[];
723
+ };
724
+ breakdown: {
725
+ notional: number;
726
+ taker_fee_bps: number;
727
+ effective_bps: number;
728
+ vip_discount: number;
729
+ sharp_multiplier: number;
730
+ };
731
+ ledger_preview: Array<Record<string, unknown>>;
732
+ disclosure_version: string;
733
+ };
734
+ note: string;
735
+ }
736
+ declare class FeesResource extends Resource {
737
+ estimate(params: FeeEstimateParams, opts?: RequestOptions): APIPromise<FeeEstimate>;
738
+ }
739
+
583
740
  /**
584
741
  * Grants resource — Builder Program token grants (PAX-denominated) with
585
742
  * cliff + linear vest. Callers use `pax.grants` to view their grants and
@@ -687,11 +844,13 @@ declare class MarketsResource extends Resource {
687
844
  }
688
845
 
689
846
  /**
690
- * Orders resource — your orders.
847
+ * Orders resource — your orders (single + batch).
691
848
  *
692
849
  * POST /v1/orders place()
693
850
  * DELETE /v1/orders/{id} cancel()
694
851
  * GET /v1/account/orders list()
852
+ * POST /v1/orders/batch placeBatch() — v2.1+, up to 25 orders
853
+ * DELETE /v1/orders/batch cancelBatch() — v2.1+, up to 50 orders
695
854
  */
696
855
 
697
856
  interface PlaceOrderParams {
@@ -709,10 +868,75 @@ interface ListOrdersParams {
709
868
  cursor?: string;
710
869
  limit?: number;
711
870
  }
871
+ /** Per-item result inside a batch response — one entry per input order. */
872
+ interface BatchOrderResultItem {
873
+ ok: boolean;
874
+ index: number;
875
+ client_order_id: string | null;
876
+ data?: unknown;
877
+ attribution?: {
878
+ execution_builder_id?: string;
879
+ acquisition_builder_id?: string | null;
880
+ order_id?: string | null;
881
+ write?: {
882
+ ok: boolean;
883
+ rowCount?: number;
884
+ reason?: string;
885
+ };
886
+ };
887
+ error?: {
888
+ code: string;
889
+ message: string;
890
+ };
891
+ }
892
+ interface BatchOrderSummary {
893
+ submitted: number;
894
+ succeeded: number;
895
+ failed: number;
896
+ duration_ms: number;
897
+ }
898
+ interface BatchOrdersResult {
899
+ results: BatchOrderResultItem[];
900
+ summary: BatchOrderSummary;
901
+ }
902
+ interface BatchCancelResultItem {
903
+ ok: boolean;
904
+ index: number;
905
+ order_id?: string;
906
+ data?: unknown;
907
+ error?: {
908
+ code: string;
909
+ message: string;
910
+ };
911
+ }
912
+ interface BatchCancelResult {
913
+ results: BatchCancelResultItem[];
914
+ summary: BatchOrderSummary;
915
+ }
712
916
  declare class OrdersResource extends Resource {
713
917
  place(params: PlaceOrderParams, opts?: RequestOptions): APIPromise<Order>;
714
918
  cancel(orderId: string, opts?: RequestOptions): APIPromise<Order>;
715
919
  list(params?: ListOrdersParams, opts?: RequestOptions): PagePromise<Order>;
920
+ /**
921
+ * Place multiple orders in a single request (up to 25 per batch).
922
+ *
923
+ * Each order is processed sequentially by the CLOB engine (single-writer per
924
+ * market). Response contains a `results` array with one entry per input order
925
+ * (indexed) plus a `summary` with counts + duration. One bad order does not
926
+ * fail the whole batch — inspect `results[i].ok` per item.
927
+ *
928
+ * Batch cap is env-tunable server-side (BATCH_ORDERS_MAX, default 25). Exceeding
929
+ * returns `413 BATCH_TOO_LARGE`.
930
+ */
931
+ placeBatch(orders: PlaceOrderParams[], opts?: RequestOptions): APIPromise<BatchOrdersResult>;
932
+ /**
933
+ * Cancel multiple orders in a single request (up to 50 per batch).
934
+ *
935
+ * Each cancel is processed sequentially by the CLOB engine. Response mirrors
936
+ * `placeBatch` shape — inspect `results[i].ok` per item. Batch cap env-tunable
937
+ * server-side (BATCH_CANCEL_MAX, default 50).
938
+ */
939
+ cancelBatch(orderIds: string[], opts?: RequestOptions): APIPromise<BatchCancelResult>;
716
940
  }
717
941
 
718
942
  /**
@@ -825,7 +1049,7 @@ declare class TemplatesResource extends Resource {
825
1049
  * }, { idempotencyKey: "ord_1" }).withResponse();
826
1050
  */
827
1051
 
828
- declare const VERSION = "2.0.0";
1052
+ declare const VERSION = "2.2.0";
829
1053
  type PaxClientOptions = HttpClientOptions;
830
1054
  declare class PaxClient {
831
1055
  private readonly _http;
@@ -838,6 +1062,8 @@ declare class PaxClient {
838
1062
  readonly sandboxKeys: SandboxKeysResource;
839
1063
  readonly apply: ApplyResource;
840
1064
  readonly grants: GrantsResource;
1065
+ readonly fees: FeesResource;
1066
+ readonly audit: AuditResource;
841
1067
  constructor(opts: PaxClientOptions);
842
1068
  get baseUrl(): string;
843
1069
  get userAgent(): string;
@@ -1079,4 +1305,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1079
1305
  onRetry?: (attempt: number, error: Error) => void;
1080
1306
  }): Promise<T>;
1081
1307
 
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 };
1308
+ export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type AuditBatch, type AuditEvent, AuditResource, type AuditStatus, 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 MerkleProof, 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,163 @@ declare class AccountResource extends Resource {
580
580
  trades(params?: ListTradesParams, opts?: RequestOptions): PagePromise<Trade>;
581
581
  }
582
582
 
583
+ /**
584
+ * Audit resource — public no-auth verifier over PAX's hash-chained event
585
+ * log + Merkle-batched anchor chain. Any third party (auditor, investor,
586
+ * external verifier) can independently reconstruct + verify without trusting
587
+ * PAX at all.
588
+ *
589
+ * GET /v1/audit/status status()
590
+ * GET /v1/audit/batches/latest latestBatch()
591
+ * GET /v1/audit/batches/{num} getBatch(num)
592
+ * GET /v1/audit/events/{seq} getEvent(seq)
593
+ * GET /v1/audit/proof/{seq} getProof(seq)
594
+ * GET /v1/audit/anchor/{num} getAnchor(num)
595
+ *
596
+ * v2.2+ — Polymarket has no equivalent surface. Merkle algo is OpenZeppelin
597
+ * sorted-pair sha256, so Solidity `MerkleProof.verify` can verify proofs
598
+ * on-chain without changes.
599
+ */
600
+
601
+ interface AuditStatus {
602
+ events: {
603
+ total: number;
604
+ first_at: string;
605
+ last_at: string;
606
+ };
607
+ batches: {
608
+ total: number;
609
+ anchored: number;
610
+ };
611
+ latest_batch: AuditBatch | null;
612
+ latest_anchor: Pick<AuditBatch, "batch_num" | "anchored_at" | "anchor_target" | "anchor_ref"> | null;
613
+ anchor_lag_seconds: number | null;
614
+ publisher_mode: string;
615
+ verify_docs: string;
616
+ }
617
+ interface AuditBatch {
618
+ batch_num: number;
619
+ batch_id: string;
620
+ first_seq: number;
621
+ last_seq: number;
622
+ event_count: number;
623
+ merkle_root: string;
624
+ prev_batch_hash: string | null;
625
+ created_at: string;
626
+ anchored_at: string | null;
627
+ anchor_target: string | null;
628
+ anchor_ref: string | null;
629
+ anchor_proof: Record<string, unknown> | null;
630
+ anchor_public_url?: string | null;
631
+ }
632
+ interface AuditEvent {
633
+ event_id: string;
634
+ seq: number;
635
+ event_type: string;
636
+ prev_event_hash: string;
637
+ event_hash: string;
638
+ payload: unknown;
639
+ idempotency_key: string;
640
+ created_at: string;
641
+ emitter: string;
642
+ schema_version: number;
643
+ batch_id: string | null;
644
+ batch_seq: number | null;
645
+ }
646
+ interface MerkleProof {
647
+ seq: number;
648
+ event_hash: string;
649
+ batch: Pick<AuditBatch, "batch_num" | "merkle_root" | "first_seq" | "last_seq" | "anchored_at" | "anchor_target" | "anchor_ref">;
650
+ merkle_proof: string[];
651
+ verify_algo: string;
652
+ verify_snippet: string;
653
+ }
654
+ declare class AuditResource extends Resource {
655
+ status(opts?: RequestOptions): APIPromise<AuditStatus>;
656
+ latestBatch(opts?: RequestOptions): APIPromise<AuditBatch>;
657
+ getBatch(batchNum: number, opts?: RequestOptions): APIPromise<AuditBatch>;
658
+ getEvent(seq: number, opts?: RequestOptions): APIPromise<AuditEvent>;
659
+ getProof(seq: number, opts?: RequestOptions): APIPromise<MerkleProof>;
660
+ getAnchor(batchNum: number, opts?: RequestOptions): APIPromise<AuditBatch>;
661
+ /**
662
+ * Verify a Merkle inclusion proof locally (client-side). Mirrors
663
+ * OpenZeppelin's sorted-pair sha256 algorithm — identical logic to the
664
+ * server-side batcher, so callers can independently confirm inclusion
665
+ * without trusting the API response.
666
+ */
667
+ static verifyProof(leaf: string, root: string, proof: string[]): boolean;
668
+ /** Async variant using WebCrypto — works in browsers, Deno, Bun, edge runtimes. */
669
+ static verifyProofAsync(leaf: string, root: string, proof: string[]): Promise<boolean>;
670
+ }
671
+
672
+ /**
673
+ * Fees resource — pre-trade 5-actor split estimator.
674
+ *
675
+ * GET /v1/fees/estimate estimate()
676
+ *
677
+ * v2.1+ — Polymarket has no equivalent. Returns identical shape to the `fee`
678
+ * block on post-trade responses (same 5-actor `splits` + `attribution` +
679
+ * `breakdown` + `ledger_preview`). Powered server-side by `lib/fiveActorFees`
680
+ * so env-tunable bps flow through automatically without SDK bumps.
681
+ */
682
+
683
+ interface FeeEstimateParams {
684
+ marketId?: string;
685
+ side?: "YES" | "NO";
686
+ action?: "BUY" | "SELL";
687
+ size: Decimal | number;
688
+ price: Decimal | number;
689
+ /** VIP discount, 0..0.55 (0 = no discount). */
690
+ vipDiscount?: number;
691
+ /** Sharp multiplier, 1..1.5 (1 = neutral). */
692
+ sharpMultiplier?: number;
693
+ isMintTaker?: boolean;
694
+ isAmmMaker?: boolean;
695
+ /** Override actors for "what if" scenarios. Defaults to caller's key + env. */
696
+ acquisitionBuilderId?: string;
697
+ executionBuilderId?: string;
698
+ operatorId?: string;
699
+ marketCreatorId?: string;
700
+ }
701
+ interface FeeEstimate {
702
+ input: Record<string, unknown>;
703
+ fee: {
704
+ taker_fee_bps: number;
705
+ effective_bps: number;
706
+ taker_fee_total: number;
707
+ maker_rebate: number;
708
+ platform_take: number;
709
+ splits: {
710
+ acquisition_builder: number;
711
+ execution_builder: number;
712
+ operator: number;
713
+ market_creator: number;
714
+ lp: number;
715
+ platform_net: number;
716
+ };
717
+ attribution: {
718
+ acquisition_builder_id: string | null;
719
+ execution_builder_id: string | null;
720
+ operator_id: string | null;
721
+ market_creator_id: string | null;
722
+ unfilled_roles: string[];
723
+ };
724
+ breakdown: {
725
+ notional: number;
726
+ taker_fee_bps: number;
727
+ effective_bps: number;
728
+ vip_discount: number;
729
+ sharp_multiplier: number;
730
+ };
731
+ ledger_preview: Array<Record<string, unknown>>;
732
+ disclosure_version: string;
733
+ };
734
+ note: string;
735
+ }
736
+ declare class FeesResource extends Resource {
737
+ estimate(params: FeeEstimateParams, opts?: RequestOptions): APIPromise<FeeEstimate>;
738
+ }
739
+
583
740
  /**
584
741
  * Grants resource — Builder Program token grants (PAX-denominated) with
585
742
  * cliff + linear vest. Callers use `pax.grants` to view their grants and
@@ -687,11 +844,13 @@ declare class MarketsResource extends Resource {
687
844
  }
688
845
 
689
846
  /**
690
- * Orders resource — your orders.
847
+ * Orders resource — your orders (single + batch).
691
848
  *
692
849
  * POST /v1/orders place()
693
850
  * DELETE /v1/orders/{id} cancel()
694
851
  * GET /v1/account/orders list()
852
+ * POST /v1/orders/batch placeBatch() — v2.1+, up to 25 orders
853
+ * DELETE /v1/orders/batch cancelBatch() — v2.1+, up to 50 orders
695
854
  */
696
855
 
697
856
  interface PlaceOrderParams {
@@ -709,10 +868,75 @@ interface ListOrdersParams {
709
868
  cursor?: string;
710
869
  limit?: number;
711
870
  }
871
+ /** Per-item result inside a batch response — one entry per input order. */
872
+ interface BatchOrderResultItem {
873
+ ok: boolean;
874
+ index: number;
875
+ client_order_id: string | null;
876
+ data?: unknown;
877
+ attribution?: {
878
+ execution_builder_id?: string;
879
+ acquisition_builder_id?: string | null;
880
+ order_id?: string | null;
881
+ write?: {
882
+ ok: boolean;
883
+ rowCount?: number;
884
+ reason?: string;
885
+ };
886
+ };
887
+ error?: {
888
+ code: string;
889
+ message: string;
890
+ };
891
+ }
892
+ interface BatchOrderSummary {
893
+ submitted: number;
894
+ succeeded: number;
895
+ failed: number;
896
+ duration_ms: number;
897
+ }
898
+ interface BatchOrdersResult {
899
+ results: BatchOrderResultItem[];
900
+ summary: BatchOrderSummary;
901
+ }
902
+ interface BatchCancelResultItem {
903
+ ok: boolean;
904
+ index: number;
905
+ order_id?: string;
906
+ data?: unknown;
907
+ error?: {
908
+ code: string;
909
+ message: string;
910
+ };
911
+ }
912
+ interface BatchCancelResult {
913
+ results: BatchCancelResultItem[];
914
+ summary: BatchOrderSummary;
915
+ }
712
916
  declare class OrdersResource extends Resource {
713
917
  place(params: PlaceOrderParams, opts?: RequestOptions): APIPromise<Order>;
714
918
  cancel(orderId: string, opts?: RequestOptions): APIPromise<Order>;
715
919
  list(params?: ListOrdersParams, opts?: RequestOptions): PagePromise<Order>;
920
+ /**
921
+ * Place multiple orders in a single request (up to 25 per batch).
922
+ *
923
+ * Each order is processed sequentially by the CLOB engine (single-writer per
924
+ * market). Response contains a `results` array with one entry per input order
925
+ * (indexed) plus a `summary` with counts + duration. One bad order does not
926
+ * fail the whole batch — inspect `results[i].ok` per item.
927
+ *
928
+ * Batch cap is env-tunable server-side (BATCH_ORDERS_MAX, default 25). Exceeding
929
+ * returns `413 BATCH_TOO_LARGE`.
930
+ */
931
+ placeBatch(orders: PlaceOrderParams[], opts?: RequestOptions): APIPromise<BatchOrdersResult>;
932
+ /**
933
+ * Cancel multiple orders in a single request (up to 50 per batch).
934
+ *
935
+ * Each cancel is processed sequentially by the CLOB engine. Response mirrors
936
+ * `placeBatch` shape — inspect `results[i].ok` per item. Batch cap env-tunable
937
+ * server-side (BATCH_CANCEL_MAX, default 50).
938
+ */
939
+ cancelBatch(orderIds: string[], opts?: RequestOptions): APIPromise<BatchCancelResult>;
716
940
  }
717
941
 
718
942
  /**
@@ -825,7 +1049,7 @@ declare class TemplatesResource extends Resource {
825
1049
  * }, { idempotencyKey: "ord_1" }).withResponse();
826
1050
  */
827
1051
 
828
- declare const VERSION = "2.0.0";
1052
+ declare const VERSION = "2.2.0";
829
1053
  type PaxClientOptions = HttpClientOptions;
830
1054
  declare class PaxClient {
831
1055
  private readonly _http;
@@ -838,6 +1062,8 @@ declare class PaxClient {
838
1062
  readonly sandboxKeys: SandboxKeysResource;
839
1063
  readonly apply: ApplyResource;
840
1064
  readonly grants: GrantsResource;
1065
+ readonly fees: FeesResource;
1066
+ readonly audit: AuditResource;
841
1067
  constructor(opts: PaxClientOptions);
842
1068
  get baseUrl(): string;
843
1069
  get userAgent(): string;
@@ -1079,4 +1305,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1079
1305
  onRetry?: (attempt: number, error: Error) => void;
1080
1306
  }): Promise<T>;
1081
1307
 
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 };
1308
+ export { APIPromise, type APIResponseInfo, type Account, type AccountBalance, AccountResource, type ApiKey, type ApplicationResult, type ApplicationStatus, type ApplyCreateParams, ApplyResource, type AuditBatch, type AuditEvent, AuditResource, type AuditStatus, 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 MerkleProof, 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