@polymarket/bindings 0.5.0 → 0.7.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.
@@ -1,173 +1,9 @@
1
1
  import * as _polymarket_types from '@polymarket/types';
2
- import { HexString, EvmAddress, EvmSignature, Erc1271Signature } from '@polymarket/types';
2
+ import { EvmAddress, HexString, EvmSignature, Erc1271Signature, TxHash } from '@polymarket/types';
3
+ import { PositionId, TokenId, BaseUnits, OrderSide, MarketId, ConditionId, DecimalString, PaginationCursor, RfqId, RfqQuoteId, ComboConditionId, EpochMilliseconds, RfqRequestorPublicId, BuilderCode, EventId } from '../index.js';
3
4
  import { z } from 'zod';
4
- import { ComboConditionId, EventId, PositionId, DecimalString, MarketId, CtfConditionId, PaginationCursor, RfqId, RfqQuoteId, EpochMilliseconds, OrderSide, TokenId, BaseUnits, RfqRequestorPublicId } from '../index.js';
5
5
  import { S as SignatureType } from '../signature-type-CrLAA9AN.js';
6
6
 
7
- /**
8
- * Known collateral-return plan operation kinds.
9
- *
10
- * The service evolves this set independently of released clients, so plan
11
- * parsing accepts unknown kinds as plain strings; see
12
- * {@link CollateralReturnOperationKind}.
13
- */
14
- declare enum CollateralReturnKnownOperationKind {
15
- Split = "split",
16
- Merge = "merge",
17
- Redeem = "redeem",
18
- SplitOnCondition = "split_on_condition",
19
- MergeOnCondition = "merge_on_condition",
20
- SplitOnEvent = "split_on_event",
21
- MergeOnEvent = "merge_on_event",
22
- ConvertOnEvent = "convert_on_event",
23
- Extract = "extract",
24
- Inject = "inject",
25
- ConvertToYesBasket = "convert_to_yes_basket",
26
- MergeFromYesBasket = "merge_from_yes_basket",
27
- Compress = "compress"
28
- }
29
- /**
30
- * A collateral-return operation kind. Known kinds are enumerated in
31
- * {@link CollateralReturnKnownOperationKind}; newly introduced kinds flow
32
- * through as plain strings so plans keep parsing before a client release that
33
- * enumerates them.
34
- */
35
- type CollateralReturnOperationKind = CollateralReturnKnownOperationKind | (string & {});
36
- type CollateralReturnOperation = {
37
- kind: CollateralReturnOperationKind;
38
- conditionId?: ComboConditionId;
39
- eventId?: EventId;
40
- positionId?: PositionId;
41
- conditionIndex: number;
42
- amount: DecimalString;
43
- };
44
- type CollateralReturnPositionAmount = {
45
- positionId: PositionId;
46
- amount: DecimalString;
47
- };
48
- type CollateralReturnPositionSummary = {
49
- consumed: CollateralReturnPositionAmount[];
50
- created: CollateralReturnPositionAmount[];
51
- };
52
- type CollateralReturnRouterCall = {
53
- to: EvmAddress;
54
- data: HexString;
55
- };
56
- /**
57
- * The plan fields execution consumes: the plan identifier round-tripped to
58
- * the service, the chain and wallet the plan was computed for, and the exact
59
- * Router call the execution signs and submits.
60
- */
61
- declare const CollateralReturnPlanSchema: z.ZodObject<{
62
- planHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
63
- chainId: z.ZodNumber;
64
- wallet: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
65
- routerCall: z.ZodPipe<z.ZodObject<{
66
- to: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
67
- data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
68
- }, z.core.$strip>, z.ZodTransform<CollateralReturnRouterCall, {
69
- to: EvmAddress;
70
- data: `0x${string}`;
71
- }>>;
72
- }, z.core.$loose>;
73
- type CollateralReturnPlanResponse = {
74
- planHash: HexString;
75
- chainId: number;
76
- wallet: EvmAddress;
77
- blockNumber: bigint;
78
- startingPusd: DecimalString;
79
- netPusdOut: DecimalString;
80
- finalPusd: DecimalString;
81
- operations: CollateralReturnOperation[];
82
- operationCount: number;
83
- truncated: boolean;
84
- estimatedCost: number;
85
- requiredPusdInput: DecimalString;
86
- requiredPositions: CollateralReturnPositionAmount[];
87
- positionSummary: CollateralReturnPositionSummary;
88
- candidatePositionIds: PositionId[];
89
- routerCall: CollateralReturnRouterCall;
90
- };
91
- declare const CollateralReturnPlanResponseSchema: z.ZodPipe<z.ZodObject<{
92
- plan_hash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
93
- chain_id: z.ZodNumber;
94
- wallet: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
95
- block_number: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
96
- starting_pusd: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
97
- net_pusd_out: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
98
- final_pusd: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
99
- operations: z.ZodArray<z.ZodPipe<z.ZodObject<{
100
- kind: z.ZodPipe<z.ZodString, z.ZodTransform<CollateralReturnKnownOperationKind | (string & {}), string>>;
101
- condition_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>>;
102
- event_id: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>]>, z.ZodTransform<EventId, string>>>;
103
- position_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
104
- condition_index: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
105
- amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
106
- }, z.core.$strip>, z.ZodTransform<CollateralReturnOperation, {
107
- kind: CollateralReturnKnownOperationKind | (string & {});
108
- condition_index: number;
109
- amount: DecimalString;
110
- condition_id?: ComboConditionId | undefined;
111
- event_id?: EventId | undefined;
112
- position_id?: PositionId | undefined;
113
- }>>>;
114
- operation_count: z.ZodNumber;
115
- truncated: z.ZodBoolean;
116
- estimated_cost: z.ZodNumber;
117
- required_pusd_input: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
118
- required_positions: z.ZodArray<z.ZodPipe<z.ZodObject<{
119
- position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
120
- amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
121
- }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
122
- position_id: PositionId;
123
- amount: DecimalString;
124
- }>>>;
125
- position_summary: z.ZodOptional<z.ZodPipe<z.ZodObject<{
126
- consumed: z.ZodArray<z.ZodPipe<z.ZodObject<{
127
- position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
128
- amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
129
- }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
130
- position_id: PositionId;
131
- amount: DecimalString;
132
- }>>>;
133
- created: z.ZodArray<z.ZodPipe<z.ZodObject<{
134
- position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
135
- amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
136
- }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
137
- position_id: PositionId;
138
- amount: DecimalString;
139
- }>>>;
140
- }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionSummary, {
141
- consumed: CollateralReturnPositionAmount[];
142
- created: CollateralReturnPositionAmount[];
143
- }>>>;
144
- candidate_position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
145
- router_call: z.ZodPipe<z.ZodObject<{
146
- to: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
147
- data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
148
- }, z.core.$strip>, z.ZodTransform<CollateralReturnRouterCall, {
149
- to: EvmAddress;
150
- data: `0x${string}`;
151
- }>>;
152
- }, z.core.$strip>, z.ZodTransform<CollateralReturnPlanResponse, {
153
- plan_hash: `0x${string}`;
154
- chain_id: number;
155
- wallet: EvmAddress;
156
- block_number: bigint;
157
- starting_pusd: DecimalString;
158
- net_pusd_out: DecimalString;
159
- final_pusd: DecimalString;
160
- operations: CollateralReturnOperation[];
161
- operation_count: number;
162
- truncated: boolean;
163
- estimated_cost: number;
164
- required_pusd_input: DecimalString;
165
- required_positions: CollateralReturnPositionAmount[];
166
- candidate_position_ids: PositionId[];
167
- router_call: CollateralReturnRouterCall;
168
- position_summary?: CollateralReturnPositionSummary | undefined;
169
- }>>;
170
-
171
7
  declare enum RfqDirection {
172
8
  Buy = "BUY",
173
9
  Sell = "SELL"
@@ -212,6 +48,7 @@ declare enum RfqKnownErrorCode {
212
48
  InternalError = "INTERNAL_ERROR",
213
49
  LegMetadataUnavailable = "LEG_METADATA_UNAVAILABLE",
214
50
  MakerAlreadyResponded = "MAKER_ALREADY_RESPONDED",
51
+ MakerDeclined = "MAKER_DECLINED",
215
52
  MakerNotRequired = "MAKER_NOT_REQUIRED",
216
53
  MakerQuoteLimited = "MAKER_QUOTE_LIMITED",
217
54
  MissingMakerAddressInQuote = "MISSING_MAKER_ADDRESS_IN_QUOTE",
@@ -226,6 +63,7 @@ declare enum RfqKnownErrorCode {
226
63
  MissingTakerAmountInSignedOrder = "MISSING_TAKER_AMOUNT_IN_SIGNED_ORDER",
227
64
  MissingTimestampInSignedOrder = "MISSING_TIMESTAMP_IN_SIGNED_ORDER",
228
65
  MissingTokenIdInSignedOrder = "MISSING_TOKEN_ID_IN_SIGNED_ORDER",
66
+ NoQuotes = "NO_QUOTES",
229
67
  OrderSideOrTokenDoesNotMatchRequest = "ORDER_SIDE_OR_TOKEN_DOES_NOT_MATCH_REQUEST",
230
68
  PreExecutionBalanceReservationFailed = "PRE_EXECUTION_BALANCE_RESERVATION_FAILED",
231
69
  PriceE6NotPositive = "PRICE_E6_NOT_POSITIVE",
@@ -244,6 +82,7 @@ declare enum RfqKnownErrorCode {
244
82
  SignedOrderSizeDoesNotCoverQuote = "SIGNED_ORDER_SIZE_DOES_NOT_COVER_QUOTE",
245
83
  SignedOrderTakerAmountNotPositive = "SIGNED_ORDER_TAKER_AMOUNT_NOT_POSITIVE",
246
84
  SizeE6NotPositive = "SIZE_E6_NOT_POSITIVE",
85
+ SizeTooLarge = "SIZE_TOO_LARGE",
247
86
  SubmissionWindowClosed = "SUBMISSION_WINDOW_CLOSED",
248
87
  TradeSubmissionFailed = "TRADE_SUBMISSION_FAILED",
249
88
  Unauthenticated = "UNAUTHENTICATED",
@@ -258,7 +97,7 @@ declare enum RfqKnownErrorCode {
258
97
  type RfqErrorCode = RfqKnownErrorCode | (string & {});
259
98
  type ComboMarket = {
260
99
  id: MarketId;
261
- conditionId: CtfConditionId;
100
+ conditionId: ConditionId;
262
101
  slug: string;
263
102
  title: string;
264
103
  outcomes: ComboMarketOutcomes;
@@ -278,7 +117,7 @@ type ComboMarketOutcomes = {
278
117
  declare const ListComboMarketsResponseSchema: z.ZodPipe<z.ZodObject<{
279
118
  markets: z.ZodArray<z.ZodPipe<z.ZodObject<{
280
119
  id: z.ZodPipe<z.ZodString, z.ZodTransform<MarketId, string>>;
281
- condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<CtfConditionId, string>>;
120
+ condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<ConditionId, string>>;
282
121
  position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
283
122
  slug: z.ZodString;
284
123
  title: z.ZodString;
@@ -289,7 +128,7 @@ declare const ListComboMarketsResponseSchema: z.ZodPipe<z.ZodObject<{
289
128
  tags: z.ZodArray<z.ZodString>;
290
129
  }, z.core.$strip>, z.ZodTransform<ComboMarket, {
291
130
  id: MarketId;
292
- condition_id: CtfConditionId;
131
+ condition_id: ConditionId;
293
132
  position_ids: PositionId[];
294
133
  slug: string;
295
134
  title: string;
@@ -863,4 +702,421 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
863
702
  type RfqQuoterInboundMessage = z.infer<typeof RfqQuoterInboundMessageSchema>;
864
703
  type RfqQuoterOutboundMessage = RfqQuoteMessage | RfqQuoteCancelMessage | RfqConfirmationResponseMessage;
865
704
 
866
- export { CollateralReturnKnownOperationKind, type CollateralReturnOperation, type CollateralReturnOperationKind, type CollateralReturnPlanResponse, CollateralReturnPlanResponseSchema, CollateralReturnPlanSchema, type CollateralReturnPositionAmount, type CollateralReturnPositionSummary, type CollateralReturnRouterCall, type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, type RfqConfirmationAck, RfqConfirmationDecision, type RfqConfirmationRequest, type RfqConfirmationResponseMessage, RfqDirection, type RfqErrorCode, type RfqErrorMessage, RfqExecutionStatus, type RfqExecutionUpdate, RfqId, RfqKnownErrorCode, RfqKnownInboundType, type RfqOrderSide, type RfqQuoteAck, type RfqQuoteCancelAck, type RfqQuoteCancelMessage, RfqQuoteId, type RfqQuoteMessage, type RfqQuoteRequest, type RfqQuoterInboundMessage, RfqQuoterInboundMessageSchema, type RfqQuoterOutboundMessage, type RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide, type RfqSignedOrder, type RfqTrade };
705
+ /** Lifecycle status of an RFQ. */
706
+ declare enum RfqStatus {
707
+ AwaitingRequesterAcceptance = "AWAITING_REQUESTER_ACCEPTANCE",
708
+ AwaitingMakerConfirmation = "AWAITING_MAKER_CONFIRMATION",
709
+ Executing = "EXECUTING",
710
+ Filled = "FILLED",
711
+ Failed = "FAILED",
712
+ Expired = "EXPIRED",
713
+ Canceled = "CANCELED"
714
+ }
715
+ /**
716
+ * Machine-readable reason an RFQ request or acceptance was rejected.
717
+ *
718
+ * @remarks
719
+ * Codes not enumerated in this SDK release are classified as
720
+ * {@link RfqRejectionCode.RequestFailed} with the original error preserved on
721
+ * `cause`.
722
+ */
723
+ declare enum RfqRejectionCode {
724
+ /** The request body could not be decoded as JSON. */
725
+ InvalidJson = "INVALID_JSON",
726
+ /** The request message is malformed. */
727
+ InvalidMessage = "INVALID_MESSAGE",
728
+ /** The authenticated role is not valid for this request. */
729
+ InvalidRole = "INVALID_ROLE",
730
+ /** The authenticated role is not authorized for this request. */
731
+ UnauthorizedRole = "UNAUTHORIZED_ROLE",
732
+ /** Authentication credentials are missing or invalid. */
733
+ Unauthenticated = "UNAUTHENTICATED",
734
+ /** The authenticated address does not match the request. */
735
+ AddressMismatch = "ADDRESS_MISMATCH",
736
+ /** The request is malformed or references invalid legs. */
737
+ InvalidRfq = "INVALID_RFQ",
738
+ /** The legs are mutually exclusive (e.g. YES and NO on the same market). */
739
+ ContradictoryLegs = "CONTRADICTORY_LEGS",
740
+ /** Leg metadata is temporarily unavailable; the request may be retried. */
741
+ LegMetadataUnavailable = "LEG_METADATA_UNAVAILABLE",
742
+ /** The acceptance is invalid (unknown RFQ, wrong state, quote/builder mismatch). */
743
+ InvalidAcceptance = "INVALID_ACCEPTANCE",
744
+ /** The referenced quote is invalid or no longer available. */
745
+ InvalidQuote = "INVALID_QUOTE",
746
+ /** The order signature failed verification. */
747
+ InvalidSignature = "INVALID_SIGNATURE",
748
+ /** The request identity is invalid. */
749
+ InvalidIdentity = "INVALID_IDENTITY",
750
+ /** The RFQ does not exist for the authenticated requester. */
751
+ UnknownRfq = "UNKNOWN_RFQ",
752
+ /** The RFQ acceptance window has expired. */
753
+ ExpiredRfq = "EXPIRED_RFQ",
754
+ /** The RFQ is not in a state that permits this operation. */
755
+ InvalidRfqState = "INVALID_RFQ_STATE",
756
+ /** The quote does not match the RFQ being accepted. */
757
+ QuoteMismatch = "QUOTE_MISMATCH",
758
+ /** The submission window is closed. */
759
+ SubmissionWindowClosed = "SUBMISSION_WINDOW_CLOSED",
760
+ /** A required service is temporarily unavailable. */
761
+ ServiceUnavailable = "SERVICE_UNAVAILABLE",
762
+ /** Balance reservation failed before execution. */
763
+ PreExecutionBalanceReservationFailed = "PRE_EXECUTION_BALANCE_RESERVATION_FAILED",
764
+ /** The requester does not have sufficient balance. */
765
+ BalanceValidationFailed = "BALANCE_VALIDATION_FAILED",
766
+ /** The requester does not have sufficient allowance. */
767
+ AllowanceValidationFailed = "ALLOWANCE_VALIDATION_FAILED",
768
+ /** The accepted trade could not be submitted for execution. */
769
+ TradeSubmissionFailed = "TRADE_SUBMISSION_FAILED",
770
+ /** The request failed without a more specific classification. */
771
+ RequestFailed = "REQUEST_FAILED"
772
+ }
773
+ /** Reason no quote was returned for a combo quote request. */
774
+ declare enum ComboQuoteUnavailableReason {
775
+ NoQuotes = "NO_QUOTES",
776
+ SizeTooLarge = "SIZE_TOO_LARGE"
777
+ }
778
+ /** Reason an accepted combo quote did not proceed to a fill. */
779
+ declare enum ComboAcceptFailureReason {
780
+ MakerDeclined = "MAKER_DECLINED",
781
+ AcceptanceWindowExpired = "ACCEPTANCE_WINDOW_EXPIRED",
782
+ /** The trade failed before or during onchain execution handoff. */
783
+ ExecutionFailed = "EXECUTION_FAILED"
784
+ }
785
+ type BuilderRfqRequestedSize = {
786
+ unit: RfqRequestedSizeUnit;
787
+ value_e6: string;
788
+ };
789
+ type BuilderRfqCreateRequest = {
790
+ signer_address: EvmAddress;
791
+ maker_address: EvmAddress;
792
+ signature_type: SignatureType;
793
+ leg_position_ids: string[];
794
+ direction: RfqDirection;
795
+ side: RfqSide;
796
+ requested_size: BuilderRfqRequestedSize;
797
+ };
798
+ type BuilderRfqAcceptRequest = {
799
+ quote_id: string;
800
+ signed_order: RfqSignedOrder;
801
+ };
802
+ /** Structured error carried inside combo RFQ responses. */
803
+ type BuilderRfqError = {
804
+ code: RfqErrorCode;
805
+ message: string;
806
+ };
807
+ /** The winning quote for an RFQ. */
808
+ type BuilderRfqQuote = {
809
+ quoteId: RfqQuoteId;
810
+ /** Blended price across legs, in collateral per outcome token. */
811
+ blendedPrice: DecimalString;
812
+ /** Signed-order collateral for BUY, or position shares for SELL. */
813
+ makerAmount: DecimalString;
814
+ /** Signed-order shares for BUY, or gross collateral limit for SELL. */
815
+ takerAmount: DecimalString;
816
+ /** Total collateral (BUY) or position-share (SELL) balance required to accept. */
817
+ totalRequired: DecimalString;
818
+ /** Exact collateral proceeds after fees. Present only for SELL quotes. */
819
+ netReceive?: DecimalString;
820
+ };
821
+ type BuilderRfqResponseRequestedSize = {
822
+ unit: RfqRequestedSizeUnit;
823
+ valueE6: BaseUnits;
824
+ };
825
+ /** Original request echoed by a quote-ready builder RFQ response. */
826
+ type BuilderRfqResponseRequest = {
827
+ rfqId: RfqId;
828
+ legPositionIds: PositionId[];
829
+ conditionId: ComboConditionId;
830
+ yesPositionId: PositionId;
831
+ noPositionId: PositionId;
832
+ direction: RfqDirection;
833
+ side: RfqSide;
834
+ requestedSize: BuilderRfqResponseRequestedSize;
835
+ };
836
+ type BuilderRfqQuoteReadyResponse = {
837
+ rfqId: RfqId;
838
+ status: RfqStatus.AwaitingRequesterAcceptance;
839
+ /** Acceptance deadline (Unix ms). */
840
+ expiresAt: EpochMilliseconds;
841
+ builderCode: BuilderCode;
842
+ request: BuilderRfqResponseRequest;
843
+ quote: BuilderRfqQuote;
844
+ };
845
+ type BuilderRfqFinalStateResponse = {
846
+ rfqId: RfqId;
847
+ status: RfqStatus.Failed | RfqStatus.Expired | RfqStatus.Canceled;
848
+ error?: BuilderRfqError;
849
+ };
850
+ declare const BuilderRfqCreateResponseSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodObject<{
851
+ rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
852
+ status: z.ZodLiteral<RfqStatus.AwaitingRequesterAcceptance>;
853
+ expires_at: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
854
+ builder_code: z.ZodPipe<z.ZodString, z.ZodTransform<BuilderCode, string>>;
855
+ request: z.ZodPipe<z.ZodObject<{
856
+ rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
857
+ leg_position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
858
+ condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>;
859
+ yes_position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
860
+ no_position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
861
+ direction: z.ZodEnum<typeof RfqDirection>;
862
+ side: z.ZodEnum<typeof RfqSide>;
863
+ requested_size: z.ZodPipe<z.ZodObject<{
864
+ unit: z.ZodEnum<typeof RfqRequestedSizeUnit>;
865
+ value_e6: z.ZodPipe<z.ZodString, z.ZodTransform<BaseUnits, string>>;
866
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqResponseRequestedSize, {
867
+ unit: RfqRequestedSizeUnit;
868
+ value_e6: BaseUnits;
869
+ }>>;
870
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqResponseRequest, {
871
+ rfq_id: RfqId;
872
+ leg_position_ids: PositionId[];
873
+ condition_id: ComboConditionId;
874
+ yes_position_id: PositionId;
875
+ no_position_id: PositionId;
876
+ direction: RfqDirection;
877
+ side: RfqSide;
878
+ requested_size: BuilderRfqResponseRequestedSize;
879
+ }>>;
880
+ quote: z.ZodPipe<z.ZodObject<{
881
+ quote_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>;
882
+ blended_price_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
883
+ maker_amount_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
884
+ taker_amount_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
885
+ total_required_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
886
+ net_receive_e6: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>>;
887
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqQuote, {
888
+ quote_id: RfqQuoteId;
889
+ blended_price_e6: DecimalString;
890
+ maker_amount_e6: DecimalString;
891
+ taker_amount_e6: DecimalString;
892
+ total_required_e6: DecimalString;
893
+ net_receive_e6?: DecimalString | undefined;
894
+ }>>;
895
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqQuoteReadyResponse, {
896
+ rfq_id: RfqId;
897
+ status: RfqStatus.AwaitingRequesterAcceptance;
898
+ expires_at: EpochMilliseconds;
899
+ builder_code: BuilderCode;
900
+ request: BuilderRfqResponseRequest;
901
+ quote: BuilderRfqQuote;
902
+ }>>, z.ZodPipe<z.ZodObject<{
903
+ rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
904
+ status: z.ZodEnum<{
905
+ FAILED: RfqStatus.Failed;
906
+ EXPIRED: RfqStatus.Expired;
907
+ CANCELED: RfqStatus.Canceled;
908
+ }>;
909
+ error: z.ZodOptional<z.ZodPipe<z.ZodObject<{
910
+ code: z.ZodPipe<z.ZodString, z.ZodTransform<(string & {}) | RfqKnownErrorCode, string>>;
911
+ message: z.ZodString;
912
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqError, {
913
+ code: (string & {}) | RfqKnownErrorCode;
914
+ message: string;
915
+ }>>>;
916
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqFinalStateResponse, {
917
+ rfq_id: RfqId;
918
+ status: RfqStatus.Failed | RfqStatus.Expired | RfqStatus.Canceled;
919
+ error?: BuilderRfqError | undefined;
920
+ }>>]>;
921
+ type BuilderRfqCreateResponse = BuilderRfqQuoteReadyResponse | BuilderRfqFinalStateResponse;
922
+ /**
923
+ * Status projection returned on accept responses and post-acceptance status
924
+ * reads.
925
+ *
926
+ * @remarks
927
+ * Onchain execution progress is merged into the top-level `status`:
928
+ * {@link RfqExecutionStatus} values surface alongside the RFQ lifecycle
929
+ * (`MATCHED` is reported as {@link RfqStatus.Executing}).
930
+ */
931
+ type BuilderRfqStatusResponse = {
932
+ rfqId: RfqId;
933
+ status: RfqStatus | RfqExecutionStatus;
934
+ takerOrderHash?: string;
935
+ txHash?: TxHash;
936
+ error?: BuilderRfqError;
937
+ };
938
+ declare const BuilderRfqStatusResponseSchema: z.ZodPipe<z.ZodObject<{
939
+ rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
940
+ status: z.ZodUnion<readonly [z.ZodEnum<typeof RfqStatus>, z.ZodEnum<typeof RfqExecutionStatus>]>;
941
+ taker_order_hash: z.ZodOptional<z.ZodString>;
942
+ tx_hash: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<TxHash, string>>>;
943
+ error: z.ZodOptional<z.ZodPipe<z.ZodObject<{
944
+ code: z.ZodPipe<z.ZodString, z.ZodTransform<(string & {}) | RfqKnownErrorCode, string>>;
945
+ message: z.ZodString;
946
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqError, {
947
+ code: (string & {}) | RfqKnownErrorCode;
948
+ message: string;
949
+ }>>>;
950
+ }, z.core.$strip>, z.ZodTransform<BuilderRfqStatusResponse, {
951
+ rfq_id: RfqId;
952
+ status: RfqExecutionStatus | RfqStatus;
953
+ taker_order_hash?: string | undefined;
954
+ tx_hash?: TxHash | undefined;
955
+ error?: BuilderRfqError | undefined;
956
+ }>>;
957
+
958
+ /**
959
+ * Known collateral-return plan operation kinds.
960
+ *
961
+ * The service evolves this set independently of released clients, so plan
962
+ * parsing accepts unknown kinds as plain strings; see
963
+ * {@link CollateralReturnOperationKind}.
964
+ */
965
+ declare enum CollateralReturnKnownOperationKind {
966
+ Split = "split",
967
+ Merge = "merge",
968
+ Redeem = "redeem",
969
+ SplitOnCondition = "split_on_condition",
970
+ MergeOnCondition = "merge_on_condition",
971
+ SplitOnEvent = "split_on_event",
972
+ MergeOnEvent = "merge_on_event",
973
+ ConvertOnEvent = "convert_on_event",
974
+ Extract = "extract",
975
+ Inject = "inject",
976
+ ConvertToYesBasket = "convert_to_yes_basket",
977
+ MergeFromYesBasket = "merge_from_yes_basket",
978
+ Compress = "compress"
979
+ }
980
+ /**
981
+ * A collateral-return operation kind. Known kinds are enumerated in
982
+ * {@link CollateralReturnKnownOperationKind}; newly introduced kinds flow
983
+ * through as plain strings so plans keep parsing before a client release that
984
+ * enumerates them.
985
+ */
986
+ type CollateralReturnOperationKind = CollateralReturnKnownOperationKind | (string & {});
987
+ type CollateralReturnOperation = {
988
+ kind: CollateralReturnOperationKind;
989
+ conditionId?: ComboConditionId;
990
+ eventId?: EventId;
991
+ positionId?: PositionId;
992
+ conditionIndex: number;
993
+ amount: DecimalString;
994
+ };
995
+ type CollateralReturnPositionAmount = {
996
+ positionId: PositionId;
997
+ amount: DecimalString;
998
+ };
999
+ type CollateralReturnPositionSummary = {
1000
+ consumed: CollateralReturnPositionAmount[];
1001
+ created: CollateralReturnPositionAmount[];
1002
+ };
1003
+ type CollateralReturnRouterCall = {
1004
+ to: EvmAddress;
1005
+ data: HexString;
1006
+ };
1007
+ /**
1008
+ * The plan fields execution consumes: the plan identifier round-tripped to
1009
+ * the service, the chain and wallet the plan was computed for, and the exact
1010
+ * Router call the execution signs and submits.
1011
+ */
1012
+ declare const CollateralReturnPlanSchema: z.ZodObject<{
1013
+ planHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
1014
+ chainId: z.ZodNumber;
1015
+ wallet: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
1016
+ routerCall: z.ZodPipe<z.ZodObject<{
1017
+ to: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
1018
+ data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
1019
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnRouterCall, {
1020
+ to: EvmAddress;
1021
+ data: `0x${string}`;
1022
+ }>>;
1023
+ }, z.core.$loose>;
1024
+ type CollateralReturnPlanResponse = {
1025
+ planHash: HexString;
1026
+ chainId: number;
1027
+ wallet: EvmAddress;
1028
+ blockNumber: bigint;
1029
+ startingPusd: DecimalString;
1030
+ netPusdOut: DecimalString;
1031
+ finalPusd: DecimalString;
1032
+ operations: CollateralReturnOperation[];
1033
+ operationCount: number;
1034
+ truncated: boolean;
1035
+ estimatedCost: number;
1036
+ requiredPusdInput: DecimalString;
1037
+ requiredPositions: CollateralReturnPositionAmount[];
1038
+ positionSummary: CollateralReturnPositionSummary;
1039
+ candidatePositionIds: PositionId[];
1040
+ routerCall: CollateralReturnRouterCall;
1041
+ };
1042
+ declare const CollateralReturnPlanResponseSchema: z.ZodPipe<z.ZodObject<{
1043
+ plan_hash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
1044
+ chain_id: z.ZodNumber;
1045
+ wallet: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
1046
+ block_number: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
1047
+ starting_pusd: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1048
+ net_pusd_out: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1049
+ final_pusd: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1050
+ operations: z.ZodArray<z.ZodPipe<z.ZodObject<{
1051
+ kind: z.ZodPipe<z.ZodString, z.ZodTransform<(string & {}) | CollateralReturnKnownOperationKind, string>>;
1052
+ condition_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>>;
1053
+ event_id: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodPipe<z.ZodNumber, z.ZodTransform<string, number>>]>, z.ZodTransform<EventId, string>>>;
1054
+ position_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
1055
+ condition_index: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1056
+ amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1057
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnOperation, {
1058
+ kind: (string & {}) | CollateralReturnKnownOperationKind;
1059
+ condition_index: number;
1060
+ amount: DecimalString;
1061
+ condition_id?: ComboConditionId | undefined;
1062
+ event_id?: EventId | undefined;
1063
+ position_id?: PositionId | undefined;
1064
+ }>>>;
1065
+ operation_count: z.ZodNumber;
1066
+ truncated: z.ZodBoolean;
1067
+ estimated_cost: z.ZodNumber;
1068
+ required_pusd_input: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1069
+ required_positions: z.ZodArray<z.ZodPipe<z.ZodObject<{
1070
+ position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
1071
+ amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1072
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
1073
+ position_id: PositionId;
1074
+ amount: DecimalString;
1075
+ }>>>;
1076
+ position_summary: z.ZodOptional<z.ZodPipe<z.ZodObject<{
1077
+ consumed: z.ZodArray<z.ZodPipe<z.ZodObject<{
1078
+ position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
1079
+ amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1080
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
1081
+ position_id: PositionId;
1082
+ amount: DecimalString;
1083
+ }>>>;
1084
+ created: z.ZodArray<z.ZodPipe<z.ZodObject<{
1085
+ position_id: z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>;
1086
+ amount: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
1087
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionAmount, {
1088
+ position_id: PositionId;
1089
+ amount: DecimalString;
1090
+ }>>>;
1091
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnPositionSummary, {
1092
+ consumed: CollateralReturnPositionAmount[];
1093
+ created: CollateralReturnPositionAmount[];
1094
+ }>>>;
1095
+ candidate_position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
1096
+ router_call: z.ZodPipe<z.ZodObject<{
1097
+ to: z.ZodPipe<z.ZodString, z.ZodTransform<EvmAddress, string>>;
1098
+ data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
1099
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnRouterCall, {
1100
+ to: EvmAddress;
1101
+ data: `0x${string}`;
1102
+ }>>;
1103
+ }, z.core.$strip>, z.ZodTransform<CollateralReturnPlanResponse, {
1104
+ plan_hash: `0x${string}`;
1105
+ chain_id: number;
1106
+ wallet: EvmAddress;
1107
+ block_number: bigint;
1108
+ starting_pusd: DecimalString;
1109
+ net_pusd_out: DecimalString;
1110
+ final_pusd: DecimalString;
1111
+ operations: CollateralReturnOperation[];
1112
+ operation_count: number;
1113
+ truncated: boolean;
1114
+ estimated_cost: number;
1115
+ required_pusd_input: DecimalString;
1116
+ required_positions: CollateralReturnPositionAmount[];
1117
+ candidate_position_ids: PositionId[];
1118
+ router_call: CollateralReturnRouterCall;
1119
+ position_summary?: CollateralReturnPositionSummary | undefined;
1120
+ }>>;
1121
+
1122
+ export { type BuilderRfqAcceptRequest, type BuilderRfqCreateRequest, type BuilderRfqCreateResponse, BuilderRfqCreateResponseSchema, type BuilderRfqError, type BuilderRfqFinalStateResponse, type BuilderRfqQuote, type BuilderRfqQuoteReadyResponse, type BuilderRfqRequestedSize, type BuilderRfqResponseRequest, type BuilderRfqResponseRequestedSize, type BuilderRfqStatusResponse, BuilderRfqStatusResponseSchema, CollateralReturnKnownOperationKind, type CollateralReturnOperation, type CollateralReturnOperationKind, type CollateralReturnPlanResponse, CollateralReturnPlanResponseSchema, CollateralReturnPlanSchema, type CollateralReturnPositionAmount, type CollateralReturnPositionSummary, type CollateralReturnRouterCall, ComboAcceptFailureReason, type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, ComboQuoteUnavailableReason, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, type RfqConfirmationAck, RfqConfirmationDecision, type RfqConfirmationRequest, type RfqConfirmationResponseMessage, RfqDirection, type RfqErrorCode, type RfqErrorMessage, RfqExecutionStatus, type RfqExecutionUpdate, RfqId, RfqKnownErrorCode, RfqKnownInboundType, type RfqOrderSide, type RfqQuoteAck, type RfqQuoteCancelAck, type RfqQuoteCancelMessage, RfqQuoteId, type RfqQuoteMessage, type RfqQuoteRequest, type RfqQuoterInboundMessage, RfqQuoterInboundMessageSchema, type RfqQuoterOutboundMessage, RfqRejectionCode, type RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide, type RfqSignedOrder, RfqStatus, type RfqTrade };