@polymarket/bindings 0.12.0 → 0.13.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-Z6SGQXSJ.js +2 -0
- package/dist/chunk-Z6SGQXSJ.js.map +1 -0
- package/dist/data/index.d.ts +171 -2
- package/dist/data/index.js +1 -1
- package/dist/data/index.js.map +1 -1
- package/dist/{orders-BMW5PN-Q.d.ts → orders-BV68_6ST.d.ts} +495 -34
- package/dist/perps/index.d.ts +922 -4
- package/dist/perps/index.js +1 -1
- package/dist/perps/index.js.map +1 -1
- package/dist/subscriptions/index.d.ts +358 -61
- package/dist/subscriptions/index.js +1 -1
- package/dist/subscriptions/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-DAWT25YZ.js +0 -2
- package/dist/chunk-DAWT25YZ.js.map +0 -1
package/dist/perps/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{ca as FetchPerpsAccountConfigResponseSchema,V as FetchPerpsAccountStatsResponseSchema,T as FetchPerpsBalancesResponseSchema,oa as FetchPerpsBuilderApprovalsResponseSchema,
|
|
1
|
+
import {o,a,b as b$1,c}from'../chunk-Z6SGQXSJ.js';export{za as CreatePerpsChaseResponseSchema,ca as FetchPerpsAccountConfigResponseSchema,V as FetchPerpsAccountStatsResponseSchema,T as FetchPerpsBalancesResponseSchema,oa as FetchPerpsBuilderApprovalsResponseSchema,hb as FetchPerpsCandlesResponseSchema,ya as FetchPerpsChasesResponseSchema,gb as FetchPerpsFeesResponseSchema,cb as FetchPerpsFundingHistoryResponseSchema,Na as FetchPerpsInstrumentsResponseSchema,Ob as FetchPerpsOpenOrdersResponseSchema,Nb as FetchPerpsOrdersResponseSchema,Z as FetchPerpsPortfolioResponseSchema,Ta as FetchPerpsStatisticsResponseSchema,Pa as FetchPerpsTickersResponseSchema,ab as FetchPerpsTradesResponseSchema,xb as FetchPerpsUnreadNotificationsCountResponseSchema,sa as ListPerpsBuilderEarningsResponseSchema,Ba as ListPerpsDepositsResponseSchema,ea as ListPerpsEquityHistoryResponseSchema,Rb as ListPerpsFillsResponseSchema,$ as ListPerpsFundingPaymentsResponseSchema,Ia as ListPerpsInternalTransfersResponseSchema,wb as ListPerpsNotificationsResponseSchema,ga as ListPerpsPnlHistoryResponseSchema,Ea as ListPerpsWithdrawalsResponseSchema,yb as MarkPerpsNotificationsReadResponseSchema,ba as PerpsAccountConfigSchema,Qb as PerpsAccountFillSchema,Sb as PerpsAccountFillUpdateSchema,aa as PerpsAccountFundingPaymentEntrySchema,_ as PerpsAccountFundingPaymentSchema,U as PerpsAccountStatsSchema,M as PerpsAssetSchema,S as PerpsBalanceSchema,Ya as PerpsBboSchema,Za as PerpsBboUpdateSchema,Va as PerpsBookLevelSchema,Wa as PerpsBookSchema,Xa as PerpsBookUpdateSchema,na as PerpsBuilderApprovalSchema,e as PerpsBuilderEarningIdSchema,qa as PerpsBuilderEarningSchema,ta as PerpsBuilderEarningsAssetSchema,ra as PerpsBuilderEarningsSnapshotSchema,ua as PerpsBuilderEarningsSummarySchema,ma as PerpsBuilderStatusSchema,la as PerpsBuilderTermsSchema,Ib as PerpsCancelAllOrdersResponseSchema,Eb as PerpsCancelOrderErrorCodeSchema,Hb as PerpsCancelOrderResultSchema,Ra as PerpsCandleSchema,xa as PerpsChaseAcceptedSchema,va as PerpsChaseIdSchema,wa as PerpsChaseSchema,c as PerpsClientOrderIdSchema,Fb as PerpsCommandAckSchema,Cb as PerpsCommandStatusSchema,ja as PerpsCreateProxyResponseSchema,ia as PerpsCredentialsResponseSchema,O as PerpsDataResponseSchema,l as PerpsDecimalInputSchema,ka as PerpsDeleteProxyResponseSchema,Aa as PerpsDepositSchema,s as PerpsDepositStatus,F as PerpsDepositStatusSchema,Ca as PerpsDepositUpdateSchema,j as PerpsEntityIdSchema,da as PerpsEquityPointSchema,eb as PerpsFeeScheduleEntrySchema,db as PerpsFeeTierSchema,fb as PerpsFeesInfoSchema,k as PerpsFundingIntervalSchema,g as PerpsFundingPaymentIdSchema,bb as PerpsFundingRateSchema,n as PerpsInstrumentCategory,A as PerpsInstrumentCategorySchema,a as PerpsInstrumentIdSchema,Ma as PerpsInstrumentSchema,La as PerpsInstrumentSettlementSchema,m as PerpsInstrumentType,z as PerpsInstrumentTypeSchema,v as PerpsInternalTransferDirection,I as PerpsInternalTransferDirectionSchema,i as PerpsInternalTransferIdSchema,Ja as PerpsInternalTransferResponseSchema,Ha as PerpsInternalTransferSchema,H as PerpsInternalTransferTypeSchema,w as PerpsKlineInterval,J as PerpsKlineIntervalSchema,Db as PerpsKnownCancelOrderErrorCode,u as PerpsKnownInternalTransferType,t as PerpsKnownWithdrawalStatus,qb as PerpsLimitOrderCanceledNotificationSchema,rb as PerpsLiquidationWarningNotificationSchema,pa as PerpsLiquidityRole,X as PerpsMarginSummarySchema,mb as PerpsMarginType,nb as PerpsMarginTypeSchema,vb as PerpsNotificationEntrySchema,d as PerpsNotificationIdSchema,kb as PerpsNotificationOrderType,lb as PerpsNotificationOrderTypeSchema,ub as PerpsNotificationSchema,ib as PerpsNotificationType,jb as PerpsNotificationTypeSchema,b as PerpsOrderIdSchema,Mb as PerpsOrderSchema,zb as PerpsOrderStatus,Bb as PerpsOrderStatusSchema,Pb as PerpsOrderUpdateSchema,x as PerpsPnlInterval,K as PerpsPnlIntervalSchema,fa as PerpsPnlPointSchema,W as PerpsPortfolioPositionSchema,Y as PerpsPortfolioSchema,ob as PerpsPositionChangeNotificationSchema,pb as PerpsPositionClosedNotificationSchema,tb as PerpsPositionDeleveragedNotificationSchema,sb as PerpsPositionLiquidatedNotificationSchema,Gb as PerpsPostOrderAckSchema,ha as PerpsProxyKeySchema,_a as PerpsPublicTradeSchema,$a as PerpsPublicTradeUpdateSchema,Ka as PerpsRiskTierSchema,o as PerpsSide,B as PerpsSideSchema,y as PerpsSortDirection,L as PerpsSortDirectionSchema,Sa as PerpsStatisticSchema,Ua as PerpsStatisticUpdateSchema,Qa as PerpsTickerEntrySchema,Oa as PerpsTickerSchema,p as PerpsTimeInForce,C as PerpsTimeInForceSchema,q as PerpsTpSlKind,D as PerpsTpSlKindSchema,Ab as PerpsTpSlOrderFieldsSchema,r as PerpsTpSlScope,E as PerpsTpSlScopeSchema,f as PerpsTradeIdSchema,N as PerpsTxHashSchema,Lb as PerpsUpdateLeverageBatchResultSchema,Kb as PerpsUpdateLeverageRejectionSchema,Jb as PerpsUpdateLeverageResultSchema,Fa as PerpsWithdrawResponseSchema,h as PerpsWithdrawalIdSchema,Da as PerpsWithdrawalSchema,G as PerpsWithdrawalStatusSchema,Ga as PerpsWithdrawalUpdateSchema,R as decimalString,Q as perpsBaseUnits,P as perpsDecimal}from'../chunk-Z6SGQXSJ.js';import {u,da,Oa}from'../chunk-3IZ4N7C2.js';import {z as z$1}from'zod';var h=z$1.number().int().transform(e=>e===0?null:u(e)),br=z$1.object({status:z$1.literal("ok"),deadline:h}),I=z$1.object({deadline:h,triggered:z$1.number().int().nonnegative(),daily_limit:z$1.number().int().nonnegative(),next_reset:da}).transform(e=>({deadline:e.deadline,triggered:e.triggered,dailyLimit:e.daily_limit,nextReset:e.next_reset})),gr=I;var P=(i=>(i.Ok="ok",i.NotFound="not_found",i.HistoryPending="history_pending",i.HistoryLimit="history_limit",i.ResourceLimit="resource_limit",i.TemporarilyUnavailable="temporarily_unavailable",i.Unavailable="unavailable",i))(P||{}),y=(a=>(a.Increase="increase",a.Decrease="decrease",a))(y||{}),v=z$1.object({position:z$1.number(),open:z$1.number(),high:z$1.number(),low:z$1.number(),close:z$1.number()}),A=z$1.object({position:z$1.number(),kind:z$1.enum(y)}),C=z$1.object({candles:z$1.array(v).max(22),markers:z$1.array(A).max(256)}),R=z$1.object({position_cycle_id:z$1.string(),side:z$1.enum(o),started_at:da,as_of_at:da,is_closed:z$1.boolean(),size_after:Oa,entry_price:Oa,as_of_price:Oa,pnl:Oa,pnl_percent:Oa.nullable(),leverage:z$1.number().int().nonnegative().nullable(),chart:C}).transform(e=>({positionCycleId:e.position_cycle_id,side:e.side,startedAt:e.started_at,asOfAt:e.as_of_at,isClosed:e.is_closed,sizeAfter:e.size_after,entryPrice:e.entry_price,asOfPrice:e.as_of_price,pnl:e.pnl,pnlPercent:e.pnl_percent,leverage:e.leverage,chart:e.chart})),z=z$1.string().regex(/^(0|[1-9][0-9]{0,19})$/).refine(e=>/^[0-9]{1,20}$/.test(e)&&BigInt(e)<=18446744073709551615n),x=z$1.object({instrument_id:a,trade_id:z.optional()}),S=z$1.discriminatedUnion("status",[x.extend({status:z$1.literal("ok"),snapshot:R}),x.extend({status:z$1.enum(P).exclude(["Ok"]),snapshot:z$1.never().optional()})]).transform(e=>{let c={instrumentId:e.instrument_id,...e.trade_id===void 0?{}:{tradeId:e.trade_id}};return e.status==="ok"?{...c,status:e.status,snapshot:e.snapshot}:{...c,status:e.status}}),w=S.transform((e,c)=>e.tradeId===void 0?(c.addIssue({code:"custom",message:"Historical snapshot requires trade_id"}),z$1.NEVER):{...e,tradeId:e.tradeId}),Rr=z$1.object({history_as_of_at:da,active:z$1.array(S),history:z$1.array(w)}).transform(e=>({historyAsOfAt:e.history_as_of_at,active:e.active,history:e.history}));var Or=z$1.object({registered:z$1.boolean()}).transform(e=>e.registered);var b=z$1.number().int().positive().max(Number.MAX_SAFE_INTEGER).transform(e=>e),g=(a=>(a.Running="running",a.Paused="paused",a))(g||{}),p=z$1.string().regex(/^\d+(?:\.\d+)?$/).pipe(Oa),O=z$1.object({twid:b,iid:a,buy:z$1.boolean(),qty:p,fill:p,dur:z$1.number().int().positive(),ivl:z$1.number().int().positive(),rnd:z$1.boolean(),slip_bps:z$1.number().int().min(0).max(1e4),min_px:p,max_px:p,ro:z$1.boolean(),st:z$1.enum(g),slices:z$1.number().int().nonnegative(),slice_count:z$1.number().int().positive(),sts:da,ets:da,cts:da,avg_px:p.optional(),coid:c.optional(),oid:b$1.optional()}).transform(e=>({twapId:e.twid,instrumentId:e.iid,side:e.buy?"BUY":"SELL",quantity:e.qty,filledQuantity:e.fill,durationMs:e.dur,intervalMs:e.ivl,randomize:e.rnd,slippageBps:e.slip_bps,minPrice:e.min_px,maxPrice:e.max_px,reduceOnly:e.ro,status:e.st,slices:e.slices,sliceCount:e.slice_count,startedAt:e.sts,endsAt:e.ets,createdAt:e.cts,...e.avg_px===void 0?{}:{averagePrice:e.avg_px},...e.coid===void 0?{}:{clientOrderId:e.coid},...e.oid===void 0?{}:{orderId:e.oid}})),T=z$1.object({status:z$1.literal("ok"),twid:b,ts:da}).transform(e=>({twapId:e.twid,timestamp:e.ts})),Hr=z$1.array(O),Dr=z$1.union([T,z$1.object({status:z$1.literal("err"),error:z$1.string().min(1)})]);export{Dr as CreatePerpsTwapResponseSchema,gr as FetchPerpsAutoCancelStatusResponseSchema,Hr as FetchPerpsTwapsResponseSchema,br as PerpsAutoCancelResponseSchema,I as PerpsAutoCancelStatusSchema,v as PerpsPositionSnapshotCandleSchema,C as PerpsPositionSnapshotChartSchema,y as PerpsPositionSnapshotMarkerKind,A as PerpsPositionSnapshotMarkerSchema,R as PerpsPositionSnapshotSchema,P as PerpsPositionSnapshotStatus,Rr as PerpsPositionSnapshotsSchema,Or as PerpsRegistrationResponseSchema,T as PerpsTwapAcceptedSchema,b as PerpsTwapIdSchema,O as PerpsTwapSchema,g as PerpsTwapStatus};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/perps/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/perps/auto-cancel.ts"],"names":["AutoCancelDeadlineSchema","z","value","toEpochMilliseconds","PerpsAutoCancelResponseSchema","PerpsAutoCancelStatusSchema","EpochMillisecondsSchema","status","FetchPerpsAutoCancelStatusResponseSchema"],"mappings":"yoJAIA,IAAMA,EAA2BC,CAAAA,CAC9B,MAAA,EAAO,CACP,GAAA,GACA,SAAA,CAAWC,CAAAA,EAAWA,CAAAA,GAAU,CAAA,CAAI,KAAOC,CAAAA,CAAoBD,CAAK,CAAE,CAAA,CAS5DE,GAAgCH,CAAAA,CAAE,MAAA,CAAO,CACpD,MAAA,CAAQA,EAAE,OAAA,CAAQ,IAAI,CAAA,CACtB,QAAA,CAAUD,CACZ,CAAC,CAAA,CAeYK,CAAAA,CAA8BJ,CAAAA,CACxC,OAAO,CACN,QAAA,CAAUD,CAAAA,CACV,SAAA,CAAWC,EAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,aAAY,CACxC,WAAA,CAAaA,CAAAA,CAAE,MAAA,GAAS,GAAA,EAAI,CAAE,WAAA,EAAY,CAC1C,WAAYK,EACd,CAAC,CAAA,CACA,SAAA,CAAWC,IAAY,CACtB,QAAA,CAAUA,CAAAA,CAAO,QAAA,CACjB,UAAWA,CAAAA,CAAO,SAAA,CAClB,UAAA,CAAYA,CAAAA,CAAO,YACnB,SAAA,CAAWA,CAAAA,CAAO,UACpB,CAAA,CAAE,EAUSC,EAAAA,CACXH","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { EpochMillisecondsSchema, toEpochMilliseconds } from '../shared';\n\n// The API reports an unarmed schedule as `deadline: 0`.\nconst AutoCancelDeadlineSchema = z\n .number()\n .int()\n .transform((value) => (value === 0 ? null : toEpochMilliseconds(value)));\n\n/**\n * Acknowledgement for a Perps auto-cancel update. `deadline` echoes the armed\n * cancellation time in Unix milliseconds, or `null` when the schedule was\n * disarmed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelResponseSchema = z.object({\n status: z.literal('ok'),\n deadline: AutoCancelDeadlineSchema,\n});\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelResponse = z.infer<\n typeof PerpsAutoCancelResponseSchema\n>;\n\n/**\n * Current auto-cancel state for an account. `deadline` is `null` when no\n * schedule is armed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelStatusSchema = z\n .object({\n deadline: AutoCancelDeadlineSchema,\n triggered: z.number().int().nonnegative(),\n daily_limit: z.number().int().nonnegative(),\n next_reset: EpochMillisecondsSchema,\n })\n .transform((status) => ({\n deadline: status.deadline,\n triggered: status.triggered,\n dailyLimit: status.daily_limit,\n nextReset: status.next_reset,\n }));\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelStatus = z.infer<typeof PerpsAutoCancelStatusSchema>;\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const FetchPerpsAutoCancelStatusResponseSchema =\n PerpsAutoCancelStatusSchema;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/perps/auto-cancel.ts","../../src/perps/position-snapshots.ts","../../src/perps/registration.ts","../../src/perps/twaps.ts"],"names":["AutoCancelDeadlineSchema","z","value","toEpochMilliseconds","PerpsAutoCancelResponseSchema","PerpsAutoCancelStatusSchema","EpochMillisecondsSchema","status","FetchPerpsAutoCancelStatusResponseSchema","PerpsPositionSnapshotStatus","PerpsPositionSnapshotMarkerKind","PerpsPositionSnapshotCandleSchema","PerpsPositionSnapshotMarkerSchema","PerpsPositionSnapshotChartSchema","PerpsPositionSnapshotSchema","PerpsSide","DecimalStringSchema","snapshot","TradeIdSchema","IdentitySchema","PerpsInstrumentIdSchema","ResultSchema","item","identity","HistoryResultSchema","ctx","PerpsPositionSnapshotsSchema","response","PerpsRegistrationResponseSchema","PerpsTwapIdSchema","PerpsTwapStatus","DecimalSchema","PerpsTwapSchema","PerpsClientOrderIdSchema","PerpsOrderIdSchema","run","PerpsTwapAcceptedSchema","accepted","FetchPerpsTwapsResponseSchema","CreatePerpsTwapResponseSchema"],"mappings":"6gKAIMA,CAAAA,CAA2BC,GAAAA,CAC9B,QAAO,CACP,GAAA,GACA,SAAA,CAAWC,CAAAA,EAAWA,IAAU,CAAA,CAAI,IAAA,CAAOC,EAAoBD,CAAK,CAAE,EAS5DE,EAAAA,CAAgCH,GAAAA,CAAE,MAAA,CAAO,CACpD,OAAQA,GAAA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A,CAAAA,CAAI,MAAO,EAC/D,GAAIA,CAAAA,CAAI,OAAS,MAAA,CAAY,GAAK,CAAE,aAAA,CAAeA,EAAI,IAAK,CAAA,CAC5D,GAAIA,CAAAA,CAAI,GAAA,GAAQ,OAAY,EAAC,CAAI,CAAE,OAAA,CAASA,CAAAA,CAAI,GAAI,CACtD,CAAA,CAAE,EAISC,CAAAA,CAA0BnC,GAAAA,CACpC,OAAO,CACN,MAAA,CAAQA,IAAE,OAAA,CAAQ,IAAI,CAAA,CACtB,IAAA,CAAM4B,EACN,EAAA,CAAIvB,EACN,CAAC,CAAA,CACA,SAAA,CAAW+B,IAAc,CAAE,MAAA,CAAQA,EAAS,IAAA,CAAM,SAAA,CAAWA,EAAS,EAAG,CAAA,CAAE,EAMjEC,EAAAA,CAAgCrC,GAAAA,CAAE,MAAM+B,CAAe,CAAA,CAEvDO,GAAgCtC,GAAAA,CAAE,KAAA,CAAM,CACnDmC,CAAAA,CACAnC,GAAAA,CAAE,OAAO,CAAE,MAAA,CAAQA,IAAE,OAAA,CAAQ,KAAK,EAAG,KAAA,CAAOA,GAAAA,CAAE,QAAO,CAAE,GAAA,CAAI,CAAC,CAAE,CAAC,CACjE,CAAC","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { EpochMillisecondsSchema, toEpochMilliseconds } from '../shared';\n\n// The API reports an unarmed schedule as `deadline: 0`.\nconst AutoCancelDeadlineSchema = z\n .number()\n .int()\n .transform((value) => (value === 0 ? null : toEpochMilliseconds(value)));\n\n/**\n * Acknowledgement for a Perps auto-cancel update. `deadline` echoes the armed\n * cancellation time in Unix milliseconds, or `null` when the schedule was\n * disarmed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelResponseSchema = z.object({\n status: z.literal('ok'),\n deadline: AutoCancelDeadlineSchema,\n});\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelResponse = z.infer<\n typeof PerpsAutoCancelResponseSchema\n>;\n\n/**\n * Current auto-cancel state for an account. `deadline` is `null` when no\n * schedule is armed.\n *\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsAutoCancelStatusSchema = z\n .object({\n deadline: AutoCancelDeadlineSchema,\n triggered: z.number().int().nonnegative(),\n daily_limit: z.number().int().nonnegative(),\n next_reset: EpochMillisecondsSchema,\n })\n .transform((status) => ({\n deadline: status.deadline,\n triggered: status.triggered,\n dailyLimit: status.daily_limit,\n nextReset: status.next_reset,\n }));\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsAutoCancelStatus = z.infer<typeof PerpsAutoCancelStatusSchema>;\n\n/**\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const FetchPerpsAutoCancelStatusResponseSchema =\n PerpsAutoCancelStatusSchema;\n","import { z } from 'zod';\nimport { DecimalStringSchema, EpochMillisecondsSchema } from '../shared';\nimport {\n type PerpsInstrumentId,\n PerpsInstrumentIdSchema,\n PerpsSide,\n} from './common';\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotStatus {\n Ok = 'ok',\n NotFound = 'not_found',\n HistoryPending = 'history_pending',\n HistoryLimit = 'history_limit',\n ResourceLimit = 'resource_limit',\n TemporarilyUnavailable = 'temporarily_unavailable',\n Unavailable = 'unavailable',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport enum PerpsPositionSnapshotMarkerKind {\n Increase = 'increase',\n Decrease = 'decrease',\n}\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotCandleSchema = z.object({\n position: z.number(),\n open: z.number(),\n high: z.number(),\n low: z.number(),\n close: z.number(),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotCandle = z.infer<\n typeof PerpsPositionSnapshotCandleSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotMarkerSchema = z.object({\n position: z.number(),\n kind: z.enum(PerpsPositionSnapshotMarkerKind),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotMarker = z.infer<\n typeof PerpsPositionSnapshotMarkerSchema\n>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotChartSchema = z.object({\n candles: z.array(PerpsPositionSnapshotCandleSchema).max(22),\n markers: z.array(PerpsPositionSnapshotMarkerSchema).max(256),\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotChart = z.infer<\n typeof PerpsPositionSnapshotChartSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotSchema = z\n .object({\n position_cycle_id: z.string(),\n side: z.enum(PerpsSide),\n started_at: EpochMillisecondsSchema,\n as_of_at: EpochMillisecondsSchema,\n is_closed: z.boolean(),\n size_after: DecimalStringSchema,\n entry_price: DecimalStringSchema,\n as_of_price: DecimalStringSchema,\n pnl: DecimalStringSchema,\n pnl_percent: DecimalStringSchema.nullable(),\n leverage: z.number().int().nonnegative().nullable(),\n chart: PerpsPositionSnapshotChartSchema,\n })\n .transform((snapshot) => ({\n positionCycleId: snapshot.position_cycle_id,\n side: snapshot.side,\n startedAt: snapshot.started_at,\n asOfAt: snapshot.as_of_at,\n isClosed: snapshot.is_closed,\n sizeAfter: snapshot.size_after,\n entryPrice: snapshot.entry_price,\n asOfPrice: snapshot.as_of_price,\n pnl: snapshot.pnl,\n pnlPercent: snapshot.pnl_percent,\n leverage: snapshot.leverage,\n chart: snapshot.chart,\n }));\n/** A position cycle valued at captured state or immediately after a selected fill.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshot = z.infer<typeof PerpsPositionSnapshotSchema>;\n\nconst TradeIdSchema = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,19})$/)\n .refine(\n (value) =>\n /^[0-9]{1,20}$/.test(value) && BigInt(value) <= 18446744073709551615n,\n );\nconst IdentitySchema = z.object({\n instrument_id: PerpsInstrumentIdSchema,\n trade_id: TradeIdSchema.optional(),\n});\nconst ResultSchema = z\n .discriminatedUnion('status', [\n IdentitySchema.extend({\n status: z.literal(PerpsPositionSnapshotStatus.Ok),\n snapshot: PerpsPositionSnapshotSchema,\n }),\n IdentitySchema.extend({\n status: z.enum(PerpsPositionSnapshotStatus).exclude(['Ok']),\n snapshot: z.never().optional(),\n }),\n ])\n .transform((item): PerpsPositionSnapshotResult => {\n const identity = {\n instrumentId: item.instrument_id,\n ...(item.trade_id === undefined ? {} : { tradeId: item.trade_id }),\n };\n return item.status === PerpsPositionSnapshotStatus.Ok\n ? { ...identity, status: item.status, snapshot: item.snapshot }\n : { ...identity, status: item.status };\n });\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshotResult =\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: PerpsPositionSnapshotStatus.Ok;\n snapshot: PerpsPositionSnapshot;\n }\n | {\n instrumentId: PerpsInstrumentId;\n tradeId?: string;\n status: Exclude<\n PerpsPositionSnapshotStatus,\n PerpsPositionSnapshotStatus.Ok\n >;\n };\nconst HistoryResultSchema = ResultSchema.transform((item, ctx) => {\n if (item.tradeId === undefined) {\n ctx.addIssue({\n code: 'custom',\n message: 'Historical snapshot requires trade_id',\n });\n return z.NEVER;\n }\n return { ...item, tradeId: item.tradeId };\n});\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsHistoricalPositionSnapshotResult = z.infer<\n typeof HistoryResultSchema\n>;\n\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsPositionSnapshotsSchema = z\n .object({\n history_as_of_at: EpochMillisecondsSchema,\n active: z.array(ResultSchema),\n history: z.array(HistoryResultSchema),\n })\n .transform((response) => ({\n historyAsOfAt: response.history_as_of_at,\n active: response.active,\n history: response.history,\n }));\n/** Ordered selections and the completed-history horizon. No pagination.\n * @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsPositionSnapshots = z.infer<\n typeof PerpsPositionSnapshotsSchema\n>;\n","import { z } from 'zod';\n\n/**\n * Parses whether an address has a Perps account.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport const PerpsRegistrationResponseSchema = z\n .object({ registered: z.boolean() })\n .transform((response) => response.registered);\n","import { z } from 'zod';\nimport {\n DecimalStringSchema,\n EpochMillisecondsSchema,\n OrderSide,\n} from '../shared';\nimport {\n PerpsClientOrderIdSchema,\n PerpsInstrumentIdSchema,\n PerpsOrderIdSchema,\n} from './common';\n\n/** Opaque run identity.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapId = number & { readonly __tag: 'PerpsTwapId' };\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapIdSchema = z\n .number()\n .int()\n .positive()\n .max(Number.MAX_SAFE_INTEGER)\n .transform((value) => value as PerpsTwapId);\n/** Active runs only; ended runs are absent from the active collection.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport enum PerpsTwapStatus {\n Running = 'running',\n Paused = 'paused',\n}\nconst DecimalSchema = z\n .string()\n .regex(/^\\d+(?:\\.\\d+)?$/)\n .pipe(DecimalStringSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapSchema = z\n .object({\n twid: PerpsTwapIdSchema,\n iid: PerpsInstrumentIdSchema,\n buy: z.boolean(),\n qty: DecimalSchema,\n fill: DecimalSchema,\n dur: z.number().int().positive(),\n ivl: z.number().int().positive(),\n rnd: z.boolean(),\n slip_bps: z.number().int().min(0).max(10000),\n min_px: DecimalSchema,\n max_px: DecimalSchema,\n ro: z.boolean(),\n st: z.enum(PerpsTwapStatus),\n slices: z.number().int().nonnegative(),\n slice_count: z.number().int().positive(),\n sts: EpochMillisecondsSchema,\n ets: EpochMillisecondsSchema,\n cts: EpochMillisecondsSchema,\n avg_px: DecimalSchema.optional(),\n coid: PerpsClientOrderIdSchema.optional(),\n oid: PerpsOrderIdSchema.optional(),\n })\n .transform((run) => ({\n twapId: run.twid,\n instrumentId: run.iid,\n side: run.buy ? OrderSide.BUY : OrderSide.SELL,\n quantity: run.qty,\n filledQuantity: run.fill,\n durationMs: run.dur,\n intervalMs: run.ivl,\n randomize: run.rnd,\n slippageBps: run.slip_bps,\n minPrice: run.min_px,\n maxPrice: run.max_px,\n reduceOnly: run.ro,\n status: run.st,\n slices: run.slices,\n sliceCount: run.slice_count,\n startedAt: run.sts,\n endsAt: run.ets,\n createdAt: run.cts,\n ...(run.avg_px === undefined ? {} : { averagePrice: run.avg_px }),\n ...(run.coid === undefined ? {} : { clientOrderId: run.coid }),\n ...(run.oid === undefined ? {} : { orderId: run.oid }),\n }));\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport type PerpsTwap = z.infer<typeof PerpsTwapSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const PerpsTwapAcceptedSchema = z\n .object({\n status: z.literal('ok'),\n twid: PerpsTwapIdSchema,\n ts: EpochMillisecondsSchema,\n })\n .transform((accepted) => ({ twapId: accepted.twid, timestamp: accepted.ts }));\n/** Acceptance does not guarantee all scheduled quantity will fill.\n * @experimental This API may change in a breaking way in any release, including patch releases.\n */\nexport type PerpsTwapAccepted = z.infer<typeof PerpsTwapAcceptedSchema>;\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const FetchPerpsTwapsResponseSchema = z.array(PerpsTwapSchema);\n/** @experimental This API may change in a breaking way in any release, including patch releases. */\nexport const CreatePerpsTwapResponseSchema = z.union([\n PerpsTwapAcceptedSchema,\n z.object({ status: z.literal('err'), error: z.string().min(1) }),\n]);\n"]}
|