@polymarket/bindings 0.1.0-beta.6 → 0.1.0-beta.7
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-CFT5AXUR.js +2 -0
- package/dist/chunk-CFT5AXUR.js.map +1 -0
- package/dist/common-DVmtlYtD.d.ts +99 -0
- package/dist/perps/index.d.ts +1958 -0
- package/dist/perps/index.js +2 -0
- package/dist/perps/index.js.map +1 -0
- package/dist/rfq.d.ts +78 -1
- package/dist/rfq.js +1 -1
- package/dist/rfq.js.map +1 -1
- package/dist/subscriptions/index.d.ts +1829 -3
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +8 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{T as FetchPerpsAccountConfigResponseSchema,G as FetchPerpsBalancesResponseSchema,Ra as FetchPerpsCandlesResponseSchema,Qa as FetchPerpsFeesResponseSchema,Ma as FetchPerpsFundingHistoryResponseSchema,pa as FetchPerpsInstrumentsResponseSchema,Za as FetchPerpsOpenOrdersResponseSchema,Ya as FetchPerpsOrdersResponseSchema,M as FetchPerpsPortfolioResponseSchema,xa as FetchPerpsStatisticsResponseSchema,sa as FetchPerpsTickersResponseSchema,Ja as FetchPerpsTradesResponseSchema,da as ListPerpsDepositsResponseSchema,V as ListPerpsEquityHistoryResponseSchema,bb as ListPerpsFillsResponseSchema,P as ListPerpsFundingPaymentsResponseSchema,X as ListPerpsPnlHistoryResponseSchema,ha as ListPerpsWithdrawalsResponseSchema,R as PerpsAccountConfigSchema,$a as PerpsAccountFillSchema,N as PerpsAccountFundingPaymentSchema,z as PerpsAssetSchema,F as PerpsBalanceSchema,Da as PerpsBboSchema,za as PerpsBookLevelSchema,Aa as PerpsBookSchema,ua as PerpsCandleSchema,c as PerpsClientOrderIdSchema,Wa as PerpsCommandAckSchema,Ta as PerpsCommandStatusSchema,B as PerpsDataResponseSchema,g as PerpsDecimalInputSchema,ba as PerpsDepositSchema,l as PerpsDepositStatus,u as PerpsDepositStatusSchema,U as PerpsEquityPointSchema,Na as PerpsFeeScheduleEntrySchema,Pa as PerpsFeesInfoSchema,Ka as PerpsFundingRateSchema,i as PerpsInstrumentCategory,r as PerpsInstrumentCategorySchema,a as PerpsInstrumentIdSchema,na as PerpsInstrumentSchema,h as PerpsInstrumentType,q as PerpsInstrumentTypeSchema,n as PerpsInternalTransferDirection,w as PerpsInternalTransferDirectionSchema,f as PerpsInternalTransferIdSchema,ka as PerpsInternalTransferSchema,o as PerpsKlineInterval,x as PerpsKlineIntervalSchema,J as PerpsMarginSummarySchema,Ua as PerpsOrderCommandAckSchema,b as PerpsOrderIdSchema,Sa as PerpsOrderSchema,p as PerpsPnlInterval,y as PerpsPnlIntervalSchema,W as PerpsPnlPointSchema,H as PerpsPortfolioPositionSchema,K as PerpsPortfolioSchema,Y as PerpsProxyKeySchema,Ga as PerpsPublicTradeSchema,ma as PerpsRiskTierSchema,j as PerpsSide,s as PerpsSideSchema,va as PerpsStatisticSchema,qa as PerpsTickerSchema,k as PerpsTimeInForce,t as PerpsTimeInForceSchema,d as PerpsTradeIdSchema,e as PerpsWithdrawalIdSchema,fa as PerpsWithdrawalSchema,m as PerpsWithdrawalStatus,v as PerpsWithdrawalStatusSchema,S as RawPerpsAccountConfigSchema,ab as RawPerpsAccountFillSchema,cb as RawPerpsAccountFillUpdateSchema,Q as RawPerpsAccountFundingPaymentEntrySchema,O as RawPerpsAccountFundingPaymentSchema,Fa as RawPerpsBboDataSchema,Ea as RawPerpsBboSchema,Ba as RawPerpsBookSchema,Ca as RawPerpsBookUpdateSchema,$ as RawPerpsCreateProxyResponseSchema,_ as RawPerpsCredentialsResponseSchema,aa as RawPerpsDeleteProxyResponseSchema,ca as RawPerpsDepositSchema,ea as RawPerpsDepositUpdateSchema,Oa as RawPerpsFeeScheduleEntrySchema,La as RawPerpsFundingRateSchema,oa as RawPerpsInstrumentSchema,la as RawPerpsInternalTransferSchema,Va as RawPerpsOrderCommandAckSchema,Xa as RawPerpsOrderSchema,_a as RawPerpsOrderUpdateSchema,I as RawPerpsPortfolioPositionSchema,L as RawPerpsPortfolioSchema,Z as RawPerpsProxyKeySchema,Ia as RawPerpsPublicTradeResponseSchema,Ha as RawPerpsPublicTradeSchema,ya as RawPerpsStatisticDataSchema,wa as RawPerpsStatisticSchema,ta as RawPerpsTickerEntrySchema,ra as RawPerpsTickerSchema,A as RawPerpsTxHashSchema,ia as RawPerpsWithdrawResponseSchema,ga as RawPerpsWithdrawalSchema,ja as RawPerpsWithdrawalUpdateSchema,E as decimalString,D as perpsBaseUnits,C as perpsDecimal}from'../chunk-CFT5AXUR.js';import'../chunk-SB2LAVJ4.js';//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/rfq.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ declare enum RfqErrorCode {
|
|
|
42
42
|
InvalidRfq = "INVALID_RFQ",
|
|
43
43
|
InvalidRfqState = "INVALID_RFQ_STATE",
|
|
44
44
|
InvalidRole = "INVALID_ROLE",
|
|
45
|
+
InvalidSignature = "INVALID_SIGNATURE",
|
|
46
|
+
InternalError = "INTERNAL_ERROR",
|
|
45
47
|
LegMetadataUnavailable = "LEG_METADATA_UNAVAILABLE",
|
|
46
48
|
MakerAlreadyResponded = "MAKER_ALREADY_RESPONDED",
|
|
47
49
|
MakerNotRequired = "MAKER_NOT_REQUIRED",
|
|
@@ -182,6 +184,7 @@ declare enum RfqKnownInboundType {
|
|
|
182
184
|
ConfirmationRequest = "RFQ_CONFIRMATION_REQUEST",
|
|
183
185
|
ConfirmationAck = "ACK_RFQ_CONFIRMATION_RESPONSE",
|
|
184
186
|
ExecutionUpdate = "RFQ_EXECUTION_UPDATE",
|
|
187
|
+
Trade = "RFQ_TRADE",
|
|
185
188
|
Error = "RFQ_ERROR"
|
|
186
189
|
}
|
|
187
190
|
declare const RfqKnownInboundMessageSchema: z.ZodObject<{
|
|
@@ -395,8 +398,44 @@ declare const RfqExecutionUpdateSchema: z.ZodPipe<z.ZodObject<{
|
|
|
395
398
|
tx_hash?: _polymarket_types.TxHash | undefined;
|
|
396
399
|
}>>;
|
|
397
400
|
type RfqExecutionUpdate = z.infer<typeof RfqExecutionUpdateSchema>;
|
|
401
|
+
declare const RfqTradeSchema: z.ZodPipe<z.ZodObject<{
|
|
402
|
+
type: z.ZodLiteral<RfqKnownInboundType.Trade>;
|
|
403
|
+
rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
|
|
404
|
+
requester_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqRequestorPublicId, string>>;
|
|
405
|
+
condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>;
|
|
406
|
+
leg_position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
|
|
407
|
+
direction: z.ZodEnum<typeof RfqDirection>;
|
|
408
|
+
side: z.ZodLiteral<RfqSide.Yes>;
|
|
409
|
+
price_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
410
|
+
size_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
411
|
+
executed_at: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
412
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
413
|
+
conditionId: ComboConditionId;
|
|
414
|
+
direction: RfqDirection;
|
|
415
|
+
executedAt: EpochMilliseconds;
|
|
416
|
+
legPositionIds: PositionId[];
|
|
417
|
+
price: DecimalString;
|
|
418
|
+
requesterId: RfqRequestorPublicId;
|
|
419
|
+
rfqId: RfqId;
|
|
420
|
+
side: RfqSide.Yes;
|
|
421
|
+
size: DecimalString;
|
|
422
|
+
type: "trade";
|
|
423
|
+
}, {
|
|
424
|
+
type: RfqKnownInboundType.Trade;
|
|
425
|
+
rfq_id: RfqId;
|
|
426
|
+
requester_id: RfqRequestorPublicId;
|
|
427
|
+
condition_id: ComboConditionId;
|
|
428
|
+
leg_position_ids: PositionId[];
|
|
429
|
+
direction: RfqDirection;
|
|
430
|
+
side: RfqSide.Yes;
|
|
431
|
+
price_e6: DecimalString;
|
|
432
|
+
size_e6: DecimalString;
|
|
433
|
+
executed_at: EpochMilliseconds;
|
|
434
|
+
}>>;
|
|
435
|
+
type RfqTrade = z.infer<typeof RfqTradeSchema>;
|
|
398
436
|
declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
399
437
|
type: z.ZodLiteral<RfqKnownInboundType.Error>;
|
|
438
|
+
error_id: z.ZodOptional<z.ZodString>;
|
|
400
439
|
request_type: z.ZodOptional<z.ZodString>;
|
|
401
440
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
402
441
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
@@ -405,6 +444,7 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
405
444
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
406
445
|
}, z.core.$strip>, z.ZodTransform<{
|
|
407
446
|
code: RfqErrorCode;
|
|
447
|
+
errorId: string | undefined;
|
|
408
448
|
message: string;
|
|
409
449
|
quoteId: RfqQuoteId | undefined;
|
|
410
450
|
requestType: string | undefined;
|
|
@@ -414,6 +454,7 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
414
454
|
type: RfqKnownInboundType.Error;
|
|
415
455
|
code: RfqErrorCode;
|
|
416
456
|
error: string;
|
|
457
|
+
error_id?: string | undefined;
|
|
417
458
|
request_type?: string | undefined;
|
|
418
459
|
rfq_id?: RfqId | undefined;
|
|
419
460
|
quote_id?: RfqQuoteId | undefined;
|
|
@@ -594,8 +635,42 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
594
635
|
rfq_id: RfqId;
|
|
595
636
|
status: RfqExecutionStatus;
|
|
596
637
|
tx_hash?: _polymarket_types.TxHash | undefined;
|
|
638
|
+
}>>, z.ZodPipe<z.ZodObject<{
|
|
639
|
+
type: z.ZodLiteral<RfqKnownInboundType.Trade>;
|
|
640
|
+
rfq_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>;
|
|
641
|
+
requester_id: z.ZodPipe<z.ZodString, z.ZodTransform<RfqRequestorPublicId, string>>;
|
|
642
|
+
condition_id: z.ZodPipe<z.ZodString, z.ZodTransform<ComboConditionId, string>>;
|
|
643
|
+
leg_position_ids: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PositionId, string>>>;
|
|
644
|
+
direction: z.ZodEnum<typeof RfqDirection>;
|
|
645
|
+
side: z.ZodLiteral<RfqSide.Yes>;
|
|
646
|
+
price_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
647
|
+
size_e6: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
|
|
648
|
+
executed_at: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
|
|
649
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
650
|
+
conditionId: ComboConditionId;
|
|
651
|
+
direction: RfqDirection;
|
|
652
|
+
executedAt: EpochMilliseconds;
|
|
653
|
+
legPositionIds: PositionId[];
|
|
654
|
+
price: DecimalString;
|
|
655
|
+
requesterId: RfqRequestorPublicId;
|
|
656
|
+
rfqId: RfqId;
|
|
657
|
+
side: RfqSide.Yes;
|
|
658
|
+
size: DecimalString;
|
|
659
|
+
type: "trade";
|
|
660
|
+
}, {
|
|
661
|
+
type: RfqKnownInboundType.Trade;
|
|
662
|
+
rfq_id: RfqId;
|
|
663
|
+
requester_id: RfqRequestorPublicId;
|
|
664
|
+
condition_id: ComboConditionId;
|
|
665
|
+
leg_position_ids: PositionId[];
|
|
666
|
+
direction: RfqDirection;
|
|
667
|
+
side: RfqSide.Yes;
|
|
668
|
+
price_e6: DecimalString;
|
|
669
|
+
size_e6: DecimalString;
|
|
670
|
+
executed_at: EpochMilliseconds;
|
|
597
671
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
598
672
|
type: z.ZodLiteral<RfqKnownInboundType.Error>;
|
|
673
|
+
error_id: z.ZodOptional<z.ZodString>;
|
|
599
674
|
request_type: z.ZodOptional<z.ZodString>;
|
|
600
675
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
601
676
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
@@ -604,6 +679,7 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
604
679
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
605
680
|
}, z.core.$strip>, z.ZodTransform<{
|
|
606
681
|
code: RfqErrorCode;
|
|
682
|
+
errorId: string | undefined;
|
|
607
683
|
message: string;
|
|
608
684
|
quoteId: RfqQuoteId | undefined;
|
|
609
685
|
requestType: string | undefined;
|
|
@@ -613,6 +689,7 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
613
689
|
type: RfqKnownInboundType.Error;
|
|
614
690
|
code: RfqErrorCode;
|
|
615
691
|
error: string;
|
|
692
|
+
error_id?: string | undefined;
|
|
616
693
|
request_type?: string | undefined;
|
|
617
694
|
rfq_id?: RfqId | undefined;
|
|
618
695
|
quote_id?: RfqQuoteId | undefined;
|
|
@@ -621,4 +698,4 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
621
698
|
type RfqQuoterInboundMessage = z.infer<typeof RfqQuoterInboundMessageSchema>;
|
|
622
699
|
type RfqQuoterOutboundMessage = RfqQuoteMessage | RfqQuoteCancelMessage | RfqConfirmationResponseMessage;
|
|
623
700
|
|
|
624
|
-
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, ComboMarketSchema, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, RfqAuthResponseMessageSchema, type RfqConfirmationAck, RfqConfirmationAckSchema, RfqConfirmationDecision, RfqConfirmationDecisionSchema, type RfqConfirmationRequest, RfqConfirmationRequestSchema, type RfqConfirmationResponseMessage, RfqDirection, RfqDirectionSchema, RfqErrorCode, RfqErrorCodeSchema, type RfqErrorMessage, RfqErrorMessageSchema, RfqExecutionStatus, RfqExecutionStatusSchema, type RfqExecutionUpdate, RfqExecutionUpdateSchema, RfqId, RfqKnownInboundMessageSchema, RfqKnownInboundType, type RfqOrderSide, type RfqQuoteAck, RfqQuoteAckSchema, type RfqQuoteCancelAck, RfqQuoteCancelAckSchema, type RfqQuoteCancelMessage, RfqQuoteId, type RfqQuoteMessage, type RfqQuoteRequest, RfqQuoteRequestSchema, type RfqQuoterInboundMessage, RfqQuoterInboundMessageSchema, type RfqQuoterOutboundMessage, type RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestedSizeUnitSchema, RfqRequestorPublicId, RfqSide, RfqSideSchema, type RfqSignedOrder };
|
|
701
|
+
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, ComboMarketSchema, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, RfqAuthResponseMessageSchema, type RfqConfirmationAck, RfqConfirmationAckSchema, RfqConfirmationDecision, RfqConfirmationDecisionSchema, type RfqConfirmationRequest, RfqConfirmationRequestSchema, type RfqConfirmationResponseMessage, RfqDirection, RfqDirectionSchema, RfqErrorCode, RfqErrorCodeSchema, type RfqErrorMessage, RfqErrorMessageSchema, RfqExecutionStatus, RfqExecutionStatusSchema, type RfqExecutionUpdate, RfqExecutionUpdateSchema, RfqId, RfqKnownInboundMessageSchema, RfqKnownInboundType, type RfqOrderSide, type RfqQuoteAck, RfqQuoteAckSchema, type RfqQuoteCancelAck, RfqQuoteCancelAckSchema, type RfqQuoteCancelMessage, RfqQuoteId, type RfqQuoteMessage, type RfqQuoteRequest, RfqQuoteRequestSchema, type RfqQuoterInboundMessage, RfqQuoterInboundMessageSchema, type RfqQuoterOutboundMessage, type RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestedSizeUnitSchema, RfqRequestorPublicId, RfqSide, RfqSideSchema, type RfqSignedOrder, type RfqTrade, RfqTradeSchema };
|
package/dist/rfq.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-HOD4LKZU.js';import {X,ra,Ha,xa,wa,Ia,$,aa,W as W$1,Ca,Aa,Ba,Ga}from'./chunk-SB2LAVJ4.js';import {z as z$1}from'zod';var
|
|
1
|
+
import {b as b$1}from'./chunk-HOD4LKZU.js';import {X as X$1,ra,Ha,xa,wa,Ia,$,aa,W as W$1,Ca,Aa,Ba,Ga}from'./chunk-SB2LAVJ4.js';import {z as z$1}from'zod';var x=(o=>(o.Buy="BUY",o.Sell="SELL",o))(x||{}),O=(o=>(o.Yes="YES",o.No="NO",o))(O||{}),g=(o=>(o.Confirm="CONFIRM",o.Decline="DECLINE",o))(g||{}),T=(u=>(u.Matched="MATCHED",u.Mined="MINED",u.Confirmed="CONFIRMED",u.Retrying="RETRYING",u.Failed="FAILED",u))(T||{}),N=(o=>(o.Notional="notional",o.Shares="shares",o))(N||{}),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.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||{}),f=z$1.enum(x),R=z$1.literal("YES"),D=z$1.enum(g),L=z$1.enum(T),G=z$1.enum(N),C=z$1.enum(M),U=z$1.object({id:ra,condition_id:X$1,position_ids:z$1.array(xa),slug:z$1.string(),title:z$1.string(),outcomes:z$1.array(z$1.string()),outcome_prices:z$1.array(Ha),image:z$1.string(),volume:z$1.number(),tags:z$1.array(z$1.string())}).superRefine((e,I)=>{e.outcomes.length!==2&&I.addIssue({code:"custom",message:`Expected binary combo market outcomes, received ${e.outcomes.length}.`,path:["outcomes"]}),e.position_ids.length!==e.outcomes.length&&I.addIssue({code:"custom",message:"Expected position_ids and outcomes to have matching lengths.",path:["position_ids"]}),e.outcome_prices.length!==e.outcomes.length&&I.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})),W=z$1.object({markets:z$1.array(U),next_cursor:wa.nullish()}).transform(e=>({markets:e.markets,nextCursor:e.next_cursor??void 0})),b=z$1.discriminatedUnion("unit",[z$1.object({unit:z$1.literal("notional"),value_e6:Ia}),z$1.object({unit:z$1.literal("shares"),value_e6:Ia})]).transform(e=>({unit:e.unit,value:e.value_e6})),Q=(n=>(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))(Q||{}),d=z$1.object({type:z$1.enum(Q)}),v=d.extend({type:z$1.literal("auth"),success:z$1.boolean(),address:$.optional(),role:z$1.string().optional(),error:z$1.string().optional()}),k=d.extend({type:z$1.literal("RFQ_REQUEST"),rfq_id:Aa,requestor_public_id:Ca,leg_position_ids:z$1.array(xa),condition_id:W$1,yes_position_id:xa,no_position_id:xa,direction:f,side:R,requested_size:b,submission_deadline:aa}).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})),F=d.extend({type:z$1.literal("ACK_RFQ_QUOTE"),rfq_id:Aa,quote_id:Ba}).transform(e=>({quoteId:e.quote_id,rfqId:e.rfq_id,type:"quote_ack"})),z=d.extend({type:z$1.literal("ACK_RFQ_QUOTE_CANCEL"),rfq_id:Aa,quote_id:Ba}).transform(e=>({quoteId:e.quote_id,rfqId:e.rfq_id,type:"quote_cancel_ack"})),P=d.extend({type:z$1.literal("RFQ_CONFIRMATION_REQUEST"),rfq_id:Aa,quote_id:Ba,signer_address:$,maker_address:$,signature_type:b$1,leg_position_ids:z$1.array(xa),condition_id:W$1,yes_position_id:xa,no_position_id:xa,direction:f,side:R,fill_size_e6:Ia,price_e6:Ia,confirm_by:aa}).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})),V=d.extend({type:z$1.literal("ACK_RFQ_CONFIRMATION_RESPONSE"),rfq_id:Aa,quote_id:Ba,decision:D}).transform(e=>({decision:e.decision,quoteId:e.quote_id,rfqId:e.rfq_id,type:"confirmation_ack"})),B=d.extend({type:z$1.literal("RFQ_EXECUTION_UPDATE"),rfq_id:Aa,status:L,tx_hash:Ga.optional()}).transform(e=>({rfqId:e.rfq_id,status:e.status,...e.tx_hash===void 0?{}:{txHash:e.tx_hash},type:"execution_update"})),H=d.extend({type:z$1.literal("RFQ_TRADE"),rfq_id:Aa,requester_id:Ca,condition_id:W$1,leg_position_ids:z$1.array(xa),direction:f,side:R,price_e6:Ia,size_e6:Ia,executed_at:aa}).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"})),K=d.extend({type:z$1.literal("RFQ_ERROR"),error_id:z$1.string().optional(),request_type:z$1.string().optional(),rfq_id:Aa.optional(),quote_id:Ba.optional(),code:C,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"})),X=z$1.discriminatedUnion("type",[v,k,F,z,P,V,B,H,K]);export{U as ComboMarketSchema,W as ListComboMarketsResponseSchema,v as RfqAuthResponseMessageSchema,V as RfqConfirmationAckSchema,g as RfqConfirmationDecision,D as RfqConfirmationDecisionSchema,P as RfqConfirmationRequestSchema,x as RfqDirection,f as RfqDirectionSchema,M as RfqErrorCode,C as RfqErrorCodeSchema,K as RfqErrorMessageSchema,T as RfqExecutionStatus,L as RfqExecutionStatusSchema,B as RfqExecutionUpdateSchema,d as RfqKnownInboundMessageSchema,Q as RfqKnownInboundType,F as RfqQuoteAckSchema,z as RfqQuoteCancelAckSchema,k as RfqQuoteRequestSchema,X as RfqQuoterInboundMessageSchema,N as RfqRequestedSizeUnit,G as RfqRequestedSizeUnitSchema,O as RfqSide,R as RfqSideSchema,H as RfqTradeSchema};//# 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","Signature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,OAAQwB,EAAAA,CACR,MAAA,CAAQrB,EACR,OAAA,CAASiC,EAAAA,CAAa,UACxB,CAAC,CAAA,CAAE,SAAA,CAAWR,CAAAA,GAAa,CACzB,MAAOA,CAAAA,CAAQ,MAAA,CACf,MAAA,CAAQA,CAAAA,CAAQ,MAAA,CAChB,GAAIA,EAAQ,OAAA,GAAY,MAAA,CAAY,EAAC,CAAI,CAAE,MAAA,CAAQA,EAAQ,OAAQ,CAAA,CACnE,KAAM,kBACR,CAAA,CAAE,EAIWS,CAAAA,CAAwBjB,CAAAA,CAA6B,MAAA,CAAO,CACvE,IAAA,CAAMpB,GAAAA,CAAE,QAAQ,WAAyB,CAAA,CACzC,YAAA,CAAcA,GAAAA,CAAE,MAAA,EAAO,CAAE,UAAS,CAClC,MAAA,CAAQwB,EAAAA,CAAY,QAAA,EAAS,CAC7B,QAAA,CAAUM,GAAiB,QAAA,EAAS,CACpC,KAAMzB,CAAAA,CACN,KAAA,CAAOL,IAAE,MAAA,EAAO,CAChB,OAAA,CAASA,GAAAA,CAAE,OAAA,EAAQ,CAAE,UACvB,CAAC,CAAA,CAAE,SAAA,CAAW4B,CAAAA,GAAa,CACzB,KAAMA,CAAAA,CAAQ,IAAA,CACd,OAAA,CAASA,CAAAA,CAAQ,KAAA,CACjB,OAAA,CAASA,EAAQ,QAAA,CACjB,WAAA,CAAaA,EAAQ,YAAA,CACrB,KAAA,CAAOA,EAAQ,MAAA,CACf,IAAA,CAAM,WACR,CAAA,CAAE,CAAA,CAIWU,CAAAA,CAAgCtC,IAAE,kBAAA,CAAmB,MAAA,CAAQ,CACxEqB,CAAAA,CACAE,CAAAA,CACAM,CAAAA,CACAE,EACAC,CAAAA,CACAE,CAAAA,CACAC,CAAAA,CACAE,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 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 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 RfqErrorMessageSchema = RfqKnownInboundMessageSchema.extend({\n type: z.literal(RfqKnownInboundType.Error),\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 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 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","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":"0JAyCO,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,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,SAAW,UAAA,CACXA,CAAAA,CAAA,MAAA,CAAS,QAAA,CALCA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAQAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,MAAA,CAAS,QAAA,CAFCA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAKAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,eAAA,CAAkB,kBAAA,CAClBA,CAAAA,CAAA,yBAAA,CAA4B,8BAC5BA,CAAAA,CAAA,uBAAA,CAA0B,2BAAA,CAC1BA,CA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AAA,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"]}
|