@polymarket/bindings 0.1.0-beta.14 → 0.1.0-beta.16
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/{chunk-BI6DX3LX.js → chunk-AG5LLIAW.js} +2 -2
- package/dist/{chunk-BI6DX3LX.js.map → chunk-AG5LLIAW.js.map} +1 -1
- package/dist/chunk-KMTIKS2E.js +2 -0
- package/dist/chunk-KMTIKS2E.js.map +1 -0
- package/dist/{chunk-G2DC5MZA.js → chunk-SRNC7OM5.js} +2 -2
- package/dist/{chunk-G2DC5MZA.js.map → chunk-SRNC7OM5.js.map} +1 -1
- package/dist/clob/index.d.ts +4 -4
- package/dist/clob/index.js +1 -1
- package/dist/clob/index.js.map +1 -1
- package/dist/data/index.js +1 -1
- package/dist/gamma/index.js +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/perps/index.js +1 -1
- package/dist/relayer/index.js +1 -1
- package/dist/rfq.d.ts +20 -40
- package/dist/rfq.js +1 -1
- package/dist/rfq.js.map +1 -1
- package/dist/subscriptions/index.d.ts +65 -65
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-GTLPG5HR.js +0 -2
- package/dist/chunk-GTLPG5HR.js.map +0 -1
package/dist/rfq.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare enum RfqRequestedSizeUnit {
|
|
|
27
27
|
Notional = "notional",
|
|
28
28
|
Shares = "shares"
|
|
29
29
|
}
|
|
30
|
-
declare enum
|
|
30
|
+
declare enum RfqKnownErrorCode {
|
|
31
31
|
AddressMismatch = "ADDRESS_MISMATCH",
|
|
32
32
|
AllowanceValidationFailed = "ALLOWANCE_VALIDATION_FAILED",
|
|
33
33
|
BalanceValidationFailed = "BALANCE_VALIDATION_FAILED",
|
|
@@ -47,6 +47,7 @@ declare enum RfqErrorCode {
|
|
|
47
47
|
LegMetadataUnavailable = "LEG_METADATA_UNAVAILABLE",
|
|
48
48
|
MakerAlreadyResponded = "MAKER_ALREADY_RESPONDED",
|
|
49
49
|
MakerNotRequired = "MAKER_NOT_REQUIRED",
|
|
50
|
+
MakerQuoteLimited = "MAKER_QUOTE_LIMITED",
|
|
50
51
|
PreExecutionBalanceReservationFailed = "PRE_EXECUTION_BALANCE_RESERVATION_FAILED",
|
|
51
52
|
QuoteMismatch = "QUOTE_MISMATCH",
|
|
52
53
|
QuoteUnavailable = "QUOTE_UNAVAILABLE",
|
|
@@ -59,12 +60,17 @@ declare enum RfqErrorCode {
|
|
|
59
60
|
UnauthorizedRole = "UNAUTHORIZED_ROLE",
|
|
60
61
|
UnknownRfq = "UNKNOWN_RFQ"
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
/**
|
|
64
|
+
* An RFQ error code. Known codes are enumerated in {@link RfqKnownErrorCode};
|
|
65
|
+
* newly introduced codes flow through as plain strings so they can be handled
|
|
66
|
+
* before a client release that enumerates them.
|
|
67
|
+
*/
|
|
68
|
+
type RfqErrorCode = RfqKnownErrorCode | (string & {});
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Use {@link RfqKnownErrorCode} instead. This alias will be
|
|
71
|
+
* removed at the end of the beta phase.
|
|
72
|
+
*/
|
|
73
|
+
declare const RfqErrorCode: typeof RfqKnownErrorCode;
|
|
68
74
|
type ComboMarket = {
|
|
69
75
|
id: MarketId;
|
|
70
76
|
conditionId: CtfConditionId;
|
|
@@ -84,29 +90,6 @@ type ComboMarketOutcomes = {
|
|
|
84
90
|
yes: ComboMarketOutcome;
|
|
85
91
|
no: ComboMarketOutcome;
|
|
86
92
|
};
|
|
87
|
-
declare const ComboMarketSchema: z.ZodPipe<z.ZodObject<{
|
|
88
|
-
id: z.ZodPipe<z.ZodString, z.ZodTransform<MarketId, string>>;
|
|
89
|
-
condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<CtfConditionId, string>>;
|
|
90
|
-
position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
|
|
91
|
-
slug: z.ZodString;
|
|
92
|
-
title: z.ZodString;
|
|
93
|
-
outcomes: z.ZodArray<z.ZodString>;
|
|
94
|
-
outcome_prices: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>>;
|
|
95
|
-
image: z.ZodString;
|
|
96
|
-
volume: z.ZodNumber;
|
|
97
|
-
tags: z.ZodArray<z.ZodString>;
|
|
98
|
-
}, z.core.$strip>, z.ZodTransform<ComboMarket, {
|
|
99
|
-
id: MarketId;
|
|
100
|
-
condition_id: CtfConditionId;
|
|
101
|
-
position_ids: PositionId[];
|
|
102
|
-
slug: string;
|
|
103
|
-
title: string;
|
|
104
|
-
outcomes: string[];
|
|
105
|
-
outcome_prices: DecimalString[];
|
|
106
|
-
image: string;
|
|
107
|
-
volume: number;
|
|
108
|
-
tags: string[];
|
|
109
|
-
}>>;
|
|
110
93
|
declare const ListComboMarketsResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
111
94
|
markets: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
112
95
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<MarketId, string>>;
|
|
@@ -187,9 +170,6 @@ declare enum RfqKnownInboundType {
|
|
|
187
170
|
Trade = "RFQ_TRADE",
|
|
188
171
|
Error = "RFQ_ERROR"
|
|
189
172
|
}
|
|
190
|
-
declare const RfqKnownInboundMessageSchema: z.ZodObject<{
|
|
191
|
-
type: z.ZodEnum<typeof RfqKnownInboundType>;
|
|
192
|
-
}, z.core.$strip>;
|
|
193
173
|
declare const RfqAuthResponseMessageSchema: z.ZodObject<{
|
|
194
174
|
type: z.ZodLiteral<RfqKnownInboundType.Auth>;
|
|
195
175
|
success: z.ZodBoolean;
|
|
@@ -439,11 +419,11 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
439
419
|
request_type: z.ZodOptional<z.ZodString>;
|
|
440
420
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
441
421
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
442
|
-
code: z.
|
|
422
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<RfqKnownErrorCode | (string & {}), string>>;
|
|
443
423
|
error: z.ZodString;
|
|
444
424
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
445
425
|
}, z.core.$strip>, z.ZodTransform<{
|
|
446
|
-
code:
|
|
426
|
+
code: RfqKnownErrorCode | (string & {});
|
|
447
427
|
errorId: string | undefined;
|
|
448
428
|
message: string;
|
|
449
429
|
quoteId: RfqQuoteId | undefined;
|
|
@@ -452,7 +432,7 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
452
432
|
type: "rfq_error";
|
|
453
433
|
}, {
|
|
454
434
|
type: RfqKnownInboundType.Error;
|
|
455
|
-
code:
|
|
435
|
+
code: RfqKnownErrorCode | (string & {});
|
|
456
436
|
error: string;
|
|
457
437
|
error_id?: string | undefined;
|
|
458
438
|
request_type?: string | undefined;
|
|
@@ -674,11 +654,11 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
674
654
|
request_type: z.ZodOptional<z.ZodString>;
|
|
675
655
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
676
656
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
677
|
-
code: z.
|
|
657
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<RfqKnownErrorCode | (string & {}), string>>;
|
|
678
658
|
error: z.ZodString;
|
|
679
659
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
680
660
|
}, z.core.$strip>, z.ZodTransform<{
|
|
681
|
-
code:
|
|
661
|
+
code: RfqKnownErrorCode | (string & {});
|
|
682
662
|
errorId: string | undefined;
|
|
683
663
|
message: string;
|
|
684
664
|
quoteId: RfqQuoteId | undefined;
|
|
@@ -687,7 +667,7 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
687
667
|
type: "rfq_error";
|
|
688
668
|
}, {
|
|
689
669
|
type: RfqKnownInboundType.Error;
|
|
690
|
-
code:
|
|
670
|
+
code: RfqKnownErrorCode | (string & {});
|
|
691
671
|
error: string;
|
|
692
672
|
error_id?: string | undefined;
|
|
693
673
|
request_type?: string | undefined;
|
|
@@ -698,4 +678,4 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
698
678
|
type RfqQuoterInboundMessage = z.infer<typeof RfqQuoterInboundMessageSchema>;
|
|
699
679
|
type RfqQuoterOutboundMessage = RfqQuoteMessage | RfqQuoteCancelMessage | RfqConfirmationResponseMessage;
|
|
700
680
|
|
|
701
|
-
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes,
|
|
681
|
+
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, type RfqConfirmationAck, RfqConfirmationDecision, type RfqConfirmationRequest, type RfqConfirmationResponseMessage, RfqDirection, 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 };
|
package/dist/rfq.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-HOD4LKZU.js';import {Z,ta,Ja,za,ya,Ka,ba,ca,Y,Ea,Ca,Da,Ia}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-HOD4LKZU.js';import {Z as Z$1,ta,Ja,za,ya,Ka,ba,ca,Y,Ea,Ca,Da,Ia}from'./chunk-KMTIKS2E.js';import {z as z$1}from'zod';var E=(o=>(o.Buy="BUY",o.Sell="SELL",o))(E||{}),N=(o=>(o.Yes="YES",o.No="NO",o))(N||{}),g=(o=>(o.Confirm="CONFIRM",o.Decline="DECLINE",o))(g||{}),T=(c=>(c.Matched="MATCHED",c.Mined="MINED",c.Confirmed="CONFIRMED",c.Retrying="RETRYING",c.Failed="FAILED",c))(T||{}),Q=(o=>(o.Notional="notional",o.Shares="shares",o))(Q||{}),M=(i=>(i.AddressMismatch="ADDRESS_MISMATCH",i.AllowanceValidationFailed="ALLOWANCE_VALIDATION_FAILED",i.BalanceValidationFailed="BALANCE_VALIDATION_FAILED",i.ContradictoryLegs="CONTRADICTORY_LEGS",i.ExpiredRfq="EXPIRED_RFQ",i.InvalidAcceptance="INVALID_ACCEPTANCE",i.InvalidConfirmation="INVALID_CONFIRMATION",i.InvalidExecutionResult="INVALID_EXECUTION_RESULT",i.InvalidIdentity="INVALID_IDENTITY",i.InvalidMessage="INVALID_MESSAGE",i.InvalidQuote="INVALID_QUOTE",i.InvalidRfq="INVALID_RFQ",i.InvalidRfqState="INVALID_RFQ_STATE",i.InvalidRole="INVALID_ROLE",i.InvalidSignature="INVALID_SIGNATURE",i.InternalError="INTERNAL_ERROR",i.LegMetadataUnavailable="LEG_METADATA_UNAVAILABLE",i.MakerAlreadyResponded="MAKER_ALREADY_RESPONDED",i.MakerNotRequired="MAKER_NOT_REQUIRED",i.MakerQuoteLimited="MAKER_QUOTE_LIMITED",i.PreExecutionBalanceReservationFailed="PRE_EXECUTION_BALANCE_RESERVATION_FAILED",i.QuoteMismatch="QUOTE_MISMATCH",i.QuoteUnavailable="QUOTE_UNAVAILABLE",i.RateLimited="RATE_LIMITED",i.RequestFailed="REQUEST_FAILED",i.ServiceUnavailable="SERVICE_UNAVAILABLE",i.SubmissionWindowClosed="SUBMISSION_WINDOW_CLOSED",i.TradeSubmissionFailed="TRADE_SUBMISSION_FAILED",i.Unauthenticated="UNAUTHENTICATED",i.UnauthorizedRole="UNAUTHORIZED_ROLE",i.UnknownRfq="UNKNOWN_RFQ",i))(M||{}),W=M,m=z$1.enum(E),f=z$1.literal("YES"),x=z$1.enum(g),O=z$1.enum(T),b=z$1.string().transform(e=>e),C=z$1.object({id:ta,condition_id:Z$1,position_ids:z$1.array(za),slug:z$1.string(),title:z$1.string(),outcomes:z$1.array(z$1.string()),outcome_prices:z$1.array(Ja),image:z$1.string(),volume:z$1.number(),tags:z$1.array(z$1.string())}).superRefine((e,l)=>{e.outcomes.length!==2&&l.addIssue({code:"custom",message:`Expected binary combo market outcomes, received ${e.outcomes.length}.`,path:["outcomes"]}),e.position_ids.length!==e.outcomes.length&&l.addIssue({code:"custom",message:"Expected position_ids and outcomes to have matching lengths.",path:["position_ids"]}),e.outcome_prices.length!==e.outcomes.length&&l.addIssue({code:"custom",message:"Expected outcome_prices and outcomes to have matching lengths.",path:["outcome_prices"]});}).transform(e=>({conditionId:e.condition_id,id:e.id,image:e.image,outcomes:{yes:{label:e.outcomes[0],positionId:e.position_ids[0],price:e.outcome_prices[0]},no:{label:e.outcomes[1],positionId:e.position_ids[1],price:e.outcome_prices[1]}},slug:e.slug,tags:e.tags,title:e.title,volume:e.volume})),X=z$1.object({markets:z$1.array(C),next_cursor:ya.nullish()}).transform(e=>({markets:e.markets,nextCursor:e.next_cursor??void 0})),D=z$1.discriminatedUnion("unit",[z$1.object({unit:z$1.literal("notional"),value_e6:Ka}),z$1.object({unit:z$1.literal("shares"),value_e6:Ka})]).transform(e=>({unit:e.unit,value:e.value_e6})),L=(s=>(s.Auth="auth",s.QuoteRequest="RFQ_REQUEST",s.QuoteAck="ACK_RFQ_QUOTE",s.QuoteCancelAck="ACK_RFQ_QUOTE_CANCEL",s.ConfirmationRequest="RFQ_CONFIRMATION_REQUEST",s.ConfirmationAck="ACK_RFQ_CONFIRMATION_RESPONSE",s.ExecutionUpdate="RFQ_EXECUTION_UPDATE",s.Trade="RFQ_TRADE",s.Error="RFQ_ERROR",s))(L||{}),U=z$1.object({type:z$1.literal("auth"),success:z$1.boolean(),address:ba.optional(),role:z$1.string().optional(),error:z$1.string().optional()}),v=z$1.object({type:z$1.literal("RFQ_REQUEST"),rfq_id:Ca,requestor_public_id:Ea,leg_position_ids:z$1.array(za),condition_id:Y,yes_position_id:za,no_position_id:za,direction:m,side:f,requested_size:D,submission_deadline:ca}).transform(e=>({conditionId:e.condition_id,direction:e.direction,legPositionIds:e.leg_position_ids,noPositionId:e.no_position_id,requestorPublicId:e.requestor_public_id,requestedSize:e.requested_size,rfqId:e.rfq_id,side:e.side,submissionDeadline:e.submission_deadline,type:"quote_request",yesPositionId:e.yes_position_id})),k=z$1.object({type:z$1.literal("ACK_RFQ_QUOTE"),rfq_id:Ca,quote_id:Da}).transform(e=>({quoteId:e.quote_id,rfqId:e.rfq_id,type:"quote_ack"})),F=z$1.object({type:z$1.literal("ACK_RFQ_QUOTE_CANCEL"),rfq_id:Ca,quote_id:Da}).transform(e=>({quoteId:e.quote_id,rfqId:e.rfq_id,type:"quote_cancel_ack"})),z=z$1.object({type:z$1.literal("RFQ_CONFIRMATION_REQUEST"),rfq_id:Ca,quote_id:Da,signer_address:ba,maker_address:ba,signature_type:b$1,leg_position_ids:z$1.array(za),condition_id:Y,yes_position_id:za,no_position_id:za,direction:m,side:f,fill_size_e6:Ka,price_e6:Ka,confirm_by:ca}).transform(e=>({conditionId:e.condition_id,confirmBy:e.confirm_by,direction:e.direction,fillSize:e.fill_size_e6,legPositionIds:e.leg_position_ids,makerAddress:e.maker_address,noPositionId:e.no_position_id,price:e.price_e6,quoteId:e.quote_id,rfqId:e.rfq_id,side:e.side,signatureType:e.signature_type,signerAddress:e.signer_address,type:"confirmation_request",yesPositionId:e.yes_position_id})),P=z$1.object({type:z$1.literal("ACK_RFQ_CONFIRMATION_RESPONSE"),rfq_id:Ca,quote_id:Da,decision:x}).transform(e=>({decision:e.decision,quoteId:e.quote_id,rfqId:e.rfq_id,type:"confirmation_ack"})),V=z$1.object({type:z$1.literal("RFQ_EXECUTION_UPDATE"),rfq_id:Ca,status:O,tx_hash:Ia.optional()}).transform(e=>({rfqId:e.rfq_id,status:e.status,...e.tx_hash===void 0?{}:{txHash:e.tx_hash},type:"execution_update"})),B=z$1.object({type:z$1.literal("RFQ_TRADE"),rfq_id:Ca,requester_id:Ea,condition_id:Y,leg_position_ids:z$1.array(za),direction:m,side:f,price_e6:Ka,size_e6:Ka,executed_at:ca}).transform(e=>({conditionId:e.condition_id,direction:e.direction,executedAt:e.executed_at,legPositionIds:e.leg_position_ids,price:e.price_e6,requesterId:e.requester_id,rfqId:e.rfq_id,side:e.side,size:e.size_e6,type:"trade"})),j=z$1.object({type:z$1.literal("RFQ_ERROR"),error_id:z$1.string().optional(),request_type:z$1.string().optional(),rfq_id:Ca.optional(),quote_id:Da.optional(),code:b,error:z$1.string(),request:z$1.unknown().optional()}).transform(e=>({code:e.code,errorId:e.error_id,message:e.error,quoteId:e.quote_id,requestType:e.request_type,rfqId:e.rfq_id,type:"rfq_error"})),Z=z$1.discriminatedUnion("type",[U,v,k,F,z,P,V,B,j]);export{X as ListComboMarketsResponseSchema,g as RfqConfirmationDecision,E as RfqDirection,W as RfqErrorCode,T as RfqExecutionStatus,M as RfqKnownErrorCode,L as RfqKnownInboundType,Z as RfqQuoterInboundMessageSchema,Q as RfqRequestedSizeUnit,N as RfqSide};//# sourceMappingURL=rfq.js.map
|
|
2
2
|
//# sourceMappingURL=rfq.js.map
|
package/dist/rfq.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rfq.ts"],"names":["RfqDirection","RfqSide","RfqConfirmationDecision","RfqExecutionStatus","RfqRequestedSizeUnit","RfqErrorCode","RfqDirectionSchema","z","RfqSideSchema","RfqConfirmationDecisionSchema","RfqExecutionStatusSchema","RfqRequestedSizeUnitSchema","RfqErrorCodeSchema","ComboMarketSchema","MarketIdSchema","CtfConditionIdSchema","PositionIdSchema","DecimalStringSchema","market","context","ListComboMarketsResponseSchema","PaginationCursorSchema","response","RfqRequestedSizeSchema","E6BigIntStringToDecimalStringSchema","size","RfqKnownInboundType","RfqKnownInboundMessageSchema","RfqAuthResponseMessageSchema","EvmAddressSchema","RfqQuoteRequestSchema","RfqIdSchema","RfqRequestorPublicIdSchema","ComboConditionIdSchema","EpochMillisecondsSchema","message","RfqQuoteAckSchema","RfqQuoteIdSchema","RfqQuoteCancelAckSchema","RfqConfirmationRequestSchema","SignatureTypeSchema","RfqConfirmationAckSchema","RfqExecutionUpdateSchema","TxHashSchema","RfqTradeSchema","RfqErrorMessageSchema","RfqQuoterInboundMessageSchema"],"mappings":"6IAyCO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,GAAA,CAAM,KAAA,CACNA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,GAAA,CAAM,KAAA,CACNA,CAAAA,CAAA,EAAA,CAAK,IAAA,CAFKA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,QAAU,SAAA,CAFAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,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E,MAAA,EAAO,CAAE,QAAA,EAAS,CAC9B,YAAA,CAAcA,GAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS,CAClC,MAAA,CAAQwB,EAAAA,CAAY,QAAA,GACpB,QAAA,CAAUM,EAAAA,CAAiB,QAAA,EAAS,CACpC,IAAA,CAAMzB,CAAAA,CACN,KAAA,CAAOL,GAAAA,CAAE,MAAA,EAAO,CAChB,OAAA,CAASA,GAAAA,CAAE,OAAA,EAAQ,CAAE,UACvB,CAAC,CAAA,CAAE,SAAA,CAAW4B,CAAAA,GAAa,CACzB,IAAA,CAAMA,CAAAA,CAAQ,IAAA,CACd,OAAA,CAASA,CAAAA,CAAQ,QAAA,CACjB,OAAA,CAASA,CAAAA,CAAQ,MACjB,OAAA,CAASA,CAAAA,CAAQ,QAAA,CACjB,WAAA,CAAaA,CAAAA,CAAQ,YAAA,CACrB,KAAA,CAAOA,CAAAA,CAAQ,MAAA,CACf,IAAA,CAAM,WACR,CAAA,CAAE,CAAA,CAIWW,CAAAA,CAAgCvC,IAAE,kBAAA,CAAmB,MAAA,CAAQ,CACxEqB,CAAAA,CACAE,CAAAA,CACAM,CAAAA,CACAE,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACAC,CACF,CAAC","file":"rfq.js","sourcesContent":["import type {\n Erc1271Signature,\n EvmSignature,\n HexString,\n} from '@polymarket/types';\nimport { z } from 'zod';\nimport { type SignatureType, SignatureTypeSchema } from './clob/signature-type';\nimport type {\n BaseUnits,\n CtfConditionId,\n DecimalString,\n EvmAddress,\n MarketId,\n TokenId,\n} from './shared';\nimport {\n ComboConditionIdSchema,\n CtfConditionIdSchema,\n DecimalStringSchema,\n E6BigIntStringToDecimalStringSchema,\n EpochMillisecondsSchema,\n EvmAddressSchema,\n MarketIdSchema,\n type OrderSide,\n PaginationCursorSchema,\n type PositionId,\n PositionIdSchema,\n type RfqId,\n RfqIdSchema,\n type RfqQuoteId,\n RfqQuoteIdSchema,\n RfqRequestorPublicIdSchema,\n TxHashSchema,\n} from './shared';\n\nexport type {\n RfqId,\n RfqQuoteId,\n RfqRequestorPublicId,\n} from './shared';\n\nexport enum RfqDirection {\n Buy = 'BUY',\n Sell = 'SELL',\n}\n\nexport enum RfqSide {\n Yes = 'YES',\n No = 'NO',\n}\n\nexport enum RfqConfirmationDecision {\n Confirm = 'CONFIRM',\n Decline = 'DECLINE',\n}\n\nexport enum RfqExecutionStatus {\n Matched = 'MATCHED',\n Mined = 'MINED',\n Confirmed = 'CONFIRMED',\n Retrying = 'RETRYING',\n Failed = 'FAILED',\n}\n\nexport enum RfqRequestedSizeUnit {\n Notional = 'notional',\n Shares = 'shares',\n}\n\nexport enum RfqErrorCode {\n AddressMismatch = 'ADDRESS_MISMATCH',\n AllowanceValidationFailed = 'ALLOWANCE_VALIDATION_FAILED',\n BalanceValidationFailed = 'BALANCE_VALIDATION_FAILED',\n ContradictoryLegs = 'CONTRADICTORY_LEGS',\n ExpiredRfq = 'EXPIRED_RFQ',\n InvalidAcceptance = 'INVALID_ACCEPTANCE',\n InvalidConfirmation = 'INVALID_CONFIRMATION',\n InvalidExecutionResult = 'INVALID_EXECUTION_RESULT',\n InvalidIdentity = 'INVALID_IDENTITY',\n InvalidMessage = 'INVALID_MESSAGE',\n InvalidQuote = 'INVALID_QUOTE',\n InvalidRfq = 'INVALID_RFQ',\n InvalidRfqState = 'INVALID_RFQ_STATE',\n InvalidRole = 'INVALID_ROLE',\n InvalidSignature = 'INVALID_SIGNATURE',\n InternalError = 'INTERNAL_ERROR',\n LegMetadataUnavailable = 'LEG_METADATA_UNAVAILABLE',\n MakerAlreadyResponded = 'MAKER_ALREADY_RESPONDED',\n MakerNotRequired = 'MAKER_NOT_REQUIRED',\n PreExecutionBalanceReservationFailed = 'PRE_EXECUTION_BALANCE_RESERVATION_FAILED',\n QuoteMismatch = 'QUOTE_MISMATCH',\n QuoteUnavailable = 'QUOTE_UNAVAILABLE',\n RateLimited = 'RATE_LIMITED',\n RequestFailed = 'REQUEST_FAILED',\n ServiceUnavailable = 'SERVICE_UNAVAILABLE',\n SubmissionWindowClosed = 'SUBMISSION_WINDOW_CLOSED',\n TradeSubmissionFailed = 'TRADE_SUBMISSION_FAILED',\n Unauthenticated = 'UNAUTHENTICATED',\n UnauthorizedRole = 'UNAUTHORIZED_ROLE',\n UnknownRfq = 'UNKNOWN_RFQ',\n}\n\nexport const RfqDirectionSchema = z.enum(RfqDirection);\nexport const RfqSideSchema = z.literal(RfqSide.Yes);\nexport const RfqConfirmationDecisionSchema = z.enum(RfqConfirmationDecision);\nexport const RfqExecutionStatusSchema = z.enum(RfqExecutionStatus);\nexport const RfqRequestedSizeUnitSchema = z.enum(RfqRequestedSizeUnit);\nexport const RfqErrorCodeSchema = z.enum(RfqErrorCode);\n\nexport type ComboMarket = {\n id: MarketId;\n conditionId: CtfConditionId;\n slug: string;\n title: string;\n outcomes: ComboMarketOutcomes;\n image: string;\n volume: number;\n tags: string[];\n};\n\nexport type ComboMarketOutcome = {\n label: string;\n positionId: PositionId;\n price: DecimalString;\n};\n\nexport type ComboMarketOutcomes = {\n yes: ComboMarketOutcome;\n no: ComboMarketOutcome;\n};\n\nexport const ComboMarketSchema = z\n .object({\n id: MarketIdSchema,\n condition_id: CtfConditionIdSchema,\n position_ids: z.array(PositionIdSchema),\n slug: z.string(),\n title: z.string(),\n outcomes: z.array(z.string()),\n outcome_prices: z.array(DecimalStringSchema),\n image: z.string(),\n volume: z.number(),\n tags: z.array(z.string()),\n })\n .superRefine((market, context) => {\n if (market.outcomes.length !== 2) {\n context.addIssue({\n code: 'custom',\n message: `Expected binary combo market outcomes, received ${market.outcomes.length}.`,\n path: ['outcomes'],\n });\n }\n\n if (market.position_ids.length !== market.outcomes.length) {\n context.addIssue({\n code: 'custom',\n message: 'Expected position_ids and outcomes to have matching lengths.',\n path: ['position_ids'],\n });\n }\n\n if (market.outcome_prices.length !== market.outcomes.length) {\n context.addIssue({\n code: 'custom',\n message:\n 'Expected outcome_prices and outcomes to have matching lengths.',\n path: ['outcome_prices'],\n });\n }\n })\n .transform(\n (market): ComboMarket => ({\n conditionId: market.condition_id,\n id: market.id,\n image: market.image,\n outcomes: {\n yes: {\n label: market.outcomes[0] as string,\n positionId: market.position_ids[0] as PositionId,\n price: market.outcome_prices[0] as DecimalString,\n },\n no: {\n label: market.outcomes[1] as string,\n positionId: market.position_ids[1] as PositionId,\n price: market.outcome_prices[1] as DecimalString,\n },\n },\n slug: market.slug,\n tags: market.tags,\n title: market.title,\n volume: market.volume,\n }),\n );\n\nexport const ListComboMarketsResponseSchema = z\n .object({\n markets: z.array(ComboMarketSchema),\n next_cursor: PaginationCursorSchema.nullish(),\n })\n .transform((response) => ({\n markets: response.markets,\n nextCursor: response.next_cursor ?? undefined,\n }));\n\nexport type ListComboMarketsResponse = z.infer<\n typeof ListComboMarketsResponseSchema\n>;\n\nexport type RfqRequestedSize =\n | {\n unit: RfqRequestedSizeUnit.Notional;\n value: DecimalString;\n }\n | {\n unit: RfqRequestedSizeUnit.Shares;\n value: DecimalString;\n };\n\nconst RfqRequestedSizeSchema = z\n .discriminatedUnion('unit', [\n z.object({\n unit: z.literal(RfqRequestedSizeUnit.Notional),\n value_e6: E6BigIntStringToDecimalStringSchema,\n }),\n z.object({\n unit: z.literal(RfqRequestedSizeUnit.Shares),\n value_e6: E6BigIntStringToDecimalStringSchema,\n }),\n ])\n .transform(\n (size): RfqRequestedSize => ({\n unit: size.unit,\n value: size.value_e6,\n }),\n ) satisfies z.ZodType<RfqRequestedSize>;\n\nexport type RfqSignedOrder = {\n salt: string;\n maker: EvmAddress;\n signer: EvmAddress;\n tokenId: PositionId | TokenId;\n makerAmount: BaseUnits;\n takerAmount: BaseUnits;\n side: RfqOrderSide;\n signatureType: SignatureType;\n timestamp: string;\n builder?: HexString;\n expiration?: string;\n metadata?: HexString;\n signature: EvmSignature | Erc1271Signature;\n};\n\nexport type RfqOrderSide = OrderSide | 0 | 1;\n\nexport type RfqAuthMessage = {\n type: 'auth';\n auth: {\n apiKey: string;\n passphrase: string;\n secret: string;\n };\n identity: {\n signer_address: EvmAddress;\n maker_address: EvmAddress;\n signature_type: SignatureType;\n };\n};\n\nexport enum RfqKnownInboundType {\n Auth = 'auth',\n QuoteRequest = 'RFQ_REQUEST',\n QuoteAck = 'ACK_RFQ_QUOTE',\n QuoteCancelAck = 'ACK_RFQ_QUOTE_CANCEL',\n ConfirmationRequest = 'RFQ_CONFIRMATION_REQUEST',\n ConfirmationAck = 'ACK_RFQ_CONFIRMATION_RESPONSE',\n ExecutionUpdate = 'RFQ_EXECUTION_UPDATE',\n Trade = 'RFQ_TRADE',\n Error = 'RFQ_ERROR',\n}\n\nexport const RfqKnownInboundMessageSchema = z.object({\n type: z.enum(RfqKnownInboundType),\n});\n\nexport const RfqAuthResponseMessageSchema = RfqKnownInboundMessageSchema.extend(\n {\n type: z.literal(RfqKnownInboundType.Auth),\n success: z.boolean(),\n address: EvmAddressSchema.optional(),\n role: z.string().optional(),\n error: z.string().optional(),\n },\n);\n\nexport type RfqAuthResponseMessage = z.infer<\n typeof RfqAuthResponseMessageSchema\n>;\n\nexport const RfqQuoteRequestSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.QuoteRequest),\n rfq_id: RfqIdSchema,\n requestor_public_id: RfqRequestorPublicIdSchema,\n leg_position_ids: z.array(PositionIdSchema),\n condition_id: ComboConditionIdSchema,\n yes_position_id: PositionIdSchema,\n no_position_id: PositionIdSchema,\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n requested_size: RfqRequestedSizeSchema,\n submission_deadline: EpochMillisecondsSchema,\n}).transform((message) => ({\n conditionId: message.condition_id,\n direction: message.direction,\n legPositionIds: message.leg_position_ids,\n noPositionId: message.no_position_id,\n requestorPublicId: message.requestor_public_id,\n requestedSize: message.requested_size,\n rfqId: message.rfq_id,\n side: message.side,\n submissionDeadline: message.submission_deadline,\n type: 'quote_request' as const,\n yesPositionId: message.yes_position_id,\n}));\n\nexport type RfqQuoteRequest = z.infer<typeof RfqQuoteRequestSchema>;\n\nexport type RfqQuoteMessage = {\n type: 'RFQ_QUOTE';\n rfq_id: RfqId;\n price_e6: string;\n size_e6: string;\n signed_order: RfqSignedOrder;\n};\n\nexport type RfqQuoteCancelMessage = {\n type: 'RFQ_QUOTE_CANCEL';\n rfq_id: RfqId;\n quote_id: RfqQuoteId;\n signer_address: EvmAddress;\n maker_address: EvmAddress;\n};\n\nexport const RfqQuoteAckSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.QuoteAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n}).transform((message) => ({\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'quote_ack' as const,\n}));\n\nexport type RfqQuoteAck = z.infer<typeof RfqQuoteAckSchema>;\n\nexport const RfqQuoteCancelAckSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.QuoteCancelAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n}).transform((message) => ({\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'quote_cancel_ack' as const,\n}));\n\nexport type RfqQuoteCancelAck = z.infer<typeof RfqQuoteCancelAckSchema>;\n\nexport const RfqConfirmationRequestSchema = RfqKnownInboundMessageSchema.extend(\n {\n type: z.literal(RfqKnownInboundType.ConfirmationRequest),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n signer_address: EvmAddressSchema,\n maker_address: EvmAddressSchema,\n signature_type: SignatureTypeSchema,\n leg_position_ids: z.array(PositionIdSchema),\n condition_id: ComboConditionIdSchema,\n yes_position_id: PositionIdSchema,\n no_position_id: PositionIdSchema,\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n fill_size_e6: E6BigIntStringToDecimalStringSchema,\n price_e6: E6BigIntStringToDecimalStringSchema,\n confirm_by: EpochMillisecondsSchema,\n },\n).transform((message) => ({\n conditionId: message.condition_id,\n confirmBy: message.confirm_by,\n direction: message.direction,\n fillSize: message.fill_size_e6,\n legPositionIds: message.leg_position_ids,\n makerAddress: message.maker_address,\n noPositionId: message.no_position_id,\n price: message.price_e6,\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n side: message.side,\n signatureType: message.signature_type,\n signerAddress: message.signer_address,\n type: 'confirmation_request' as const,\n yesPositionId: message.yes_position_id,\n}));\n\nexport type RfqConfirmationRequest = z.infer<\n typeof RfqConfirmationRequestSchema\n>;\n\nexport type RfqConfirmationResponseMessage = {\n type: 'RFQ_CONFIRMATION_RESPONSE';\n rfq_id: RfqId;\n quote_id: RfqQuoteId;\n decision: RfqConfirmationDecision;\n};\n\nexport const RfqConfirmationAckSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.ConfirmationAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n decision: RfqConfirmationDecisionSchema,\n}).transform((message) => ({\n decision: message.decision,\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'confirmation_ack' as const,\n}));\n\nexport type RfqConfirmationAck = z.infer<typeof RfqConfirmationAckSchema>;\n\nexport const RfqExecutionUpdateSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.ExecutionUpdate),\n rfq_id: RfqIdSchema,\n status: RfqExecutionStatusSchema,\n tx_hash: TxHashSchema.optional(),\n}).transform((message) => ({\n rfqId: message.rfq_id,\n status: message.status,\n ...(message.tx_hash === undefined ? {} : { txHash: message.tx_hash }),\n type: 'execution_update' as const,\n}));\n\nexport type RfqExecutionUpdate = z.infer<typeof RfqExecutionUpdateSchema>;\n\nexport const RfqTradeSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.Trade),\n rfq_id: RfqIdSchema,\n requester_id: RfqRequestorPublicIdSchema,\n condition_id: ComboConditionIdSchema,\n leg_position_ids: z.array(PositionIdSchema),\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n price_e6: E6BigIntStringToDecimalStringSchema,\n size_e6: E6BigIntStringToDecimalStringSchema,\n executed_at: EpochMillisecondsSchema,\n}).transform((message) => ({\n conditionId: message.condition_id,\n direction: message.direction,\n executedAt: message.executed_at,\n legPositionIds: message.leg_position_ids,\n price: message.price_e6,\n requesterId: message.requester_id,\n rfqId: message.rfq_id,\n side: message.side,\n size: message.size_e6,\n type: 'trade' as const,\n}));\n\nexport type RfqTrade = z.infer<typeof RfqTradeSchema>;\n\nexport const RfqErrorMessageSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.Error),\n error_id: z.string().optional(),\n request_type: z.string().optional(),\n rfq_id: RfqIdSchema.optional(),\n quote_id: RfqQuoteIdSchema.optional(),\n code: RfqErrorCodeSchema,\n error: z.string(),\n request: z.unknown().optional(),\n}).transform((message) => ({\n code: message.code,\n errorId: message.error_id,\n message: message.error,\n quoteId: message.quote_id,\n requestType: message.request_type,\n rfqId: message.rfq_id,\n type: 'rfq_error' as const,\n}));\n\nexport type RfqErrorMessage = z.infer<typeof RfqErrorMessageSchema>;\n\nexport const RfqQuoterInboundMessageSchema = z.discriminatedUnion('type', [\n RfqAuthResponseMessageSchema,\n RfqQuoteRequestSchema,\n RfqQuoteAckSchema,\n RfqQuoteCancelAckSchema,\n RfqConfirmationRequestSchema,\n RfqConfirmationAckSchema,\n RfqExecutionUpdateSchema,\n RfqTradeSchema,\n RfqErrorMessageSchema,\n]);\n\nexport type RfqQuoterInboundMessage = z.infer<\n typeof RfqQuoterInboundMessageSchema\n>;\n\nexport type RfqQuoterOutboundMessage =\n | RfqQuoteMessage\n | RfqQuoteCancelMessage\n | RfqConfirmationResponseMessage;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/rfq.ts"],"names":["RfqDirection","RfqSide","RfqConfirmationDecision","RfqExecutionStatus","RfqRequestedSizeUnit","RfqKnownErrorCode","RfqErrorCode","RfqDirectionSchema","z","RfqSideSchema","RfqConfirmationDecisionSchema","RfqExecutionStatusSchema","RfqErrorCodeSchema","value","ComboMarketSchema","MarketIdSchema","CtfConditionIdSchema","PositionIdSchema","DecimalStringSchema","market","context","ListComboMarketsResponseSchema","PaginationCursorSchema","response","RfqRequestedSizeSchema","E6BigIntStringToDecimalStringSchema","size","RfqKnownInboundType","RfqAuthResponseMessageSchema","EvmAddressSchema","RfqQuoteRequestSchema","RfqIdSchema","RfqRequestorPublicIdSchema","ComboConditionIdSchema","EpochMillisecondsSchema","message","RfqQuoteAckSchema","RfqQuoteIdSchema","RfqQuoteCancelAckSchema","RfqConfirmationRequestSchema","SignatureTypeSchema","RfqConfirmationAckSchema","RfqExecutionUpdateSchema","TxHashSchema","RfqTradeSchema","RfqErrorMessageSchema","RfqQuoterInboundMessageSchema"],"mappings":"oJAyCO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,GAAA,CAAM,KAAA,CACNA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,GAAA,CAAM,KAAA,CACNA,CAAAA,CAAA,EAAA,CAAK,IAAA,CAFKA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CACVA,CAAAA,CAAA,QAAU,SAAA,CAFAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAA,CAAU,UACVA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,EAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,MAAA,CAAS,QAAA,CALCA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAQAC,C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AAE,UACvB,CAAC,CAAA,CACA,SAAA,CAAW2B,CAAAA,GAAa,CACvB,IAAA,CAAMA,CAAAA,CAAQ,IAAA,CACd,OAAA,CAASA,CAAAA,CAAQ,QAAA,CACjB,OAAA,CAASA,CAAAA,CAAQ,MACjB,OAAA,CAASA,CAAAA,CAAQ,QAAA,CACjB,WAAA,CAAaA,CAAAA,CAAQ,YAAA,CACrB,KAAA,CAAOA,CAAAA,CAAQ,MAAA,CACf,IAAA,CAAM,WACR,CAAA,CAAE,CAAA,CAISW,CAAAA,CAAgCtC,IAAE,kBAAA,CAAmB,MAAA,CAAQ,CACxEoB,CAAAA,CACAE,CAAAA,CACAM,CAAAA,CACAE,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACAC,CAAAA,CACAE,CAAAA,CACAC,CACF,CAAC","file":"rfq.js","sourcesContent":["import type {\n Erc1271Signature,\n EvmSignature,\n HexString,\n} from '@polymarket/types';\nimport { z } from 'zod';\nimport { type SignatureType, SignatureTypeSchema } from './clob/signature-type';\nimport type {\n BaseUnits,\n CtfConditionId,\n DecimalString,\n EvmAddress,\n MarketId,\n TokenId,\n} from './shared';\nimport {\n ComboConditionIdSchema,\n CtfConditionIdSchema,\n DecimalStringSchema,\n E6BigIntStringToDecimalStringSchema,\n EpochMillisecondsSchema,\n EvmAddressSchema,\n MarketIdSchema,\n type OrderSide,\n PaginationCursorSchema,\n type PositionId,\n PositionIdSchema,\n type RfqId,\n RfqIdSchema,\n type RfqQuoteId,\n RfqQuoteIdSchema,\n RfqRequestorPublicIdSchema,\n TxHashSchema,\n} from './shared';\n\nexport type {\n RfqId,\n RfqQuoteId,\n RfqRequestorPublicId,\n} from './shared';\n\nexport enum RfqDirection {\n Buy = 'BUY',\n Sell = 'SELL',\n}\n\nexport enum RfqSide {\n Yes = 'YES',\n No = 'NO',\n}\n\nexport enum RfqConfirmationDecision {\n Confirm = 'CONFIRM',\n Decline = 'DECLINE',\n}\n\nexport enum RfqExecutionStatus {\n Matched = 'MATCHED',\n Mined = 'MINED',\n Confirmed = 'CONFIRMED',\n Retrying = 'RETRYING',\n Failed = 'FAILED',\n}\n\nexport enum RfqRequestedSizeUnit {\n Notional = 'notional',\n Shares = 'shares',\n}\n\nexport enum RfqKnownErrorCode {\n AddressMismatch = 'ADDRESS_MISMATCH',\n AllowanceValidationFailed = 'ALLOWANCE_VALIDATION_FAILED',\n BalanceValidationFailed = 'BALANCE_VALIDATION_FAILED',\n ContradictoryLegs = 'CONTRADICTORY_LEGS',\n ExpiredRfq = 'EXPIRED_RFQ',\n InvalidAcceptance = 'INVALID_ACCEPTANCE',\n InvalidConfirmation = 'INVALID_CONFIRMATION',\n InvalidExecutionResult = 'INVALID_EXECUTION_RESULT',\n InvalidIdentity = 'INVALID_IDENTITY',\n InvalidMessage = 'INVALID_MESSAGE',\n InvalidQuote = 'INVALID_QUOTE',\n InvalidRfq = 'INVALID_RFQ',\n InvalidRfqState = 'INVALID_RFQ_STATE',\n InvalidRole = 'INVALID_ROLE',\n InvalidSignature = 'INVALID_SIGNATURE',\n InternalError = 'INTERNAL_ERROR',\n LegMetadataUnavailable = 'LEG_METADATA_UNAVAILABLE',\n MakerAlreadyResponded = 'MAKER_ALREADY_RESPONDED',\n MakerNotRequired = 'MAKER_NOT_REQUIRED',\n MakerQuoteLimited = 'MAKER_QUOTE_LIMITED',\n PreExecutionBalanceReservationFailed = 'PRE_EXECUTION_BALANCE_RESERVATION_FAILED',\n QuoteMismatch = 'QUOTE_MISMATCH',\n QuoteUnavailable = 'QUOTE_UNAVAILABLE',\n RateLimited = 'RATE_LIMITED',\n RequestFailed = 'REQUEST_FAILED',\n ServiceUnavailable = 'SERVICE_UNAVAILABLE',\n SubmissionWindowClosed = 'SUBMISSION_WINDOW_CLOSED',\n TradeSubmissionFailed = 'TRADE_SUBMISSION_FAILED',\n Unauthenticated = 'UNAUTHENTICATED',\n UnauthorizedRole = 'UNAUTHORIZED_ROLE',\n UnknownRfq = 'UNKNOWN_RFQ',\n}\n\n/**\n * An RFQ error code. Known codes are enumerated in {@link RfqKnownErrorCode};\n * newly introduced codes flow through as plain strings so they can be handled\n * before a client release that enumerates them.\n */\nexport type RfqErrorCode = RfqKnownErrorCode | (string & {});\n\n/**\n * @deprecated Use {@link RfqKnownErrorCode} instead. This alias will be\n * removed at the end of the beta phase.\n */\nexport const RfqErrorCode = RfqKnownErrorCode;\n\nconst RfqDirectionSchema = z.enum(RfqDirection);\nconst RfqSideSchema = z.literal(RfqSide.Yes);\nconst RfqConfirmationDecisionSchema = z.enum(RfqConfirmationDecision);\nconst RfqExecutionStatusSchema = z.enum(RfqExecutionStatus);\n\n// Error codes evolve independently of released clients. Codes not yet\n// enumerated in RfqKnownErrorCode must still parse and flow through as-is.\nconst RfqErrorCodeSchema = z.string().transform((value): RfqErrorCode => value);\n\nexport type ComboMarket = {\n id: MarketId;\n conditionId: CtfConditionId;\n slug: string;\n title: string;\n outcomes: ComboMarketOutcomes;\n image: string;\n volume: number;\n tags: string[];\n};\n\nexport type ComboMarketOutcome = {\n label: string;\n positionId: PositionId;\n price: DecimalString;\n};\n\nexport type ComboMarketOutcomes = {\n yes: ComboMarketOutcome;\n no: ComboMarketOutcome;\n};\n\nconst ComboMarketSchema = z\n .object({\n id: MarketIdSchema,\n condition_id: CtfConditionIdSchema,\n position_ids: z.array(PositionIdSchema),\n slug: z.string(),\n title: z.string(),\n outcomes: z.array(z.string()),\n outcome_prices: z.array(DecimalStringSchema),\n image: z.string(),\n volume: z.number(),\n tags: z.array(z.string()),\n })\n .superRefine((market, context) => {\n if (market.outcomes.length !== 2) {\n context.addIssue({\n code: 'custom',\n message: `Expected binary combo market outcomes, received ${market.outcomes.length}.`,\n path: ['outcomes'],\n });\n }\n\n if (market.position_ids.length !== market.outcomes.length) {\n context.addIssue({\n code: 'custom',\n message: 'Expected position_ids and outcomes to have matching lengths.',\n path: ['position_ids'],\n });\n }\n\n if (market.outcome_prices.length !== market.outcomes.length) {\n context.addIssue({\n code: 'custom',\n message:\n 'Expected outcome_prices and outcomes to have matching lengths.',\n path: ['outcome_prices'],\n });\n }\n })\n .transform(\n (market): ComboMarket => ({\n conditionId: market.condition_id,\n id: market.id,\n image: market.image,\n outcomes: {\n yes: {\n label: market.outcomes[0] as string,\n positionId: market.position_ids[0] as PositionId,\n price: market.outcome_prices[0] as DecimalString,\n },\n no: {\n label: market.outcomes[1] as string,\n positionId: market.position_ids[1] as PositionId,\n price: market.outcome_prices[1] as DecimalString,\n },\n },\n slug: market.slug,\n tags: market.tags,\n title: market.title,\n volume: market.volume,\n }),\n );\n\nexport const ListComboMarketsResponseSchema = z\n .object({\n markets: z.array(ComboMarketSchema),\n next_cursor: PaginationCursorSchema.nullish(),\n })\n .transform((response) => ({\n markets: response.markets,\n nextCursor: response.next_cursor ?? undefined,\n }));\n\nexport type ListComboMarketsResponse = z.infer<\n typeof ListComboMarketsResponseSchema\n>;\n\nexport type RfqRequestedSize =\n | {\n unit: RfqRequestedSizeUnit.Notional;\n value: DecimalString;\n }\n | {\n unit: RfqRequestedSizeUnit.Shares;\n value: DecimalString;\n };\n\nconst RfqRequestedSizeSchema = z\n .discriminatedUnion('unit', [\n z.object({\n unit: z.literal(RfqRequestedSizeUnit.Notional),\n value_e6: E6BigIntStringToDecimalStringSchema,\n }),\n z.object({\n unit: z.literal(RfqRequestedSizeUnit.Shares),\n value_e6: E6BigIntStringToDecimalStringSchema,\n }),\n ])\n .transform(\n (size): RfqRequestedSize => ({\n unit: size.unit,\n value: size.value_e6,\n }),\n ) satisfies z.ZodType<RfqRequestedSize>;\n\nexport type RfqSignedOrder = {\n salt: string;\n maker: EvmAddress;\n signer: EvmAddress;\n tokenId: PositionId | TokenId;\n makerAmount: BaseUnits;\n takerAmount: BaseUnits;\n side: RfqOrderSide;\n signatureType: SignatureType;\n timestamp: string;\n builder?: HexString;\n expiration?: string;\n metadata?: HexString;\n signature: EvmSignature | Erc1271Signature;\n};\n\nexport type RfqOrderSide = OrderSide | 0 | 1;\n\nexport type RfqAuthMessage = {\n type: 'auth';\n auth: {\n apiKey: string;\n passphrase: string;\n secret: string;\n };\n identity: {\n signer_address: EvmAddress;\n maker_address: EvmAddress;\n signature_type: SignatureType;\n };\n};\n\nexport enum RfqKnownInboundType {\n Auth = 'auth',\n QuoteRequest = 'RFQ_REQUEST',\n QuoteAck = 'ACK_RFQ_QUOTE',\n QuoteCancelAck = 'ACK_RFQ_QUOTE_CANCEL',\n ConfirmationRequest = 'RFQ_CONFIRMATION_REQUEST',\n ConfirmationAck = 'ACK_RFQ_CONFIRMATION_RESPONSE',\n ExecutionUpdate = 'RFQ_EXECUTION_UPDATE',\n Trade = 'RFQ_TRADE',\n Error = 'RFQ_ERROR',\n}\n\nconst RfqAuthResponseMessageSchema = z.object({\n type: z.literal(RfqKnownInboundType.Auth),\n success: z.boolean(),\n address: EvmAddressSchema.optional(),\n role: z.string().optional(),\n error: z.string().optional(),\n});\n\nexport type RfqAuthResponseMessage = z.infer<\n typeof RfqAuthResponseMessageSchema\n>;\n\nconst RfqQuoteRequestSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.QuoteRequest),\n rfq_id: RfqIdSchema,\n requestor_public_id: RfqRequestorPublicIdSchema,\n leg_position_ids: z.array(PositionIdSchema),\n condition_id: ComboConditionIdSchema,\n yes_position_id: PositionIdSchema,\n no_position_id: PositionIdSchema,\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n requested_size: RfqRequestedSizeSchema,\n submission_deadline: EpochMillisecondsSchema,\n })\n .transform((message) => ({\n conditionId: message.condition_id,\n direction: message.direction,\n legPositionIds: message.leg_position_ids,\n noPositionId: message.no_position_id,\n requestorPublicId: message.requestor_public_id,\n requestedSize: message.requested_size,\n rfqId: message.rfq_id,\n side: message.side,\n submissionDeadline: message.submission_deadline,\n type: 'quote_request' as const,\n yesPositionId: message.yes_position_id,\n }));\n\nexport type RfqQuoteRequest = z.infer<typeof RfqQuoteRequestSchema>;\n\nexport type RfqQuoteMessage = {\n type: 'RFQ_QUOTE';\n rfq_id: RfqId;\n price_e6: string;\n size_e6: string;\n signed_order: RfqSignedOrder;\n};\n\nexport type RfqQuoteCancelMessage = {\n type: 'RFQ_QUOTE_CANCEL';\n rfq_id: RfqId;\n quote_id: RfqQuoteId;\n signer_address: EvmAddress;\n maker_address: EvmAddress;\n};\n\nconst RfqQuoteAckSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.QuoteAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n })\n .transform((message) => ({\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'quote_ack' as const,\n }));\n\nexport type RfqQuoteAck = z.infer<typeof RfqQuoteAckSchema>;\n\nconst RfqQuoteCancelAckSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.QuoteCancelAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n })\n .transform((message) => ({\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'quote_cancel_ack' as const,\n }));\n\nexport type RfqQuoteCancelAck = z.infer<typeof RfqQuoteCancelAckSchema>;\n\nconst RfqConfirmationRequestSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.ConfirmationRequest),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n signer_address: EvmAddressSchema,\n maker_address: EvmAddressSchema,\n signature_type: SignatureTypeSchema,\n leg_position_ids: z.array(PositionIdSchema),\n condition_id: ComboConditionIdSchema,\n yes_position_id: PositionIdSchema,\n no_position_id: PositionIdSchema,\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n fill_size_e6: E6BigIntStringToDecimalStringSchema,\n price_e6: E6BigIntStringToDecimalStringSchema,\n confirm_by: EpochMillisecondsSchema,\n })\n .transform((message) => ({\n conditionId: message.condition_id,\n confirmBy: message.confirm_by,\n direction: message.direction,\n fillSize: message.fill_size_e6,\n legPositionIds: message.leg_position_ids,\n makerAddress: message.maker_address,\n noPositionId: message.no_position_id,\n price: message.price_e6,\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n side: message.side,\n signatureType: message.signature_type,\n signerAddress: message.signer_address,\n type: 'confirmation_request' as const,\n yesPositionId: message.yes_position_id,\n }));\n\nexport type RfqConfirmationRequest = z.infer<\n typeof RfqConfirmationRequestSchema\n>;\n\nexport type RfqConfirmationResponseMessage = {\n type: 'RFQ_CONFIRMATION_RESPONSE';\n rfq_id: RfqId;\n quote_id: RfqQuoteId;\n decision: RfqConfirmationDecision;\n};\n\nconst RfqConfirmationAckSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.ConfirmationAck),\n rfq_id: RfqIdSchema,\n quote_id: RfqQuoteIdSchema,\n decision: RfqConfirmationDecisionSchema,\n })\n .transform((message) => ({\n decision: message.decision,\n quoteId: message.quote_id,\n rfqId: message.rfq_id,\n type: 'confirmation_ack' as const,\n }));\n\nexport type RfqConfirmationAck = z.infer<typeof RfqConfirmationAckSchema>;\n\nconst RfqExecutionUpdateSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.ExecutionUpdate),\n rfq_id: RfqIdSchema,\n status: RfqExecutionStatusSchema,\n tx_hash: TxHashSchema.optional(),\n })\n .transform((message) => ({\n rfqId: message.rfq_id,\n status: message.status,\n ...(message.tx_hash === undefined ? {} : { txHash: message.tx_hash }),\n type: 'execution_update' as const,\n }));\n\nexport type RfqExecutionUpdate = z.infer<typeof RfqExecutionUpdateSchema>;\n\nconst RfqTradeSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.Trade),\n rfq_id: RfqIdSchema,\n requester_id: RfqRequestorPublicIdSchema,\n condition_id: ComboConditionIdSchema,\n leg_position_ids: z.array(PositionIdSchema),\n direction: RfqDirectionSchema,\n side: RfqSideSchema,\n price_e6: E6BigIntStringToDecimalStringSchema,\n size_e6: E6BigIntStringToDecimalStringSchema,\n executed_at: EpochMillisecondsSchema,\n })\n .transform((message) => ({\n conditionId: message.condition_id,\n direction: message.direction,\n executedAt: message.executed_at,\n legPositionIds: message.leg_position_ids,\n price: message.price_e6,\n requesterId: message.requester_id,\n rfqId: message.rfq_id,\n side: message.side,\n size: message.size_e6,\n type: 'trade' as const,\n }));\n\nexport type RfqTrade = z.infer<typeof RfqTradeSchema>;\n\nconst RfqErrorMessageSchema = z\n .object({\n type: z.literal(RfqKnownInboundType.Error),\n error_id: z.string().optional(),\n request_type: z.string().optional(),\n rfq_id: RfqIdSchema.optional(),\n quote_id: RfqQuoteIdSchema.optional(),\n code: RfqErrorCodeSchema,\n error: z.string(),\n request: z.unknown().optional(),\n })\n .transform((message) => ({\n code: message.code,\n errorId: message.error_id,\n message: message.error,\n quoteId: message.quote_id,\n requestType: message.request_type,\n rfqId: message.rfq_id,\n type: 'rfq_error' as const,\n }));\n\nexport type RfqErrorMessage = z.infer<typeof RfqErrorMessageSchema>;\n\nexport const RfqQuoterInboundMessageSchema = z.discriminatedUnion('type', [\n RfqAuthResponseMessageSchema,\n RfqQuoteRequestSchema,\n RfqQuoteAckSchema,\n RfqQuoteCancelAckSchema,\n RfqConfirmationRequestSchema,\n RfqConfirmationAckSchema,\n RfqExecutionUpdateSchema,\n RfqTradeSchema,\n RfqErrorMessageSchema,\n]);\n\nexport type RfqQuoterInboundMessage = z.infer<\n typeof RfqQuoterInboundMessageSchema\n>;\n\nexport type RfqQuoterOutboundMessage =\n | RfqQuoteMessage\n | RfqQuoteCancelMessage\n | RfqConfirmationResponseMessage;\n"]}
|