@polymarket/bindings 0.9.0 → 0.11.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.
@@ -4407,6 +4407,256 @@ type PerpsResyncEvent = {
4407
4407
  */
4408
4408
  type PerpsSessionEvent = PerpsSessionUpdateEvent | PerpsResyncEvent;
4409
4409
 
4410
+ declare enum RealtimeKnownErrorCode {
4411
+ BadOp = "bad_op",
4412
+ BadChannel = "bad_channel",
4413
+ BadFilter = "bad_filter",
4414
+ SubscriptionLimit = "sub_limit",
4415
+ RateLimited = "rate_limited",
4416
+ AuthRequired = "auth_required",
4417
+ AuthUnavailable = "auth_unavailable",
4418
+ AuthExpired = "auth_expired",
4419
+ AuthAttempts = "auth_attempts",
4420
+ AuthInvalid = "auth_invalid"
4421
+ }
4422
+ /**
4423
+ * A realtime error code. Known codes are enumerated in {@link RealtimeKnownErrorCode};
4424
+ * newly introduced codes flow through as plain strings so they can be handled
4425
+ * before a client release that enumerates them.
4426
+ */
4427
+ type RealtimeErrorCode = RealtimeKnownErrorCode | (string & {});
4428
+ declare enum PolyboltChannel {
4429
+ Crypto = "price.crypto",
4430
+ Twap = "price.crypto.twap",
4431
+ Equity = "price.equity"
4432
+ }
4433
+ /** A filter sent to a PolyBolt price channel. */
4434
+ type PolyboltFilter = {
4435
+ symbol: string;
4436
+ window_seconds?: 60;
4437
+ } | {
4438
+ asset_id: string;
4439
+ };
4440
+ /** One item in a PolyBolt subscription operation. */
4441
+ type PolyboltSubscription = {
4442
+ channel: PolyboltChannel;
4443
+ filter: PolyboltFilter;
4444
+ };
4445
+ declare enum PolyboltAckOp {
4446
+ Subscribed = "subscribed",
4447
+ Unsubscribed = "unsubscribed",
4448
+ Pong = "pong",
4449
+ Authed = "authed",
4450
+ Error = "error"
4451
+ }
4452
+ declare const PolyboltAckSchema: z.ZodObject<{
4453
+ op: z.ZodEnum<typeof PolyboltAckOp>;
4454
+ channel: z.ZodOptional<z.ZodString>;
4455
+ rid: z.ZodOptional<z.ZodString>;
4456
+ code: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<(string & {}) | RealtimeKnownErrorCode, string>>>;
4457
+ }, z.core.$strip>;
4458
+ type PolyboltAck = z.infer<typeof PolyboltAckSchema>;
4459
+ declare const PolyboltEnvelopeSchema: z.ZodObject<{
4460
+ v: z.ZodLiteral<1>;
4461
+ channel: z.ZodEnum<typeof PolyboltChannel>;
4462
+ seq: z.ZodNumber;
4463
+ ts: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4464
+ snapshot: z.ZodOptional<z.ZodBoolean>;
4465
+ dropped: z.ZodOptional<z.ZodNumber>;
4466
+ payload: z.ZodUnknown;
4467
+ }, z.core.$strip>;
4468
+ type PolyboltEnvelope = z.infer<typeof PolyboltEnvelopeSchema>;
4469
+ declare const CryptoPriceEventSchema: z.ZodUnion<readonly [z.ZodObject<{
4470
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4471
+ seq: z.ZodOptional<z.ZodNumber>;
4472
+ dropped: z.ZodOptional<z.ZodNumber>;
4473
+ topic: z.ZodLiteral<"prices.crypto">;
4474
+ type: z.ZodLiteral<"update">;
4475
+ payload: z.ZodPipe<z.ZodObject<{
4476
+ symbol: z.ZodString;
4477
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4478
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4479
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4480
+ received_at: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>;
4481
+ is_carried_forward: z.ZodOptional<z.ZodBoolean>;
4482
+ }, z.core.$strip>, z.ZodTransform<{
4483
+ symbol: string;
4484
+ timestamp: EpochMilliseconds;
4485
+ value: DecimalString;
4486
+ receivedAt: EpochMilliseconds | undefined;
4487
+ isCarriedForward: boolean | undefined;
4488
+ }, {
4489
+ symbol: string;
4490
+ timestamp: EpochMilliseconds;
4491
+ value: DecimalString;
4492
+ full_accuracy_value: DecimalString;
4493
+ received_at?: EpochMilliseconds | undefined;
4494
+ is_carried_forward?: boolean | undefined;
4495
+ }>>;
4496
+ }, z.core.$strip>, z.ZodObject<{
4497
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4498
+ seq: z.ZodOptional<z.ZodNumber>;
4499
+ dropped: z.ZodOptional<z.ZodNumber>;
4500
+ topic: z.ZodLiteral<"prices.crypto">;
4501
+ type: z.ZodLiteral<"subscribe">;
4502
+ payload: z.ZodObject<{
4503
+ symbol: z.ZodString;
4504
+ data: z.ZodArray<z.ZodPipe<z.ZodObject<{
4505
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4506
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4507
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4508
+ }, z.core.$strip>, z.ZodTransform<{
4509
+ timestamp: EpochMilliseconds;
4510
+ value: DecimalString;
4511
+ }, {
4512
+ timestamp: EpochMilliseconds;
4513
+ value: DecimalString;
4514
+ full_accuracy_value: DecimalString;
4515
+ }>>>;
4516
+ }, z.core.$strip>;
4517
+ }, z.core.$strip>]>;
4518
+ /**
4519
+ * A cryptocurrency price event.
4520
+ *
4521
+ * `seq` is scoped to one channel on one WebSocket connection and resets after
4522
+ * reconnecting. When an SDK subscription spans multiple connections, sequence
4523
+ * values from those connections may interleave.
4524
+ */
4525
+ type CryptoPriceEvent = z.infer<typeof CryptoPriceEventSchema>;
4526
+ type CryptoPriceSnapshotEvent = Extract<CryptoPriceEvent, {
4527
+ type: 'subscribe';
4528
+ }>;
4529
+ declare const CryptoTwapPriceEventSchema: z.ZodUnion<readonly [z.ZodObject<{
4530
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4531
+ seq: z.ZodOptional<z.ZodNumber>;
4532
+ dropped: z.ZodOptional<z.ZodNumber>;
4533
+ topic: z.ZodLiteral<"prices.crypto.twap">;
4534
+ type: z.ZodLiteral<"update">;
4535
+ payload: z.ZodPipe<z.ZodObject<{
4536
+ symbol: z.ZodString;
4537
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4538
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4539
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4540
+ window_seconds: z.ZodLiteral<60>;
4541
+ }, z.core.$strip>, z.ZodTransform<{
4542
+ symbol: string;
4543
+ timestamp: EpochMilliseconds;
4544
+ value: DecimalString;
4545
+ windowSeconds: 60;
4546
+ }, {
4547
+ symbol: string;
4548
+ timestamp: EpochMilliseconds;
4549
+ value: DecimalString;
4550
+ full_accuracy_value: DecimalString;
4551
+ window_seconds: 60;
4552
+ }>>;
4553
+ }, z.core.$strip>, z.ZodObject<{
4554
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4555
+ seq: z.ZodOptional<z.ZodNumber>;
4556
+ dropped: z.ZodOptional<z.ZodNumber>;
4557
+ topic: z.ZodLiteral<"prices.crypto.twap">;
4558
+ type: z.ZodLiteral<"subscribe">;
4559
+ payload: z.ZodPipe<z.ZodObject<{
4560
+ symbol: z.ZodString;
4561
+ data: z.ZodArray<z.ZodPipe<z.ZodObject<{
4562
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4563
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4564
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4565
+ }, z.core.$strip>, z.ZodTransform<{
4566
+ timestamp: EpochMilliseconds;
4567
+ value: DecimalString;
4568
+ }, {
4569
+ timestamp: EpochMilliseconds;
4570
+ value: DecimalString;
4571
+ full_accuracy_value: DecimalString;
4572
+ }>>>;
4573
+ window_seconds: z.ZodLiteral<60>;
4574
+ }, z.core.$strip>, z.ZodTransform<{
4575
+ symbol: string;
4576
+ data: {
4577
+ timestamp: EpochMilliseconds;
4578
+ value: DecimalString;
4579
+ }[];
4580
+ windowSeconds: 60;
4581
+ }, {
4582
+ symbol: string;
4583
+ data: {
4584
+ timestamp: EpochMilliseconds;
4585
+ value: DecimalString;
4586
+ }[];
4587
+ window_seconds: 60;
4588
+ }>>;
4589
+ }, z.core.$strip>]>;
4590
+ /**
4591
+ * A cryptocurrency TWAP event.
4592
+ *
4593
+ * `seq` is scoped to one channel on one WebSocket connection and resets after
4594
+ * reconnecting. When an SDK subscription spans multiple connections, sequence
4595
+ * values from those connections may interleave.
4596
+ */
4597
+ type CryptoTwapPriceEvent = z.infer<typeof CryptoTwapPriceEventSchema>;
4598
+ type CryptoTwapPriceSnapshotEvent = Extract<CryptoTwapPriceEvent, {
4599
+ type: 'subscribe';
4600
+ }>;
4601
+ declare const EquityPriceEventSchema: z.ZodUnion<readonly [z.ZodObject<{
4602
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4603
+ seq: z.ZodOptional<z.ZodNumber>;
4604
+ dropped: z.ZodOptional<z.ZodNumber>;
4605
+ topic: z.ZodLiteral<"prices.equity">;
4606
+ type: z.ZodLiteral<"update">;
4607
+ payload: z.ZodPipe<z.ZodObject<{
4608
+ symbol: z.ZodString;
4609
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4610
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4611
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4612
+ received_at: z.ZodOptional<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>;
4613
+ is_carried_forward: z.ZodOptional<z.ZodBoolean>;
4614
+ }, z.core.$strip>, z.ZodTransform<{
4615
+ symbol: string;
4616
+ timestamp: EpochMilliseconds;
4617
+ value: DecimalString;
4618
+ receivedAt: EpochMilliseconds | undefined;
4619
+ isCarriedForward: boolean | undefined;
4620
+ }, {
4621
+ symbol: string;
4622
+ timestamp: EpochMilliseconds;
4623
+ value: DecimalString;
4624
+ full_accuracy_value: DecimalString;
4625
+ received_at?: EpochMilliseconds | undefined;
4626
+ is_carried_forward?: boolean | undefined;
4627
+ }>>;
4628
+ }, z.core.$strip>, z.ZodObject<{
4629
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4630
+ seq: z.ZodOptional<z.ZodNumber>;
4631
+ dropped: z.ZodOptional<z.ZodNumber>;
4632
+ topic: z.ZodLiteral<"prices.equity">;
4633
+ type: z.ZodLiteral<"subscribe">;
4634
+ payload: z.ZodObject<{
4635
+ symbol: z.ZodString;
4636
+ data: z.ZodArray<z.ZodPipe<z.ZodObject<{
4637
+ timestamp: z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>;
4638
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
4639
+ full_accuracy_value: z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>;
4640
+ }, z.core.$strip>, z.ZodTransform<{
4641
+ timestamp: EpochMilliseconds;
4642
+ value: DecimalString;
4643
+ }, {
4644
+ timestamp: EpochMilliseconds;
4645
+ value: DecimalString;
4646
+ full_accuracy_value: DecimalString;
4647
+ }>>>;
4648
+ }, z.core.$strip>;
4649
+ }, z.core.$strip>]>;
4650
+ /**
4651
+ * An equity price event.
4652
+ *
4653
+ * `seq` is scoped to one channel on one WebSocket connection and resets after
4654
+ * reconnecting. When an SDK subscription spans multiple connections, sequence
4655
+ * values from those connections may interleave.
4656
+ */
4657
+ type EquityPriceEvent = z.infer<typeof EquityPriceEventSchema>;
4658
+ type PriceEvent = CryptoPriceEvent | CryptoTwapPriceEvent | EquityPriceEvent;
4659
+
4410
4660
  declare const CommentRemovedPayloadSchema: z.ZodObject<{
4411
4661
  id: z.ZodString;
4412
4662
  body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -6812,4 +7062,4 @@ declare const SportsResultEventSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
6812
7062
  }>>;
6813
7063
  type SportsEvent = z.infer<typeof SportsResultEventSchema>;
6814
7064
 
6815
- export { type CommentCreatedEvent, CommentCreatedEventSchema, type CommentRemovedEvent, CommentRemovedEventSchema, type CommentRemovedPayload, type CommentsEvent, CommentsEventSchema, type CryptoPricesBinanceEvent, CryptoPricesBinanceEventSchema, type CryptoPricesBinanceTopic, type CryptoPricesChainlinkEvent, CryptoPricesChainlinkEventSchema, type CryptoPricesChainlinkTopic, type CryptoPricesChainlinkTwapEvent, CryptoPricesChainlinkTwapEventSchema, type CryptoPricesChainlinkTwapSixtyEvent, CryptoPricesChainlinkTwapSixtyEventSchema, type CryptoPricesChainlinkTwapThirtyEvent, CryptoPricesChainlinkTwapThirtyEventSchema, type CryptoPricesChainlinkTwapTopic, type CryptoPricesChainlinkTwapWindowSeconds, type CryptoPricesEvent, CryptoPricesEventSchema, type CryptoPricesTopic, type CustomMarketEvent, CustomMarketEventSchema, type EquityPriceSnapshotPoint, type EquityPriceSubscribePayload, type EquityPriceUpdatePayload, type EquityPricesEvent, EquityPricesEventSchema, type EquityPricesSubscribeEvent, EquityPricesSubscribeEventSchema, type EquityPricesTopic, type EquityPricesUpdateEvent, EquityPricesUpdateEventSchema, type MarketBestBidAskEvent, MarketBestBidAskEventSchema, type MarketBookEvent, MarketBookEventSchema, type MarketEvent, type MarketEventMessage, MarketEventSchema, type MarketLastTradePriceEvent, MarketLastTradePriceEventSchema, type MarketPriceChangeEvent, MarketPriceChangeEventSchema, type MarketResolvedEvent, MarketResolvedEventSchema, type MarketTickSizeChangeEvent, MarketTickSizeChangeEventSchema, type NewMarketEvent, NewMarketEventSchema, type OrderBookLevel, type PerpsBalanceUpdateEvent, PerpsBalanceUpdateEventSchema, type PerpsBboEvent, PerpsBboEventSchema, type PerpsBookEvent, PerpsBookEventSchema, type PerpsCandleEvent, PerpsCandleEventSchema, type PerpsDepositUpdateEvent, PerpsDepositUpdateEventSchema, type PerpsFillUpdateEvent, PerpsFillUpdateEventSchema, type PerpsFundingUpdateEvent, PerpsFundingUpdateEventSchema, type PerpsMarketDataEvent, PerpsMarketDataEventSchema, type PerpsNotificationUpdateEvent, PerpsNotificationUpdateEventSchema, PerpsNotificationsResyncFrameSchema, type PerpsOrderUpdateEvent, PerpsOrderUpdateEventSchema, type PerpsPortfolioUpdateEvent, PerpsPortfolioUpdateEventSchema, type PerpsResyncEvent, type PerpsSessionEvent, type PerpsSessionUpdateEvent, PerpsSessionUpdateEventSchema, type PerpsStatisticEvent, PerpsStatisticEventSchema, type PerpsTickerEvent, PerpsTickerEventSchema, type PerpsTpSlUpdateEvent, PerpsTpSlUpdateEventSchema, type PerpsTradeEvent, PerpsTradeEventSchema, type PerpsWithdrawalUpdateEvent, PerpsWithdrawalUpdateEventSchema, type PriceChange, type PriceUpdatePayload, type ReactionCreatedEvent, ReactionCreatedEventSchema, type ReactionRemovedEvent, ReactionRemovedEventSchema, type RealtimeEvent, RealtimeEventSchema, type SportsEvent, SportsResultEventSchema, type StandardMarketEvent, StandardMarketEventSchema, type TradeMakerOrder, TradeStatus, type UserEvent, UserEventSchema, type UserOrderEvent, UserOrderEventSchema, UserOrderEventType, UserOrderStatus, type UserTradeEvent, UserTradeEventSchema };
7065
+ export { type CommentCreatedEvent, CommentCreatedEventSchema, type CommentRemovedEvent, CommentRemovedEventSchema, type CommentRemovedPayload, type CommentsEvent, CommentsEventSchema, type CryptoPriceEvent, CryptoPriceEventSchema, type CryptoPriceSnapshotEvent, type CryptoPricesBinanceEvent, CryptoPricesBinanceEventSchema, type CryptoPricesBinanceTopic, type CryptoPricesChainlinkEvent, CryptoPricesChainlinkEventSchema, type CryptoPricesChainlinkTopic, type CryptoPricesChainlinkTwapEvent, CryptoPricesChainlinkTwapEventSchema, type CryptoPricesChainlinkTwapSixtyEvent, CryptoPricesChainlinkTwapSixtyEventSchema, type CryptoPricesChainlinkTwapThirtyEvent, CryptoPricesChainlinkTwapThirtyEventSchema, type CryptoPricesChainlinkTwapTopic, type CryptoPricesChainlinkTwapWindowSeconds, type CryptoPricesEvent, CryptoPricesEventSchema, type CryptoPricesTopic, type CryptoTwapPriceEvent, CryptoTwapPriceEventSchema, type CryptoTwapPriceSnapshotEvent, type CustomMarketEvent, CustomMarketEventSchema, type EquityPriceEvent, EquityPriceEventSchema, type EquityPriceSnapshotPoint, type EquityPriceSubscribePayload, type EquityPriceUpdatePayload, type EquityPricesEvent, EquityPricesEventSchema, type EquityPricesSubscribeEvent, EquityPricesSubscribeEventSchema, type EquityPricesTopic, type EquityPricesUpdateEvent, EquityPricesUpdateEventSchema, type MarketBestBidAskEvent, MarketBestBidAskEventSchema, type MarketBookEvent, MarketBookEventSchema, type MarketEvent, type MarketEventMessage, MarketEventSchema, type MarketLastTradePriceEvent, MarketLastTradePriceEventSchema, type MarketPriceChangeEvent, MarketPriceChangeEventSchema, type MarketResolvedEvent, MarketResolvedEventSchema, type MarketTickSizeChangeEvent, MarketTickSizeChangeEventSchema, type NewMarketEvent, NewMarketEventSchema, type OrderBookLevel, type PerpsBalanceUpdateEvent, PerpsBalanceUpdateEventSchema, type PerpsBboEvent, PerpsBboEventSchema, type PerpsBookEvent, PerpsBookEventSchema, type PerpsCandleEvent, PerpsCandleEventSchema, type PerpsDepositUpdateEvent, PerpsDepositUpdateEventSchema, type PerpsFillUpdateEvent, PerpsFillUpdateEventSchema, type PerpsFundingUpdateEvent, PerpsFundingUpdateEventSchema, type PerpsMarketDataEvent, PerpsMarketDataEventSchema, type PerpsNotificationUpdateEvent, PerpsNotificationUpdateEventSchema, PerpsNotificationsResyncFrameSchema, type PerpsOrderUpdateEvent, PerpsOrderUpdateEventSchema, type PerpsPortfolioUpdateEvent, PerpsPortfolioUpdateEventSchema, type PerpsResyncEvent, type PerpsSessionEvent, type PerpsSessionUpdateEvent, PerpsSessionUpdateEventSchema, type PerpsStatisticEvent, PerpsStatisticEventSchema, type PerpsTickerEvent, PerpsTickerEventSchema, type PerpsTpSlUpdateEvent, PerpsTpSlUpdateEventSchema, type PerpsTradeEvent, PerpsTradeEventSchema, type PerpsWithdrawalUpdateEvent, PerpsWithdrawalUpdateEventSchema, type PolyboltAck, PolyboltAckOp, PolyboltAckSchema, PolyboltChannel, type PolyboltEnvelope, PolyboltEnvelopeSchema, type PolyboltFilter, type PolyboltSubscription, type PriceChange, type PriceEvent, type PriceUpdatePayload, type ReactionCreatedEvent, ReactionCreatedEventSchema, type ReactionRemovedEvent, ReactionRemovedEventSchema, type RealtimeErrorCode, type RealtimeEvent, RealtimeEventSchema, RealtimeKnownErrorCode, type SportsEvent, SportsResultEventSchema, type StandardMarketEvent, StandardMarketEventSchema, type TradeMakerOrder, TradeStatus, type UserEvent, UserEventSchema, type UserOrderEvent, UserOrderEventSchema, UserOrderEventType, UserOrderStatus, type UserTradeEvent, UserTradeEventSchema };
@@ -1,2 +1,2 @@
1
- import {Q,N,R,S}from'../chunk-NILFT6EF.js';import {Ga,Ea as Ea$1,Ca,va,za as za$1,wa,sb,b as b$1,a,P,V,pb,Z,ka as ka$1,oa,_a}from'../chunk-V3FFOW6W.js';import {za,Oa,z as z$1,Ua,Ea,aa,fa,ka,Aa,Ba,da,xa,Qa,T}from'../chunk-RGWF46B7.js';export{d as TradeStatus}from'../chunk-RGWF46B7.js';import {z}from'zod';var x=z.preprocess(t=>typeof t=="string"?t.toUpperCase():t,za),ie=(s=>(s.Live="LIVE",s.Matched="MATCHED",s.Delayed="DELAYED",s.Unmatched="UNMATCHED",s.Canceled="CANCELED",s))(ie||{}),Ie=z.enum(ie),ne=z.object({price:Oa,size:Oa}),b=z.string().regex(/^\d+$/).transform(t=>z$1(new Date(Number(t)*1e3).toISOString())),Ce=z.string().regex(/^\d+$/).transform(t=>t==="0"?void 0:z$1(new Date(Number(t)*1e3).toISOString())),re=z.object({event_type:z.literal("book"),market:aa,asset_id:Ea,bids:z.array(ne),asks:z.array(ne),hash:z.string().nullish(),timestamp:fa.nullish(),min_order_size:Ua,tick_size:Ua,neg_risk:z.boolean().nullish(),last_trade_price:Ua}).transform(({event_type:t,asset_id:i,min_order_size:r,tick_size:a,neg_risk:o,last_trade_price:s,...u})=>({topic:"market",type:t,payload:{...u,conditionId:u.market,market:u.market,assetId:i,tokenId:i,minOrderSize:r,tickSize:a,negRisk:o,lastTradePrice:s}})),xe=z.object({asset_id:Ea,price:Oa,size:Oa,side:x,hash:z.string().nullish(),best_bid:Ua,best_ask:Ua}).transform(({asset_id:t,best_bid:i,best_ask:r,...a})=>({...a,assetId:t,tokenId:t,bestBid:i,bestAsk:r})),ae=z.object({event_type:z.literal("price_change"),market:aa,price_changes:z.array(xe),timestamp:fa.nullish()}).transform(({event_type:t,price_changes:i,...r})=>({topic:"market",type:t,payload:{...r,conditionId:r.market,market:r.market,priceChanges:i}})),oe=z.object({event_type:z.literal("last_trade_price"),market:aa,asset_id:Ea,price:Oa,size:Ua,fee_rate_bps:Ua,side:x,timestamp:fa.nullish(),transaction_hash:z.string().nullish()}).transform(({event_type:t,asset_id:i,fee_rate_bps:r,transaction_hash:a,...o})=>({topic:"market",type:t,payload:{...o,conditionId:o.market,market:o.market,assetId:i,tokenId:i,feeRateBps:r,transactionHash:a}})),se=z.object({event_type:z.literal("tick_size_change"),market:aa,asset_id:Ea,old_tick_size:Ua,new_tick_size:Oa,timestamp:fa.nullish()}).transform(({event_type:t,asset_id:i,old_tick_size:r,new_tick_size:a,...o})=>({topic:"market",type:t,payload:{...o,conditionId:o.market,market:o.market,assetId:i,tokenId:i,oldTickSize:r,newTickSize:a}})),ce=z.object({event_type:z.literal("best_bid_ask"),market:aa,asset_id:Ea,best_bid:Ua,best_ask:Ua,spread:Ua,timestamp:fa.nullish()}).transform(({event_type:t,asset_id:i,best_bid:r,best_ask:a,...o})=>({topic:"market",type:t,payload:{...o,conditionId:o.market,market:o.market,assetId:i,tokenId:i,bestBid:r,bestAsk:a}})),pe=z.object({id:z.string(),ticker:z.string().nullish(),slug:z.string().nullish(),title:z.string().nullish(),description:z.string().nullish()}),de=z.object({event_type:z.literal("new_market"),id:z.string(),question:z.string().nullish(),market:z.string(),slug:z.string().nullish(),description:z.string().nullish(),assets_ids:z.array(Ea).nullish(),outcomes:z.array(z.string()).nullish(),event_message:pe.nullish(),timestamp:fa.nullish(),tags:z.array(z.string()).nullish(),condition_id:aa.nullish(),active:z.boolean().nullish(),clob_token_ids:z.array(z.string()).nullish(),sports_market_type:z.string().nullish(),line:Ua,game_start_time:ka.nullish(),order_price_min_tick_size:Ua,group_item_title:z.string().nullish(),taker_base_fee:Ua,fees_enabled:z.boolean().nullish(),fee_schedule:z.unknown().nullish()}).transform(({event_type:t,assets_ids:i,event_message:r,condition_id:a,clob_token_ids:o,sports_market_type:s,game_start_time:u,order_price_min_tick_size:P,group_item_title:E,taker_base_fee:v,fees_enabled:T,fee_schedule:g,...z})=>({topic:"market",type:t,payload:{...z,assetIds:i,tokenIds:i,eventMessage:r,conditionId:a,clobTokenIds:o,sportsMarketType:s,gameStartTime:u,orderPriceMinTickSize:P,groupItemTitle:E,takerBaseFee:v,feesEnabled:T,feeSchedule:g}})),le=z.object({event_type:z.literal("market_resolved"),id:z.string(),market:aa,assets_ids:z.array(Ea).nullish(),winning_asset_id:Ea.nullish(),winning_outcome:z.string().nullish(),event_message:pe.nullish(),timestamp:fa.nullish(),tags:z.array(z.string()).nullish()}).transform(({event_type:t,assets_ids:i,winning_asset_id:r,winning_outcome:a,event_message:o,...s})=>({topic:"market",type:t,payload:{...s,conditionId:s.market,market:s.market,assetIds:i,tokenIds:i,winningAssetId:r,winningTokenId:r,winningOutcome:a,eventMessage:o}})),me=(a=>(a.Placement="PLACEMENT",a.Update="UPDATE",a.Cancellation="CANCELLATION",a))(me||{}),_e=z.enum(me),be=z.object({event_type:z.literal("order"),id:z.string(),owner:z.string(),market:aa,asset_id:Ea,side:x,order_owner:z.string().nullish(),original_size:Oa,size_matched:Oa,price:Oa,associate_trades:z.array(z.string()).nullish(),outcome:z.string().nullish(),type:_e,created_at:b.nullish(),expiration:Ce.nullish(),order_type:Aa.nullish(),status:Ie.nullish(),maker_address:z.string().nullish(),timestamp:fa}).transform(({event_type:t,type:i,asset_id:r,order_owner:a,original_size:o,size_matched:s,associate_trades:u,created_at:P,expiration:E,order_type:v,maker_address:T,...g})=>({topic:"user",type:t,payload:{...g,conditionId:g.market,market:g.market,orderEventType:i,assetId:r,tokenId:r,orderOwner:a,originalSize:o,sizeMatched:s,associateTrades:u,createdAt:P,expiresAt:E,orderType:v,makerAddress:T}})),ze=z.object({order_id:z.string(),owner:z.string(),maker_address:z.string().nullish(),matched_amount:Oa,price:Oa,fee_rate_bps:Ua,asset_id:Ea,outcome:z.string().nullish(),outcome_index:z.number().int().nullish(),side:x}).transform(({order_id:t,maker_address:i,matched_amount:r,fee_rate_bps:a,asset_id:o,outcome_index:s,...u})=>({...u,orderId:t,makerAddress:i,matchedAmount:r,feeRateBps:a,assetId:o,tokenId:o,outcomeIndex:s})),Me=z.object({event_type:z.literal("trade"),type:z.literal("TRADE"),id:z.string(),taker_order_id:z.string(),market:aa,asset_id:Ea,side:x,size:Oa,fee_rate_bps:Ua,price:Oa,status:Ba,match_time:b.nullish(),matchtime:b.nullish(),last_update:b.nullish(),outcome:z.string().nullish(),owner:z.string(),trade_owner:z.string().nullish(),maker_address:z.string().nullish(),transaction_hash:z.string().nullish(),bucket_index:z.number().int().nullish(),maker_orders:z.array(ze).nullish(),trader_side:z.union([z.literal("TAKER"),z.literal("MAKER")]).nullish(),timestamp:fa}).transform(({event_type:t,type:i,taker_order_id:r,asset_id:a,fee_rate_bps:o,match_time:s,matchtime:u,last_update:P,trade_owner:E,maker_address:v,transaction_hash:T,bucket_index:g,maker_orders:z,trader_side:ve,...M})=>({topic:"user",type:t,payload:{...M,conditionId:M.market,market:M.market,takerOrderId:r,assetId:a,tokenId:a,feeRateBps:o,matchedAt:s??u,updatedAt:P,tradeOwner:E,makerAddress:v,transactionHash:T,bucketIndex:g,makerOrders:z,traderSide:ve}})),Ot=z.discriminatedUnion("event_type",[re,ae,oe,se]),Bt=z.discriminatedUnion("event_type",[ce,de,le]),qt=z.discriminatedUnion("event_type",[re,ae,oe,se,ce,de,le]),jt=z.discriminatedUnion("event_type",[be,Me]);var he=z.number().int().nonnegative(),we=z.string().regex(/^trades::\d+$/),Ue=z.string().regex(/^bbo::\d+$/),Ae=z.string().regex(/^book::\d+$/),De=z.string().regex(/^tickers::(all|\d+)$/),Re=z.string().regex(/^statistics::(all|\d+)$/),Oe=z.string().regex(/^klines::\d+::(1m|5m|15m|1h|4h|1d|1w)$/),Be=z.string().regex(/^tpsl::\d+$/),qe=z.enum(["balances","portfolio","orders","fills","funding","deposits","withdrawals","notifications"]),k=z.object({ts:da,sq:he}),je=k.extend({ch:we,data:z.array(Ga)}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.trades",type:"trade",channel:t,timestamp:i,sequence:r,payload:a})),Ne=k.extend({ch:Ue,data:Ea$1}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.bbo",type:"bbo",channel:t,timestamp:i,sequence:r,payload:a})),Le=k.extend({ch:Ae,data:Ca}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.book",type:"book",channel:t,timestamp:i,sequence:r,payload:{instrumentId:ue(t),...a}})),Ze=k.extend({ch:De,data:va}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.tickers",type:"ticker",channel:t,timestamp:i,sequence:r,payload:a})),Fe=k.extend({ch:Re,data:za$1}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.statistics",type:"statistic",channel:t,timestamp:i,sequence:r,payload:a})),$e=k.extend({ch:Oe,data:z.array(wa)}).transform(({ch:t,ts:i,sq:r,data:a})=>({topic:"perps.candles",type:"candle",channel:t,timestamp:i,sequence:r,payload:{instrumentId:ue(t),interval:nt(t),candles:a}})),Qt=z.union([je,Ne,Le,Ze,Fe,$e]),Ke=k.extend({ch:qe});function f(t,i,r){return Ke.extend({ch:z.literal(i),data:r}).transform(a=>{let o=a;return {type:t,channel:o.ch,timestamp:o.ts,sequence:o.sq,payload:o.data}})}var He=f("balance","balances",P),We=f("portfolio","portfolio",V),Ye=f("order","orders",pb),Ve=f("fill","fills",z.array(sb)),Qe=f("funding","funding",Z),Ge=f("deposit","deposits",ka$1),Je=f("withdrawal","withdrawals",oa),Xe=f("notification","notifications",_a),Gt=z.object({ch:z.literal("notifications"),ts:da,sq:he,type:z.literal("resync")}).transform(({ch:t,ts:i,sq:r})=>({type:"resync",channel:t,timestamp:i,sequence:r})),et=z.object({oid:b$1,st:z.enum(["untriggered","armed","cancelled","expired"]),reason:z.string().optional()}),tt=k.extend({ch:Be,data:et.transform(t=>({orderId:t.oid,status:t.st,reason:t.reason}))}).transform(({ch:t,ts:i,sq:r,data:a})=>({type:"tpsl",channel:t,timestamp:i,sequence:r,payload:a})),Jt=z.union([He,We,Ye,Ve,Qe,Ge,Je,Xe,tt]);function ue(t){let[,i]=t.split("::");return a.parse(Number(i))}function nt(t){let[,,i]=t.split("::");return i}var it=z.object({id:z.string(),body:z.string().nullish(),parentEntityType:xa.nullish(),parentEntityID:z.number().int().nullish(),parentCommentID:z.string().nullish(),userAddress:z.string().nullish(),replyAddress:z.string().nullish(),createdAt:z.string().nullish(),updatedAt:z.string().nullish(),media:z.array(R).nullish(),profile:N.nullish(),reactions:z.array(Q).nullish(),reportCount:z.number().int().nullish(),reactionCount:z.number().int().nullish(),tradeAsset:z.string().nullish()}),rt=z.object({topic:z.literal("comments"),type:z.literal("comment_created"),timestamp:da,payload:S}),at=z.object({topic:z.literal("comments"),type:z.literal("comment_removed"),timestamp:da,payload:it}),ot=z.object({topic:z.literal("comments"),type:z.literal("reaction_created"),timestamp:da,payload:Q}),st=z.object({topic:z.literal("comments"),type:z.literal("reaction_removed"),timestamp:da,payload:Q}),Se=z.object({symbol:z.string(),timestamp:da,value:Qa}),ct="prices.crypto.binance",pt="prices.crypto.chainlink",ke="prices.crypto.chainlink.twap",dt=z.literal("crypto_prices"),lt=z.literal("crypto_prices_chainlink"),mt=z.literal("crypto_prices_twap_thirty"),ht=z.literal("crypto_prices_twap_sixty"),ut=dt.transform(()=>ct),yt=lt.transform(()=>pt),St=mt.transform(()=>ke),kt=ht.transform(()=>ke),ft=z.object({topic:ut,type:z.literal("update"),timestamp:da,payload:Se}),gt=z.object({topic:yt,type:z.literal("update"),timestamp:da,payload:Se}),ye=1000000000000000000n;function Pt(t){let i=BigInt(t),r=i<0n,a=r?-i:i,o=a/ye,s=(a%ye).toString().padStart(18,"0").replace(/0+$/,"");return T(`${r?"-":""}${o}${s===""?"":`.${s}`}`)}var Et=z.string().regex(/^-?\d+$/).transform(Pt),vt=z.object({symbol:z.string(),value:Qa,full_accuracy_value:Et,timestamp:da});function fe(t){return vt.extend({window_s:z.literal(t)}).transform(i=>({symbol:i.symbol,timestamp:i.timestamp,value:i.full_accuracy_value,windowSeconds:i.window_s}))}var ge=z.object({topic:St,type:z.literal("update"),timestamp:da,payload:fe(30)}),Pe=z.object({topic:kt,type:z.literal("update"),timestamp:da,payload:fe(60)}),rn=z.union([ge,Pe]),Tt=z.discriminatedUnion("topic",[ft,gt,ge,Pe]),It=z.object({symbol:z.string(),value:Qa,full_accuracy_value:Oa.nullish(),timestamp:da,received_at:da.nullish(),is_carried_forward:z.boolean().nullish()}).transform(({full_accuracy_value:t,received_at:i,is_carried_forward:r,value:a,...o})=>({...o,value:t??a,receivedAt:i,isCarriedForward:r})),Ct=z.object({timestamp:z.number(),value:Qa}),xt=z.object({symbol:z.string(),data:z.array(Ct)}),_t=z.literal("equity_prices"),bt="prices.equity.pyth",Ee=_t.transform(()=>bt),zt=z.object({topic:Ee,type:z.literal("update"),timestamp:da,payload:It}),Mt=z.object({topic:Ee,type:z.literal("subscribe"),timestamp:da,payload:xt}),wt=z.discriminatedUnion("type",[zt,Mt]),Ut=z.discriminatedUnion("type",[rt,at,ot,st]),an=z.discriminatedUnion("topic",[Ut,Tt,wt]);var At=z.object({gameId:z.number().int(),sportradarGameId:z.string().nullish(),slug:z.string().nullish(),leagueAbbreviation:z.string(),homeTeam:z.string().nullish(),awayTeam:z.string().nullish(),status:z.string(),live:z.boolean(),ended:z.boolean(),score:z.string(),period:z.string().nullish(),elapsed:z.string().nullish(),finishedTimestamp:ka.nullish(),finished_timestamp:ka.nullish(),turn:z.string().nullish()}).transform(({finishedTimestamp:t,finished_timestamp:i,...r})=>({...r,finishedAt:t??i})),pn=At.transform(t=>({topic:"sports",type:"sport_result",payload:t}));export{rt as CommentCreatedEventSchema,at as CommentRemovedEventSchema,Ut as CommentsEventSchema,ft as CryptoPricesBinanceEventSchema,gt as CryptoPricesChainlinkEventSchema,rn as CryptoPricesChainlinkTwapEventSchema,Pe as CryptoPricesChainlinkTwapSixtyEventSchema,ge as CryptoPricesChainlinkTwapThirtyEventSchema,Tt as CryptoPricesEventSchema,Bt as CustomMarketEventSchema,wt as EquityPricesEventSchema,Mt as EquityPricesSubscribeEventSchema,zt as EquityPricesUpdateEventSchema,ce as MarketBestBidAskEventSchema,re as MarketBookEventSchema,qt as MarketEventSchema,oe as MarketLastTradePriceEventSchema,ae as MarketPriceChangeEventSchema,le as MarketResolvedEventSchema,se as MarketTickSizeChangeEventSchema,de as NewMarketEventSchema,He as PerpsBalanceUpdateEventSchema,Ne as PerpsBboEventSchema,Le as PerpsBookEventSchema,$e as PerpsCandleEventSchema,Ge as PerpsDepositUpdateEventSchema,Ve as PerpsFillUpdateEventSchema,Qe as PerpsFundingUpdateEventSchema,Qt as PerpsMarketDataEventSchema,Xe as PerpsNotificationUpdateEventSchema,Gt as PerpsNotificationsResyncFrameSchema,Ye as PerpsOrderUpdateEventSchema,We as PerpsPortfolioUpdateEventSchema,Jt as PerpsSessionUpdateEventSchema,Fe as PerpsStatisticEventSchema,Ze as PerpsTickerEventSchema,tt as PerpsTpSlUpdateEventSchema,je as PerpsTradeEventSchema,Je as PerpsWithdrawalUpdateEventSchema,ot as ReactionCreatedEventSchema,st as ReactionRemovedEventSchema,an as RealtimeEventSchema,pn as SportsResultEventSchema,Ot as StandardMarketEventSchema,jt as UserEventSchema,be as UserOrderEventSchema,me as UserOrderEventType,ie as UserOrderStatus,Me as UserTradeEventSchema};//# sourceMappingURL=index.js.map
1
+ import {Q,N,R,S}from'../chunk-NILFT6EF.js';import {Ga,Ea as Ea$1,Ca,va,za as za$1,wa,sb,b,a,P,V,pb,Z,ka as ka$1,oa,_a}from'../chunk-V3FFOW6W.js';import {za,Oa,z as z$1,Ua,Ea,aa,fa,ka,Aa,Ba,da,Qa,xa,T as T$1}from'../chunk-RGWF46B7.js';export{d as TradeStatus}from'../chunk-RGWF46B7.js';import {z}from'zod';var _=z.preprocess(t=>typeof t=="string"?t.toUpperCase():t,za),oe=(p=>(p.Live="LIVE",p.Matched="MATCHED",p.Delayed="DELAYED",p.Unmatched="UNMATCHED",p.Canceled="CANCELED",p))(oe||{}),Me=z.enum(oe),ae=z.object({price:Oa,size:Oa}),w=z.string().regex(/^\d+$/).transform(t=>z$1(new Date(Number(t)*1e3).toISOString())),Ue=z.string().regex(/^\d+$/).transform(t=>t==="0"?void 0:z$1(new Date(Number(t)*1e3).toISOString())),se=z.object({event_type:z.literal("book"),market:aa,asset_id:Ea,bids:z.array(ae),asks:z.array(ae),hash:z.string().nullish(),timestamp:fa.nullish(),min_order_size:Ua,tick_size:Ua,neg_risk:z.boolean().nullish(),last_trade_price:Ua}).transform(({event_type:t,asset_id:n,min_order_size:r,tick_size:a,neg_risk:s,last_trade_price:p,...S})=>({topic:"market",type:t,payload:{...S,conditionId:S.market,market:S.market,assetId:n,tokenId:n,minOrderSize:r,tickSize:a,negRisk:s,lastTradePrice:p}})),Ae=z.object({asset_id:Ea,price:Oa,size:Oa,side:_,hash:z.string().nullish(),best_bid:Ua,best_ask:Ua}).transform(({asset_id:t,best_bid:n,best_ask:r,...a})=>({...a,assetId:t,tokenId:t,bestBid:n,bestAsk:r})),pe=z.object({event_type:z.literal("price_change"),market:aa,price_changes:z.array(Ae),timestamp:fa.nullish()}).transform(({event_type:t,price_changes:n,...r})=>({topic:"market",type:t,payload:{...r,conditionId:r.market,market:r.market,priceChanges:n}})),ce=z.object({event_type:z.literal("last_trade_price"),market:aa,asset_id:Ea,price:Oa,size:Ua,fee_rate_bps:Ua,side:_,timestamp:fa.nullish(),transaction_hash:z.string().nullish()}).transform(({event_type:t,asset_id:n,fee_rate_bps:r,transaction_hash:a,...s})=>({topic:"market",type:t,payload:{...s,conditionId:s.market,market:s.market,assetId:n,tokenId:n,feeRateBps:r,transactionHash:a}})),de=z.object({event_type:z.literal("tick_size_change"),market:aa,asset_id:Ea,old_tick_size:Ua,new_tick_size:Oa,timestamp:fa.nullish()}).transform(({event_type:t,asset_id:n,old_tick_size:r,new_tick_size:a,...s})=>({topic:"market",type:t,payload:{...s,conditionId:s.market,market:s.market,assetId:n,tokenId:n,oldTickSize:r,newTickSize:a}})),le=z.object({event_type:z.literal("best_bid_ask"),market:aa,asset_id:Ea,best_bid:Ua,best_ask:Ua,spread:Ua,timestamp:fa.nullish()}).transform(({event_type:t,asset_id:n,best_bid:r,best_ask:a,...s})=>({topic:"market",type:t,payload:{...s,conditionId:s.market,market:s.market,assetId:n,tokenId:n,bestBid:r,bestAsk:a}})),me=z.object({id:z.string(),ticker:z.string().nullish(),slug:z.string().nullish(),title:z.string().nullish(),description:z.string().nullish()}),ye=z.object({event_type:z.literal("new_market"),id:z.string(),question:z.string().nullish(),market:z.string(),slug:z.string().nullish(),description:z.string().nullish(),assets_ids:z.array(Ea).nullish(),outcomes:z.array(z.string()).nullish(),event_message:me.nullish(),timestamp:fa.nullish(),tags:z.array(z.string()).nullish(),condition_id:aa.nullish(),active:z.boolean().nullish(),clob_token_ids:z.array(z.string()).nullish(),sports_market_type:z.string().nullish(),line:Ua,game_start_time:ka.nullish(),order_price_min_tick_size:Ua,group_item_title:z.string().nullish(),taker_base_fee:Ua,fees_enabled:z.boolean().nullish(),fee_schedule:z.unknown().nullish()}).transform(({event_type:t,assets_ids:n,event_message:r,condition_id:a,clob_token_ids:s,sports_market_type:p,game_start_time:S,order_price_min_tick_size:I,group_item_title:C,taker_base_fee:x,fees_enabled:y,fee_schedule:g,...M})=>({topic:"market",type:t,payload:{...M,assetIds:n,tokenIds:n,eventMessage:r,conditionId:a,clobTokenIds:s,sportsMarketType:p,gameStartTime:S,orderPriceMinTickSize:I,groupItemTitle:C,takerBaseFee:x,feesEnabled:y,feeSchedule:g}})),ue=z.object({event_type:z.literal("market_resolved"),id:z.string(),market:aa,assets_ids:z.array(Ea).nullish(),winning_asset_id:Ea.nullish(),winning_outcome:z.string().nullish(),event_message:me.nullish(),timestamp:fa.nullish(),tags:z.array(z.string()).nullish()}).transform(({event_type:t,assets_ids:n,winning_asset_id:r,winning_outcome:a,event_message:s,...p})=>({topic:"market",type:t,payload:{...p,conditionId:p.market,market:p.market,assetIds:n,tokenIds:n,winningAssetId:r,winningTokenId:r,winningOutcome:a,eventMessage:s}})),he=(a=>(a.Placement="PLACEMENT",a.Update="UPDATE",a.Cancellation="CANCELLATION",a))(he||{}),De=z.enum(he),qe=z.object({event_type:z.literal("order"),id:z.string(),owner:z.string(),market:aa,asset_id:Ea,side:_,order_owner:z.string().nullish(),original_size:Oa,size_matched:Oa,price:Oa,associate_trades:z.array(z.string()).nullish(),outcome:z.string().nullish(),type:De,created_at:w.nullish(),expiration:Ue.nullish(),order_type:Aa.nullish(),status:Me.nullish(),maker_address:z.string().nullish(),timestamp:fa}).transform(({event_type:t,type:n,asset_id:r,order_owner:a,original_size:s,size_matched:p,associate_trades:S,created_at:I,expiration:C,order_type:x,maker_address:y,...g})=>({topic:"user",type:t,payload:{...g,conditionId:g.market,market:g.market,orderEventType:n,assetId:r,tokenId:r,orderOwner:a,originalSize:s,sizeMatched:p,associateTrades:S,createdAt:I,expiresAt:C,orderType:x,makerAddress:y}})),Be=z.object({order_id:z.string(),owner:z.string(),maker_address:z.string().nullish(),matched_amount:Oa,price:Oa,fee_rate_bps:Ua,asset_id:Ea,outcome:z.string().nullish(),outcome_index:z.number().int().nullish(),side:_}).transform(({order_id:t,maker_address:n,matched_amount:r,fee_rate_bps:a,asset_id:s,outcome_index:p,...S})=>({...S,orderId:t,makerAddress:n,matchedAmount:r,feeRateBps:a,assetId:s,tokenId:s,outcomeIndex:p})),Re=z.object({event_type:z.literal("trade"),type:z.literal("TRADE"),id:z.string(),taker_order_id:z.string(),market:aa,asset_id:Ea,side:_,size:Oa,fee_rate_bps:Ua,price:Oa,status:Ba,match_time:w.nullish(),matchtime:w.nullish(),last_update:w.nullish(),outcome:z.string().nullish(),owner:z.string(),trade_owner:z.string().nullish(),maker_address:z.string().nullish(),transaction_hash:z.string().nullish(),bucket_index:z.number().int().nullish(),maker_orders:z.array(Be).nullish(),trader_side:z.union([z.literal("TAKER"),z.literal("MAKER")]).nullish(),timestamp:fa}).transform(({event_type:t,type:n,taker_order_id:r,asset_id:a,fee_rate_bps:s,match_time:p,matchtime:S,last_update:I,trade_owner:C,maker_address:x,transaction_hash:y,bucket_index:g,maker_orders:M,trader_side:ze,...U})=>({topic:"user",type:t,payload:{...U,conditionId:U.market,market:U.market,takerOrderId:r,assetId:a,tokenId:a,feeRateBps:s,matchedAt:p??S,updatedAt:I,tradeOwner:C,makerAddress:x,transactionHash:y,bucketIndex:g,makerOrders:M,traderSide:ze}})),Qt=z.discriminatedUnion("event_type",[se,pe,ce,de]),Gt=z.discriminatedUnion("event_type",[le,ye,ue]),Jt=z.discriminatedUnion("event_type",[se,pe,ce,de,le,ye,ue]),Xt=z.discriminatedUnion("event_type",[qe,Re]);var Se=z.number().int().nonnegative(),Oe=z.string().regex(/^trades::\d+$/),je=z.string().regex(/^bbo::\d+$/),Ne=z.string().regex(/^book::\d+$/),Le=z.string().regex(/^tickers::(all|\d+)$/),Ze=z.string().regex(/^statistics::(all|\d+)$/),Fe=z.string().regex(/^klines::\d+::(1m|5m|15m|1h|4h|1d|1w)$/),$e=z.string().regex(/^tpsl::\d+$/),He=z.enum(["balances","portfolio","orders","fills","funding","deposits","withdrawals","notifications"]),E=z.object({ts:da,sq:Se}),We=E.extend({ch:Oe,data:z.array(Ga)}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.trades",type:"trade",channel:t,timestamp:n,sequence:r,payload:a})),Ye=E.extend({ch:je,data:Ea$1}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.bbo",type:"bbo",channel:t,timestamp:n,sequence:r,payload:a})),Ke=E.extend({ch:Ne,data:Ca}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.book",type:"book",channel:t,timestamp:n,sequence:r,payload:{instrumentId:fe(t),...a}})),Ve=E.extend({ch:Le,data:va}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.tickers",type:"ticker",channel:t,timestamp:n,sequence:r,payload:a})),Qe=E.extend({ch:Ze,data:za$1}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.statistics",type:"statistic",channel:t,timestamp:n,sequence:r,payload:a})),Ge=E.extend({ch:Fe,data:z.array(wa)}).transform(({ch:t,ts:n,sq:r,data:a})=>({topic:"perps.candles",type:"candle",channel:t,timestamp:n,sequence:r,payload:{instrumentId:fe(t),interval:ct(t),candles:a}})),ln=z.union([We,Ye,Ke,Ve,Qe,Ge]),Je=E.extend({ch:He});function v(t,n,r){return Je.extend({ch:z.literal(n),data:r}).transform(a=>{let s=a;return {type:t,channel:s.ch,timestamp:s.ts,sequence:s.sq,payload:s.data}})}var Xe=v("balance","balances",P),et=v("portfolio","portfolio",V),tt=v("order","orders",pb),nt=v("fill","fills",z.array(sb)),it=v("funding","funding",Z),rt=v("deposit","deposits",ka$1),at=v("withdrawal","withdrawals",oa),ot=v("notification","notifications",_a),mn=z.object({ch:z.literal("notifications"),ts:da,sq:Se,type:z.literal("resync")}).transform(({ch:t,ts:n,sq:r})=>({type:"resync",channel:t,timestamp:n,sequence:r})),st=z.object({oid:b,st:z.enum(["untriggered","armed","cancelled","expired"]),reason:z.string().optional()}),pt=E.extend({ch:$e,data:st.transform(t=>({orderId:t.oid,status:t.st,reason:t.reason}))}).transform(({ch:t,ts:n,sq:r,data:a})=>({type:"tpsl",channel:t,timestamp:n,sequence:r,payload:a})),yn=z.union([Xe,et,tt,nt,it,rt,at,ot,pt]);function fe(t){let[,n]=t.split("::");return a.parse(Number(n))}function ct(t){let[,,n]=t.split("::");return n}var dt=(y=>(y.BadOp="bad_op",y.BadChannel="bad_channel",y.BadFilter="bad_filter",y.SubscriptionLimit="sub_limit",y.RateLimited="rate_limited",y.AuthRequired="auth_required",y.AuthUnavailable="auth_unavailable",y.AuthExpired="auth_expired",y.AuthAttempts="auth_attempts",y.AuthInvalid="auth_invalid",y))(dt||{}),ke=(a=>(a.Crypto="price.crypto",a.Twap="price.crypto.twap",a.Equity="price.equity",a))(ke||{}),Pe=(p=>(p.Subscribed="subscribed",p.Unsubscribed="unsubscribed",p.Pong="pong",p.Authed="authed",p.Error="error",p))(Pe||{}),fn=z.object({op:z.enum(Pe),channel:z.string().optional(),rid:z.string().optional(),code:z.string().transform(t=>t).optional()}),kn=z.object({v:z.literal(1),channel:z.enum(ke),seq:z.number().int().nonnegative(),ts:da,snapshot:z.boolean().optional(),dropped:z.number().int().nonnegative().optional(),payload:z.unknown()}),lt=z.object({timestamp:da,value:Qa,full_accuracy_value:Oa}).transform(({timestamp:t,full_accuracy_value:n})=>({timestamp:t,value:n})),Ee=z.object({symbol:z.string(),timestamp:da,value:Qa,full_accuracy_value:Oa,received_at:da.optional(),is_carried_forward:z.boolean().optional()}).transform(({symbol:t,timestamp:n,full_accuracy_value:r,received_at:a,is_carried_forward:s})=>({symbol:t,timestamp:n,value:r,receivedAt:a,isCarriedForward:s})),D=z.object({symbol:z.string(),data:z.array(lt)}),ve=z.literal(60),mt=z.object({symbol:z.string(),timestamp:da,value:Qa,full_accuracy_value:Oa,window_seconds:ve}).transform(({symbol:t,timestamp:n,full_accuracy_value:r,window_seconds:a})=>({symbol:t,timestamp:n,value:r,windowSeconds:a})),yt=D.extend({window_seconds:ve}).transform(({symbol:t,data:n,window_seconds:r})=>({symbol:t,data:n,windowSeconds:r})),T=z.object({timestamp:da,seq:z.number().optional(),dropped:z.number().optional()}),ut=z.union([T.extend({topic:z.literal("prices.crypto"),type:z.literal("update"),payload:Ee}),T.extend({topic:z.literal("prices.crypto"),type:z.literal("subscribe"),payload:D})]),ht=z.union([T.extend({topic:z.literal("prices.crypto.twap"),type:z.literal("update"),payload:mt}),T.extend({topic:z.literal("prices.crypto.twap"),type:z.literal("subscribe"),payload:yt})]),St=z.union([T.extend({topic:z.literal("prices.equity"),type:z.literal("update"),payload:Ee}),T.extend({topic:z.literal("prices.equity"),type:z.literal("subscribe"),payload:D})]);function Pn(t){let n={timestamp:t.ts,seq:t.seq,dropped:t.dropped,type:t.snapshot?"subscribe":"update",payload:t.payload};switch(t.channel){case "price.crypto":return ut.safeParse({...n,topic:"prices.crypto"}).data;case "price.crypto.twap":return ht.safeParse({...n,topic:"prices.crypto.twap"}).data;case "price.equity":return St.safeParse({...n,topic:"prices.equity"}).data}}var ft=z.object({id:z.string(),body:z.string().nullish(),parentEntityType:xa.nullish(),parentEntityID:z.number().int().nullish(),parentCommentID:z.string().nullish(),userAddress:z.string().nullish(),replyAddress:z.string().nullish(),createdAt:z.string().nullish(),updatedAt:z.string().nullish(),media:z.array(R).nullish(),profile:N.nullish(),reactions:z.array(Q).nullish(),reportCount:z.number().int().nullish(),reactionCount:z.number().int().nullish(),tradeAsset:z.string().nullish()}),kt=z.object({topic:z.literal("comments"),type:z.literal("comment_created"),timestamp:da,payload:S}),Pt=z.object({topic:z.literal("comments"),type:z.literal("comment_removed"),timestamp:da,payload:ft}),Et=z.object({topic:z.literal("comments"),type:z.literal("reaction_created"),timestamp:da,payload:Q}),vt=z.object({topic:z.literal("comments"),type:z.literal("reaction_removed"),timestamp:da,payload:Q}),Te=z.object({symbol:z.string(),timestamp:da,value:Qa}),gt="prices.crypto.binance",Tt="prices.crypto.chainlink",Ie="prices.crypto.chainlink.twap",It=z.literal("crypto_prices"),Ct=z.literal("crypto_prices_chainlink"),xt=z.literal("crypto_prices_twap_thirty"),bt=z.literal("crypto_prices_twap_sixty"),_t=It.transform(()=>gt),zt=Ct.transform(()=>Tt),wt=xt.transform(()=>Ie),Mt=bt.transform(()=>Ie),Ut=z.object({topic:_t,type:z.literal("update"),timestamp:da,payload:Te}),At=z.object({topic:zt,type:z.literal("update"),timestamp:da,payload:Te}),ge=1000000000000000000n;function Dt(t){let n=BigInt(t),r=n<0n,a=r?-n:n,s=a/ge,p=(a%ge).toString().padStart(18,"0").replace(/0+$/,"");return T$1(`${r?"-":""}${s}${p===""?"":`.${p}`}`)}var qt=z.string().regex(/^-?\d+$/).transform(Dt),Bt=z.object({symbol:z.string(),value:Qa,full_accuracy_value:qt,timestamp:da});function Ce(t){return Bt.extend({window_s:z.literal(t)}).transform(n=>({symbol:n.symbol,timestamp:n.timestamp,value:n.full_accuracy_value,windowSeconds:n.window_s}))}var xe=z.object({topic:wt,type:z.literal("update"),timestamp:da,payload:Ce(30)}),be=z.object({topic:Mt,type:z.literal("update"),timestamp:da,payload:Ce(60)}),In=z.union([xe,be]),Rt=z.discriminatedUnion("topic",[Ut,At,xe,be]),Ot=z.object({symbol:z.string(),value:Qa,full_accuracy_value:Oa.nullish(),timestamp:da,received_at:da.nullish(),is_carried_forward:z.boolean().nullish()}).transform(({full_accuracy_value:t,received_at:n,is_carried_forward:r,value:a,...s})=>({...s,value:t??a,receivedAt:n,isCarriedForward:r})),jt=z.object({timestamp:z.number(),value:Qa}),Nt=z.object({symbol:z.string(),data:z.array(jt)}),Lt=z.literal("equity_prices"),Zt="prices.equity.pyth",_e=Lt.transform(()=>Zt),Ft=z.object({topic:_e,type:z.literal("update"),timestamp:da,payload:Ot}),$t=z.object({topic:_e,type:z.literal("subscribe"),timestamp:da,payload:Nt}),Ht=z.discriminatedUnion("type",[Ft,$t]),Wt=z.discriminatedUnion("type",[kt,Pt,Et,vt]),Cn=z.discriminatedUnion("topic",[Wt,Rt,Ht]);var Yt=z.object({gameId:z.number().int(),sportradarGameId:z.string().nullish(),slug:z.string().nullish(),leagueAbbreviation:z.string(),homeTeam:z.string().nullish(),awayTeam:z.string().nullish(),status:z.string(),live:z.boolean(),ended:z.boolean(),score:z.string(),period:z.string().nullish(),elapsed:z.string().nullish(),finishedTimestamp:ka.nullish(),finished_timestamp:ka.nullish(),turn:z.string().nullish()}).transform(({finishedTimestamp:t,finished_timestamp:n,...r})=>({...r,finishedAt:t??n})),zn=Yt.transform(t=>({topic:"sports",type:"sport_result",payload:t}));export{kt as CommentCreatedEventSchema,Pt as CommentRemovedEventSchema,Wt as CommentsEventSchema,ut as CryptoPriceEventSchema,Ut as CryptoPricesBinanceEventSchema,At as CryptoPricesChainlinkEventSchema,In as CryptoPricesChainlinkTwapEventSchema,be as CryptoPricesChainlinkTwapSixtyEventSchema,xe as CryptoPricesChainlinkTwapThirtyEventSchema,Rt as CryptoPricesEventSchema,ht as CryptoTwapPriceEventSchema,Gt as CustomMarketEventSchema,St as EquityPriceEventSchema,Ht as EquityPricesEventSchema,$t as EquityPricesSubscribeEventSchema,Ft as EquityPricesUpdateEventSchema,le as MarketBestBidAskEventSchema,se as MarketBookEventSchema,Jt as MarketEventSchema,ce as MarketLastTradePriceEventSchema,pe as MarketPriceChangeEventSchema,ue as MarketResolvedEventSchema,de as MarketTickSizeChangeEventSchema,ye as NewMarketEventSchema,Xe as PerpsBalanceUpdateEventSchema,Ye as PerpsBboEventSchema,Ke as PerpsBookEventSchema,Ge as PerpsCandleEventSchema,rt as PerpsDepositUpdateEventSchema,nt as PerpsFillUpdateEventSchema,it as PerpsFundingUpdateEventSchema,ln as PerpsMarketDataEventSchema,ot as PerpsNotificationUpdateEventSchema,mn as PerpsNotificationsResyncFrameSchema,tt as PerpsOrderUpdateEventSchema,et as PerpsPortfolioUpdateEventSchema,yn as PerpsSessionUpdateEventSchema,Qe as PerpsStatisticEventSchema,Ve as PerpsTickerEventSchema,pt as PerpsTpSlUpdateEventSchema,We as PerpsTradeEventSchema,at as PerpsWithdrawalUpdateEventSchema,Pe as PolyboltAckOp,fn as PolyboltAckSchema,ke as PolyboltChannel,kn as PolyboltEnvelopeSchema,Et as ReactionCreatedEventSchema,vt as ReactionRemovedEventSchema,Cn as RealtimeEventSchema,dt as RealtimeKnownErrorCode,zn as SportsResultEventSchema,Qt as StandardMarketEventSchema,Xt as UserEventSchema,qe as UserOrderEventSchema,he as UserOrderEventType,oe as UserOrderStatus,Re as UserTradeEventSchema,Pn as parsePolyboltEvent};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map