@kuest/bindings 0.0.0-stage → 0.13.1
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/chunk-2KNK5TP7.js +2 -0
- package/dist/chunk-2KNK5TP7.js.map +1 -0
- package/dist/chunk-53SZ2ZWR.js +2 -0
- package/dist/chunk-53SZ2ZWR.js.map +1 -0
- package/dist/chunk-HOD4LKZU.js +2 -0
- package/dist/chunk-HOD4LKZU.js.map +1 -0
- package/dist/chunk-XSRN2HAT.js +2 -0
- package/dist/chunk-XSRN2HAT.js.map +1 -0
- package/dist/clob/index.d.ts +5390 -0
- package/dist/clob/index.js +2 -0
- package/dist/clob/index.js.map +1 -0
- package/dist/combos/index.d.ts +1126 -0
- package/dist/combos/index.js +2 -0
- package/dist/combos/index.js.map +1 -0
- package/dist/comment-CSYM3bRy.d.ts +945 -0
- package/dist/data/index.d.ts +4863 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/gamma/index.d.ts +10129 -0
- package/dist/gamma/index.js +2 -0
- package/dist/gamma/index.js.map +1 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/orders-MU1eB8o-.d.ts +2929 -0
- package/dist/perps/index.d.ts +2884 -0
- package/dist/perps/index.js +2 -0
- package/dist/perps/index.js.map +1 -0
- package/dist/relayer/index.d.ts +227 -0
- package/dist/relayer/index.js +2 -0
- package/dist/relayer/index.js.map +1 -0
- package/dist/shared-Dm807IWG.d.ts +223 -0
- package/dist/signature-type-CrLAA9AN.d.ts +23 -0
- package/dist/subscriptions/index.d.ts +7963 -0
- package/dist/subscriptions/index.js +2 -0
- package/dist/subscriptions/index.js.map +1 -0
- package/package.json +92 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{a as SignatureType,b as SignatureTypeSchema}from'../chunk-HOD4LKZU.js';import {O}from'../chunk-53SZ2ZWR.js';import {Pa,ba,ka,ia,Fa,Ua,Ca,Va,Ta,da,Ra,la,X,Aa,za,oa,Ba,Oa,Ga,ha,_,ya,pa,Ea,aa,z as z$1,ea,ga,na,wa,qa,f,xa}from'../chunk-2KNK5TP7.js';import {z}from'zod';import {never}from'@kuest/types';function F(e){return z.object({count:z.number(),data:z.array(e),limit:z.number(),next_cursor:z.string()}).transform(({next_cursor:t,...i})=>({...i,nextCursor:t}))}var Ht=z.object({closed_only:z.boolean()}).transform(({closed_only:e})=>({closedOnly:e})),Oe=z.object({asset_id:Fa,associate_trades:z.array(z.string()),created_at:ia,expiration:ka,id:z.string(),maker_address:z.string(),market:ba,order_type:z.string(),original_size:Pa,outcome:z.string(),owner:z.string(),price:Pa,side:z.string(),size_matched:Pa,status:z.string()}).transform(({asset_id:e,associate_trades:t,created_at:i,expiration:n,maker_address:c,market:m,order_type:l,original_size:g,size_matched:x,...R})=>{let S={...R,conditionId:m,assetId:e,tokenId:e,associateTrades:t,createdAt:i,makerAddress:c,orderType:l,originalSize:g,sizeMatched:x};return n===void 0?S:{...S,expiresAt:n}}),Kt=F(Oe),Ae=z.object({asset_id:Fa,fee_rate_bps:z.preprocess(Ua,Pa.nullable()),maker_address:z.string(),matched_amount:Pa,order_id:z.string(),outcome:z.string(),owner:z.string(),price:Pa,side:z.string()}).transform(({asset_id:e,fee_rate_bps:t,maker_address:i,matched_amount:n,order_id:c,...m})=>({...m,assetId:e,tokenId:e,feeRateBps:t,makerAddress:i,matchedAmount:n,orderId:c})),De=z.object({asset_id:Fa,bucket_index:z.number(),fee_rate_bps:Pa,id:z.string(),last_update:ia,maker_address:z.string(),maker_orders:z.array(Ae),market:ba,match_time:ia,outcome:z.string(),owner:z.string(),price:Pa,side:z.string(),size:Pa,status:Ca,taker_order_id:z.string(),trader_side:z.enum(["TAKER","MAKER"]),transaction_hash:z.preprocess(Va,z.string().optional())}).transform(({asset_id:e,bucket_index:t,fee_rate_bps:i,last_update:n,maker_address:c,maker_orders:m,market:l,match_time:g,taker_order_id:x,trader_side:R,transaction_hash:S,...p})=>({...p,conditionId:l,assetId:e,tokenId:e,bucketIndex:t,feeRateBps:i,updatedAt:n,makerAddress:c,makerOrders:m,matchedAt:g,takerOrderId:x,traderSide:R,transactionHash:S})),Vt=F(De),ce=(n=>(n.COLLATERAL="COLLATERAL",n.CONDITIONAL="CONDITIONAL",n.CONDITIONAL_V2="CONDITIONAL-V2",n))(ce||{}),Yt=z.enum(ce),Zt=z.object({allowances:z.record(da,z.string().transform(BigInt)),balance:Ta}),qt=z.object({scoring:z.boolean()}),Wt=z.record(z.string(),z.boolean()),Pe=z.object({asset_address:z.string(),asset_rate:Ra,condition_id:ba,date:la,earnings:Ra,maker_address:z.string()}).transform(({asset_address:e,asset_rate:t,condition_id:i,maker_address:n,...c})=>({...c,assetAddress:e,assetRate:t,conditionId:i,makerAddress:n})),Gt=F(Pe),ze=z.object({asset_address:z.string(),asset_rate:Ra,date:la,earnings:Ra,maker_address:z.string(),native_earnings:Ra.optional(),sponsored_earnings:Ra.optional()}).transform(({asset_address:e,asset_rate:t,maker_address:i,native_earnings:n,sponsored_earnings:c,...m})=>({...m,assetAddress:e,assetRate:t,makerAddress:i,nativeEarnings:n,sponsoredEarnings:c})),Qt=z.array(ze),$t=z.record(ba,z.number()),Ce=z.object({outcome:z.string(),price:Ra,token_id:Fa}).transform(({token_id:e,...t})=>({...t,assetId:e,tokenId:e})),Ee=z.object({asset_address:z.string(),end_date:la,rate_per_day:Ra,start_date:la,total_rewards:Ra}).transform(({asset_address:e,end_date:t,rate_per_day:i,start_date:n,total_rewards:c})=>({assetAddress:e,endDate:t,ratePerDay:i,startDate:n,totalRewards:c})),Ne=z.object({asset_address:z.string(),asset_rate:Ra,earnings:Ra}).transform(({asset_address:e,asset_rate:t,...i})=>({...i,assetAddress:e,assetRate:t})),we=z.object({condition_id:ba,earning_percentage:z.number(),earnings:z.array(Ne),event_slug:z.string(),image:z.string(),maker_address:z.string(),market_competitiveness:z.number(),market_slug:z.string(),question:z.string(),rewards_config:z.array(Ee),rewards_max_spread:z.number(),rewards_min_size:Ra,tokens:z.array(Ce)}).transform(({condition_id:e,earning_percentage:t,event_slug:i,maker_address:n,market_competitiveness:c,market_slug:m,rewards_config:l,rewards_max_spread:g,rewards_min_size:x,...R})=>({...R,conditionId:e,earningPercentage:t,eventSlug:i,makerAddress:n,marketCompetitiveness:c,marketSlug:m,rewardsConfig:l,rewardsMaxSpread:g,rewardsMinSize:x})),Xt=F(we);var Me=z.object({apiKey:X,secret:z.string(),passphrase:z.string()}).transform(e=>({key:e.apiKey,passphrase:e.passphrase,secret:e.secret})),rr=z.array(X),or=Me,pe=z.object({key:X,createdAt:la.optional(),revokedAt:la.nullable().optional()}),ir=z.array(z.union([X.transform(e=>({key:e})),pe])).transform(e=>e.map(t=>pe.parse(t)));var Le=z.object({id:z.string(),tradeType:z.string(),takerOrderHash:z.string(),builder:z.string(),market:ba,assetId:Fa,side:Aa,size:Pa,sizeUsdc:Pa,price:Pa,status:z.string(),outcome:z.string(),outcomeIndex:z.number().int(),owner:z.string(),maker:z.string(),transactionHash:z.string(),matchTime:ia,bucketIndex:z.number().int(),fee:Pa,feeUsdc:Pa,err_msg:z.string().nullable().optional(),createdAt:la.optional(),updatedAt:la.optional()}).transform(({err_msg:e,assetId:t,market:i,matchTime:n,...c})=>({...c,conditionId:i,assetId:t,tokenId:t,errMsg:e,matchedAt:n})),dr=z.object({limit:z.number().int(),count:z.number().int(),next_cursor:z.string(),data:z.array(Le)}).transform(({next_cursor:e,...t})=>({...t,nextCursor:e})),me=1e4,ve=z.object({builder_maker_fee_rate_bps:z.number(),builder_taker_fee_rate_bps:z.number()}).transform(({builder_maker_fee_rate_bps:e,builder_taker_fee_rate_bps:t})=>({maker:e/me,taker:t/me})),cr=ve;var gr=z.object({canceled:z.array(za),not_canceled:z.record(za,z.string())}).transform(({canceled:e,not_canceled:t})=>({canceled:e,notCanceled:t}));var yr=z.object({mid:Pa}),hr=z.record(Fa,Pa),kr=z.object({price:Pa}),Be=z.partialRecord(Aa,Pa),Ir=z.record(Fa,Be),_r=z.object({spread:Pa}),xr=z.record(Fa,Pa),Fe=z.object({price:Pa,side:Aa}),Tr=Fe.extend({side:z.union([Aa,z.literal("")])}).transform(e=>e.side===""?null:{price:e.price,side:e.side}),je=z.object({price:Pa,side:Aa,token_id:Fa}).transform(({token_id:e,price:t,side:i})=>({assetId:e,tokenId:e,price:t,side:i})),Rr=z.array(je),Ue=z.object({condition_id:ba}).transform(({condition_id:e})=>e),br=Ue,He=z.object({r:z.number().default(0),e:z.number().default(0)}).transform(({r:e,e:t})=>({rate:e,exponent:t})),Ke=z.object({t:Fa,o:z.string()}).transform(({t:e,o:t})=>({assetId:e,tokenId:e,outcome:t})),Ve=z.object({fd:He.nullish(),mts:oa,nr:z.boolean().optional(),t:z.array(Ke)}).transform(({fd:e,mts:t,nr:i,t:n})=>({feeInfo:e??{rate:0,exponent:0},negRisk:i??false,tickSize:t,tokens:n})),Or=Ve;var Ye=z.object({neg_risk:z.boolean()}).transform(({neg_risk:e,...t})=>({...t,negRisk:e})),Pr=Ye;var ge=(p=>(p[p.ORDER_CANCELLATION=1]="ORDER_CANCELLATION",p[p.ORDER_FILL=2]="ORDER_FILL",p[p.MARKET_REGISTERED=3]="MARKET_REGISTERED",p[p.MARKET_RESOLVED=4]="MARKET_RESOLVED",p[p.REWARD_PAYOUT=5]="REWARD_PAYOUT",p[p.CHILD_COMMENT_CREATED=6]="CHILD_COMMENT_CREATED",p[p.YIELD_PAYOUT=7]="YIELD_PAYOUT",p[p.ORDER_FILL_FAILED=8]="ORDER_FILL_FAILED",p[p.AUTO_REDEEMED=9]="AUTO_REDEEMED",p[p.COMBO_AUTO_REDEEMED=10]="COMBO_AUTO_REDEEMED",p[p.TAKER_TIER_UPGRADED=11]="TAKER_TIER_UPGRADED",p))(ge||{}),Ze=z.enum(ge),V=z.object({asset_id:Fa,eventSlug:z.string().optional(),icon:z.string().optional(),image:z.string().optional(),market:ba,market_slug:z.string().optional(),matched_size:Pa,order_id:za,original_size:Pa,outcome:z.string(),outcome_index:z.number().int(),price:Pa,question:z.string().optional(),remaining_size:Pa,seriesSlug:z.string().optional(),side:Aa,trade_id:z.preprocess(Va,z.string().optional()),transaction_hash:z.preprocess(Va,Oa.optional()),type:z.preprocess(Va,Ba.optional())}).transform(({asset_id:e,market:t,market_slug:i,matched_size:n,order_id:c,original_size:m,outcome_index:l,remaining_size:g,trade_id:x,transaction_hash:R,type:S,...p})=>({...p,conditionId:t,assetId:e,tokenId:e,marketSlug:i,matchedSize:n,orderId:c,orderType:S,originalSize:m,outcomeIndex:l,remainingSize:g,tradeId:x,transactionHash:R})),qe=z.object({outcome:z.string(),price:Ra.optional(),token_id:Fa,winner:z.boolean()}).transform(({token_id:e,...t})=>({...t,assetId:e,tokenId:e})),We=z.object({max_spread:z.number(),min_size:Ra,rates:z.array(z.object({asset_address:z.string(),rewards_daily_rate:Ra}).transform(({asset_address:e,rewards_daily_rate:t})=>({assetAddress:e,dailyRate:t}))).nullish()}).transform(({max_spread:e,min_size:t,...i})=>({...i,maxSpread:e,minSize:t})),Se=z.object({accepting_order_timestamp:ha.nullish(),accepting_orders:z.boolean(),active:z.boolean(),archived:z.boolean().optional(),closed:z.boolean(),condition_id:ba,description:z.string(),enable_order_book:z.boolean().optional(),end_date_iso:ha.nullish(),eventSlug:z.string().optional(),fpmm:z.string(),game_start_time:z.preprocess(Ua,ha.nullish()),icon:z.string(),image:z.string(),is_50_50_outcome:z.boolean().optional(),maker_base_fee:z.number().nullable(),market_slug:z.string(),minimum_order_size:Ra,minimum_tick_size:Ra,neg_risk:z.boolean().optional(),neg_risk_market_id:z.string().optional(),neg_risk_request_id:z.string().optional(),notifications_enabled:z.boolean().optional(),question:z.string(),question_id:Ga,rewards:We.optional(),seconds_delay:z.number().int(),tags:z.array(z.string()).nullish(),taker_base_fee:z.number().nullable(),tokens:z.array(qe)}).transform(({accepting_order_timestamp:e,accepting_orders:t,condition_id:i,enable_order_book:n,end_date_iso:c,game_start_time:m,is_50_50_outcome:l,maker_base_fee:g,market_slug:x,minimum_order_size:R,minimum_tick_size:S,neg_risk:p,neg_risk_market_id:U,neg_risk_request_id:H,notifications_enabled:I,question_id:xe,seconds_delay:Te,taker_base_fee:Re,...be})=>({...be,acceptingOrders:t,acceptingOrdersTimestamp:e,conditionId:i,enableOrderBook:n,endDate:c,gameStartTime:m,is5050Outcome:l,makerBaseFee:g,marketSlug:x,minimumOrderSize:R,minimumTickSize:S,negRisk:p,negRiskMarketId:U,negRiskRequestId:H,notificationsEnabled:I,questionId:xe,secondsDelay:Te,takerBaseFee:Re})),Ge=z.object({proxyWallet:da,reward:Ra,txnHash:Oa}).transform(({txnHash:e,...t})=>({...t,transactionHash:e})),Qe=z.object({amount:Ra,proxyWallet:da,txnHash:Oa}).transform(({txnHash:e,...t})=>({...t,transactionHash:e})),$e=z.object({body:z.string().nullish(),createdAt:pa.nullish(),eventSlug:z.string().nullish(),eventTitle:z.string().nullish(),id:_,image:z.string().nullish(),parentCommentID:_.nullish(),parentEntityID:z.number().int().nullish(),parentEntityType:ya.nullish(),profile:O.nullish(),seriesSlug:z.string().nullish(),seriesTitle:z.string().nullish(),userAddress:z.string().nullish()}),Xe=z.object({amount:Ra,conditionId:ba,image:z.string(),marketUrl:z.string().optional(),negRisk:z.boolean(),portfolioUrl:z.string().optional(),position:z.string().optional(),proxyWallet:da,question:z.string(),slug:z.string(),txnHash:Oa}).transform(({slug:e,txnHash:t,...i})=>({...i,marketSlug:e,transactionHash:t})),Je=z.object({amount:Ra,conditionId:aa,legs:z.number().int(),outcomeIndex:z.number().int(),portfolioUrl:z.string().optional(),positionId:Ea,proxyWallet:da,txnHash:Oa}).transform(({txnHash:e,...t})=>({...t,transactionHash:e})),et=z.object({previous_tier:z.number().int(),tier:z.number().int(),rebate_bps:z.number().int(),snapshot_date:z.iso.date().transform(z$1)}).transform(({previous_tier:e,tier:t,rebate_bps:i,snapshot_date:n})=>({previousTier:e,tier:t,rebateBps:i,snapshotDate:n})),tt=z.preprocess(e=>typeof e!="string"?e:/^\d+$/.test(e)?Number(e):Date.parse(e),ea);function b(e,t){return z.object({id:xa,owner:X,payload:t,timestamp:tt,type:z.literal(e)})}var rt=b(1,V),ot=b(2,V),it=b(3,Se),nt=b(4,Se),at=b(5,Ge),st=b(6,$e),dt=b(7,Qe),ct=b(8,V),pt=b(9,Xe),mt=b(10,Je),lt=b(11,et),gt=z.discriminatedUnion("type",[rt,ot,it,nt,at,st,dt,ct,pt,mt,lt]),St=z.object({type:z.number().int()}),wr=z.array(z.unknown()).transform((e,t)=>{let i=[];return e.forEach((n,c)=>{let m=St.safeParse(n);if(!m.success){for(let g of m.error.issues)t.addIssue({...g,path:[c,...g.path]});return}if(!Ze.safeParse(m.data.type).success)return;let l=gt.safeParse(n);if(l.success){i.push(l.data);return}for(let g of l.error.issues)t.addIssue({...g,path:[c,...g.path]});}),i});var fe=z.object({price:Pa,size:Pa}),ft=z.string().regex(/^[a-f0-9]{40}$/).transform(e=>e),ut=Pa.transform(Number).pipe(oa),ue=z.object({market:ba,asset_id:Fa,timestamp:ga.nullish(),bids:z.array(fe),asks:z.array(fe),min_order_size:Pa,tick_size:ut,neg_risk:z.boolean(),last_trade_price:Pa.nullish(),hash:ft}).transform(({market:e,asset_id:t,min_order_size:i,tick_size:n,neg_risk:c,last_trade_price:m,...l})=>({...l,conditionId:e,assetId:t,tokenId:t,minOrderSize:i,tickSize:n,negRisk:c,lastTradePrice:m})),Br=ue,Fr=z.array(ue);var Hr=z.object({heartbeat_id:z.string().min(1)}).transform(({heartbeat_id:e})=>({heartbeatId:e})),Kr=z.object({error_msg:z.literal("Invalid Heartbeat ID"),heartbeat_id:z.string()});var ye=z.preprocess(e=>e===""?"0":e,Pa),ht=z.object({errorMsg:z.string(),makingAmount:ye,orderID:z.string(),status:z.string(),success:z.boolean(),takingAmount:ye,tradeIDs:z.array(z.string()).default([]),transactionsHashes:z.array(z.string()).default([])}),he=(n=>(n.LIVE="live",n.MATCHED="matched",n.DELAYED="delayed",n))(he||{}),kt=z.nativeEnum(he),ke=(S=>(S.UNMATCHED="unmatched",S.MARKET_NOT_READY="market_not_ready",S.INSUFFICIENT_BALANCE_OR_ALLOWANCE="insufficient_balance_or_allowance",S.INVALID_NONCE="invalid_nonce",S.INVALID_EXPIRATION="invalid_expiration",S.POST_ONLY_WOULD_CROSS="post_only_would_cross",S.POST_ONLY_MODE="post_only_mode",S.FOK_NOT_FILLED="fok_not_filled",S.FAK_NOT_FILLED="fak_not_filled",S.UNKNOWN="unknown",S))(ke||{}),It=z.nativeEnum(ke),_t=z.object({ok:z.literal(true),orderId:za.refine(e=>e.length>0),status:kt,makingAmount:Pa,takingAmount:Pa,tradeIds:z.array(z.string()),transactionsHashes:z.array(Oa)}),xt=z.object({ok:z.literal(false),code:It,message:z.string().min(1)}),Tt=ht.transform(Ot),Wr=z.array(Tt);function Rt(e){return e.success&&e.errorMsg===""&&e.orderID!==""&&Dt(e.status)}function bt(e){switch(e){case "live":return "live";case "matched":return "matched";case "delayed":return "delayed";default:never(`Unexpected order post status: ${e}`);}}function Ot(e){return Rt(e)?_t.parse({makingAmount:e.makingAmount,ok:true,orderId:e.orderID,status:bt(e.status),takingAmount:e.takingAmount,tradeIds:e.tradeIDs,transactionsHashes:e.transactionsHashes}):xt.parse({code:At(e),message:e.errorMsg||"Unknown order failure",ok:false})}function At(e){if(e.status==="unmatched")return "unmatched";switch(e.errorMsg){case "the market is not yet ready to process new orders":return "market_not_ready";case "invalid nonce":return "invalid_nonce";case "invalid expiration":return "invalid_expiration";case "invalid post-only order: order crosses book":return "post_only_would_cross";case "post-only mode: only post-only orders and cancels are allowed":return "post_only_mode";case "order couldn't be fully filled. FOK orders are fully filled or killed.":return "fok_not_filled";case "no orders found to match with FAK order. FAK orders are partially filled or killed if no match is found.":return "fak_not_filled"}return e.errorMsg.includes("not enough balance / allowance")?"insufficient_balance_or_allowance":"unknown"}function Dt(e){return e==="live"||e==="matched"||e==="delayed"}var Qr="LTE=";var Ie=z.object({id:z.number().int().optional(),asset_address:z.string(),start_date:la,end_date:la.optional(),rate_per_day:Ra,total_rewards:Ra.optional()}).transform(({asset_address:e,start_date:t,end_date:i,rate_per_day:n,total_rewards:c,...m})=>({...m,assetAddress:e,startDate:t,endDate:i,ratePerDay:n,totalRewards:c})),Pt=z.object({condition_id:ba,rewards_max_spread:z.number().optional(),rewards_min_size:Ra.optional(),rewards_config:z.array(Ie).optional(),sponsored_daily_rate:Ra.optional(),sponsors_count:z.number().int().optional(),native_daily_rate:Ra.optional(),total_daily_rate:Ra.optional()}).transform(({condition_id:e,rewards_max_spread:t,rewards_min_size:i,rewards_config:n,sponsored_daily_rate:c,sponsors_count:m,native_daily_rate:l,total_daily_rate:g,...x})=>({...x,conditionId:e,rewardsMaxSpread:t,rewardsMinSize:i,rewardsConfig:n,sponsoredDailyRate:c,sponsorsCount:m,nativeDailyRate:l,totalDailyRate:g})),eo=z.object({limit:z.number().int(),count:z.number().int(),next_cursor:z.string(),data:z.array(Pt)}).transform(({next_cursor:e,...t})=>({...t,nextCursor:e})),_e=z.object({token_id:Fa,outcome:z.string(),price:Ra}).transform(({token_id:e,...t})=>({...t,assetId:e,tokenId:e})),zt=z.object({asset_address:z.string(),start_date:la,end_date:la.optional(),rate_per_day:Ra,total_rewards:Ra.optional()}).transform(({asset_address:e,start_date:t,end_date:i,rate_per_day:n,total_rewards:c,...m})=>({...m,assetAddress:e,startDate:t,endDate:i,ratePerDay:n,totalRewards:c})),Ct=z.object({condition_id:ba,question:z.string(),market_slug:z.string().optional(),event_slug:z.string().optional(),image:z.string().optional(),rewards_max_spread:z.number().optional(),rewards_min_size:Ra.optional(),market_competitiveness:z.number().optional(),tokens:z.array(_e),rewards_config:z.array(zt).optional()}).transform(({condition_id:e,market_slug:t,event_slug:i,rewards_max_spread:n,rewards_min_size:c,market_competitiveness:m,rewards_config:l,...g})=>({...g,conditionId:e,marketSlug:t,eventSlug:i,rewardsMaxSpread:n,rewardsMinSize:c,marketCompetitiveness:m,rewardsConfig:l})),to=z.object({limit:z.number().int(),count:z.number().int(),next_cursor:z.string(),data:z.array(Ct)}).transform(({next_cursor:e,...t})=>({...t,nextCursor:e})),Et=(I=>(I.MarketId="market_id",I.CreatedAt="created_at",I.Volume24Hr="volume_24hr",I.Spread="spread",I.Competitiveness="competitiveness",I.MaxSpread="max_spread",I.MinSize="min_size",I.Question="question",I.OneDayPriceChange="one_day_price_change",I.RatePerDay="rate_per_day",I.Price="price",I.EndDate="end_date",I.StartDate="start_date",I.RewardEndDate="reward_end_date",I))(Et||{}),Nt=z.object({condition_id:ba,market_id:wa,market_slug:z.string(),question:z.string(),image:z.string(),market_competitiveness:z.number(),rewards_config:z.array(Ie),rewards_max_spread:z.number(),rewards_min_size:Ra,spread:Ra,tokens:z.array(_e),group_item_title:z.string(),volume_24hr:Ra,event_id:na,event_slug:z.string(),created_at:la,one_day_price_change:Ra,end_date:z.literal("").transform(()=>{}).or(la)}).transform(({condition_id:e,market_id:t,market_slug:i,market_competitiveness:n,rewards_config:c,rewards_max_spread:m,rewards_min_size:l,group_item_title:g,volume_24hr:x,event_id:R,event_slug:S,created_at:p,one_day_price_change:U,end_date:H,...I})=>({...I,conditionId:e,marketId:t,marketSlug:i,marketCompetitiveness:n,rewardsConfig:c,rewardsMaxSpread:m,rewardsMinSize:l,groupItemTitle:g,volume24hr:x,eventId:R,eventSlug:S,createdAt:p,oneDayPriceChange:U,endDate:H})),ro=z.object({limit:z.number().int(),count:z.number().int(),next_cursor:z.string(),data:z.array(Nt)}).transform(({next_cursor:e,...t})=>({...t,nextCursor:e})),wt=z.object({date:qa,condition_id:ba,asset_address:da,maker_address:da,rebated_fees_usdc:Pa}).transform(({condition_id:e,asset_address:t,maker_address:i,rebated_fees_usdc:n,...c})=>({...c,conditionId:e,assetAddress:t,makerAddress:i,rebatedFeesUsdc:n})),oo=z.array(wt).nullable().transform(e=>e??[]);var Mt=z.object({address:da,scopes:z.array(f).min(1),valid_until:z.number().int().nonnegative()}).transform(({valid_until:e,...t})=>({...t,validUntil:e})),so=z.object({signers:z.array(Mt),wallet:da});var vt=z.object({minimum_tick_size:oa}).transform(({minimum_tick_size:e,...t})=>({...t,minimumTickSize:e})),lo=vt;export{_t as AcceptedOrderResponseSchema,Mt as ActiveSessionSignerSchema,so as ActiveSessionSignersResponseSchema,Me as ApiKeyCredsSchema,rr as ApiKeysResponseSchema,ce as AssetType,Yt as AssetTypeSchema,Xe as AutoRedeemedNotificationPayloadSchema,pt as AutoRedeemedNotificationSchema,Zt as BalanceAllowanceResponseSchema,or as BuilderApiKeyCredsSchema,pe as BuilderApiKeySchema,ir as BuilderApiKeysResponseSchema,ve as BuilderFeeRatesSchema,Le as BuilderTradeSchema,gr as CancelOrdersResponseSchema,st as ChildCommentCreatedNotificationSchema,$e as ChildCommentNotificationPayloadSchema,De as ClobTradeSchema,Vt as ClobTradesPageSchema,Ht as ClosedOnlyModeSchema,Je as ComboAutoRedeemedNotificationPayloadSchema,mt as ComboAutoRedeemedNotificationSchema,Ue as ConditionByTokenSchema,Pt as CurrentRewardSchema,Qr as END_CURSOR,Ne as EarningSchema,cr as FetchBuilderFeeRatesResponseSchema,Or as FetchMarketInfoResponseSchema,Pr as FetchNegRiskResponseSchema,Br as FetchOrderBookResponseSchema,lo as FetchTickSizeResponseSchema,Tr as LastTradePriceSchema,Rr as LastTradePricesSchema,He as MarketFeeInfoSchema,Ve as MarketInfoSchema,Se as MarketNotificationPayloadSchema,We as MarketNotificationRewardsSchema,qe as MarketNotificationTokenSchema,it as MarketRegisteredNotificationSchema,nt as MarketResolvedNotificationSchema,Ct as MarketRewardSchema,Ke as MarketTokenSchema,yr as MidpointSchema,hr as MidpointsSchema,Ye as NegRiskSchema,gt as NotificationSchema,ge as NotificationType,Ze as NotificationTypeSchema,wr as NotificationsResponseSchema,Oe as OpenOrderSchema,Kt as OpenOrdersPageSchema,ft as OrderBookHashSchema,fe as OrderBookLevelSchema,ue as OrderBookSchema,Fr as OrderBooksSchema,rt as OrderCancellationNotificationSchema,ct as OrderFillFailedNotificationSchema,ot as OrderFillNotificationSchema,Kr as OrderHeartbeatMismatchResponseSchema,Hr as OrderHeartbeatSchema,V as OrderNotificationPayloadSchema,he as OrderPostStatus,kt as OrderPostStatusSchema,ke as OrderResponseErrorCode,It as OrderResponseErrorCodeSchema,Tt as OrderResponseSchema,Wr as OrderResponsesSchema,qt as OrderScoringResponseSchema,Wt as OrdersScoringResponseSchema,dr as PaginatedBuilderTradesSchema,eo as PaginatedCurrentRewardsSchema,to as PaginatedMarketRewardsSchema,ro as PaginatedRewardMarketsSchema,kr as PriceSchema,Ir as PricesSchema,wt as RebatedFeeSchema,oo as RebatedFeesResponseSchema,xt as RejectedOrderResponseSchema,br as ResolveConditionByTokenResponseSchema,Nt as RewardMarketSchema,Et as RewardMarketSort,Ge as RewardPayoutNotificationPayloadSchema,at as RewardPayoutNotificationSchema,Ee as RewardsConfigSchema,$t as RewardsPercentagesSchema,_r as SpreadSchema,xr as SpreadsSchema,et as TakerTierUpgradedNotificationPayloadSchema,lt as TakerTierUpgradedNotificationSchema,vt as TickSizeSchema,Ce as TokenSchema,ze as TotalUserEarningSchema,Qt as TotalUserEarningsResponseSchema,Pe as UserEarningSchema,Gt as UserEarningsPageSchema,we as UserRewardsEarningSchema,Xt as UserRewardsEarningsPageSchema,Qe as YieldPayoutNotificationPayloadSchema,dt as YieldPayoutNotificationSchema};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/clob/account.ts","../../src/clob/api-key.ts","../../src/clob/builder.ts","../../src/clob/cancel.ts","../../src/clob/market-data.ts","../../src/clob/neg-risk.ts","../../src/clob/notifications.ts","../../src/clob/order-book.ts","../../src/clob/order-heartbeats.ts","../../src/clob/order-response.ts","../../src/clob/pagination.ts","../../src/clob/rewards.ts","../../src/clob/session-signer.ts","../../src/clob/tick-size.ts"],"names":["createCursorPageSchema","item","z","next_cursor","rest","ClosedOnlyModeSchema","closed_only","OpenOrderSchema","ClobAssetIdSchema","EpochLikeToIsoDateTimeStringSchema","OptionalEpochLikeToIsoDateTimeStringSchema","ConditionIdSchema","DecimalStringSchema","asset_id","associate_trades","created_at","expiration","maker_address","market","order_type","original_size","size_matched","transformed","OpenOrdersPageSchema","MakerOrderSchema","emptyStringToNull","fee_rate_bps","matched_amount","order_id","ClobTradeSchema","TradeStatusSchema","emptyStringToUndefined","bucket_index","last_update","maker_orders","match_time","taker_order_id","trader_side","transaction_hash","ClobTradesPageSchema","AssetType","AssetTypeSchema","BalanceAllowanceResponseSchema","EvmAddressSchema","BaseUnitsSchema","OrderScoringResponseSchema","OrdersScoringResponseSchema","UserEarningSchema","DecimalishSchema","EpochMillisecondsToIsoDateTimeStringSchema","asset_address","asset_rate","condition_id","UserEarningsPageSchema","TotalUserEarningSchema","native_earnings","sponsored_earnings","TotalUserEarningsResponseSchema","RewardsPercentagesSchema","TokenSchema","token_id","RewardsConfigSchema","end_date","rate_per_day","start_date","total_rewards","EarningSchema","UserRewardsEarningSchema","earning_percentage","event_slug","market_competitiveness","market_slug","rewards_config","rewards_max_spread","rewards_min_size","UserRewardsEarningsPageSchema","ApiKeyCredsSchema","ApiKeySchema","creds","ApiKeysResponseSchema","BuilderApiKeyCredsSchema","BuilderApiKeySchema","BuilderApiKeysResponseSchema","key","apiKeys","apiKey","BuilderTradeSchema","OrderSideSchema","err_msg","assetId","matchTime","PaginatedBuilderTradesSchema","BUILDER_FEES_BPS","BuilderFeeRatesSchema","builder_maker_fee_rate_bps","builder_taker_fee_rate_bps","FetchBuilderFeeRatesResponseSchema","CancelOrdersResponseSchema","OrderIdSchema","canceled","not_canceled","MidpointSchema","MidpointsSchema","PriceSchema","PricesBySideSchema","PricesSchema","SpreadSchema","SpreadsSchema","LastTradePriceValueSchema","LastTradePriceSchema","lastTrade","LastTradePriceForTokenResponseSchema","price","side","LastTradePricesSchema","ConditionByTokenSchema","ResolveConditionByTokenResponseSchema","MarketFeeInfoSchema","r","e","MarketTokenSchema","t","o","MarketInfoSchema","TickSizeValueSchema","fd","mts","nr","FetchMarketInfoResponseSchema","NegRiskSchema","neg_risk","FetchNegRiskResponseSchema","NotificationType","NotificationTypeSchema","OrderNotificationPayloadSchema","TxHashSchema","OrderTypeSchema","matched_size","outcome_index","remaining_size","trade_id","type","MarketNotificationTokenSchema","MarketNotificationRewardsSchema","rewards_daily_rate","max_spread","min_size","MarketNotificationPayloadSchema","DateLikeToIsoDateTimeStringSchema","QuestionIdSchema","accepting_order_timestamp","accepting_orders","enable_order_book","end_date_iso","game_start_time","is_50_50_outcome","maker_base_fee","minimum_order_size","minimum_tick_size","neg_risk_market_id","neg_risk_request_id","notifications_enabled","question_id","seconds_delay","taker_base_fee","RewardPayoutNotificationPayloadSchema","txnHash","YieldPayoutNotificationPayloadSchema","ChildCommentNotificationPayloadSchema","IsoDateTimeStringSchema","CommentIdSchema","CommentParentEntityTypeSchema","CommentProfileSchema","AutoRedeemedNotificationPayloadSchema","slug","ComboAutoRedeemedNotificationPayloadSchema","ComboConditionIdSchema","PositionIdSchema","TakerTierUpgradedNotificationPayloadSchema","toIsoCalendarDateString","previous_tier","tier","rebate_bps","snapshot_date","NotificationTimestampSchema","value","EpochMillisecondsSchema","createNotificationSchema","payload","NotificationIdSchema","OrderCancellationNotificationSchema","OrderFillNotificationSchema","MarketRegisteredNotificationSchema","MarketResolvedNotificationSchema","RewardPayoutNotificationSchema","ChildCommentCreatedNotificationSchema","YieldPayoutNotificationSchema","OrderFillFailedNotificationSchema","AutoRedeemedNotificationSchema","ComboAutoRedeemedNotificationSchema","TakerTierUpgradedNotificationSchema","NotificationSchema","NotificationTypeProbeSchema","NotificationsResponseSchema","items","ctx","notifications","index","probe","issue","notification","OrderBookLevelSchema","OrderBookHashSchema","OrderBookTickSizeSchema","OrderBookSchema","EpochMillisecondsStringSchema","min_order_size","tick_size","last_trade_price","FetchOrderBookResponseSchema","OrderBooksSchema","OrderHeartbeatSchema","heartbeat_id","OrderHeartbeatMismatchResponseSchema","OrderResponseAmountSchema","OrderResponsePayloadSchema","OrderPostStatus","OrderPostStatusSchema","OrderResponseErrorCode","OrderResponseErrorCodeSchema","AcceptedOrderResponseSchema","orderId","RejectedOrderResponseSchema","OrderResponseSchema","normalizeOrderResponse","OrderResponsesSchema","isAcceptedOrderResponse","response","isOrderPostStatus","parseOrderPostStatus","status","never","inferOrderResponseErrorCode","END_CURSOR","CurrentRewardConfigSchema","CurrentRewardSchema","sponsored_daily_rate","sponsors_count","native_daily_rate","total_daily_rate","PaginatedCurrentRewardsSchema","RewardTokenSchema","RewardConfigSchema","MarketRewardSchema","PaginatedMarketRewardsSchema","RewardMarketSort","RewardMarketSchema","MarketIdSchema","EventIdSchema","market_id","group_item_title","volume_24hr","event_id","one_day_price_change","PaginatedRewardMarketsSchema","RebatedFeeSchema","IsoCalendarDateStringSchema","rebated_fees_usdc","RebatedFeesResponseSchema","fees","ActiveSessionSignerSchema","SessionSignerScopeSchema","valid_until","ActiveSessionSignersResponseSchema","TickSizeSchema","FetchTickSizeResponseSchema"],"mappings":"iTAqBA,SAASA,CAAAA,CAAmDC,EAAa,CACvE,OAAOC,CAAAA,CACJ,MAAA,CAAO,CACN,KAAA,CAAOA,EAAE,MAAA,EAAO,CAChB,IAAA,CAAMA,CAAAA,CAAE,KAAA,CAAMD,CAAI,CAAA,CAClB,KAAA,CAAOC,CAAAA,CAAE,MAAA,EAAO,CAChB,WAAA,CAAaA,CAAAA,CAAE,MAAA,EACjB,CAAC,CAAA,CACA,SAAA,CAAU,CAAC,CAAE,WAAA,CAAAC,CAAAA,CAAa,GAAGC,CAAK,CAAA,IAAO,CACxC,GAAGA,CAAAA,CACH,UAAA,CAAYD,CACd,CAAA,CAAE,CACN,CAEO,IAAME,EAAAA,CAAuBH,CAAAA,CACjC,MAAA,CAAO,CACN,WAAA,CAAaA,CAAAA,CAAE,OA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CACb,YAAA,CAAcF,CAAAA,CACd,YAAA,CAAcjC,EACd,eAAA,CAAiB0P,CACnB,CAAA,CACF,CAAA,CAEWC,EAAAA,CAA4B1Q,CAAAA,CACtC,KAAA,CAAMuQ,EAAgB,CAAA,CACtB,QAAA,EAAS,CACT,SAAA,CAAWI,CAAAA,EAASA,CAAAA,EAAQ,EAAE,ECrT1B,IAAMC,EAAAA,CAA4B5Q,CAAAA,CACtC,MAAA,CAAO,CACN,OAAA,CAASyC,EAAAA,CACT,MAAA,CAAQzC,EAAE,KAAA,CAAM6Q,CAAwB,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,CAC/C,WAAA,CAAa7Q,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,WAAA,EAChC,CAAC,CAAA,CACA,SAAA,CAAU,CAAC,CAAE,WAAA,CAAA8Q,CAAAA,CAAa,GAAG5Q,CAAK,CAAA,IAAO,CACxC,GAAGA,CAAAA,CACH,UAAA,CAAY4Q,CACd,EAAE,CAAA,CAOSC,EAAAA,CAAqC/Q,CAAAA,CAAE,MAAA,CAAO,CACzD,OAAA,CAASA,CAAAA,CAAE,KAAA,CAAM4Q,EAAyB,CAAA,CAC1C,MAAA,CAAQnO,EACV,CAAC,EC9BM,IAAMuO,EAAAA,CAAiBhR,CAAAA,CAC3B,MAAA,CAAO,CACN,iBAAA,CAAmB0H,EACrB,CAAC,CAAA,CACA,SAAA,CAAU,CAAC,CAAE,iBAAA,CAAAkC,CAAAA,CAAmB,GAAG1J,CAAK,CAAA,IAAO,CAC9C,GAAGA,CAAAA,CACH,eAAA,CAAiB0J,CACnB,CAAA,CAAE,CAAA,CAESqH,EAAAA,CAA8BD","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport {\n BaseUnitsSchema,\n ClobAssetIdSchema,\n type ConditionId,\n ConditionIdSchema,\n DecimalishSchema,\n type DecimalString,\n DecimalStringSchema,\n EpochLikeToIsoDateTimeStringSchema,\n EpochMillisecondsToIsoDateTimeStringSchema,\n EvmAddressSchema,\n emptyStringToNull,\n emptyStringToUndefined,\n type IsoDateTimeString,\n OptionalEpochLikeToIsoDateTimeStringSchema,\n type PositionId,\n type TokenId,\n TradeStatusSchema,\n} from '../shared';\n\nfunction createCursorPageSchema<TItem extends z.ZodTypeAny>(item: TItem) {\n return z\n .object({\n count: z.number(),\n data: z.array(item),\n limit: z.number(),\n next_cursor: z.string(),\n })\n .transform(({ next_cursor, ...rest }) => ({\n ...rest,\n nextCursor: next_cursor,\n }));\n}\n\nexport const ClosedOnlyModeSchema = z\n .object({\n closed_only: z.boolean(),\n })\n .transform(({ closed_only }) => ({\n closedOnly: closed_only,\n }));\n\nexport type ClosedOnlyMode = z.infer<typeof ClosedOnlyModeSchema>;\n\nexport type OpenOrder = {\n id: string;\n /** Exchange asset identifier for a CTF token or Polymarket V2 position. */\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n /** Condition ID for the market associated with this order. */\n conditionId: ConditionId;\n owner: string;\n makerAddress: string;\n side: string;\n price: DecimalString;\n originalSize: DecimalString;\n sizeMatched: DecimalString;\n outcome: string;\n orderType: string;\n status: string;\n associateTrades: string[];\n createdAt: IsoDateTimeString;\n expiresAt?: IsoDateTimeString;\n};\n\nexport const OpenOrderSchema = z\n .object({\n asset_id: ClobAssetIdSchema,\n associate_trades: z.array(z.string()),\n created_at: EpochLikeToIsoDateTimeStringSchema,\n expiration: OptionalEpochLikeToIsoDateTimeStringSchema,\n id: z.string(),\n maker_address: z.string(),\n market: ConditionIdSchema,\n order_type: z.string(),\n original_size: DecimalStringSchema,\n outcome: z.string(),\n owner: z.string(),\n price: DecimalStringSchema,\n side: z.string(),\n size_matched: DecimalStringSchema,\n status: z.string(),\n })\n .transform(\n ({\n asset_id,\n associate_trades,\n created_at,\n expiration,\n maker_address,\n market,\n order_type,\n original_size,\n size_matched,\n ...rest\n }) => {\n const transformed = {\n ...rest,\n conditionId: market,\n assetId: asset_id,\n tokenId: asset_id,\n associateTrades: associate_trades,\n createdAt: created_at,\n makerAddress: maker_address,\n orderType: order_type,\n originalSize: original_size,\n sizeMatched: size_matched,\n };\n\n return expiration === undefined\n ? transformed\n : { ...transformed, expiresAt: expiration };\n },\n ) satisfies z.ZodType<OpenOrder>;\n\nexport const OpenOrdersPageSchema = createCursorPageSchema(OpenOrderSchema);\n\nexport type OpenOrdersPage = z.infer<typeof OpenOrdersPageSchema>;\n\nexport type MakerOrder = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n feeRateBps: DecimalString | null;\n makerAddress: string;\n matchedAmount: DecimalString;\n orderId: string;\n outcome: string;\n owner: string;\n price: DecimalString;\n side: string;\n};\n\nconst MakerOrderSchema = z\n .object({\n asset_id: ClobAssetIdSchema,\n // The API serializes a missing maker fee rate as an empty string.\n // Normalize to null so consumers never see '' as a DecimalString. This\n // matches py-sdk, where MakerOrder.fee_rate_bps is nullable.\n fee_rate_bps: z.preprocess(\n emptyStringToNull,\n DecimalStringSchema.nullable(),\n ),\n maker_address: z.string(),\n matched_amount: DecimalStringSchema,\n order_id: z.string(),\n outcome: z.string(),\n owner: z.string(),\n price: DecimalStringSchema,\n side: z.string(),\n })\n .transform(\n ({\n asset_id,\n fee_rate_bps,\n maker_address,\n matched_amount,\n order_id,\n ...rest\n }) => ({\n ...rest,\n assetId: asset_id,\n tokenId: asset_id,\n feeRateBps: fee_rate_bps,\n makerAddress: maker_address,\n matchedAmount: matched_amount,\n orderId: order_id,\n }),\n ) satisfies z.ZodType<MakerOrder>;\n\nexport type ClobTrade = {\n id: string;\n /** Exchange asset identifier for a CTF token or Polymarket V2 position. */\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n /** Condition ID for the market associated with this trade. */\n conditionId: ConditionId;\n owner: string;\n makerAddress: string;\n takerOrderId: string;\n side: string;\n traderSide: 'TAKER' | 'MAKER';\n price: DecimalString;\n size: DecimalString;\n outcome: string;\n status: string;\n feeRateBps: DecimalString;\n bucketIndex: number;\n /**\n * Transaction hash, or undefined when unavailable (for example, while\n * broadcast is pending or after a failure before broadcast).\n */\n transactionHash: string | undefined;\n makerOrders: MakerOrder[];\n matchedAt: IsoDateTimeString;\n updatedAt: IsoDateTimeString;\n};\n\nexport const ClobTradeSchema = z\n .object({\n asset_id: ClobAssetIdSchema,\n bucket_index: z.number(),\n fee_rate_bps: DecimalStringSchema,\n id: z.string(),\n last_update: EpochLikeToIsoDateTimeStringSchema,\n maker_address: z.string(),\n maker_orders: z.array(MakerOrderSchema),\n market: ConditionIdSchema,\n match_time: EpochLikeToIsoDateTimeStringSchema,\n outcome: z.string(),\n owner: z.string(),\n price: DecimalStringSchema,\n side: z.string(),\n size: DecimalStringSchema,\n status: TradeStatusSchema,\n taker_order_id: z.string(),\n trader_side: z.enum(['TAKER', 'MAKER']),\n transaction_hash: z.preprocess(\n emptyStringToUndefined,\n z.string().optional(),\n ),\n })\n .transform(\n ({\n asset_id,\n bucket_index,\n fee_rate_bps,\n last_update,\n maker_address,\n maker_orders,\n market,\n match_time,\n taker_order_id,\n trader_side,\n transaction_hash,\n ...rest\n }) => ({\n ...rest,\n conditionId: market,\n assetId: asset_id,\n tokenId: asset_id,\n bucketIndex: bucket_index,\n feeRateBps: fee_rate_bps,\n updatedAt: last_update,\n makerAddress: maker_address,\n makerOrders: maker_orders,\n matchedAt: match_time,\n takerOrderId: taker_order_id,\n traderSide: trader_side,\n transactionHash: transaction_hash,\n }),\n ) satisfies z.ZodType<ClobTrade>;\n\nexport const ClobTradesPageSchema = createCursorPageSchema(ClobTradeSchema);\n\nexport type ClobTradesPage = z.infer<typeof ClobTradesPageSchema>;\n\nexport enum AssetType {\n COLLATERAL = 'COLLATERAL',\n CONDITIONAL = 'CONDITIONAL',\n CONDITIONAL_V2 = 'CONDITIONAL-V2',\n}\n\nexport const AssetTypeSchema = z.enum(AssetType);\n\nexport const BalanceAllowanceResponseSchema = z.object({\n allowances: z.record(EvmAddressSchema, z.string().transform(BigInt)),\n balance: BaseUnitsSchema,\n});\n\nexport type BalanceAllowanceResponse = z.infer<\n typeof BalanceAllowanceResponseSchema\n>;\n\nexport const OrderScoringResponseSchema = z.object({\n scoring: z.boolean(),\n});\n\nexport type OrderScoringResponse = z.infer<typeof OrderScoringResponseSchema>;\n\nexport const OrdersScoringResponseSchema = z.record(z.string(), z.boolean());\n\nexport type OrdersScoringResponse = z.infer<typeof OrdersScoringResponseSchema>;\n\nexport const UserEarningSchema = z\n .object({\n asset_address: z.string(),\n asset_rate: DecimalishSchema,\n condition_id: ConditionIdSchema,\n date: EpochMillisecondsToIsoDateTimeStringSchema,\n earnings: DecimalishSchema,\n maker_address: z.string(),\n })\n .transform(\n ({ asset_address, asset_rate, condition_id, maker_address, ...rest }) => ({\n ...rest,\n assetAddress: asset_address,\n assetRate: asset_rate,\n conditionId: condition_id,\n makerAddress: maker_address,\n }),\n );\n\nexport type UserEarning = z.infer<typeof UserEarningSchema>;\n\nexport const UserEarningsPageSchema = createCursorPageSchema(UserEarningSchema);\n\nexport type UserEarningsPage = z.infer<typeof UserEarningsPageSchema>;\n\nexport const TotalUserEarningSchema = z\n .object({\n asset_address: z.string(),\n asset_rate: DecimalishSchema,\n date: EpochMillisecondsToIsoDateTimeStringSchema,\n earnings: DecimalishSchema,\n maker_address: z.string(),\n native_earnings: DecimalishSchema.optional(),\n sponsored_earnings: DecimalishSchema.optional(),\n })\n .transform(\n ({\n asset_address,\n asset_rate,\n maker_address,\n native_earnings,\n sponsored_earnings,\n ...rest\n }) => ({\n ...rest,\n assetAddress: asset_address,\n assetRate: asset_rate,\n makerAddress: maker_address,\n nativeEarnings: native_earnings,\n sponsoredEarnings: sponsored_earnings,\n }),\n );\n\nexport type TotalUserEarning = z.infer<typeof TotalUserEarningSchema>;\n\nexport const TotalUserEarningsResponseSchema = z.array(TotalUserEarningSchema);\n\nexport type TotalUserEarningsResponse = z.infer<\n typeof TotalUserEarningsResponseSchema\n>;\n\nexport const RewardsPercentagesSchema = z.record(ConditionIdSchema, z.number());\n\nexport type RewardsPercentages = z.infer<typeof RewardsPercentagesSchema>;\n\nexport const TokenSchema = z\n .object({\n outcome: z.string(),\n price: DecimalishSchema,\n token_id: ClobAssetIdSchema,\n })\n .transform(({ token_id, ...rest }) => ({\n ...rest,\n assetId: token_id,\n tokenId: token_id,\n })) satisfies z.ZodType<RewardMarketToken>;\n\ntype RewardMarketToken = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n outcome: string;\n price: DecimalString;\n};\n\nexport const RewardsConfigSchema = z\n .object({\n asset_address: z.string(),\n end_date: EpochMillisecondsToIsoDateTimeStringSchema,\n rate_per_day: DecimalishSchema,\n start_date: EpochMillisecondsToIsoDateTimeStringSchema,\n total_rewards: DecimalishSchema,\n })\n .transform(\n ({ asset_address, end_date, rate_per_day, start_date, total_rewards }) => ({\n assetAddress: asset_address,\n endDate: end_date,\n ratePerDay: rate_per_day,\n startDate: start_date,\n totalRewards: total_rewards,\n }),\n );\n\nexport const EarningSchema = z\n .object({\n asset_address: z.string(),\n asset_rate: DecimalishSchema,\n earnings: DecimalishSchema,\n })\n .transform(({ asset_address, asset_rate, ...rest }) => ({\n ...rest,\n assetAddress: asset_address,\n assetRate: asset_rate,\n }));\n\nexport const UserRewardsEarningSchema = z\n .object({\n condition_id: ConditionIdSchema,\n earning_percentage: z.number(),\n earnings: z.array(EarningSchema),\n event_slug: z.string(),\n image: z.string(),\n maker_address: z.string(),\n market_competitiveness: z.number(),\n market_slug: z.string(),\n question: z.string(),\n rewards_config: z.array(RewardsConfigSchema),\n rewards_max_spread: z.number(),\n rewards_min_size: DecimalishSchema,\n tokens: z.array(TokenSchema),\n })\n .transform(\n ({\n condition_id,\n earning_percentage,\n event_slug,\n maker_address,\n market_competitiveness,\n market_slug,\n rewards_config,\n rewards_max_spread,\n rewards_min_size,\n ...rest\n }) => ({\n ...rest,\n conditionId: condition_id,\n earningPercentage: earning_percentage,\n eventSlug: event_slug,\n makerAddress: maker_address,\n marketCompetitiveness: market_competitiveness,\n marketSlug: market_slug,\n rewardsConfig: rewards_config,\n rewardsMaxSpread: rewards_max_spread,\n rewardsMinSize: rewards_min_size,\n }),\n ) satisfies z.ZodType<UserRewardsEarning>;\n\nexport type UserRewardsEarning = {\n conditionId: ConditionId;\n earningPercentage: number;\n earnings: Array<{\n assetAddress: string;\n assetRate: DecimalString;\n earnings: DecimalString;\n }>;\n eventSlug: string;\n image: string;\n makerAddress: string;\n marketCompetitiveness: number;\n marketSlug: string;\n question: string;\n rewardsConfig: Array<{\n assetAddress: string;\n endDate: IsoDateTimeString;\n ratePerDay: DecimalString;\n startDate: IsoDateTimeString;\n totalRewards: DecimalString;\n }>;\n rewardsMaxSpread: number;\n rewardsMinSize: DecimalString;\n tokens: RewardMarketToken[];\n};\n\nexport const UserRewardsEarningsPageSchema = createCursorPageSchema(\n UserRewardsEarningSchema,\n);\n\nexport type UserRewardsEarningsPage = z.infer<\n typeof UserRewardsEarningsPageSchema\n>;\n","import { z } from 'zod';\nimport {\n ApiKeySchema,\n EpochMillisecondsToIsoDateTimeStringSchema,\n} from '../shared';\n\nexport const ApiKeyCredsSchema = z\n .object({\n apiKey: ApiKeySchema,\n secret: z.string(),\n passphrase: z.string(),\n })\n .transform((creds) => ({\n key: creds.apiKey,\n passphrase: creds.passphrase,\n secret: creds.secret,\n }));\n\nexport type ApiKeyCreds = z.infer<typeof ApiKeyCredsSchema>;\n\nexport const ApiKeysResponseSchema = z.array(ApiKeySchema);\n\nexport type ApiKeysResponse = z.infer<typeof ApiKeysResponseSchema>;\n\nexport const BuilderApiKeyCredsSchema = ApiKeyCredsSchema;\n\nexport type BuilderApiKeyCreds = z.infer<typeof BuilderApiKeyCredsSchema>;\n\nexport const BuilderApiKeySchema = z.object({\n key: ApiKeySchema,\n createdAt: EpochMillisecondsToIsoDateTimeStringSchema.optional(),\n revokedAt: EpochMillisecondsToIsoDateTimeStringSchema.nullable().optional(),\n});\n\nexport type BuilderApiKey = z.infer<typeof BuilderApiKeySchema>;\n\nexport const BuilderApiKeysResponseSchema = z\n .array(\n z.union([ApiKeySchema.transform((key) => ({ key })), BuilderApiKeySchema]),\n )\n .transform((apiKeys) =>\n apiKeys.map((apiKey) => BuilderApiKeySchema.parse(apiKey)),\n );\n\nexport type BuilderApiKeysResponse = z.infer<\n typeof BuilderApiKeysResponseSchema\n>;\n","import { z } from 'zod';\nimport {\n ClobAssetIdSchema,\n type ConditionId,\n ConditionIdSchema,\n type DecimalString,\n DecimalStringSchema,\n EpochLikeToIsoDateTimeStringSchema,\n EpochMillisecondsToIsoDateTimeStringSchema,\n type IsoDateTimeString,\n type OrderSide,\n OrderSideSchema,\n type PositionId,\n type TokenId,\n} from '../shared';\n\nexport type BuilderTrade = {\n id: string;\n /** Exchange asset identifier for a CTF token or Polymarket V2 position. */\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n tradeType: string;\n takerOrderHash: string;\n builder: string;\n /** Condition ID for the market associated with this trade. */\n conditionId: ConditionId;\n side: OrderSide;\n size: DecimalString;\n sizeUsdc: DecimalString;\n price: DecimalString;\n status: string;\n outcome: string;\n outcomeIndex: number;\n owner: string;\n maker: string;\n transactionHash: string;\n matchedAt: IsoDateTimeString;\n bucketIndex: number;\n fee: DecimalString;\n feeUsdc: DecimalString;\n errMsg: string | null | undefined;\n createdAt?: IsoDateTimeString;\n updatedAt?: IsoDateTimeString;\n};\n\nexport const BuilderTradeSchema = z\n .object({\n id: z.string(),\n tradeType: z.string(),\n takerOrderHash: z.string(),\n builder: z.string(),\n market: ConditionIdSchema,\n assetId: ClobAssetIdSchema,\n side: OrderSideSchema,\n size: DecimalStringSchema,\n sizeUsdc: DecimalStringSchema,\n price: DecimalStringSchema,\n status: z.string(),\n outcome: z.string(),\n outcomeIndex: z.number().int(),\n owner: z.string(),\n maker: z.string(),\n transactionHash: z.string(),\n matchTime: EpochLikeToIsoDateTimeStringSchema,\n bucketIndex: z.number().int(),\n fee: DecimalStringSchema,\n feeUsdc: DecimalStringSchema,\n err_msg: z.string().nullable().optional(),\n createdAt: EpochMillisecondsToIsoDateTimeStringSchema.optional(),\n updatedAt: EpochMillisecondsToIsoDateTimeStringSchema.optional(),\n })\n .transform(({ err_msg, assetId, market, matchTime, ...rest }) => ({\n ...rest,\n conditionId: market,\n assetId,\n tokenId: assetId,\n errMsg: err_msg,\n matchedAt: matchTime,\n })) satisfies z.ZodType<BuilderTrade>;\n\nexport const PaginatedBuilderTradesSchema = z\n .object({\n limit: z.number().int(),\n count: z.number().int(),\n next_cursor: z.string(),\n data: z.array(BuilderTradeSchema),\n })\n .transform(({ next_cursor, ...rest }) => ({\n ...rest,\n nextCursor: next_cursor,\n }));\nexport type PaginatedBuilderTrades = z.infer<\n typeof PaginatedBuilderTradesSchema\n>;\n\nconst BUILDER_FEES_BPS = 10_000;\n\nexport const BuilderFeeRatesSchema = z\n .object({\n builder_maker_fee_rate_bps: z.number(),\n builder_taker_fee_rate_bps: z.number(),\n })\n .transform(({ builder_maker_fee_rate_bps, builder_taker_fee_rate_bps }) => ({\n maker: builder_maker_fee_rate_bps / BUILDER_FEES_BPS,\n taker: builder_taker_fee_rate_bps / BUILDER_FEES_BPS,\n }));\n\nexport const FetchBuilderFeeRatesResponseSchema = BuilderFeeRatesSchema;\n\nexport type BuilderFeeRates = z.infer<typeof BuilderFeeRatesSchema>;\nexport type FetchBuilderFeeRatesResponse = z.infer<\n typeof FetchBuilderFeeRatesResponseSchema\n>;\n","import { z } from 'zod';\nimport { OrderIdSchema } from '../shared';\n\nexport const CancelOrdersResponseSchema = z\n .object({\n canceled: z.array(OrderIdSchema),\n not_canceled: z.record(OrderIdSchema, z.string()),\n })\n .transform(({ canceled, not_canceled }) => ({\n canceled,\n notCanceled: not_canceled,\n }));\n\nexport type CancelOrdersResponse = z.infer<typeof CancelOrdersResponseSchema>;\n","import { z } from 'zod';\nimport {\n ClobAssetIdSchema,\n ConditionIdSchema,\n type DecimalString,\n DecimalStringSchema,\n type OrderSide,\n OrderSideSchema,\n type PositionId,\n type TickSizeValue,\n TickSizeValueSchema,\n type TokenId,\n} from '../shared';\n\nexport const MidpointSchema = z.object({\n mid: DecimalStringSchema,\n});\nexport type Midpoint = z.infer<typeof MidpointSchema>;\n\nexport const MidpointsSchema = z.record(ClobAssetIdSchema, DecimalStringSchema);\nexport type Midpoints = z.infer<typeof MidpointsSchema>;\n\nexport const PriceSchema = z.object({\n price: DecimalStringSchema,\n});\nexport type Price = z.infer<typeof PriceSchema>;\n\nconst PricesBySideSchema = z.partialRecord(\n OrderSideSchema,\n DecimalStringSchema,\n);\nexport type PricesBySide = z.infer<typeof PricesBySideSchema>;\n\nexport const PricesSchema = z.record(ClobAssetIdSchema, PricesBySideSchema);\nexport type Prices = z.infer<typeof PricesSchema>;\n\nexport const SpreadSchema = z.object({\n spread: DecimalStringSchema,\n});\nexport type Spread = z.infer<typeof SpreadSchema>;\n\nexport const SpreadsSchema = z.record(ClobAssetIdSchema, DecimalStringSchema);\nexport type Spreads = z.infer<typeof SpreadsSchema>;\n\nconst LastTradePriceValueSchema = z.object({\n price: DecimalStringSchema,\n side: OrderSideSchema,\n});\nexport type LastTradePrice = z.infer<typeof LastTradePriceValueSchema>;\n\nexport const LastTradePriceSchema = LastTradePriceValueSchema.extend({\n side: z.union([OrderSideSchema, z.literal('')]),\n}).transform((lastTrade): LastTradePrice | null =>\n lastTrade.side === ''\n ? null\n : { price: lastTrade.price, side: lastTrade.side },\n);\n\nconst LastTradePriceForTokenResponseSchema = z\n .object({\n price: DecimalStringSchema,\n side: OrderSideSchema,\n token_id: ClobAssetIdSchema,\n })\n .transform(({ token_id, price, side }) => ({\n assetId: token_id,\n tokenId: token_id,\n price,\n side,\n })) satisfies z.ZodType<LastTradePriceForAssetResponse>;\nexport type LastTradePriceForAssetResponse = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n price: DecimalString;\n side: OrderSide;\n};\n\n/** @deprecated Use `LastTradePriceForAssetResponse`. */\nexport type LastTradePriceForTokenResponse = LastTradePriceForAssetResponse;\n\nexport type LastTradePriceForAsset = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n price: DecimalString;\n side: OrderSide;\n};\n\n/** @deprecated Use `LastTradePriceForAsset`. */\nexport type LastTradePriceForToken = LastTradePriceForAsset;\n\nexport const LastTradePricesSchema = z.array(\n LastTradePriceForTokenResponseSchema,\n);\nexport type LastTradePrices = z.infer<typeof LastTradePricesSchema>;\n\nexport const ConditionByTokenSchema = z\n .object({\n condition_id: ConditionIdSchema,\n })\n .transform(({ condition_id }) => condition_id);\n\nexport const ResolveConditionByTokenResponseSchema = ConditionByTokenSchema;\n\nexport type ConditionByToken = z.infer<typeof ConditionByTokenSchema>;\nexport type ResolveConditionByTokenResponse = z.infer<\n typeof ResolveConditionByTokenResponseSchema\n>;\n\nexport const MarketFeeInfoSchema = z\n .object({\n r: z.number().default(0),\n e: z.number().default(0),\n })\n .transform(({ r, e }) => ({\n rate: r,\n exponent: e,\n }));\n\nexport const MarketTokenSchema = z\n .object({\n t: ClobAssetIdSchema,\n o: z.string(),\n })\n .transform(({ t, o }) => ({\n assetId: t,\n tokenId: t,\n outcome: o,\n })) satisfies z.ZodType<MarketToken>;\n\nexport const MarketInfoSchema = z\n .object({\n fd: MarketFeeInfoSchema.nullish(),\n mts: TickSizeValueSchema,\n nr: z.boolean().optional(),\n t: z.array(MarketTokenSchema),\n })\n .transform(({ fd, mts, nr, t }) => ({\n feeInfo: fd ?? { rate: 0, exponent: 0 },\n negRisk: nr ?? false,\n tickSize: mts,\n tokens: t,\n })) satisfies z.ZodType<MarketInfo>;\n\nexport const FetchMarketInfoResponseSchema = MarketInfoSchema;\n\nexport type MarketFeeInfo = z.infer<typeof MarketFeeInfoSchema>;\nexport type MarketToken = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n outcome: string;\n};\nexport type MarketInfo = {\n feeInfo: MarketFeeInfo;\n negRisk: boolean;\n tickSize: TickSizeValue;\n tokens: MarketToken[];\n};\nexport type FetchMarketInfoResponse = MarketInfo;\n","import { z } from 'zod';\n\nexport const NegRiskSchema = z\n .object({\n neg_risk: z.boolean(),\n })\n .transform(({ neg_risk, ...rest }) => ({\n ...rest,\n negRisk: neg_risk,\n }));\n\nexport const FetchNegRiskResponseSchema = NegRiskSchema;\n\nexport type NegRisk = z.infer<typeof NegRiskSchema>;\nexport type FetchNegRiskResponse = z.infer<typeof FetchNegRiskResponseSchema>;\n","import type { TxHash } from '@kuest/types';\nimport { z } from 'zod';\nimport { CommentProfileSchema } from '../gamma/comment';\nimport {\n ApiKeySchema,\n ClobAssetIdSchema,\n ComboConditionIdSchema,\n CommentIdSchema,\n CommentParentEntityTypeSchema,\n type ConditionId,\n ConditionIdSchema,\n DateLikeToIsoDateTimeStringSchema,\n DecimalishSchema,\n type DecimalString,\n DecimalStringSchema,\n EpochMillisecondsSchema,\n EvmAddressSchema,\n emptyStringToNull,\n emptyStringToUndefined,\n type IsoDateTimeString,\n IsoDateTimeStringSchema,\n NotificationIdSchema,\n type OrderId,\n OrderIdSchema,\n type OrderSide,\n OrderSideSchema,\n type OrderType,\n OrderTypeSchema,\n type PositionId,\n PositionIdSchema,\n type QuestionId,\n QuestionIdSchema,\n type TokenId,\n TxHashSchema,\n toIsoCalendarDateString,\n} from '../shared';\n\n/**\n * Kind of account notification. The wire value is an integer discriminant;\n * each kind carries a payload whose shape is tied to the kind.\n */\nexport enum NotificationType {\n ORDER_CANCELLATION = 1,\n ORDER_FILL = 2,\n MARKET_REGISTERED = 3,\n MARKET_RESOLVED = 4,\n REWARD_PAYOUT = 5,\n CHILD_COMMENT_CREATED = 6,\n YIELD_PAYOUT = 7,\n ORDER_FILL_FAILED = 8,\n AUTO_REDEEMED = 9,\n COMBO_AUTO_REDEEMED = 10,\n TAKER_TIER_UPGRADED = 11,\n}\n\nexport const NotificationTypeSchema = z.enum(NotificationType);\n\n/**\n * Payload of an order lifecycle notification (cancellation, fill, and\n * failed fill share this shape).\n *\n * `transactionHash` and `tradeId` are only populated on fills. The\n * market-display fields (`question`, `marketSlug`, `icon`, `image`,\n * `eventSlug`, `seriesSlug`) are filled best-effort by the producer and may\n * be empty strings; older notifications may omit them entirely, along with\n * `orderType`.\n */\nexport const OrderNotificationPayloadSchema = z\n .object({\n asset_id: ClobAssetIdSchema,\n eventSlug: z.string().optional(),\n icon: z.string().optional(),\n image: z.string().optional(),\n market: ConditionIdSchema,\n market_slug: z.string().optional(),\n matched_size: DecimalStringSchema,\n order_id: OrderIdSchema,\n original_size: DecimalStringSchema,\n outcome: z.string(),\n outcome_index: z.number().int(),\n price: DecimalStringSchema,\n question: z.string().optional(),\n remaining_size: DecimalStringSchema,\n seriesSlug: z.string().optional(),\n side: OrderSideSchema,\n trade_id: z.preprocess(emptyStringToUndefined, z.string().optional()),\n transaction_hash: z.preprocess(\n emptyStringToUndefined,\n TxHashSchema.optional(),\n ),\n type: z.preprocess(emptyStringToUndefined, OrderTypeSchema.optional()),\n })\n .transform(\n ({\n asset_id,\n market,\n market_slug,\n matched_size,\n order_id,\n original_size,\n outcome_index,\n remaining_size,\n trade_id,\n transaction_hash,\n type,\n ...rest\n }) => ({\n ...rest,\n conditionId: market,\n assetId: asset_id,\n tokenId: asset_id,\n marketSlug: market_slug,\n matchedSize: matched_size,\n orderId: order_id,\n orderType: type,\n originalSize: original_size,\n outcomeIndex: outcome_index,\n remainingSize: remaining_size,\n tradeId: trade_id,\n transactionHash: transaction_hash,\n }),\n ) satisfies z.ZodType<OrderNotificationPayload>;\n\nexport type OrderNotificationPayload = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n conditionId: ConditionId;\n eventSlug?: string;\n icon?: string;\n image?: string;\n marketSlug: string | undefined;\n matchedSize: DecimalString;\n orderId: OrderId;\n orderType: OrderType | undefined;\n originalSize: DecimalString;\n outcome: string;\n outcomeIndex: number;\n price: DecimalString;\n question?: string;\n remainingSize: DecimalString;\n seriesSlug?: string;\n side: OrderSide;\n tradeId: string | undefined;\n transactionHash: TxHash | undefined;\n};\n\n/**\n * One outcome token inside a market lifecycle notification payload. On a\n * market-resolved notification, `winner` marks the winning outcome.\n */\nexport const MarketNotificationTokenSchema = z\n .object({\n outcome: z.string(),\n price: DecimalishSchema.optional(),\n token_id: ClobAssetIdSchema,\n winner: z.boolean(),\n })\n .transform(({ token_id, ...rest }) => ({\n ...rest,\n assetId: token_id,\n tokenId: token_id,\n })) satisfies z.ZodType<MarketNotificationToken>;\n\nexport type MarketNotificationToken = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n outcome: string;\n price?: DecimalString;\n winner: boolean;\n};\n\n/** Liquidity-rewards parameters carried on a market lifecycle notification. */\nexport const MarketNotificationRewardsSchema = z\n .object({\n max_spread: z.number(),\n min_size: DecimalishSchema,\n rates: z\n .array(\n z\n .object({\n asset_address: z.string(),\n rewards_daily_rate: DecimalishSchema,\n })\n .transform(({ asset_address, rewards_daily_rate }) => ({\n assetAddress: asset_address,\n dailyRate: rewards_daily_rate,\n })),\n )\n .nullish(),\n })\n .transform(({ max_spread, min_size, ...rest }) => ({\n ...rest,\n maxSpread: max_spread,\n minSize: min_size,\n }));\n\nexport type MarketNotificationRewards = z.infer<\n typeof MarketNotificationRewardsSchema\n>;\n\n/**\n * Payload of a market lifecycle notification (market registered and market\n * resolved share this shape: the market the notification is about).\n *\n * Fields marked optional are absent on notifications written before the\n * producer started including them.\n */\nexport const MarketNotificationPayloadSchema = z\n .object({\n accepting_order_timestamp: DateLikeToIsoDateTimeStringSchema.nullish(),\n accepting_orders: z.boolean(),\n active: z.boolean(),\n archived: z.boolean().optional(),\n closed: z.boolean(),\n condition_id: ConditionIdSchema,\n description: z.string(),\n enable_order_book: z.boolean().optional(),\n end_date_iso: DateLikeToIsoDateTimeStringSchema.nullish(),\n eventSlug: z.string().optional(),\n fpmm: z.string(),\n game_start_time: z.preprocess(\n emptyStringToNull,\n DateLikeToIsoDateTimeStringSchema.nullish(),\n ),\n icon: z.string(),\n image: z.string(),\n is_50_50_outcome: z.boolean().optional(),\n maker_base_fee: z.number().nullable(),\n market_slug: z.string(),\n minimum_order_size: DecimalishSchema,\n minimum_tick_size: DecimalishSchema,\n neg_risk: z.boolean().optional(),\n neg_risk_market_id: z.string().optional(),\n neg_risk_request_id: z.string().optional(),\n notifications_enabled: z.boolean().optional(),\n question: z.string(),\n question_id: QuestionIdSchema,\n rewards: MarketNotificationRewardsSchema.optional(),\n seconds_delay: z.number().int(),\n tags: z.array(z.string()).nullish(),\n taker_base_fee: z.number().nullable(),\n tokens: z.array(MarketNotificationTokenSchema),\n })\n .transform(\n ({\n accepting_order_timestamp,\n accepting_orders,\n condition_id,\n enable_order_book,\n end_date_iso,\n game_start_time,\n is_50_50_outcome,\n maker_base_fee,\n market_slug,\n minimum_order_size,\n minimum_tick_size,\n neg_risk,\n neg_risk_market_id,\n neg_risk_request_id,\n notifications_enabled,\n question_id,\n seconds_delay,\n taker_base_fee,\n ...rest\n }) => ({\n ...rest,\n acceptingOrders: accepting_orders,\n acceptingOrdersTimestamp: accepting_order_timestamp,\n conditionId: condition_id,\n enableOrderBook: enable_order_book,\n endDate: end_date_iso,\n gameStartTime: game_start_time,\n is5050Outcome: is_50_50_outcome,\n makerBaseFee: maker_base_fee,\n marketSlug: market_slug,\n minimumOrderSize: minimum_order_size,\n minimumTickSize: minimum_tick_size,\n negRisk: neg_risk,\n negRiskMarketId: neg_risk_market_id,\n negRiskRequestId: neg_risk_request_id,\n notificationsEnabled: notifications_enabled,\n questionId: question_id,\n secondsDelay: seconds_delay,\n takerBaseFee: taker_base_fee,\n }),\n ) satisfies z.ZodType<MarketNotificationPayload>;\n\nexport type MarketNotificationPayload = {\n acceptingOrders: boolean;\n acceptingOrdersTimestamp: IsoDateTimeString | null | undefined;\n active: boolean;\n archived?: boolean;\n closed: boolean;\n conditionId: ConditionId;\n description: string;\n enableOrderBook: boolean | undefined;\n endDate: IsoDateTimeString | null | undefined;\n eventSlug?: string;\n fpmm: string;\n gameStartTime: IsoDateTimeString | null | undefined;\n icon: string;\n image: string;\n is5050Outcome: boolean | undefined;\n makerBaseFee: number | null;\n marketSlug: string;\n minimumOrderSize: DecimalString;\n minimumTickSize: DecimalString;\n negRisk: boolean | undefined;\n negRiskMarketId: string | undefined;\n negRiskRequestId: string | undefined;\n notificationsEnabled: boolean | undefined;\n question: string;\n questionId: QuestionId;\n rewards?: MarketNotificationRewards;\n secondsDelay: number;\n tags?: string[] | null;\n takerBaseFee: number | null;\n tokens: MarketNotificationToken[];\n};\n\n/** Payload of a liquidity-reward payout notification. */\nexport const RewardPayoutNotificationPayloadSchema = z\n .object({\n proxyWallet: EvmAddressSchema,\n reward: DecimalishSchema,\n txnHash: TxHashSchema,\n })\n .transform(({ txnHash, ...rest }) => ({\n ...rest,\n transactionHash: txnHash,\n }));\n\nexport type RewardPayoutNotificationPayload = z.infer<\n typeof RewardPayoutNotificationPayloadSchema\n>;\n\n/** Payload of a yield payout notification. */\nexport const YieldPayoutNotificationPayloadSchema = z\n .object({\n amount: DecimalishSchema,\n proxyWallet: EvmAddressSchema,\n txnHash: TxHashSchema,\n })\n .transform(({ txnHash, ...rest }) => ({\n ...rest,\n transactionHash: txnHash,\n }));\n\nexport type YieldPayoutNotificationPayload = z.infer<\n typeof YieldPayoutNotificationPayloadSchema\n>;\n\n/**\n * Payload of a child-comment notification: the reply comment, its author's\n * profile, and the event or series the thread belongs to.\n */\nexport const ChildCommentNotificationPayloadSchema = z.object({\n body: z.string().nullish(),\n createdAt: IsoDateTimeStringSchema.nullish(),\n eventSlug: z.string().nullish(),\n eventTitle: z.string().nullish(),\n id: CommentIdSchema,\n image: z.string().nullish(),\n parentCommentID: CommentIdSchema.nullish(),\n parentEntityID: z.number().int().nullish(),\n parentEntityType: CommentParentEntityTypeSchema.nullish(),\n profile: CommentProfileSchema.nullish(),\n seriesSlug: z.string().nullish(),\n seriesTitle: z.string().nullish(),\n userAddress: z.string().nullish(),\n});\n\nexport type ChildCommentNotificationPayload = z.infer<\n typeof ChildCommentNotificationPayloadSchema\n>;\n\n/**\n * Payload of an auto-redeem notification: a winning position redeemed\n * on-chain on the account's behalf.\n */\nexport const AutoRedeemedNotificationPayloadSchema = z\n .object({\n amount: DecimalishSchema,\n conditionId: ConditionIdSchema,\n image: z.string(),\n marketUrl: z.string().optional(),\n negRisk: z.boolean(),\n portfolioUrl: z.string().optional(),\n position: z.string().optional(),\n proxyWallet: EvmAddressSchema,\n question: z.string(),\n slug: z.string(),\n txnHash: TxHashSchema,\n })\n .transform(({ slug, txnHash, ...rest }) => ({\n ...rest,\n marketSlug: slug,\n transactionHash: txnHash,\n }));\n\nexport type AutoRedeemedNotificationPayload = z.infer<\n typeof AutoRedeemedNotificationPayloadSchema\n>;\n\n/**\n * Payload of a combo auto-redeem notification: a winning combo position\n * redeemed on-chain on the account's behalf. `legs` is the combo arity.\n */\nexport const ComboAutoRedeemedNotificationPayloadSchema = z\n .object({\n amount: DecimalishSchema,\n conditionId: ComboConditionIdSchema,\n legs: z.number().int(),\n outcomeIndex: z.number().int(),\n portfolioUrl: z.string().optional(),\n positionId: PositionIdSchema,\n proxyWallet: EvmAddressSchema,\n txnHash: TxHashSchema,\n })\n .transform(({ txnHash, ...rest }) => ({\n ...rest,\n transactionHash: txnHash,\n }));\n\nexport type ComboAutoRedeemedNotificationPayload = z.infer<\n typeof ComboAutoRedeemedNotificationPayloadSchema\n>;\n\n/** A taker tier upgrade in a daily snapshot; rebateBps is in basis points. */\nexport const TakerTierUpgradedNotificationPayloadSchema = z\n .object({\n previous_tier: z.number().int(),\n tier: z.number().int(),\n rebate_bps: z.number().int(),\n snapshot_date: z.iso.date().transform(toIsoCalendarDateString),\n })\n .transform(({ previous_tier, tier, rebate_bps, snapshot_date }) => ({\n previousTier: previous_tier,\n tier,\n rebateBps: rebate_bps,\n snapshotDate: snapshot_date,\n }));\n\nexport type TakerTierUpgradedNotificationPayload = z.infer<\n typeof TakerTierUpgradedNotificationPayloadSchema\n>;\n\nconst NotificationTimestampSchema = z.preprocess((value) => {\n if (typeof value !== 'string') {\n return value;\n }\n\n return /^\\d+$/.test(value) ? Number(value) : Date.parse(value);\n}, EpochMillisecondsSchema);\n\nfunction createNotificationSchema<\n TType extends NotificationType,\n TPayload extends z.ZodType,\n>(type: TType, payload: TPayload) {\n return z.object({\n id: NotificationIdSchema,\n owner: ApiKeySchema,\n payload,\n timestamp: NotificationTimestampSchema,\n type: z.literal(type),\n });\n}\n\nexport const OrderCancellationNotificationSchema = createNotificationSchema(\n NotificationType.ORDER_CANCELLATION,\n OrderNotificationPayloadSchema,\n);\n\nexport type OrderCancellationNotification = z.infer<\n typeof OrderCancellationNotificationSchema\n>;\n\nexport const OrderFillNotificationSchema = createNotificationSchema(\n NotificationType.ORDER_FILL,\n OrderNotificationPayloadSchema,\n);\n\nexport type OrderFillNotification = z.infer<typeof OrderFillNotificationSchema>;\n\nexport const MarketRegisteredNotificationSchema = createNotificationSchema(\n NotificationType.MARKET_REGISTERED,\n MarketNotificationPayloadSchema,\n);\n\nexport type MarketRegisteredNotification = z.infer<\n typeof MarketRegisteredNotificationSchema\n>;\n\nexport const MarketResolvedNotificationSchema = createNotificationSchema(\n NotificationType.MARKET_RESOLVED,\n MarketNotificationPayloadSchema,\n);\n\nexport type MarketResolvedNotification = z.infer<\n typeof MarketResolvedNotificationSchema\n>;\n\nexport const RewardPayoutNotificationSchema = createNotificationSchema(\n NotificationType.REWARD_PAYOUT,\n RewardPayoutNotificationPayloadSchema,\n);\n\nexport type RewardPayoutNotification = z.infer<\n typeof RewardPayoutNotificationSchema\n>;\n\nexport const ChildCommentCreatedNotificationSchema = createNotificationSchema(\n NotificationType.CHILD_COMMENT_CREATED,\n ChildCommentNotificationPayloadSchema,\n);\n\nexport type ChildCommentCreatedNotification = z.infer<\n typeof ChildCommentCreatedNotificationSchema\n>;\n\nexport const YieldPayoutNotificationSchema = createNotificationSchema(\n NotificationType.YIELD_PAYOUT,\n YieldPayoutNotificationPayloadSchema,\n);\n\nexport type YieldPayoutNotification = z.infer<\n typeof YieldPayoutNotificationSchema\n>;\n\nexport const OrderFillFailedNotificationSchema = createNotificationSchema(\n NotificationType.ORDER_FILL_FAILED,\n OrderNotificationPayloadSchema,\n);\n\nexport type OrderFillFailedNotification = z.infer<\n typeof OrderFillFailedNotificationSchema\n>;\n\nexport const AutoRedeemedNotificationSchema = createNotificationSchema(\n NotificationType.AUTO_REDEEMED,\n AutoRedeemedNotificationPayloadSchema,\n);\n\nexport type AutoRedeemedNotification = z.infer<\n typeof AutoRedeemedNotificationSchema\n>;\n\nexport const ComboAutoRedeemedNotificationSchema = createNotificationSchema(\n NotificationType.COMBO_AUTO_REDEEMED,\n ComboAutoRedeemedNotificationPayloadSchema,\n);\n\nexport type ComboAutoRedeemedNotification = z.infer<\n typeof ComboAutoRedeemedNotificationSchema\n>;\n\nexport const TakerTierUpgradedNotificationSchema = createNotificationSchema(\n NotificationType.TAKER_TIER_UPGRADED,\n TakerTierUpgradedNotificationPayloadSchema,\n);\n\nexport type TakerTierUpgradedNotification = z.infer<\n typeof TakerTierUpgradedNotificationSchema\n>;\n\n/**\n * Account notification. Discriminated on `type`: narrowing on it also\n * narrows `payload` to the shape carried by that notification kind.\n */\nexport const NotificationSchema = z.discriminatedUnion('type', [\n OrderCancellationNotificationSchema,\n OrderFillNotificationSchema,\n MarketRegisteredNotificationSchema,\n MarketResolvedNotificationSchema,\n RewardPayoutNotificationSchema,\n ChildCommentCreatedNotificationSchema,\n YieldPayoutNotificationSchema,\n OrderFillFailedNotificationSchema,\n AutoRedeemedNotificationSchema,\n ComboAutoRedeemedNotificationSchema,\n TakerTierUpgradedNotificationSchema,\n]);\n\nexport type Notification = z.infer<typeof NotificationSchema>;\n\nconst NotificationTypeProbeSchema = z.object({\n type: z.number().int(),\n});\n\n/**\n * Notifications with types unknown to this SDK version are omitted so newly\n * introduced kinds cannot fail the feed; recognized types validate strictly.\n */\nexport const NotificationsResponseSchema = z\n .array(z.unknown())\n .transform((items, ctx) => {\n const notifications: Notification[] = [];\n items.forEach((item, index) => {\n const probe = NotificationTypeProbeSchema.safeParse(item);\n if (!probe.success) {\n for (const issue of probe.error.issues) {\n ctx.addIssue({ ...issue, path: [index, ...issue.path] });\n }\n return;\n }\n\n if (!NotificationTypeSchema.safeParse(probe.data.type).success) {\n return;\n }\n\n const notification = NotificationSchema.safeParse(item);\n if (notification.success) {\n notifications.push(notification.data);\n return;\n }\n\n for (const issue of notification.error.issues) {\n ctx.addIssue({ ...issue, path: [index, ...issue.path] });\n }\n });\n return notifications;\n });\n\nexport type NotificationsResponse = z.infer<typeof NotificationsResponseSchema>;\n","import { z } from 'zod';\nimport {\n ClobAssetIdSchema,\n type ConditionId,\n ConditionIdSchema,\n type DecimalString,\n DecimalStringSchema,\n type EpochMilliseconds,\n EpochMillisecondsStringSchema,\n type PositionId,\n type TickSizeValue,\n TickSizeValueSchema,\n type TokenId,\n} from '../shared';\n\nexport type OrderBookLevel = {\n price: DecimalString;\n size: DecimalString;\n};\n\n/** SHA-1 hash of the serialized order book summary, encoded as bare lowercase hex. */\nexport type OrderBookHash = string & { readonly __tag: 'OrderBookHash' };\n\nexport type OrderBook = {\n /** Exchange asset identifier for a CTF token or Polymarket V2 position. */\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n /** Condition ID for the market this book belongs to. */\n conditionId: ConditionId;\n timestamp?: EpochMilliseconds | null;\n\n /** Bid levels in ascending price order, lowest bid first. */\n bids: OrderBookLevel[];\n\n /** Ask levels in descending price order, highest ask first. */\n asks: OrderBookLevel[];\n\n minOrderSize: DecimalString;\n tickSize: TickSizeValue;\n negRisk: boolean;\n lastTradePrice?: DecimalString | null;\n hash: OrderBookHash;\n};\n\nexport const OrderBookLevelSchema = z.object({\n price: DecimalStringSchema,\n size: DecimalStringSchema,\n}) satisfies z.ZodType<OrderBookLevel>;\n\nexport const OrderBookHashSchema = z\n .string()\n .regex(/^[a-f0-9]{40}$/)\n .transform((value) => value as OrderBookHash);\n\nconst OrderBookTickSizeSchema =\n DecimalStringSchema.transform(Number).pipe(TickSizeValueSchema);\n\nexport const OrderBookSchema = z\n .object({\n market: ConditionIdSchema,\n asset_id: ClobAssetIdSchema,\n timestamp: EpochMillisecondsStringSchema.nullish(),\n bids: z.array(OrderBookLevelSchema),\n asks: z.array(OrderBookLevelSchema),\n min_order_size: DecimalStringSchema,\n tick_size: OrderBookTickSizeSchema,\n neg_risk: z.boolean(),\n last_trade_price: DecimalStringSchema.nullish(),\n hash: OrderBookHashSchema,\n })\n .transform(\n ({\n market,\n asset_id,\n min_order_size,\n tick_size,\n neg_risk,\n last_trade_price,\n ...rest\n }) => ({\n ...rest,\n conditionId: market,\n assetId: asset_id,\n tokenId: asset_id,\n minOrderSize: min_order_size,\n tickSize: tick_size,\n negRisk: neg_risk,\n lastTradePrice: last_trade_price,\n }),\n ) satisfies z.ZodType<OrderBook>;\n\nexport const FetchOrderBookResponseSchema = OrderBookSchema;\nexport const OrderBooksSchema = z.array(OrderBookSchema);\n\nexport type OrderBooks = OrderBook[];\nexport type FetchOrderBookResponse = OrderBook;\n","import { z } from 'zod';\n\n/** Acknowledgement for an order heartbeat; retain the ID for the next send. */\nexport const OrderHeartbeatSchema = z\n .object({ heartbeat_id: z.string().min(1) })\n .transform(({ heartbeat_id }) => ({ heartbeatId: heartbeat_id }));\nexport type OrderHeartbeat = z.infer<typeof OrderHeartbeatSchema>;\n/** Mismatch rejection carrying the currently expected order heartbeat ID. */\nexport const OrderHeartbeatMismatchResponseSchema = z.object({\n error_msg: z.literal('Invalid Heartbeat ID'),\n heartbeat_id: z.string(),\n});\n","import { never, type TxHash } from '@kuest/types';\nimport { z } from 'zod';\nimport {\n type DecimalString,\n DecimalStringSchema,\n type OrderId,\n OrderIdSchema,\n TxHashSchema,\n} from '../shared';\n\n// The API serializes unset decimal fields as empty strings, e.g. the\n// making/taking amounts on an order that rests on the book without matching.\n// Normalize to '0' so consumers never see '' as a DecimalString.\nconst OrderResponseAmountSchema = z.preprocess(\n (value) => (value === '' ? '0' : value),\n DecimalStringSchema,\n);\n\nconst OrderResponsePayloadSchema = z.object({\n errorMsg: z.string(),\n makingAmount: OrderResponseAmountSchema,\n orderID: z.string(),\n status: z.string(),\n success: z.boolean(),\n takingAmount: OrderResponseAmountSchema,\n tradeIDs: z.array(z.string()).default([]),\n transactionsHashes: z.array(z.string()).default([]),\n});\n\ntype OrderResponsePayload = z.infer<typeof OrderResponsePayloadSchema>;\n\n/**\n * Placement outcome of an accepted order.\n */\nexport enum OrderPostStatus {\n /** The order rests on the book without matching. */\n LIVE = 'live',\n /** The order matched, fully or partially, at placement. */\n MATCHED = 'matched',\n /** The market imposes a matching delay; the order is queued. */\n DELAYED = 'delayed',\n}\n\nexport const OrderPostStatusSchema = z.nativeEnum(OrderPostStatus);\n\nexport enum OrderResponseErrorCode {\n UNMATCHED = 'unmatched',\n MARKET_NOT_READY = 'market_not_ready',\n INSUFFICIENT_BALANCE_OR_ALLOWANCE = 'insufficient_balance_or_allowance',\n INVALID_NONCE = 'invalid_nonce',\n INVALID_EXPIRATION = 'invalid_expiration',\n POST_ONLY_WOULD_CROSS = 'post_only_would_cross',\n POST_ONLY_MODE = 'post_only_mode',\n FOK_NOT_FILLED = 'fok_not_filled',\n FAK_NOT_FILLED = 'fak_not_filled',\n UNKNOWN = 'unknown',\n}\n\nexport const OrderResponseErrorCodeSchema = z.nativeEnum(\n OrderResponseErrorCode,\n);\n\n/**\n * A successfully placed order.\n */\nexport type AcceptedOrderResponse = {\n ok: true;\n /** Unique identifier of the placed order. */\n orderId: OrderId;\n /** Placement outcome. Fills only exist when the status is `matched`. */\n status: OrderPostStatus;\n /** Amount of the maker asset committed by fills at placement. `'0'` when the order did not match. */\n makingAmount: DecimalString;\n /** Amount of the taker asset received by fills at placement. `'0'` when the order did not match. */\n takingAmount: DecimalString;\n /**\n * Settlement transaction hashes for fills that occurred at placement.\n * Populated on a best-effort basis: settlement happens asynchronously, so\n * this can be empty even when the order matched. Follow the order's trades\n * to obtain hashes reliably.\n */\n transactionsHashes: TxHash[];\n /**\n * Identifiers of the trades created by fills at placement. Empty when the\n * order did not match. Later fills of a resting order create new trades\n * that are not listed here.\n */\n tradeIds: string[];\n};\n\n/**\n * An order the venue refused to place.\n */\nexport type RejectedOrderResponse = {\n ok: false;\n /** Machine-readable rejection reason. */\n code: OrderResponseErrorCode;\n /** Human-readable rejection message. */\n message: string;\n};\n\n/**\n * Result of posting an order, discriminated on `ok`.\n */\nexport type OrderResponse = AcceptedOrderResponse | RejectedOrderResponse;\n\n/**\n * Results of posting a batch of orders, in request order.\n */\nexport type OrderResponses = OrderResponse[];\n\nexport const AcceptedOrderResponseSchema = z.object({\n ok: z.literal(true),\n orderId: OrderIdSchema.refine((orderId) => orderId.length > 0),\n status: OrderPostStatusSchema,\n makingAmount: DecimalStringSchema,\n takingAmount: DecimalStringSchema,\n tradeIds: z.array(z.string()),\n transactionsHashes: z.array(TxHashSchema),\n});\n\nexport const RejectedOrderResponseSchema = z.object({\n ok: z.literal(false),\n code: OrderResponseErrorCodeSchema,\n message: z.string().min(1),\n});\n\nexport const OrderResponseSchema = OrderResponsePayloadSchema.transform(\n normalizeOrderResponse,\n);\n\nexport const OrderResponsesSchema = z.array(OrderResponseSchema);\n\nfunction isAcceptedOrderResponse(response: OrderResponsePayload): boolean {\n return (\n response.success &&\n response.errorMsg === '' &&\n response.orderID !== '' &&\n isOrderPostStatus(response.status)\n );\n}\n\nfunction parseOrderPostStatus(status: string): OrderPostStatus {\n switch (status) {\n case OrderPostStatus.LIVE:\n return OrderPostStatus.LIVE;\n case OrderPostStatus.MATCHED:\n return OrderPostStatus.MATCHED;\n case OrderPostStatus.DELAYED:\n return OrderPostStatus.DELAYED;\n default:\n never(`Unexpected order post status: ${status}`);\n }\n}\n\nfunction normalizeOrderResponse(response: OrderResponsePayload): OrderResponse {\n if (isAcceptedOrderResponse(response)) {\n return AcceptedOrderResponseSchema.parse({\n makingAmount: response.makingAmount,\n ok: true,\n orderId: response.orderID,\n status: parseOrderPostStatus(response.status),\n takingAmount: response.takingAmount,\n tradeIds: response.tradeIDs,\n transactionsHashes: response.transactionsHashes,\n });\n }\n\n return RejectedOrderResponseSchema.parse({\n code: inferOrderResponseErrorCode(response),\n message: response.errorMsg || 'Unknown order failure',\n ok: false,\n });\n}\n\nfunction inferOrderResponseErrorCode(\n response: OrderResponsePayload,\n): OrderResponseErrorCode {\n // This is a boundary heuristic over legacy mixed `success`/`status`/`errorMsg`\n // fields. It is intentionally temporary and should be removed once the API\n // exposes structured success and error variants directly.\n if (response.status === 'unmatched') {\n return OrderResponseErrorCode.UNMATCHED;\n }\n\n switch (response.errorMsg) {\n case 'the market is not yet ready to process new orders':\n return OrderResponseErrorCode.MARKET_NOT_READY;\n case 'invalid nonce':\n return OrderResponseErrorCode.INVALID_NONCE;\n case 'invalid expiration':\n return OrderResponseErrorCode.INVALID_EXPIRATION;\n case 'invalid post-only order: order crosses book':\n return OrderResponseErrorCode.POST_ONLY_WOULD_CROSS;\n case 'post-only mode: only post-only orders and cancels are allowed':\n return OrderResponseErrorCode.POST_ONLY_MODE;\n case \"order couldn't be fully filled. FOK orders are fully filled or killed.\":\n return OrderResponseErrorCode.FOK_NOT_FILLED;\n case 'no orders found to match with FAK order. FAK orders are partially filled or killed if no match is found.':\n return OrderResponseErrorCode.FAK_NOT_FILLED;\n }\n\n // CLOB currently returns one legacy text bucket for both balance and\n // allowance failures, so expose a combined structured code here.\n if (response.errorMsg.includes('not enough balance / allowance')) {\n return OrderResponseErrorCode.INSUFFICIENT_BALANCE_OR_ALLOWANCE;\n }\n\n return OrderResponseErrorCode.UNKNOWN;\n}\n\nfunction isOrderPostStatus(status: string): status is OrderPostStatus {\n return (\n status === OrderPostStatus.LIVE ||\n status === OrderPostStatus.MATCHED ||\n status === OrderPostStatus.DELAYED\n );\n}\n","export const END_CURSOR = 'LTE=';\n","import { z } from 'zod';\nimport {\n ClobAssetIdSchema,\n type ConditionId,\n ConditionIdSchema,\n DecimalishSchema,\n type DecimalString,\n DecimalStringSchema,\n EpochMillisecondsToIsoDateTimeStringSchema,\n EventIdSchema,\n EvmAddressSchema,\n IsoCalendarDateStringSchema,\n MarketIdSchema,\n type PositionId,\n type TokenId,\n} from '../shared';\n\nconst CurrentRewardConfigSchema = z\n .object({\n id: z.number().int().optional(),\n asset_address: z.string(),\n start_date: EpochMillisecondsToIsoDateTimeStringSchema,\n end_date: EpochMillisecondsToIsoDateTimeStringSchema.optional(),\n rate_per_day: DecimalishSchema,\n total_rewards: DecimalishSchema.optional(),\n })\n .transform(\n ({\n asset_address,\n start_date,\n end_date,\n rate_per_day,\n total_rewards,\n ...rest\n }) => ({\n ...rest,\n assetAddress: asset_address,\n startDate: start_date,\n endDate: end_date,\n ratePerDay: rate_per_day,\n totalRewards: total_rewards,\n }),\n );\nexport type CurrentRewardConfig = z.infer<typeof CurrentRewardConfigSchema>;\n\nexport const CurrentRewardSchema = z\n .object({\n condition_id: ConditionIdSchema,\n rewards_max_spread: z.number().optional(),\n rewards_min_size: DecimalishSchema.optional(),\n rewards_config: z.array(CurrentRewardConfigSchema).optional(),\n sponsored_daily_rate: DecimalishSchema.optional(),\n sponsors_count: z.number().int().optional(),\n native_daily_rate: DecimalishSchema.optional(),\n total_daily_rate: DecimalishSchema.optional(),\n })\n .transform(\n ({\n condition_id,\n rewards_max_spread,\n rewards_min_size,\n rewards_config,\n sponsored_daily_rate,\n sponsors_count,\n native_daily_rate,\n total_daily_rate,\n ...rest\n }) => ({\n ...rest,\n conditionId: condition_id,\n rewardsMaxSpread: rewards_max_spread,\n rewardsMinSize: rewards_min_size,\n rewardsConfig: rewards_config,\n sponsoredDailyRate: sponsored_daily_rate,\n sponsorsCount: sponsors_count,\n nativeDailyRate: native_daily_rate,\n totalDailyRate: total_daily_rate,\n }),\n );\nexport type CurrentReward = z.infer<typeof CurrentRewardSchema>;\n\nexport const PaginatedCurrentRewardsSchema = z\n .object({\n limit: z.number().int(),\n count: z.number().int(),\n next_cursor: z.string(),\n data: z.array(CurrentRewardSchema),\n })\n .transform(({ next_cursor, ...rest }) => ({\n ...rest,\n nextCursor: next_cursor,\n }));\nexport type PaginatedCurrentRewards = z.infer<\n typeof PaginatedCurrentRewardsSchema\n>;\n\nconst RewardTokenSchema = z\n .object({\n token_id: ClobAssetIdSchema,\n outcome: z.string(),\n price: DecimalishSchema,\n })\n .transform(({ token_id, ...rest }) => ({\n ...rest,\n assetId: token_id,\n tokenId: token_id,\n })) satisfies z.ZodType<RewardToken>;\nexport type RewardToken = {\n assetId: TokenId | PositionId;\n /** @deprecated Use `assetId`. */\n tokenId: TokenId | PositionId;\n outcome: string;\n price: DecimalString;\n};\n\nconst RewardConfigSchema = z\n .object({\n asset_address: z.string(),\n start_date: EpochMillisecondsToIsoDateTimeStringSchema,\n end_date: EpochMillisecondsToIsoDateTimeStringSchema.optional(),\n rate_per_day: DecimalishSchema,\n total_rewards: DecimalishSchema.optional(),\n })\n .transform(\n ({\n asset_address,\n start_date,\n end_date,\n rate_per_day,\n total_rewards,\n ...rest\n }) => ({\n ...rest,\n assetAddress: asset_address,\n startDate: start_date,\n endDate: end_date,\n ratePerDay: rate_per_day,\n totalRewards: total_rewards,\n }),\n );\nexport type RewardConfig = z.infer<typeof RewardConfigSchema>;\n\nexport const MarketRewardSchema = z\n .object({\n condition_id: ConditionIdSchema,\n question: z.string(),\n market_slug: z.string().optional(),\n event_slug: z.string().optional(),\n image: z.string().optional(),\n rewards_max_spread: z.number().optional(),\n rewards_min_size: DecimalishSchema.optional(),\n market_competitiveness: z.number().optional(),\n tokens: z.array(RewardTokenSchema),\n rewards_config: z.array(RewardConfigSchema).optional(),\n })\n .transform(\n ({\n condition_id,\n market_slug,\n event_slug,\n rewards_max_spread,\n rewards_min_size,\n market_competitiveness,\n rewards_config,\n ...rest\n }) => ({\n ...rest,\n conditionId: condition_id,\n marketSlug: market_slug,\n eventSlug: event_slug,\n rewardsMaxSpread: rewards_max_spread,\n rewardsMinSize: rewards_min_size,\n marketCompetitiveness: market_competitiveness,\n rewardsConfig: rewards_config,\n }),\n ) satisfies z.ZodType<MarketReward>;\nexport type MarketReward = {\n conditionId: ConditionId;\n question: string;\n marketSlug: string | undefined;\n eventSlug: string | undefined;\n image?: string;\n rewardsMaxSpread: number | undefined;\n rewardsMinSize: DecimalString | undefined;\n marketCompetitiveness: number | undefined;\n tokens: RewardToken[];\n rewardsConfig: RewardConfig[] | undefined;\n};\n\nexport const PaginatedMarketRewardsSchema = z\n .object({\n limit: z.number().int(),\n count: z.number().int(),\n next_cursor: z.string(),\n data: z.array(MarketRewardSchema),\n })\n .transform(({ next_cursor, ...rest }) => ({\n ...rest,\n nextCursor: next_cursor,\n }));\nexport type PaginatedMarketRewards = z.infer<\n typeof PaginatedMarketRewardsSchema\n>;\n\n/** Fields available for ordering reward market discovery. */\nexport enum RewardMarketSort {\n MarketId = 'market_id',\n CreatedAt = 'created_at',\n Volume24Hr = 'volume_24hr',\n Spread = 'spread',\n Competitiveness = 'competitiveness',\n MaxSpread = 'max_spread',\n MinSize = 'min_size',\n Question = 'question',\n OneDayPriceChange = 'one_day_price_change',\n RatePerDay = 'rate_per_day',\n Price = 'price',\n EndDate = 'end_date',\n StartDate = 'start_date',\n RewardEndDate = 'reward_end_date',\n}\n\n/** Active market with its reward configurations and discovery metadata. */\nexport const RewardMarketSchema = z\n .object({\n condition_id: ConditionIdSchema,\n market_id: MarketIdSchema,\n market_slug: z.string(),\n question: z.string(),\n image: z.string(),\n market_competitiveness: z.number(),\n rewards_config: z.array(CurrentRewardConfigSchema),\n rewards_max_spread: z.number(),\n rewards_min_size: DecimalishSchema,\n spread: DecimalishSchema,\n tokens: z.array(RewardTokenSchema),\n group_item_title: z.string(),\n volume_24hr: DecimalishSchema,\n event_id: EventIdSchema,\n event_slug: z.string(),\n created_at: EpochMillisecondsToIsoDateTimeStringSchema,\n one_day_price_change: DecimalishSchema,\n end_date: z\n .literal('')\n .transform(() => undefined)\n .or(EpochMillisecondsToIsoDateTimeStringSchema),\n })\n .transform(\n ({\n condition_id,\n market_id,\n market_slug,\n market_competitiveness,\n rewards_config,\n rewards_max_spread,\n rewards_min_size,\n group_item_title,\n volume_24hr,\n event_id,\n event_slug,\n created_at,\n one_day_price_change,\n end_date,\n ...rest\n }) => ({\n ...rest,\n conditionId: condition_id,\n marketId: market_id,\n marketSlug: market_slug,\n marketCompetitiveness: market_competitiveness,\n rewardsConfig: rewards_config,\n rewardsMaxSpread: rewards_max_spread,\n rewardsMinSize: rewards_min_size,\n groupItemTitle: group_item_title,\n volume24hr: volume_24hr,\n eventId: event_id,\n eventSlug: event_slug,\n createdAt: created_at,\n oneDayPriceChange: one_day_price_change,\n endDate: end_date,\n }),\n );\nexport type RewardMarket = z.infer<typeof RewardMarketSchema>;\nexport const PaginatedRewardMarketsSchema = z\n .object({\n limit: z.number().int(),\n count: z.number().int(),\n next_cursor: z.string(),\n data: z.array(RewardMarketSchema),\n })\n .transform(({ next_cursor, ...rest }) => ({\n ...rest,\n nextCursor: next_cursor,\n }));\n\n/** Maker fee rebates for a calendar day, in USDC units. */\nexport const RebatedFeeSchema = z\n .object({\n date: IsoCalendarDateStringSchema,\n condition_id: ConditionIdSchema,\n asset_address: EvmAddressSchema,\n maker_address: EvmAddressSchema,\n rebated_fees_usdc: DecimalStringSchema,\n })\n .transform(\n ({\n condition_id,\n asset_address,\n maker_address,\n rebated_fees_usdc,\n ...rest\n }) => ({\n ...rest,\n conditionId: condition_id,\n assetAddress: asset_address,\n makerAddress: maker_address,\n rebatedFeesUsdc: rebated_fees_usdc,\n }),\n );\nexport type RebatedFee = z.infer<typeof RebatedFeeSchema>;\nexport const RebatedFeesResponseSchema = z\n .array(RebatedFeeSchema)\n .nullable()\n .transform((fees) => fees ?? []);\n","import { z } from 'zod';\nimport {\n type EvmAddress,\n EvmAddressSchema,\n type SessionSignerScope,\n SessionSignerScopeSchema,\n} from '../shared';\n\nexport type ActiveSessionSigner = {\n address: EvmAddress;\n scopes: SessionSignerScope[];\n validUntil: number;\n};\n\nexport const ActiveSessionSignerSchema = z\n .object({\n address: EvmAddressSchema,\n scopes: z.array(SessionSignerScopeSchema).min(1),\n valid_until: z.number().int().nonnegative(),\n })\n .transform(({ valid_until, ...rest }) => ({\n ...rest,\n validUntil: valid_until,\n })) satisfies z.ZodType<ActiveSessionSigner>;\n\nexport type ActiveSessionSignersResponse = {\n signers: ActiveSessionSigner[];\n wallet: EvmAddress;\n};\n\nexport const ActiveSessionSignersResponseSchema = z.object({\n signers: z.array(ActiveSessionSignerSchema),\n wallet: EvmAddressSchema,\n}) satisfies z.ZodType<ActiveSessionSignersResponse>;\n","import { z } from 'zod';\nimport { TickSizeValueSchema } from '../shared';\n\nexport const TickSizeSchema = z\n .object({\n minimum_tick_size: TickSizeValueSchema,\n })\n .transform(({ minimum_tick_size, ...rest }) => ({\n ...rest,\n minimumTickSize: minimum_tick_size,\n }));\n\nexport const FetchTickSizeResponseSchema = TickSizeSchema;\n\nexport type TickSize = z.infer<typeof TickSizeSchema>;\nexport type FetchTickSizeResponse = z.infer<typeof FetchTickSizeResponseSchema>;\n"]}
|