@polymarket/bindings 0.1.0-beta.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2VUWIHOR.js +2 -0
- package/dist/chunk-2VUWIHOR.js.map +1 -0
- package/dist/chunk-667TIILD.js +2 -0
- package/dist/{chunk-PJWPI2GS.js.map → chunk-667TIILD.js.map} +1 -1
- package/dist/chunk-D6QJEBYH.js +2 -0
- package/dist/chunk-D6QJEBYH.js.map +1 -0
- package/dist/clob/index.d.ts +116 -52
- package/dist/clob/index.js +1 -1
- package/dist/clob/index.js.map +1 -1
- package/dist/data/index.d.ts +1050 -916
- package/dist/data/index.js +1 -1
- package/dist/data/index.js.map +1 -1
- package/dist/gamma/index.d.ts +71 -24
- package/dist/gamma/index.js +1 -1
- package/dist/gamma/index.js.map +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.js +1 -1
- package/dist/{orders-ByouGgI5.d.ts → orders-mGd3XVG1.d.ts} +451 -6
- package/dist/perps/index.d.ts +288 -3
- package/dist/perps/index.js +1 -1
- package/dist/relayer/index.js +1 -1
- package/dist/rfq.d.ts +16 -41
- package/dist/rfq.js +1 -1
- package/dist/rfq.js.map +1 -1
- package/dist/subscriptions/index.d.ts +377 -73
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-PJWPI2GS.js +0 -2
- package/dist/chunk-SB2LAVJ4.js +0 -2
- package/dist/chunk-SB2LAVJ4.js.map +0 -1
- package/dist/chunk-WZTOZWYR.js +0 -2
- package/dist/chunk-WZTOZWYR.js.map +0 -1
package/dist/perps/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{X as FetchPerpsAccountConfigResponseSchema,O as FetchPerpsAccountStatsResponseSchema,M as FetchPerpsBalancesResponseSchema,Ja as FetchPerpsCandlesResponseSchema,Ia as FetchPerpsFeesResponseSchema,Fa as FetchPerpsFundingHistoryResponseSchema,oa as FetchPerpsInstrumentsResponseSchema,Va as FetchPerpsOpenOrdersResponseSchema,Ua as FetchPerpsOrdersResponseSchema,S as FetchPerpsPortfolioResponseSchema,ua as FetchPerpsStatisticsResponseSchema,qa as FetchPerpsTickersResponseSchema,Da as FetchPerpsTradesResponseSchema,fa as ListPerpsDepositsResponseSchema,Z as ListPerpsEquityHistoryResponseSchema,Ya as ListPerpsFillsResponseSchema,U as ListPerpsFundingPaymentsResponseSchema,$ as ListPerpsPnlHistoryResponseSchema,ia as ListPerpsWithdrawalsResponseSchema,W as PerpsAccountConfigSchema,Xa as PerpsAccountFillSchema,Za as PerpsAccountFillUpdateSchema,V as PerpsAccountFundingPaymentEntrySchema,T as PerpsAccountFundingPaymentSchema,N as PerpsAccountStatsSchema,F as PerpsAssetSchema,L as PerpsBalanceSchema,za as PerpsBboSchema,Aa as PerpsBboUpdateSchema,wa as PerpsBookLevelSchema,xa as PerpsBookSchema,ya as PerpsBookUpdateSchema,Ra as PerpsCancelAllOrdersResponseSchema,Qa as PerpsCancelOrderResultSchema,sa as PerpsCandleSchema,c as PerpsClientOrderIdSchema,Oa as PerpsCommandAckSchema,Na as PerpsCommandStatusSchema,ca as PerpsCreateProxyResponseSchema,ba as PerpsCredentialsResponseSchema,H as PerpsDataResponseSchema,i as PerpsDecimalInputSchema,da as PerpsDeleteProxyResponseSchema,ea as PerpsDepositSchema,p as PerpsDepositStatus,A as PerpsDepositStatusSchema,ga as PerpsDepositUpdateSchema,g as PerpsEntityIdSchema,Y as PerpsEquityPointSchema,Ga as PerpsFeeScheduleEntrySchema,Ha as PerpsFeesInfoSchema,h as PerpsFundingIntervalSchema,Ea as PerpsFundingRateSchema,k as PerpsInstrumentCategory,v as PerpsInstrumentCategorySchema,a as PerpsInstrumentIdSchema,na as PerpsInstrumentSchema,j as PerpsInstrumentType,u as PerpsInstrumentTypeSchema,r as PerpsInternalTransferDirection,C as PerpsInternalTransferDirectionSchema,f as PerpsInternalTransferIdSchema,la as PerpsInternalTransferSchema,s as PerpsKlineInterval,D as PerpsKlineIntervalSchema,Q as PerpsMarginSummarySchema,b as PerpsOrderIdSchema,Ta as PerpsOrderSchema,Ka as PerpsOrderStatus,Ma as PerpsOrderStatusSchema,Wa as PerpsOrderUpdateSchema,t as PerpsPnlInterval,E as PerpsPnlIntervalSchema,_ as PerpsPnlPointSchema,P as PerpsPortfolioPositionSchema,R as PerpsPortfolioSchema,Pa as PerpsPostOrderAckSchema,aa as PerpsProxyKeySchema,Ba as PerpsPublicTradeSchema,Ca as PerpsPublicTradeUpdateSchema,ma as PerpsRiskTierSchema,l as PerpsSide,w as PerpsSideSchema,ta as PerpsStatisticSchema,va as PerpsStatisticUpdateSchema,ra as PerpsTickerEntrySchema,pa as PerpsTickerSchema,m as PerpsTimeInForce,x as PerpsTimeInForceSchema,n as PerpsTpSlKind,y as PerpsTpSlKindSchema,La as PerpsTpSlOrderFieldsSchema,o as PerpsTpSlScope,z as PerpsTpSlScopeSchema,d as PerpsTradeIdSchema,G as PerpsTxHashSchema,Sa as PerpsUpdateLeverageResultSchema,ja as PerpsWithdrawResponseSchema,e as PerpsWithdrawalIdSchema,ha as PerpsWithdrawalSchema,q as PerpsWithdrawalStatus,B as PerpsWithdrawalStatusSchema,ka as PerpsWithdrawalUpdateSchema,K as decimalString,J as perpsBaseUnits,I as perpsDecimal}from'../chunk-2VUWIHOR.js';import'../chunk-D6QJEBYH.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/relayer/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {$,
|
|
1
|
+
import {$,Ga,Ha}from'../chunk-D6QJEBYH.js';import {z}from'zod';var i=(n=>(n.SAFE="SAFE",n.PROXY="PROXY",n.SAFE_CREATE="SAFE-CREATE",n.WALLET="WALLET",n.WALLET_CREATE="WALLET-CREATE",n))(i||{}),D=z.enum(i),u=z.enum(["PROXY","SAFE","SAFE-CREATE"]),c=(o=>(o.STATE_NEW="STATE_NEW",o.STATE_EXECUTED="STATE_EXECUTED",o.STATE_MINED="STATE_MINED",o.STATE_CONFIRMED="STATE_CONFIRMED",o.STATE_INVALID="STATE_INVALID",o.STATE_FAILED="STATE_FAILED",o))(c||{}),m=z.enum(c),y=z.object({baseGas:z.string().optional(),gasLimit:z.string().optional(),gasPrice:z.string().optional(),gasToken:$.optional(),operation:z.string().optional(),payment:z.string().optional(),paymentReceiver:$.optional(),paymentToken:$.optional(),refundReceiver:$.optional(),relay:$.optional(),relayHub:$.optional(),relayerFee:z.string().optional(),safeTxnGas:z.string().optional()}),d=z.object({address:$,nonce:z.string().min(1)}),R=z.object({data:z.string().min(1),from:$,metadata:z.string().optional(),nonce:z.string().min(1).optional(),proxyWallet:$,signature:z.string().min(1),signatureParams:y,to:$,type:u,value:z.string().optional()}),T=z.object({data:z.string().min(1),target:$,value:z.string().min(1)}),x=z.object({calls:z.array(T).min(1),deadline:z.string().min(1),depositWallet:$}),S=z.object({depositWalletParams:x,from:$,metadata:z.string().optional(),nonce:z.string().min(1),signature:z.string().min(1),to:$,type:z.literal("WALLET")}),g=z.object({from:$,metadata:z.string().optional(),to:$,type:z.literal("WALLET-CREATE")}),W=z.union([R,S,g]),f=z.object({state:m,transactionHash:Ha.nullish().transform(a=>a??null),transactionID:Ga}).transform(({transactionHash:a,transactionID:s,...r})=>({...r,transactionHash:a??null,transactionId:s})),L=z.object({deployed:z.boolean()}),_=z.object({error_msg:z.string().nullish(),state:m,transaction_hash:z.union([z.literal(""),Ha]).transform(a=>a===""?null:a),transaction_id:Ga}).transform(({error_msg:a,transaction_hash:s,transaction_id:r,...E})=>({...E,errorMsg:a??null,transactionHash:s??null,transactionId:r}));export{T as DepositWalletCallSchema,x as DepositWalletParamsSchema,_ as GaslessTransactionSchema,L as RelayerDeployedResponseSchema,g as RelayerDepositWalletCreateRequestSchema,S as RelayerDepositWalletExecuteRequestSchema,d as RelayerExecuteParamsSchema,W as RelayerExecuteRequestSchema,f as RelayerExecuteResponseSchema,R as RelayerLegacyExecuteRequestSchema,c as RelayerTransactionState,i as RelayerTransactionType,D as RelayerTransactionTypeSchema};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
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,12 @@ 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 & {});
|
|
68
69
|
type ComboMarket = {
|
|
69
70
|
id: MarketId;
|
|
70
71
|
conditionId: CtfConditionId;
|
|
@@ -84,29 +85,6 @@ type ComboMarketOutcomes = {
|
|
|
84
85
|
yes: ComboMarketOutcome;
|
|
85
86
|
no: ComboMarketOutcome;
|
|
86
87
|
};
|
|
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
88
|
declare const ListComboMarketsResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
111
89
|
markets: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
112
90
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<MarketId, string>>;
|
|
@@ -131,7 +109,7 @@ declare const ListComboMarketsResponseSchema: z.ZodPipe<z.ZodObject<{
|
|
|
131
109
|
volume: number;
|
|
132
110
|
tags: string[];
|
|
133
111
|
}>>>;
|
|
134
|
-
next_cursor: z.ZodOptional<z.ZodNullable<z.
|
|
112
|
+
next_cursor: z.ZodOptional<z.ZodNullable<z.ZodCustom<PaginationCursor, PaginationCursor>>>;
|
|
135
113
|
}, z.core.$strip>, z.ZodTransform<{
|
|
136
114
|
markets: ComboMarket[];
|
|
137
115
|
nextCursor: PaginationCursor | undefined;
|
|
@@ -187,9 +165,6 @@ declare enum RfqKnownInboundType {
|
|
|
187
165
|
Trade = "RFQ_TRADE",
|
|
188
166
|
Error = "RFQ_ERROR"
|
|
189
167
|
}
|
|
190
|
-
declare const RfqKnownInboundMessageSchema: z.ZodObject<{
|
|
191
|
-
type: z.ZodEnum<typeof RfqKnownInboundType>;
|
|
192
|
-
}, z.core.$strip>;
|
|
193
168
|
declare const RfqAuthResponseMessageSchema: z.ZodObject<{
|
|
194
169
|
type: z.ZodLiteral<RfqKnownInboundType.Auth>;
|
|
195
170
|
success: z.ZodBoolean;
|
|
@@ -439,11 +414,11 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
439
414
|
request_type: z.ZodOptional<z.ZodString>;
|
|
440
415
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
441
416
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
442
|
-
code: z.
|
|
417
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<RfqKnownErrorCode | (string & {}), string>>;
|
|
443
418
|
error: z.ZodString;
|
|
444
419
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
445
420
|
}, z.core.$strip>, z.ZodTransform<{
|
|
446
|
-
code:
|
|
421
|
+
code: RfqKnownErrorCode | (string & {});
|
|
447
422
|
errorId: string | undefined;
|
|
448
423
|
message: string;
|
|
449
424
|
quoteId: RfqQuoteId | undefined;
|
|
@@ -452,7 +427,7 @@ declare const RfqErrorMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
|
452
427
|
type: "rfq_error";
|
|
453
428
|
}, {
|
|
454
429
|
type: RfqKnownInboundType.Error;
|
|
455
|
-
code:
|
|
430
|
+
code: RfqKnownErrorCode | (string & {});
|
|
456
431
|
error: string;
|
|
457
432
|
error_id?: string | undefined;
|
|
458
433
|
request_type?: string | undefined;
|
|
@@ -674,11 +649,11 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
674
649
|
request_type: z.ZodOptional<z.ZodString>;
|
|
675
650
|
rfq_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqId, string>>>;
|
|
676
651
|
quote_id: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<RfqQuoteId, string>>>;
|
|
677
|
-
code: z.
|
|
652
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<RfqKnownErrorCode | (string & {}), string>>;
|
|
678
653
|
error: z.ZodString;
|
|
679
654
|
request: z.ZodOptional<z.ZodUnknown>;
|
|
680
655
|
}, z.core.$strip>, z.ZodTransform<{
|
|
681
|
-
code:
|
|
656
|
+
code: RfqKnownErrorCode | (string & {});
|
|
682
657
|
errorId: string | undefined;
|
|
683
658
|
message: string;
|
|
684
659
|
quoteId: RfqQuoteId | undefined;
|
|
@@ -687,7 +662,7 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
687
662
|
type: "rfq_error";
|
|
688
663
|
}, {
|
|
689
664
|
type: RfqKnownInboundType.Error;
|
|
690
|
-
code:
|
|
665
|
+
code: RfqKnownErrorCode | (string & {});
|
|
691
666
|
error: string;
|
|
692
667
|
error_id?: string | undefined;
|
|
693
668
|
request_type?: string | undefined;
|
|
@@ -698,4 +673,4 @@ declare const RfqQuoterInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
698
673
|
type RfqQuoterInboundMessage = z.infer<typeof RfqQuoterInboundMessageSchema>;
|
|
699
674
|
type RfqQuoterOutboundMessage = RfqQuoteMessage | RfqQuoteCancelMessage | RfqConfirmationResponseMessage;
|
|
700
675
|
|
|
701
|
-
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes,
|
|
676
|
+
export { type ComboMarket, type ComboMarketOutcome, type ComboMarketOutcomes, type ListComboMarketsResponse, ListComboMarketsResponseSchema, type RfqAuthMessage, type RfqAuthResponseMessage, type RfqConfirmationAck, RfqConfirmationDecision, type RfqConfirmationRequest, type RfqConfirmationResponseMessage, RfqDirection, type RfqErrorCode, type RfqErrorMessage, RfqExecutionStatus, type RfqExecutionUpdate, RfqId, RfqKnownErrorCode, RfqKnownInboundType, type RfqOrderSide, type RfqQuoteAck, type RfqQuoteCancelAck, type RfqQuoteCancelMessage, RfqQuoteId, type RfqQuoteMessage, type RfqQuoteRequest, type RfqQuoterInboundMessage, RfqQuoterInboundMessageSchema, type RfqQuoterOutboundMessage, type RfqRequestedSize, RfqRequestedSizeUnit, RfqRequestorPublicId, RfqSide, type RfqSignedOrder, type RfqTrade };
|
package/dist/rfq.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-HOD4LKZU.js';import {
|
|
1
|
+
import {b as b$1}from'./chunk-HOD4LKZU.js';import {Z,ra,Ia,ya,xa,Ja,$,aa,Y,Da,Ba,Ca,Ha}from'./chunk-D6QJEBYH.js';import {z as z$1}from'zod';var E=(o=>(o.Buy="BUY",o.Sell="SELL",o))(E||{}),M=(o=>(o.Yes="YES",o.No="NO",o))(M||{}),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||{}),N=(o=>(o.Notional="notional",o.Shares="shares",o))(N||{}),Q=(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))(Q||{}),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),D=z$1.object({id:ra,condition_id:Z,position_ids:z$1.array(ya),slug:z$1.string(),title:z$1.string(),outcomes:z$1.array(z$1.string()),outcome_prices:z$1.array(Ia),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})),W=z$1.object({markets:z$1.array(D),next_cursor:xa.nullish()}).transform(e=>({markets:e.markets,nextCursor:e.next_cursor??void 0})),L=z$1.discriminatedUnion("unit",[z$1.object({unit:z$1.literal("notional"),value_e6:Ja}),z$1.object({unit:z$1.literal("shares"),value_e6:Ja})]).transform(e=>({unit:e.unit,value:e.value_e6})),C=(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))(C||{}),U=z$1.object({type:z$1.literal("auth"),success:z$1.boolean(),address:$.optional(),role:z$1.string().optional(),error:z$1.string().optional()}),v=z$1.object({type:z$1.literal("RFQ_REQUEST"),rfq_id:Ba,requestor_public_id:Da,leg_position_ids:z$1.array(ya),condition_id:Y,yes_position_id:ya,no_position_id:ya,direction:m,side:f,requested_size:L,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})),k=z$1.object({type:z$1.literal("ACK_RFQ_QUOTE"),rfq_id:Ba,quote_id:Ca}).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:Ba,quote_id:Ca}).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:Ba,quote_id:Ca,signer_address:$,maker_address:$,signature_type:b$1,leg_position_ids:z$1.array(ya),condition_id:Y,yes_position_id:ya,no_position_id:ya,direction:m,side:f,fill_size_e6:Ja,price_e6:Ja,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})),P=z$1.object({type:z$1.literal("ACK_RFQ_CONFIRMATION_RESPONSE"),rfq_id:Ba,quote_id:Ca,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:Ba,status:O,tx_hash:Ha.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:Ba,requester_id:Da,condition_id:Y,leg_position_ids:z$1.array(ya),direction:m,side:f,price_e6:Ja,size_e6:Ja,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"})),j=z$1.object({type:z$1.literal("RFQ_ERROR"),error_id:z$1.string().optional(),request_type:z$1.string().optional(),rfq_id:Ba.optional(),quote_id:Ca.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"})),X=z$1.discriminatedUnion("type",[U,v,k,F,z,P,V,B,j]);export{W as ListComboMarketsResponseSchema,g as RfqConfirmationDecision,E as RfqDirection,T as RfqExecutionStatus,Q as RfqKnownErrorCode,C as RfqKnownInboundType,X as RfqQuoterInboundMessageSchema,N as RfqRequestedSizeUnit,M 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","RfqConf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,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","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":"4IAyCO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,GAAA,CAAM,K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AaA,CAAAA,CAAQ,YAAA,CACrB,KAAA,CAAOA,CAAAA,CAAQ,MAAA,CACf,IAAA,CAAMA,CAAAA,CAAQ,IAAA,CACd,IAAA,CAAMA,CAAAA,CAAQ,QACd,IAAA,CAAM,OACR,CAAA,CAAE,CAAA,CAIEU,CAAAA,CAAwBrC,GAAAA,CAC3B,MAAA,CAAO,CACN,IAAA,CAAMA,GAAAA,CAAE,OAAA,CAAQ,WAAyB,CAAA,CACzC,QAAA,CAAUA,IAAE,MAAA,EAAO,CAAE,QAAA,EAAS,CAC9B,YAAA,CAAcA,GAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS,CAClC,MAAA,CAAQuB,EAAAA,CAAY,QAAA,EAAS,CAC7B,SAAUM,EAAAA,CAAiB,QAAA,EAAS,CACpC,IAAA,CAAMzB,CAAAA,CACN,KAAA,CAAOJ,IAAE,MAAA,EAAO,CAChB,OAAA,CAASA,GAAAA,CAAE,OAAA,EAAQ,CAAE,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\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"]}
|