@predictasiax/api 2.1.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,95 @@ 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
+
583
672
  /**
584
673
  * Fees resource — pre-trade 5-actor split estimator.
585
674
  *
@@ -960,7 +1049,7 @@ declare class TemplatesResource extends Resource {
960
1049
  * }, { idempotencyKey: "ord_1" }).withResponse();
961
1050
  */
962
1051
 
963
- declare const VERSION = "2.1.0";
1052
+ declare const VERSION = "2.2.0";
964
1053
  type PaxClientOptions = HttpClientOptions;
965
1054
  declare class PaxClient {
966
1055
  private readonly _http;
@@ -974,6 +1063,7 @@ declare class PaxClient {
974
1063
  readonly apply: ApplyResource;
975
1064
  readonly grants: GrantsResource;
976
1065
  readonly fees: FeesResource;
1066
+ readonly audit: AuditResource;
977
1067
  constructor(opts: PaxClientOptions);
978
1068
  get baseUrl(): string;
979
1069
  get userAgent(): string;
@@ -1215,4 +1305,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1215
1305
  onRetry?: (attempt: number, error: Error) => void;
1216
1306
  }): Promise<T>;
1217
1307
 
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 };
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,95 @@ 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
+
583
672
  /**
584
673
  * Fees resource — pre-trade 5-actor split estimator.
585
674
  *
@@ -960,7 +1049,7 @@ declare class TemplatesResource extends Resource {
960
1049
  * }, { idempotencyKey: "ord_1" }).withResponse();
961
1050
  */
962
1051
 
963
- declare const VERSION = "2.1.0";
1052
+ declare const VERSION = "2.2.0";
964
1053
  type PaxClientOptions = HttpClientOptions;
965
1054
  declare class PaxClient {
966
1055
  private readonly _http;
@@ -974,6 +1063,7 @@ declare class PaxClient {
974
1063
  readonly apply: ApplyResource;
975
1064
  readonly grants: GrantsResource;
976
1065
  readonly fees: FeesResource;
1066
+ readonly audit: AuditResource;
977
1067
  constructor(opts: PaxClientOptions);
978
1068
  get baseUrl(): string;
979
1069
  get userAgent(): string;
@@ -1215,4 +1305,4 @@ declare function runWithRetry<T>(fn: () => Promise<T>, opts?: {
1215
1305
  onRetry?: (attempt: number, error: Error) => void;
1216
1306
  }): Promise<T>;
1217
1307
 
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 };
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