@polymarket/bindings 0.1.0-beta.5 → 0.1.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ import { EvmAddress, PrivateKey, TxHash } from '@polymarket/types';
2
+ import { z } from 'zod';
3
+ import { DecimalString, BaseUnits } from './index.js';
4
+
5
+ type Tagged<T, Tag extends string> = T & {
6
+ readonly __tag: Tag;
7
+ };
8
+ type PerpsInstrumentId = Tagged<number, 'PerpsInstrumentId'>;
9
+ type PerpsOrderId = Tagged<number, 'PerpsOrderId'>;
10
+ type PerpsClientOrderId = Tagged<string, 'PerpsClientOrderId'>;
11
+ type PerpsTradeId = Tagged<number, 'PerpsTradeId'>;
12
+ type PerpsWithdrawalId = Tagged<number, 'PerpsWithdrawalId'>;
13
+ type PerpsInternalTransferId = Tagged<number, 'PerpsInternalTransferId'>;
14
+ declare const PerpsInstrumentIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<PerpsInstrumentId, number>>;
15
+ declare const PerpsOrderIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<PerpsOrderId, number>>;
16
+ declare const PerpsClientOrderIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<PerpsClientOrderId, string>>;
17
+ declare const PerpsTradeIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<PerpsTradeId, number>>;
18
+ declare const PerpsWithdrawalIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<PerpsWithdrawalId, number>>;
19
+ declare const PerpsInternalTransferIdSchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<PerpsInternalTransferId, number>>;
20
+ declare const PerpsDecimalInputSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<DecimalString, string>>, z.ZodPipe<z.ZodNumber, z.ZodTransform<DecimalString, number>>]>;
21
+ type PerpsDecimalInput = z.input<typeof PerpsDecimalInputSchema>;
22
+ declare enum PerpsInstrumentType {
23
+ Perpetual = "perpetual"
24
+ }
25
+ declare enum PerpsInstrumentCategory {
26
+ Equity = "equity",
27
+ Commodity = "commodity",
28
+ Index = "index",
29
+ Crypto = "crypto"
30
+ }
31
+ declare enum PerpsSide {
32
+ Long = "long",
33
+ Short = "short"
34
+ }
35
+ declare enum PerpsTimeInForce {
36
+ Gtc = "gtc",
37
+ Ioc = "ioc",
38
+ Fok = "fok"
39
+ }
40
+ declare enum PerpsDepositStatus {
41
+ Pending = "pending",
42
+ Confirmed = "confirmed",
43
+ Removed = "removed"
44
+ }
45
+ declare enum PerpsWithdrawalStatus {
46
+ Pending = "pending",
47
+ Confirmed = "confirmed",
48
+ Removed = "removed"
49
+ }
50
+ declare enum PerpsInternalTransferDirection {
51
+ In = "in",
52
+ Out = "out"
53
+ }
54
+ declare enum PerpsKlineInterval {
55
+ OneSecond = "1s",
56
+ OneMinute = "1m",
57
+ FiveMinutes = "5m",
58
+ FifteenMinutes = "15m",
59
+ OneHour = "1h",
60
+ FourHours = "4h",
61
+ OneDay = "1d",
62
+ OneWeek = "1w"
63
+ }
64
+ declare enum PerpsPnlInterval {
65
+ OneHour = "1h",
66
+ FourHours = "4h",
67
+ OneDay = "1d",
68
+ OneWeek = "1w"
69
+ }
70
+ declare const PerpsInstrumentTypeSchema: z.ZodEnum<typeof PerpsInstrumentType>;
71
+ declare const PerpsInstrumentCategorySchema: z.ZodEnum<typeof PerpsInstrumentCategory>;
72
+ declare const PerpsSideSchema: z.ZodEnum<typeof PerpsSide>;
73
+ declare const PerpsTimeInForceSchema: z.ZodEnum<typeof PerpsTimeInForce>;
74
+ declare const PerpsDepositStatusSchema: z.ZodEnum<typeof PerpsDepositStatus>;
75
+ declare const PerpsWithdrawalStatusSchema: z.ZodEnum<typeof PerpsWithdrawalStatus>;
76
+ declare const PerpsInternalTransferDirectionSchema: z.ZodEnum<typeof PerpsInternalTransferDirection>;
77
+ declare const PerpsKlineIntervalSchema: z.ZodEnum<typeof PerpsKlineInterval>;
78
+ declare const PerpsPnlIntervalSchema: z.ZodEnum<typeof PerpsPnlInterval>;
79
+ declare const PerpsAssetSchema: z.ZodString;
80
+ declare const RawPerpsTxHashSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<TxHash, string>>>>;
81
+ declare const PerpsDataResponseSchema: <T extends z.ZodType>(itemSchema: T) => z.ZodObject<{
82
+ data: z.ZodArray<T>;
83
+ more: z.ZodBoolean;
84
+ }, z.core.$strip>;
85
+ type PerpsCredentials = {
86
+ proxy: EvmAddress;
87
+ privateKey: PrivateKey;
88
+ secret: string;
89
+ expiresAt: number;
90
+ };
91
+ type PerpsDepositAmount = BaseUnits;
92
+ type PerpsWithdrawalAmount = BaseUnits;
93
+ type PerpsTxHash = TxHash;
94
+ type PerpsDecimal = DecimalString;
95
+ declare function perpsDecimal(value: string | number): DecimalString;
96
+ declare function perpsBaseUnits(value: string): BaseUnits;
97
+ declare function decimalString(value: string): DecimalString;
98
+
99
+ export { PerpsKlineInterval as A, PerpsKlineIntervalSchema as B, PerpsOrderIdSchema as C, PerpsPnlInterval as D, PerpsPnlIntervalSchema as E, PerpsSideSchema as F, PerpsTimeInForceSchema as G, PerpsTradeIdSchema as H, type PerpsTxHash as I, type PerpsWithdrawalAmount as J, PerpsWithdrawalIdSchema as K, PerpsWithdrawalStatusSchema as L, decimalString as M, perpsBaseUnits as N, perpsDecimal as O, type PerpsInstrumentId as P, RawPerpsTxHashSchema as R, PerpsDepositStatus as a, type PerpsWithdrawalId as b, PerpsWithdrawalStatus as c, type PerpsInternalTransferId as d, PerpsInternalTransferDirection as e, PerpsInstrumentType as f, PerpsInstrumentCategory as g, type PerpsTradeId as h, PerpsSide as i, type PerpsOrderId as j, PerpsTimeInForce as k, type PerpsClientOrderId as l, PerpsAssetSchema as m, PerpsClientOrderIdSchema as n, type PerpsCredentials as o, PerpsDataResponseSchema as p, type PerpsDecimal as q, type PerpsDecimalInput as r, PerpsDecimalInputSchema as s, type PerpsDepositAmount as t, PerpsDepositStatusSchema as u, PerpsInstrumentCategorySchema as v, PerpsInstrumentIdSchema as w, PerpsInstrumentTypeSchema as x, PerpsInternalTransferDirectionSchema as y, PerpsInternalTransferIdSchema as z };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { EpochMilliseconds, CtfConditionId, TokenId, DecimalString, IsoDateTimeString, MixedDateTimeString, ComboConditionId, PositionId, PaginationCursor, IsoCalendarDateString } from '../index.js';
2
+ import { EpochMilliseconds, DecimalString, CtfConditionId, TokenId, ComboConditionId, PositionId, IsoDateTimeString, MixedDateTimeString, PaginationCursor, IsoCalendarDateString } from '../index.js';
3
3
  import { TxHash } from '@polymarket/types';
4
4
 
5
5
  declare const AddressSchema: z.ZodString;
@@ -67,34 +67,49 @@ type ActivityBase = {
67
67
  /** Optimized profile image URL for the wallet owner. */
68
68
  profileImageOptimized: string | null;
69
69
  };
70
- type TradeActivity = ActivityBase & {
70
+ type TradeActivityBase = ActivityBase & {
71
71
  /** A directional outcome-token trade. */
72
- type: 'TRADE';
73
- /** Condition id of the market traded by the wallet. */
74
- conditionId: CtfConditionId;
75
- /** Outcome token id bought or sold by the wallet. */
76
- tokenId: TokenId;
77
- /** Direction of the wallet's trade in the outcome token. */
72
+ type: ActivityType.TRADE;
73
+ /** Whether this trade is for a Combo position instead of a binary market token. */
74
+ isCombo: boolean;
75
+ /** Direction of the wallet's trade. */
78
76
  side: Side;
79
- /** Number of outcome-token shares traded by the wallet. */
77
+ /** Number of shares traded by the wallet. */
80
78
  shares: DecimalString;
81
79
  /** The notional value of the traded shares in USD. */
82
80
  amount: DecimalString;
83
- /** The execution price per outcome-token share in USD. */
81
+ /** The execution price per share in USD. */
84
82
  price: DecimalString;
83
+ /** Human-readable title of the traded market or Combo. */
84
+ title: string;
85
+ /** Icon URL for the traded market or Combo, when available. */
86
+ icon: string | null;
87
+ };
88
+ type ClobTradeActivity = TradeActivityBase & {
89
+ /** CLOB market trades are binary market outcome-token trades. */
90
+ isCombo: false;
91
+ /** Condition id of the market traded by the wallet. */
92
+ conditionId: CtfConditionId;
93
+ /** Outcome token id bought or sold by the wallet. */
94
+ tokenId: TokenId;
85
95
  /** Display label of the outcome token traded by the wallet. */
86
96
  outcome: string;
87
97
  /** Zero-based index of the outcome token in the market's outcome list. */
88
98
  outcomeIndex: number;
89
- /** Human-readable title of the market traded by the wallet. */
90
- title: string;
91
99
  /** URL slug of the market traded by the wallet. */
92
100
  slug: string;
93
- /** Icon URL for the market traded by the wallet, when available. */
94
- icon: string | null;
95
101
  /** URL slug of the event containing the traded market. */
96
102
  eventSlug: string;
97
103
  };
104
+ type ComboTradeActivity = TradeActivityBase & {
105
+ /** Combo trades are protocol v2 Combo position trades. */
106
+ isCombo: true;
107
+ /** Combo condition id traded by the wallet. */
108
+ conditionId: ComboConditionId;
109
+ /** Combo position id bought or sold by the wallet. */
110
+ positionId: PositionId;
111
+ };
112
+ type TradeActivity = ClobTradeActivity | ComboTradeActivity;
98
113
  type SplitActivity = ActivityBase & {
99
114
  /** Splitting collateral into a complete market set. */
100
115
  type: 'SPLIT';
@@ -197,7 +212,7 @@ declare const TradeSchema: z.ZodPipe<z.ZodObject<{
197
212
  timestamp: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
198
213
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
214
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
201
216
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
202
217
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
203
218
  outcomeIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -266,7 +281,7 @@ declare const ListTradesResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
266
281
  timestamp: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
267
282
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
268
283
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
270
285
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
271
286
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
287
  outcomeIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -620,7 +635,7 @@ declare const PositionSchema: z.ZodPipe<z.ZodObject<{
620
635
  mergeable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
621
636
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
622
637
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
623
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
638
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
624
639
  eventId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
625
640
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
626
641
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -695,7 +710,7 @@ declare const ClosedPositionSchema: z.ZodPipe<z.ZodObject<{
695
710
  timestamp: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
696
711
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
697
712
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
698
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
713
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
699
714
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
700
715
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
701
716
  outcomeIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -1630,7 +1645,7 @@ declare const ListPositionsResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
1630
1645
  mergeable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1631
1646
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1632
1647
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1633
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1648
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1634
1649
  eventId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1635
1650
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1636
1651
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1705,7 +1720,7 @@ declare const ListClosedPositionsResponseSchema: z.ZodArray<z.ZodPipe<z.ZodObjec
1705
1720
  timestamp: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodNumber, z.ZodTransform<EpochMilliseconds, number>>>>;
1706
1721
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1707
1722
  slug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1708
- icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1723
+ icon: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodNullable<z.ZodString>>>;
1709
1724
  eventSlug: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1710
1725
  outcome: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1711
1726
  outcomeIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -1823,4 +1838,4 @@ type FetchPortfolioValueResponse = z.infer<typeof FetchPortfolioValueResponseSch
1823
1838
  type ListMarketPositionsResponse = z.infer<typeof ListMarketPositionsResponseSchema>;
1824
1839
  type ListComboPositionsResponse = z.infer<typeof ListComboPositionsResponseSchema>;
1825
1840
 
1826
- export { type Activity, type ActivityBase, ActivitySchema, ActivityType, ActivityTypeSchema, type Address, AddressSchema, type BuilderVolumeEntry, BuilderVolumeEntrySchema, type ClosedPosition, ClosedPositionSchema, type ComboPosition, type ComboPositionLeg, ComboPositionLegSchema, type ComboPositionMarket, type ComboPositionMarketEvent, ComboPositionMarketEventSchema, ComboPositionMarketSchema, ComboPositionSchema, ComboPositionStatus, ComboPositionStatusSchema, type ConversionActivity, type FetchEventLiveVolumeResponse, FetchEventLiveVolumeResponseSchema, type FetchPortfolioValueResponse, FetchPortfolioValueResponseSchema, type Hash64, Hash64Schema, type Holder, HolderSchema, type LeaderboardCategory, LeaderboardCategorySchema, type LeaderboardEntry, LeaderboardEntrySchema, type LeaderboardOrderBy, LeaderboardOrderBySchema, type ListActivityResponse, ListActivityResponseSchema, type ListBuilderLeaderboardResponse, ListBuilderLeaderboardResponseSchema, type ListBuilderVolumeResponse, ListBuilderVolumeResponseSchema, type ListClosedPositionsResponse, ListClosedPositionsResponseSchema, type ListComboPositionsResponse, ListComboPositionsResponseSchema, type ListMarketHoldersResponse, ListMarketHoldersResponseSchema, type ListMarketPositionsResponse, ListMarketPositionsResponseSchema, type ListOpenInterestResponse, ListOpenInterestResponseSchema, type ListPositionsResponse, ListPositionsResponseSchema, type ListTraderLeaderboardResponse, ListTraderLeaderboardResponseSchema, type ListTradesResponse, ListTradesResponseSchema, type LiveVolume, LiveVolumeSchema, type MakerRebateActivity, type MarketPosition, MarketPositionSchema, type MarketVolume, MarketVolumeSchema, type MergeActivity, type MetaHolder, MetaHolderSchema, type MetaMarketPosition, MetaMarketPositionSchema, type OpenInterest, OpenInterestSchema, type Position, PositionSchema, type RedeemActivity, type ReferralRewardActivity, type RewardActivity, type Side, SideSchema, type SplitActivity, type TimePeriod, TimePeriodSchema, type Trade, type TradeActivity, TradeSchema, type Traded, TradedSchema, type TraderLeaderboardEntry, TraderLeaderboardEntrySchema, type Value, ValueSchema, type YieldActivity };
1841
+ export { type Activity, type ActivityBase, ActivitySchema, ActivityType, ActivityTypeSchema, type Address, AddressSchema, type BuilderVolumeEntry, BuilderVolumeEntrySchema, type ClobTradeActivity, type ClosedPosition, ClosedPositionSchema, type ComboPosition, type ComboPositionLeg, ComboPositionLegSchema, type ComboPositionMarket, type ComboPositionMarketEvent, ComboPositionMarketEventSchema, ComboPositionMarketSchema, ComboPositionSchema, ComboPositionStatus, ComboPositionStatusSchema, type ComboTradeActivity, type ConversionActivity, type FetchEventLiveVolumeResponse, FetchEventLiveVolumeResponseSchema, type FetchPortfolioValueResponse, FetchPortfolioValueResponseSchema, type Hash64, Hash64Schema, type Holder, HolderSchema, type LeaderboardCategory, LeaderboardCategorySchema, type LeaderboardEntry, LeaderboardEntrySchema, type LeaderboardOrderBy, LeaderboardOrderBySchema, type ListActivityResponse, ListActivityResponseSchema, type ListBuilderLeaderboardResponse, ListBuilderLeaderboardResponseSchema, type ListBuilderVolumeResponse, ListBuilderVolumeResponseSchema, type ListClosedPositionsResponse, ListClosedPositionsResponseSchema, type ListComboPositionsResponse, ListComboPositionsResponseSchema, type ListMarketHoldersResponse, ListMarketHoldersResponseSchema, type ListMarketPositionsResponse, ListMarketPositionsResponseSchema, type ListOpenInterestResponse, ListOpenInterestResponseSchema, type ListPositionsResponse, ListPositionsResponseSchema, type ListTraderLeaderboardResponse, ListTraderLeaderboardResponseSchema, type ListTradesResponse, ListTradesResponseSchema, type LiveVolume, LiveVolumeSchema, type MakerRebateActivity, type MarketPosition, MarketPositionSchema, type MarketVolume, MarketVolumeSchema, type MergeActivity, type MetaHolder, MetaHolderSchema, type MetaMarketPosition, MetaMarketPositionSchema, type OpenInterest, OpenInterestSchema, type Position, PositionSchema, type RedeemActivity, type ReferralRewardActivity, type RewardActivity, type Side, SideSchema, type SplitActivity, type TimePeriod, TimePeriodSchema, type Trade, type TradeActivity, TradeSchema, type Traded, TradedSchema, type TraderLeaderboardEntry, TraderLeaderboardEntrySchema, type Value, ValueSchema, type YieldActivity };
@@ -1,2 +1,2 @@
1
- import {ba,Ia,X as X$1,Ea,Ga,ka,la,ma,xa,W as W$1,wa}from'../chunk-IHJYHHWK.js';import {z as z$1}from'zod';var u=z$1.string(),L=z$1.string(),A=(m=>(m.TRADE="TRADE",m.SPLIT="SPLIT",m.MERGE="MERGE",m.REDEEM="REDEEM",m.REWARD="REWARD",m.CONVERSION="CONVERSION",m.MAKER_REBATE="MAKER_REBATE",m.REFERRAL_REWARD="REFERRAL_REWARD",m.YIELD="YIELD",m))(A||{}),k=z$1.enum(A),P=z$1.enum(["BUY","SELL"]),ae=z$1.enum(["DAY","WEEK","MONTH","ALL"]),ue=z$1.enum(["OVERALL","POLITICS","SPORTS","CRYPTO","CULTURE","MENTIONS","WEATHER","ECONOMICS","TECH","FINANCE"]),pe=z$1.enum(["PNL","VOL"]);var h=z$1.preprocess(e=>e===""?void 0:e,z$1.string().optional()),j=z$1.object({proxyWallet:u.nullish(),side:P.nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),size:Ia.nullish(),price:Ia.nullish(),timestamp:ba.nullish(),title:z$1.string().nullish(),slug:z$1.string().nullish(),icon:z$1.string().nullish(),eventSlug:z$1.string().nullish(),outcome:z$1.string().nullish(),outcomeIndex:z$1.number().int().nullish(),name:z$1.string().nullish(),pseudonym:z$1.string().nullish(),bio:z$1.string().nullish(),profileImage:z$1.string().nullish(),profileImageOptimized:z$1.string().nullish(),transactionHash:z$1.string().nullish()}).transform(({asset:e,proxyWallet:i,...a})=>({...a,wallet:i,tokenId:e})),w=z$1.object({proxyWallet:u.nullish(),timestamp:ba.nullish(),conditionId:z$1.preprocess(e=>e===""?void 0:e,X$1.optional()),type:k,size:Ia.nullish(),usdcSize:Ia.nullish(),transactionHash:Ga.nullish(),price:Ia.nullish(),asset:z$1.preprocess(e=>e===""?void 0:e,Ea.optional()),side:z$1.preprocess(e=>e===""?void 0:e,P.nullish()),outcomeIndex:z$1.preprocess(e=>e===999?void 0:e,z$1.number().int().optional()),title:h,slug:h,icon:h,eventSlug:h,outcome:h,name:h,pseudonym:h,bio:h,profileImage:h,profileImageOptimized:h}),W=w.transform(N),ge=z$1.object({user:u.nullish(),traded:z$1.number().int().nullish()}),ye=z$1.array(j),Se=z$1.array(W);function N(e){let i=F(e);switch(e.type){case "TRADE":return {...i,type:e.type,conditionId:r(e.conditionId,"conditionId"),tokenId:r(e.asset,"asset"),side:r(e.side,"side"),shares:r(e.size,"size"),amount:z(e),price:r(e.price,"price"),outcome:r(e.outcome,"outcome"),outcomeIndex:r(e.outcomeIndex,"outcomeIndex"),title:r(e.title,"title"),slug:r(e.slug,"slug"),icon:e.icon??null,eventSlug:r(e.eventSlug,"eventSlug")};case "SPLIT":case "MERGE":case "REDEEM":case "CONVERSION":return {...i,type:e.type,conditionId:r(e.conditionId,"conditionId"),amount:z(e),title:r(e.title,"title"),slug:r(e.slug,"slug"),icon:e.icon??null,eventSlug:r(e.eventSlug,"eventSlug")};case "REWARD":case "MAKER_REBATE":case "REFERRAL_REWARD":case "YIELD":return {...i,type:e.type,amount:z(e)}}}function F(e){return {wallet:r(e.proxyWallet,"proxyWallet"),timestamp:r(e.timestamp,"timestamp"),transactionHash:r(e.transactionHash,"transactionHash"),name:e.name??null,pseudonym:e.pseudonym??null,bio:e.bio??null,profileImage:e.profileImage??null,profileImageOptimized:e.profileImageOptimized??null}}function z(e){return r(e.usdcSize??e.size,"usdcSize")}function r(e,i){if(e==null)throw new TypeError(`Expected activity.${i} to be present`);return e}var U=z$1.object({proxyWallet:u.nullish(),bio:z$1.string().nullish(),asset:Ea.nullish(),pseudonym:z$1.string().nullish(),amount:Ia.nullish(),displayUsernamePublic:z$1.boolean().nullish(),outcomeIndex:z$1.number().int().nullish(),name:z$1.string().nullish(),profileImage:z$1.string().nullish(),profileImageOptimized:z$1.string().nullish()}).transform(({asset:e,proxyWallet:i,...a})=>({...a,wallet:i,tokenId:e})),Y=z$1.object({token:z$1.string().nullish(),holders:z$1.array(U).nullish()}),K=z$1.object({market:L.nullish(),value:Ia.nullish()}),G=z$1.object({market:L.nullish(),value:Ia.nullish()}),Z=z$1.object({total:Ia.nullish(),markets:z$1.array(G).nullish()}),Ie=z$1.array(Y),Ee=z$1.array(K),Le=z$1.array(Z);var $=z$1.object({rank:z$1.string().nullish(),builder:z$1.string().nullish(),volume:Ia.nullish(),activeUsers:z$1.number().int().nullish(),verified:z$1.boolean().nullish(),builderLogo:z$1.string().nullish()}),q=z$1.object({dt:ka.nullish(),builder:z$1.string().nullish(),builderLogo:z$1.string().nullish(),verified:z$1.boolean().nullish(),volume:Ia.nullish(),activeUsers:z$1.number().int().nullish(),rank:z$1.string().nullish()}).transform(({dt:e,...i})=>({...i,bucketAt:e})),J=z$1.object({rank:z$1.string().nullish(),proxyWallet:u.nullish(),userName:z$1.string().nullish(),vol:Ia.nullish(),pnl:Ia.nullish(),profileImage:z$1.string().nullish(),xUsername:z$1.string().nullish(),verifiedBadge:z$1.boolean().nullish()}).transform(({proxyWallet:e,...i})=>({...i,wallet:e})),Ce=z$1.array($),Te=z$1.array(q),_e=z$1.array(J);var D=(d=>(d.Open="OPEN",d.Partial="PARTIAL",d.ResolvedWin="RESOLVED_WIN",d.ResolvedLoss="RESOLVED_LOSS",d))(D||{}),O=z$1.enum(D),Q=z$1.object({proxyWallet:u.nullish(),asset:Ea.nullish(),conditionId:X$1,size:Ia.nullish(),avgPrice:Ia.nullish(),initialValue:Ia.nullish(),currentValue:Ia.nullish(),cashPnl:Ia.nullish(),percentPnl:z$1.number().nullish(),totalBought:Ia.nullish(),realizedPnl:Ia.nullish(),percentRealizedPnl:z$1.number().nullish(),curPrice:Ia.nullish(),redeemable:z$1.boolean().nullish(),mergeable:z$1.boolean().nullish(),title:z$1.string().nullish(),slug:z$1.string().nullish(),icon:z$1.string().nullish(),eventId:z$1.string().nullish(),eventSlug:z$1.string().nullish(),outcome:z$1.string().nullish(),outcomeIndex:z$1.number().int().nullish(),oppositeOutcome:z$1.string().nullish(),oppositeAsset:Ea.nullish(),endDate:la.nullish(),negativeRisk:z$1.boolean().nullish()}).transform(({asset:e,oppositeAsset:i,proxyWallet:a,...p})=>({...p,wallet:a,tokenId:e,oppositeTokenId:i})),X=z$1.object({proxyWallet:u.nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),avgPrice:Ia.nullish(),totalBought:Ia.nullish(),realizedPnl:Ia.nullish(),curPrice:Ia.nullish(),timestamp:ba.nullish(),title:z$1.string().nullish(),slug:z$1.string().nullish(),icon:z$1.string().nullish(),eventSlug:z$1.string().nullish(),outcome:z$1.string().nullish(),outcomeIndex:z$1.number().int().nullish(),oppositeOutcome:z$1.string().nullish(),oppositeAsset:Ea.nullish(),endDate:ma.nullish()}).transform(({asset:e,oppositeAsset:i,proxyWallet:a,...p})=>({...p,wallet:a,tokenId:e,oppositeTokenId:i})),ee=z$1.object({user:u.nullish(),value:Ia.nullish()}),te=z$1.object({proxyWallet:u.nullish(),name:z$1.string().nullish(),profileImage:z$1.string().nullish(),verified:z$1.boolean().nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),avgPrice:Ia.nullish(),size:Ia.nullish(),currPrice:Ia.nullish(),currentValue:Ia.nullish(),cashPnl:Ia.nullish(),totalBought:Ia.nullish(),realizedPnl:Ia.nullish(),totalPnl:Ia.nullish(),outcome:z$1.string().nullish(),outcomeIndex:z$1.number().int().nullish()}).transform(({asset:e,proxyWallet:i,...a})=>({...a,wallet:i,tokenId:e})),ne=z$1.object({token:z$1.string().nullish(),positions:z$1.array(te).nullish()}),ie=z$1.object({event_id:z$1.string().nullish(),event_slug:z$1.string().nullish(),event_title:z$1.string().nullish(),event_image:z$1.string().nullish()}).transform(({event_id:e,event_slug:i,event_title:a,event_image:p})=>({eventId:e,eventSlug:i,eventTitle:a,eventImage:p})),oe=z$1.object({market_id:z$1.string().nullish(),slug:z$1.string().nullish(),title:z$1.string().nullish(),outcome:z$1.string().nullish(),image_url:z$1.string().nullish(),icon_url:z$1.string().nullish(),category:z$1.string().nullish(),subcategory:z$1.string().nullish(),tags:z$1.array(z$1.string()).nullish(),end_date:ka.nullish(),event:ie.nullish()}).transform(({market_id:e,image_url:i,icon_url:a,end_date:p,...d})=>({...d,marketId:e,imageUrl:i,iconUrl:a,endDate:p})),se=z$1.object({leg_index:z$1.number().int(),leg_position_id:xa,leg_condition_id:X$1,leg_outcome_index:z$1.number().int(),leg_outcome_label:z$1.string().nullish(),leg_status:O,leg_resolved_at:ka.nullish(),leg_current_price:Ia.nullish(),market:oe.nullish()}).transform(({leg_index:e,leg_position_id:i,leg_condition_id:a,leg_outcome_index:p,leg_outcome_label:d,leg_status:x,leg_resolved_at:R,leg_current_price:b,...I})=>({...I,legIndex:e,legPositionId:i,legConditionId:a,legOutcomeIndex:p,legOutcomeLabel:d,legStatus:x,legResolvedAt:R,legCurrentPrice:b})),re=z$1.object({combo_condition_id:W$1,combo_position_id:xa,module_id:z$1.number().int(),user_address:u,shares_balance:Ia,entry_avg_price_usdc:Ia.nullish(),entry_cost_usdc:Ia.nullish(),status:O,first_entry_at:ka,resolved_at:ka.nullish(),legs_total:z$1.number().int(),legs_resolved:z$1.number().int(),legs_pending:z$1.number().int(),legs:z$1.array(se)}).transform(({combo_condition_id:e,combo_position_id:i,module_id:a,user_address:p,shares_balance:d,entry_avg_price_usdc:x,entry_cost_usdc:R,first_entry_at:b,resolved_at:I,legs_total:m,legs_resolved:B,legs_pending:V,...H})=>({...H,conditionId:e,positionId:i,moduleId:a,userAddress:p,shares:d,entryAvgPriceUsdc:x,entryCostUsdc:R,firstEntryAt:b,resolvedAt:I,legsTotal:m,legsResolved:B,legsPending:V})),Be=z$1.object({combos:z$1.array(re),pagination:z$1.object({limit:z$1.number().int(),offset:z$1.number().int(),has_more:z$1.boolean(),next_cursor:wa.nullish()})}).transform(({pagination:e,...i})=>({...i,pagination:{limit:e.limit,offset:e.offset,hasMore:e.has_more,nextCursor:e.next_cursor}})),Ve=z$1.array(Q),He=z$1.array(X),je=z$1.array(ee),we=z$1.array(ne);export{W as ActivitySchema,A as ActivityType,k as ActivityTypeSchema,u as AddressSchema,q as BuilderVolumeEntrySchema,X as ClosedPositionSchema,se as ComboPositionLegSchema,ie as ComboPositionMarketEventSchema,oe as ComboPositionMarketSchema,re as ComboPositionSchema,D as ComboPositionStatus,O as ComboPositionStatusSchema,Le as FetchEventLiveVolumeResponseSchema,je as FetchPortfolioValueResponseSchema,L as Hash64Schema,U as HolderSchema,ue as LeaderboardCategorySchema,$ as LeaderboardEntrySchema,pe as LeaderboardOrderBySchema,Se as ListActivityResponseSchema,Ce as ListBuilderLeaderboardResponseSchema,Te as ListBuilderVolumeResponseSchema,He as ListClosedPositionsResponseSchema,Be as ListComboPositionsResponseSchema,Ie as ListMarketHoldersResponseSchema,we as ListMarketPositionsResponseSchema,Ee as ListOpenInterestResponseSchema,Ve as ListPositionsResponseSchema,_e as ListTraderLeaderboardResponseSchema,ye as ListTradesResponseSchema,Z as LiveVolumeSchema,te as MarketPositionSchema,G as MarketVolumeSchema,Y as MetaHolderSchema,ne as MetaMarketPositionSchema,K as OpenInterestSchema,Q as PositionSchema,P as SideSchema,ae as TimePeriodSchema,j as TradeSchema,ge as TradedSchema,J as TraderLeaderboardEntrySchema,ee as ValueSchema};//# sourceMappingURL=index.js.map
1
+ import {Ma,ba,Ja,X as X$1,Ea,Ga,xa,W as W$1,ka,la,ma,wa}from'../chunk-SB2LAVJ4.js';import {z}from'zod';var p=z.string(),v=z.string(),C=(u=>(u.TRADE="TRADE",u.SPLIT="SPLIT",u.MERGE="MERGE",u.REDEEM="REDEEM",u.REWARD="REWARD",u.CONVERSION="CONVERSION",u.MAKER_REBATE="MAKER_REBATE",u.REFERRAL_REWARD="REFERRAL_REWARD",u.YIELD="YIELD",u))(C||{}),D=z.enum(C),P=z.enum(["BUY","SELL"]),ce=z.enum(["DAY","WEEK","MONTH","ALL"]),ue=z.enum(["OVERALL","POLITICS","SPORTS","CRYPTO","CULTURE","MENTIONS","WEATHER","ECONOMICS","TECH","FINANCE"]),me=z.enum(["PNL","VOL"]);var h=z.preprocess(e=>e===""?void 0:e,z.string().optional()),w=z.object({proxyWallet:p.nullish(),side:P.nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),size:Ja.nullish(),price:Ja.nullish(),timestamp:ba.nullish(),title:z.string().nullish(),slug:z.string().nullish(),icon:z.preprocess(Ma,z.string().nullish()),eventSlug:z.string().nullish(),outcome:z.string().nullish(),outcomeIndex:z.number().int().nullish(),name:z.string().nullish(),pseudonym:z.string().nullish(),bio:z.string().nullish(),profileImage:z.string().nullish(),profileImageOptimized:z.string().nullish(),transactionHash:z.string().nullish()}).transform(({asset:e,proxyWallet:i,...r})=>({...r,wallet:i,tokenId:e})),W=z.object({proxyWallet:p.nullish(),timestamp:ba.nullish(),conditionId:z.preprocess(e=>e===""?void 0:e,z.string().optional()),type:D,size:Ja.nullish(),usdcSize:Ja.nullish(),transactionHash:Ga.nullish(),price:Ja.nullish(),asset:z.preprocess(e=>e===""?void 0:e,z.string().optional()),side:z.preprocess(e=>e===""?void 0:e,P.nullish()),isCombo:z.boolean().optional(),outcomeIndex:z.preprocess(e=>e===999?void 0:e,z.number().int().optional()),title:h,slug:h,icon:h,eventSlug:h,outcome:h,name:h,pseudonym:h,bio:h,profileImage:h,profileImageOptimized:h}),N=W.transform(F),Se=z.object({user:p.nullish(),traded:z.number().int().nullish()}),fe=z.array(w),xe=z.array(N);function F(e){let i=Y(e);switch(e.type){case "TRADE":return U(e,i);case "SPLIT":case "MERGE":case "REDEEM":case "CONVERSION":return {...i,type:e.type,conditionId:X$1.parse(l(e.conditionId,"conditionId")),amount:T(e),title:l(e.title,"title"),slug:l(e.slug,"slug"),icon:e.icon??null,eventSlug:l(e.eventSlug,"eventSlug")};case "REWARD":case "MAKER_REBATE":case "REFERRAL_REWARD":case "YIELD":return {...i,type:e.type,amount:T(e)}}}function U(e,i){let r={...i,type:"TRADE",side:l(e.side,"side"),shares:l(e.size,"size"),amount:T(e),price:l(e.price,"price"),title:l(e.title,"title"),icon:e.icon??null};return e.isCombo===true?{...r,isCombo:true,conditionId:W$1.parse(l(e.conditionId,"conditionId")),positionId:xa.parse(l(e.asset,"asset"))}:{...r,isCombo:false,conditionId:X$1.parse(l(e.conditionId,"conditionId")),tokenId:Ea.parse(l(e.asset,"asset")),outcome:l(e.outcome,"outcome"),outcomeIndex:l(e.outcomeIndex,"outcomeIndex"),slug:l(e.slug,"slug"),eventSlug:l(e.eventSlug,"eventSlug")}}function Y(e){return {wallet:l(e.proxyWallet,"proxyWallet"),timestamp:l(e.timestamp,"timestamp"),transactionHash:l(e.transactionHash,"transactionHash"),name:e.name??null,pseudonym:e.pseudonym??null,bio:e.bio??null,profileImage:e.profileImage??null,profileImageOptimized:e.profileImageOptimized??null}}function T(e){return l(e.usdcSize??e.size,"usdcSize")}function l(e,i){if(e==null)throw new TypeError(`Expected activity.${i} to be present`);return e}var K=z.object({proxyWallet:p.nullish(),bio:z.string().nullish(),asset:Ea.nullish(),pseudonym:z.string().nullish(),amount:Ja.nullish(),displayUsernamePublic:z.boolean().nullish(),outcomeIndex:z.number().int().nullish(),name:z.string().nullish(),profileImage:z.string().nullish(),profileImageOptimized:z.string().nullish()}).transform(({asset:e,proxyWallet:i,...r})=>({...r,wallet:i,tokenId:e})),G=z.object({token:z.string().nullish(),holders:z.array(K).nullish()}),Z=z.object({market:v.nullish(),value:Ja.nullish()}),$=z.object({market:v.nullish(),value:Ja.nullish()}),q=z.object({total:Ja.nullish(),markets:z.array($).nullish()}),Ee=z.array(G),Le=z.array(Z),ve=z.array(q);var J=z.object({rank:z.string().nullish(),builder:z.string().nullish(),volume:Ja.nullish(),activeUsers:z.number().int().nullish(),verified:z.boolean().nullish(),builderLogo:z.string().nullish()}),Q=z.object({dt:ka.nullish(),builder:z.string().nullish(),builderLogo:z.string().nullish(),verified:z.boolean().nullish(),volume:Ja.nullish(),activeUsers:z.number().int().nullish(),rank:z.string().nullish()}).transform(({dt:e,...i})=>({...i,bucketAt:e})),X=z.object({rank:z.string().nullish(),proxyWallet:p.nullish(),userName:z.string().nullish(),vol:Ja.nullish(),pnl:Ja.nullish(),profileImage:z.string().nullish(),xUsername:z.string().nullish(),verifiedBadge:z.boolean().nullish()}).transform(({proxyWallet:e,...i})=>({...i,wallet:e})),_e=z.array(J),Me=z.array(Q),ke=z.array(X);var O=(d=>(d.Open="OPEN",d.Partial="PARTIAL",d.ResolvedWin="RESOLVED_WIN",d.ResolvedLoss="RESOLVED_LOSS",d))(O||{}),B=z.enum(O),ee=z.object({proxyWallet:p.nullish(),asset:Ea.nullish(),conditionId:X$1,size:Ja.nullish(),avgPrice:Ja.nullish(),initialValue:Ja.nullish(),currentValue:Ja.nullish(),cashPnl:Ja.nullish(),percentPnl:z.number().nullish(),totalBought:Ja.nullish(),realizedPnl:Ja.nullish(),percentRealizedPnl:z.number().nullish(),curPrice:Ja.nullish(),redeemable:z.boolean().nullish(),mergeable:z.boolean().nullish(),title:z.string().nullish(),slug:z.string().nullish(),icon:z.preprocess(Ma,z.string().nullish()),eventId:z.string().nullish(),eventSlug:z.string().nullish(),outcome:z.string().nullish(),outcomeIndex:z.number().int().nullish(),oppositeOutcome:z.string().nullish(),oppositeAsset:Ea.nullish(),endDate:la.nullish(),negativeRisk:z.boolean().nullish()}).transform(({asset:e,oppositeAsset:i,proxyWallet:r,...c})=>({...c,wallet:r,tokenId:e,oppositeTokenId:i})),te=z.object({proxyWallet:p.nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),avgPrice:Ja.nullish(),totalBought:Ja.nullish(),realizedPnl:Ja.nullish(),curPrice:Ja.nullish(),timestamp:ba.nullish(),title:z.string().nullish(),slug:z.string().nullish(),icon:z.preprocess(Ma,z.string().nullish()),eventSlug:z.string().nullish(),outcome:z.string().nullish(),outcomeIndex:z.number().int().nullish(),oppositeOutcome:z.string().nullish(),oppositeAsset:Ea.nullish(),endDate:ma.nullish()}).transform(({asset:e,oppositeAsset:i,proxyWallet:r,...c})=>({...c,wallet:r,tokenId:e,oppositeTokenId:i})),oe=z.object({user:p.nullish(),value:Ja.nullish()}),ie=z.object({proxyWallet:p.nullish(),name:z.string().nullish(),profileImage:z.string().nullish(),verified:z.boolean().nullish(),asset:Ea.nullish(),conditionId:X$1.nullish(),avgPrice:Ja.nullish(),size:Ja.nullish(),currPrice:Ja.nullish(),currentValue:Ja.nullish(),cashPnl:Ja.nullish(),totalBought:Ja.nullish(),realizedPnl:Ja.nullish(),totalPnl:Ja.nullish(),outcome:z.string().nullish(),outcomeIndex:z.number().int().nullish()}).transform(({asset:e,proxyWallet:i,...r})=>({...r,wallet:i,tokenId:e})),ne=z.object({token:z.string().nullish(),positions:z.array(ie).nullish()}),se=z.object({event_id:z.string().nullish(),event_slug:z.string().nullish(),event_title:z.string().nullish(),event_image:z.string().nullish()}).transform(({event_id:e,event_slug:i,event_title:r,event_image:c})=>({eventId:e,eventSlug:i,eventTitle:r,eventImage:c})),re=z.object({market_id:z.string().nullish(),slug:z.string().nullish(),title:z.string().nullish(),outcome:z.string().nullish(),image_url:z.string().nullish(),icon_url:z.string().nullish(),category:z.string().nullish(),subcategory:z.string().nullish(),tags:z.array(z.string()).nullish(),end_date:ka.nullish(),event:se.nullish()}).transform(({market_id:e,image_url:i,icon_url:r,end_date:c,...d})=>({...d,marketId:e,imageUrl:i,iconUrl:r,endDate:c})),le=z.object({leg_index:z.number().int(),leg_position_id:xa,leg_condition_id:X$1,leg_outcome_index:z.number().int(),leg_outcome_label:z.string().nullish(),leg_status:B,leg_resolved_at:ka.nullish(),leg_current_price:Ja.nullish(),market:re.nullish()}).transform(({leg_index:e,leg_position_id:i,leg_condition_id:r,leg_outcome_index:c,leg_outcome_label:d,leg_status:I,leg_resolved_at:A,leg_current_price:E,...L})=>({...L,legIndex:e,legPositionId:i,legConditionId:r,legOutcomeIndex:c,legOutcomeLabel:d,legStatus:I,legResolvedAt:A,legCurrentPrice:E})),ae=z.object({combo_condition_id:W$1,combo_position_id:xa,module_id:z.number().int(),user_address:p,shares_balance:Ja,entry_avg_price_usdc:Ja.nullish(),entry_cost_usdc:Ja.nullish(),status:B,first_entry_at:ka,resolved_at:ka.nullish(),legs_total:z.number().int(),legs_resolved:z.number().int(),legs_pending:z.number().int(),legs:z.array(le)}).transform(({combo_condition_id:e,combo_position_id:i,module_id:r,user_address:c,shares_balance:d,entry_avg_price_usdc:I,entry_cost_usdc:A,first_entry_at:E,resolved_at:L,legs_total:u,legs_resolved:V,legs_pending:H,...j})=>({...j,conditionId:e,positionId:i,moduleId:r,userAddress:c,shares:d,entryAvgPriceUsdc:I,entryCostUsdc:A,firstEntryAt:E,resolvedAt:L,legsTotal:u,legsResolved:V,legsPending:H})),He=z.object({combos:z.array(ae),pagination:z.object({limit:z.number().int(),offset:z.number().int(),has_more:z.boolean(),next_cursor:wa.nullish()})}).transform(({pagination:e,...i})=>({...i,pagination:{limit:e.limit,offset:e.offset,hasMore:e.has_more,nextCursor:e.next_cursor}})),je=z.array(ee),we=z.array(te),We=z.array(oe),Ne=z.array(ne);export{N as ActivitySchema,C as ActivityType,D as ActivityTypeSchema,p as AddressSchema,Q as BuilderVolumeEntrySchema,te as ClosedPositionSchema,le as ComboPositionLegSchema,se as ComboPositionMarketEventSchema,re as ComboPositionMarketSchema,ae as ComboPositionSchema,O as ComboPositionStatus,B as ComboPositionStatusSchema,ve as FetchEventLiveVolumeResponseSchema,We as FetchPortfolioValueResponseSchema,v as Hash64Schema,K as HolderSchema,ue as LeaderboardCategorySchema,J as LeaderboardEntrySchema,me as LeaderboardOrderBySchema,xe as ListActivityResponseSchema,_e as ListBuilderLeaderboardResponseSchema,Me as ListBuilderVolumeResponseSchema,we as ListClosedPositionsResponseSchema,He as ListComboPositionsResponseSchema,Ee as ListMarketHoldersResponseSchema,Ne as ListMarketPositionsResponseSchema,Le as ListOpenInterestResponseSchema,je as ListPositionsResponseSchema,ke as ListTraderLeaderboardResponseSchema,fe as ListTradesResponseSchema,q as LiveVolumeSchema,ie as MarketPositionSchema,$ as MarketVolumeSchema,G as MetaHolderSchema,ne as MetaMarketPositionSchema,Z as OpenInterestSchema,ee as PositionSchema,P as SideSchema,ce as TimePeriodSchema,w as TradeSchema,Se as TradedSchema,X as TraderLeaderboardEntrySchema,oe as ValueSchema};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/data/common.ts","../../src/data/activity.ts","../../src/data/analytics.ts","../../src/data/leaderboard.ts","../../src/data/portfolio.ts"],"names":["AddressSchema","z","Hash64Schema","ActivityType","ActivityTypeSchema","SideSchema","TimePeriodSchema","LeaderboardCategorySchema","LeaderboardOrderBySchema","OptionalTextSchema","value","TradeSchema","TokenIdSchema","CtfConditionIdSchema","DecimalishSchema","EpochSecondsToMillisecondsSchema","asset","proxyWallet","rest","RawActivitySchema","TxHashSchema","ActivitySchema","normalizeActivity","TradedSchema","ListTradesResponseSchema","ListActivityResponseSchema","activity","base","normalizeActivityBase","expectPresent","inferAmount","field","HolderSchema","MetaHolderSchema","OpenInterestSchema","MarketVolumeSchema","LiveVolumeSchema","ListMarketHoldersResponseSchema","ListOpenInterestResponseSchema","FetchEventLiveVolumeResponseSchema","LeaderboardEntrySchema","BuilderVolumeEntrySchema","IsoDateTimeStringSchema","dt","TraderLeaderboardEntrySchema","ListBuilderLeaderboardResponseSchema","ListBuilderVolumeResponseSchema","ListTraderLeaderboardResponseSchema","ComboPositionStatus","ComboPositionStatusSchema","PositionSchema","IsoCalendarDateStringSchema","oppositeAsset","ClosedPositionSchema","MixedDateTimeStringSchema","ValueSchema","MarketPositionSchema","MetaMarketPositionSchema","ComboPositionMarketEventSchema","event_id","event_slug","event_title","event_image","ComboPositionMarketSchema","market_id","image_url","icon_url","end_date","ComboPositionLegSchema","PositionIdSchema","leg_index","leg_position_id","leg_condition_id","leg_outcome_index","leg_outcome_label","leg_status","leg_resolved_at","leg_current_price","ComboPositionSchema","ComboConditionIdSchema","combo_condition_id","combo_position_id","module_id","user_address","shares_balance","entry_avg_price_usdc","entry_cost_usdc","first_entry_at","resolved_at","legs_total","legs_resolved","legs_pending","ListComboPositionsResponseSchema","PaginationCursorSchema","pagination","ListPositionsResponseSchema","ListClosedPositionsResponseSchema","FetchPortfolioValueResponseSchema","ListMarketPositionsResponseSchema"],"mappings":"2GAEO,IAAMA,CAAAA,CAAgBC,GAAAA,CAAE,MAAA,EAAO,CACzBC,EAAeD,GAAAA,CAAE,MAAA,EAAO,CAEzBE,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,KAAA,CAAQ,QACRA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,EAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,WAAa,YAAA,CACbA,CAAAA,CAAA,YAAA,CAAe,cAAA,CACfA,CAAAA,CAAA,eAAA,CAAkB,kBAClBA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CATEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAYCC,CAAAA,CAAqBH,GAAAA,CAAE,IAAA,CAAKE,CAAY,CAAA,CAExCE,CAAAA,CAAaJ,GAAAA,CAAE,IAAA,CAAK,CAAC,MAAO,MAAM,CAAC,CAAA,CAEnCK,EAAAA,CAAmBL,GAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,CAAO,MAAA,CAAQ,OAAA,CAAS,KAAK,CAAC,CAAA,CAEzDM,GAA4BN,GAAAA,CAAE,IAAA,CAAK,CAC9C,SAAA,CACA,UAAA,CACA,QAAA,CACA,SACA,SAAA,CACA,UAAA,CACA,SAAA,CACA,WAAA,CACA,MAAA,CACA,SACF,CAAC,CAAA,CAEYO,EAAAA,CAA2BP,GAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,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GAAAA,CAC7C,MAAA,CAAO,CACN,MAAA,CAAQA,GAAAA,CAAE,MAAM6E,EAAmB,CAAA,CACnC,UAAA,CAAY7E,GAAAA,CAAE,MAAA,CAAO,CACnB,MAAOA,GAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CACtB,MAAA,CAAQA,GAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CACvB,QAAA,CAAUA,GAAAA,CAAE,OAAA,GACZ,WAAA,CAAa4F,EAAAA,CAAuB,OAAA,EACtC,CAAC,CACH,CAAC,CAAA,CACA,SAAA,CAAU,CAAC,CAAE,UAAA,CAAAC,CAAAA,CAAY,GAAG5E,CAAK,CAAA,IAAO,CACvC,GAAGA,CAAAA,CACH,UAAA,CAAY,CACV,KAAA,CAAO4E,CAAAA,CAAW,KAAA,CAClB,MAAA,CAAQA,CAAAA,CAAW,MAAA,CACnB,QAASA,CAAAA,CAAW,QAAA,CACpB,UAAA,CAAYA,CAAAA,CAAW,WACzB,CACF,EAAE,CAAA,CAESC,EAAAA,CAA8B9F,GAAAA,CAAE,KAAA,CAAMiD,CAAc,CAAA,CACpD8C,GAAoC/F,GAAAA,CAAE,KAAA,CAAMoD,CAAoB,CAAA,CAChE4C,EAAAA,CAAoChG,GAAAA,CAAE,KAAA,CAAMsD,EAAW,CAAA,CACvD2C,EAAAA,CAAoCjG,GAAAA,CAAE,KAAA,CACjDwD,EACF","file":"index.js","sourcesContent":["import { z } from 'zod';\n\nexport const AddressSchema = z.string();\nexport const Hash64Schema = z.string();\n\nexport enum ActivityType {\n TRADE = 'TRADE',\n SPLIT = 'SPLIT',\n MERGE = 'MERGE',\n REDEEM = 'REDEEM',\n REWARD = 'REWARD',\n CONVERSION = 'CONVERSION',\n MAKER_REBATE = 'MAKER_REBATE',\n REFERRAL_REWARD = 'REFERRAL_REWARD',\n YIELD = 'YIELD',\n}\n\nexport const ActivityTypeSchema = z.enum(ActivityType);\n\nexport const SideSchema = z.enum(['BUY', 'SELL']);\n\nexport const TimePeriodSchema = z.enum(['DAY', 'WEEK', 'MONTH', 'ALL']);\n\nexport const LeaderboardCategorySchema = z.enum([\n 'OVERALL',\n 'POLITICS',\n 'SPORTS',\n 'CRYPTO',\n 'CULTURE',\n 'MENTIONS',\n 'WEATHER',\n 'ECONOMICS',\n 'TECH',\n 'FINANCE',\n]);\n\nexport const LeaderboardOrderBySchema = z.enum(['PNL', 'VOL']);\n\nexport type Address = z.infer<typeof AddressSchema>;\nexport type Hash64 = z.infer<typeof Hash64Schema>;\nexport type Side = z.infer<typeof SideSchema>;\nexport type TimePeriod = z.infer<typeof TimePeriodSchema>;\nexport type LeaderboardCategory = z.infer<typeof LeaderboardCategorySchema>;\nexport type LeaderboardOrderBy = z.infer<typeof LeaderboardOrderBySchema>;\n","import { z } from 'zod';\nimport {\n type CtfConditionId,\n CtfConditionIdSchema,\n DecimalishSchema,\n type DecimalString,\n type EpochMilliseconds,\n EpochSecondsToMillisecondsSchema,\n type TokenId,\n TokenIdSchema,\n type TxHash,\n TxHashSchema,\n} from '../shared';\nimport {\n ActivityType,\n ActivityTypeSchema,\n type Address,\n AddressSchema,\n type Side,\n SideSchema,\n} from './common';\n\nexport type ActivityBase = {\n /** Wallet address whose account history contains this activity. */\n wallet: Address;\n /** Activity time as Unix epoch milliseconds. */\n timestamp: EpochMilliseconds;\n /** Polygon transaction hash that produced or records this activity. */\n transactionHash: TxHash;\n /** Display name of the wallet owner at the time returned by the API. */\n name: string | null;\n /** Public pseudonym of the wallet owner at the time returned by the API. */\n pseudonym: string | null;\n /** Profile biography of the wallet owner at the time returned by the API. */\n bio: string | null;\n /** Source profile image URL for the wallet owner. */\n profileImage: string | null;\n /** Optimized profile image URL for the wallet owner. */\n profileImageOptimized: string | null;\n};\n\nexport type TradeActivity = ActivityBase & {\n /** A directional outcome-token trade. */\n type: 'TRADE';\n /** Condition id of the market traded by the wallet. */\n conditionId: CtfConditionId;\n /** Outcome token id bought or sold by the wallet. */\n tokenId: TokenId;\n /** Direction of the wallet's trade in the outcome token. */\n side: Side;\n /** Number of outcome-token shares traded by the wallet. */\n shares: DecimalString;\n /** The notional value of the traded shares in USD. */\n amount: DecimalString;\n /** The execution price per outcome-token share in USD. */\n price: DecimalString;\n /** Display label of the outcome token traded by the wallet. */\n outcome: string;\n /** Zero-based index of the outcome token in the market's outcome list. */\n outcomeIndex: number;\n /** Human-readable title of the market traded by the wallet. */\n title: string;\n /** URL slug of the market traded by the wallet. */\n slug: string;\n /** Icon URL for the market traded by the wallet, when available. */\n icon: string | null;\n /** URL slug of the event containing the traded market. */\n eventSlug: string;\n};\n\nexport type SplitActivity = ActivityBase & {\n /** Splitting collateral into a complete market set. */\n type: 'SPLIT';\n /** Condition id of the market whose complete set was created. */\n conditionId: CtfConditionId;\n /** The collateral amount split into the complete set in USD. */\n amount: DecimalString;\n /** Human-readable title of the market whose complete set was created. */\n title: string;\n /** URL slug of the market whose complete set was created. */\n slug: string;\n /** Icon URL for the market whose complete set was created, when available. */\n icon: string | null;\n /** URL slug of the event containing the split market. */\n eventSlug: string;\n};\n\nexport type MergeActivity = ActivityBase & {\n /** Merging a complete market set into collateral. */\n type: 'MERGE';\n /** Condition id of the market whose complete set was merged. */\n conditionId: CtfConditionId;\n /** The collateral amount received from merging the complete set in USD. */\n amount: DecimalString;\n /** Human-readable title of the market whose complete set was merged. */\n title: string;\n /** URL slug of the market whose complete set was merged. */\n slug: string;\n /** Icon URL for the market whose complete set was merged, when available. */\n icon: string | null;\n /** URL slug of the event containing the merged market. */\n eventSlug: string;\n};\n\nexport type RedeemActivity = ActivityBase & {\n /** Redeeming resolved market proceeds. */\n type: 'REDEEM';\n /** Condition id of the market redeemed by the wallet. */\n conditionId: CtfConditionId;\n /** The proceeds redeemed from the resolved market in USD. */\n amount: DecimalString;\n /** Human-readable title of the market redeemed by the wallet. */\n title: string;\n /** URL slug of the market redeemed by the wallet. */\n slug: string;\n /** Icon URL for the market redeemed by the wallet, when available. */\n icon: string | null;\n /** URL slug of the event containing the redeemed market. */\n eventSlug: string;\n};\n\nexport type ConversionActivity = ActivityBase & {\n /** A market conversion or migration activity. */\n type: 'CONVERSION';\n /** Condition id of the market involved in the conversion. */\n conditionId: CtfConditionId;\n /** The amount converted or migrated for the market in USD. */\n amount: DecimalString;\n /** Human-readable title of the market involved in the conversion. */\n title: string;\n /** URL slug of the market involved in the conversion. */\n slug: string;\n /** Icon URL for the market involved in the conversion, when available. */\n icon: string | null;\n /** URL slug of the event containing the converted market. */\n eventSlug: string;\n};\n\nexport type RewardActivity = ActivityBase & {\n /** An account-level reward credit. */\n type: 'REWARD';\n /** The reward amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type MakerRebateActivity = ActivityBase & {\n /** An account-level maker rebate credit. */\n type: 'MAKER_REBATE';\n /** The maker rebate amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type ReferralRewardActivity = ActivityBase & {\n /** An account-level referral reward credit. */\n type: 'REFERRAL_REWARD';\n /** The referral reward amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type YieldActivity = ActivityBase & {\n /** An account-level yield credit. */\n type: 'YIELD';\n /** The yield amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type Activity =\n | TradeActivity\n | SplitActivity\n | MergeActivity\n | RedeemActivity\n | ConversionActivity\n | RewardActivity\n | MakerRebateActivity\n | ReferralRewardActivity\n | YieldActivity;\n\nconst OptionalTextSchema = z.preprocess(\n (value) => (value === '' ? undefined : value),\n z.string().optional(),\n);\n\nexport const TradeSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n side: SideSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n size: DecimalishSchema.nullish(),\n price: DecimalishSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.string().nullish(),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n name: z.string().nullish(),\n pseudonym: z.string().nullish(),\n bio: z.string().nullish(),\n profileImage: z.string().nullish(),\n profileImageOptimized: z.string().nullish(),\n transactionHash: z.string().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nconst RawActivitySchema = z.object({\n proxyWallet: AddressSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n conditionId: z.preprocess(\n (value) => (value === '' ? undefined : value),\n CtfConditionIdSchema.optional(),\n ),\n type: ActivityTypeSchema,\n size: DecimalishSchema.nullish(),\n usdcSize: DecimalishSchema.nullish(),\n transactionHash: TxHashSchema.nullish(),\n price: DecimalishSchema.nullish(),\n asset: z.preprocess(\n (value) => (value === '' ? undefined : value),\n TokenIdSchema.optional(),\n ),\n side: z.preprocess(\n (value) => (value === '' ? undefined : value),\n SideSchema.nullish(),\n ),\n outcomeIndex: z.preprocess(\n (value) => (value === 999 ? undefined : value),\n z.number().int().optional(),\n ),\n title: OptionalTextSchema,\n slug: OptionalTextSchema,\n icon: OptionalTextSchema,\n eventSlug: OptionalTextSchema,\n outcome: OptionalTextSchema,\n name: OptionalTextSchema,\n pseudonym: OptionalTextSchema,\n bio: OptionalTextSchema,\n profileImage: OptionalTextSchema,\n profileImageOptimized: OptionalTextSchema,\n});\n\nexport const ActivitySchema: z.ZodType<Activity> =\n RawActivitySchema.transform(normalizeActivity);\n\nexport const TradedSchema = z.object({\n user: AddressSchema.nullish(),\n traded: z.number().int().nullish(),\n});\n\nexport const ListTradesResponseSchema = z.array(TradeSchema);\nexport const ListActivityResponseSchema = z.array(ActivitySchema);\n\nexport type Trade = z.infer<typeof TradeSchema>;\nexport type Traded = z.infer<typeof TradedSchema>;\nexport type ListTradesResponse = z.infer<typeof ListTradesResponseSchema>;\nexport type ListActivityResponse = z.infer<typeof ListActivityResponseSchema>;\n\ntype RawActivity = z.infer<typeof RawActivitySchema>;\n\nfunction normalizeActivity(activity: RawActivity): Activity {\n const base = normalizeActivityBase(activity);\n\n switch (activity.type) {\n case ActivityType.TRADE:\n return {\n ...base,\n type: activity.type,\n conditionId: expectPresent(activity.conditionId, 'conditionId'),\n tokenId: expectPresent(activity.asset, 'asset'),\n side: expectPresent(activity.side, 'side'),\n shares: expectPresent(activity.size, 'size'),\n amount: inferAmount(activity),\n price: expectPresent(activity.price, 'price'),\n outcome: expectPresent(activity.outcome, 'outcome'),\n outcomeIndex: expectPresent(activity.outcomeIndex, 'outcomeIndex'),\n title: expectPresent(activity.title, 'title'),\n slug: expectPresent(activity.slug, 'slug'),\n icon: activity.icon ?? null,\n eventSlug: expectPresent(activity.eventSlug, 'eventSlug'),\n };\n case ActivityType.SPLIT:\n case ActivityType.MERGE:\n case ActivityType.REDEEM:\n case ActivityType.CONVERSION:\n return {\n ...base,\n type: activity.type,\n conditionId: expectPresent(activity.conditionId, 'conditionId'),\n amount: inferAmount(activity),\n title: expectPresent(activity.title, 'title'),\n slug: expectPresent(activity.slug, 'slug'),\n icon: activity.icon ?? null,\n eventSlug: expectPresent(activity.eventSlug, 'eventSlug'),\n };\n case ActivityType.REWARD:\n case ActivityType.MAKER_REBATE:\n case ActivityType.REFERRAL_REWARD:\n case ActivityType.YIELD:\n return {\n ...base,\n type: activity.type,\n amount: inferAmount(activity),\n };\n }\n}\n\nfunction normalizeActivityBase(activity: RawActivity): ActivityBase {\n return {\n wallet: expectPresent(activity.proxyWallet, 'proxyWallet'),\n timestamp: expectPresent(activity.timestamp, 'timestamp'),\n transactionHash: expectPresent(activity.transactionHash, 'transactionHash'),\n name: activity.name ?? null,\n pseudonym: activity.pseudonym ?? null,\n bio: activity.bio ?? null,\n profileImage: activity.profileImage ?? null,\n profileImageOptimized: activity.profileImageOptimized ?? null,\n };\n}\n\nfunction inferAmount(activity: RawActivity): DecimalString {\n return expectPresent(activity.usdcSize ?? activity.size, 'usdcSize');\n}\n\nfunction expectPresent<T>(value: T | null | undefined, field: string): T {\n if (value === null || value === undefined) {\n throw new TypeError(`Expected activity.${field} to be present`);\n }\n\n return value;\n}\n","import { z } from 'zod';\nimport { DecimalishSchema, TokenIdSchema } from '../shared';\nimport { AddressSchema, Hash64Schema } from './common';\n\nexport const HolderSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n bio: z.string().nullish(),\n asset: TokenIdSchema.nullish(),\n pseudonym: z.string().nullish(),\n amount: DecimalishSchema.nullish(),\n displayUsernamePublic: z.boolean().nullish(),\n outcomeIndex: z.number().int().nullish(),\n name: z.string().nullish(),\n profileImage: z.string().nullish(),\n profileImageOptimized: z.string().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nexport const MetaHolderSchema = z.object({\n token: z.string().nullish(),\n holders: z.array(HolderSchema).nullish(),\n});\n\nexport const OpenInterestSchema = z.object({\n market: Hash64Schema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const MarketVolumeSchema = z.object({\n market: Hash64Schema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const LiveVolumeSchema = z.object({\n total: DecimalishSchema.nullish(),\n markets: z.array(MarketVolumeSchema).nullish(),\n});\n\nexport const ListMarketHoldersResponseSchema = z.array(MetaHolderSchema);\nexport const ListOpenInterestResponseSchema = z.array(OpenInterestSchema);\nexport const FetchEventLiveVolumeResponseSchema = z.array(LiveVolumeSchema);\n\nexport type Holder = z.infer<typeof HolderSchema>;\nexport type MetaHolder = z.infer<typeof MetaHolderSchema>;\nexport type OpenInterest = z.infer<typeof OpenInterestSchema>;\nexport type MarketVolume = z.infer<typeof MarketVolumeSchema>;\nexport type LiveVolume = z.infer<typeof LiveVolumeSchema>;\nexport type ListMarketHoldersResponse = z.infer<\n typeof ListMarketHoldersResponseSchema\n>;\nexport type ListOpenInterestResponse = z.infer<\n typeof ListOpenInterestResponseSchema\n>;\nexport type FetchEventLiveVolumeResponse = z.infer<\n typeof FetchEventLiveVolumeResponseSchema\n>;\n","import { z } from 'zod';\nimport { DecimalishSchema, IsoDateTimeStringSchema } from '../shared';\nimport { AddressSchema } from './common';\n\nexport const LeaderboardEntrySchema = z.object({\n rank: z.string().nullish(),\n builder: z.string().nullish(),\n volume: DecimalishSchema.nullish(),\n activeUsers: z.number().int().nullish(),\n verified: z.boolean().nullish(),\n builderLogo: z.string().nullish(),\n});\n\nexport const BuilderVolumeEntrySchema = z\n .object({\n dt: IsoDateTimeStringSchema.nullish(),\n builder: z.string().nullish(),\n builderLogo: z.string().nullish(),\n verified: z.boolean().nullish(),\n volume: DecimalishSchema.nullish(),\n activeUsers: z.number().int().nullish(),\n rank: z.string().nullish(),\n })\n .transform(({ dt, ...rest }) => ({\n ...rest,\n bucketAt: dt,\n }));\n\nexport const TraderLeaderboardEntrySchema = z\n .object({\n rank: z.string().nullish(),\n proxyWallet: AddressSchema.nullish(),\n userName: z.string().nullish(),\n vol: DecimalishSchema.nullish(),\n pnl: DecimalishSchema.nullish(),\n profileImage: z.string().nullish(),\n xUsername: z.string().nullish(),\n verifiedBadge: z.boolean().nullish(),\n })\n .transform(({ proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n }));\n\nexport const ListBuilderLeaderboardResponseSchema = z.array(\n LeaderboardEntrySchema,\n);\nexport const ListBuilderVolumeResponseSchema = z.array(\n BuilderVolumeEntrySchema,\n);\nexport const ListTraderLeaderboardResponseSchema = z.array(\n TraderLeaderboardEntrySchema,\n);\n\nexport type LeaderboardEntry = z.infer<typeof LeaderboardEntrySchema>;\nexport type BuilderVolumeEntry = z.infer<typeof BuilderVolumeEntrySchema>;\nexport type TraderLeaderboardEntry = z.infer<\n typeof TraderLeaderboardEntrySchema\n>;\nexport type ListBuilderLeaderboardResponse = z.infer<\n typeof ListBuilderLeaderboardResponseSchema\n>;\nexport type ListBuilderVolumeResponse = z.infer<\n typeof ListBuilderVolumeResponseSchema\n>;\nexport type ListTraderLeaderboardResponse = z.infer<\n typeof ListTraderLeaderboardResponseSchema\n>;\n","import { z } from 'zod';\nimport {\n ComboConditionIdSchema,\n CtfConditionIdSchema,\n DecimalishSchema,\n EpochSecondsToMillisecondsSchema,\n IsoCalendarDateStringSchema,\n IsoDateTimeStringSchema,\n MixedDateTimeStringSchema,\n PaginationCursorSchema,\n PositionIdSchema,\n TokenIdSchema,\n} from '../shared';\nimport { AddressSchema } from './common';\n\nexport enum ComboPositionStatus {\n Open = 'OPEN',\n Partial = 'PARTIAL',\n ResolvedWin = 'RESOLVED_WIN',\n ResolvedLoss = 'RESOLVED_LOSS',\n}\n\nexport const ComboPositionStatusSchema = z.enum(ComboPositionStatus);\n\nexport const PositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema,\n size: DecimalishSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n initialValue: DecimalishSchema.nullish(),\n currentValue: DecimalishSchema.nullish(),\n cashPnl: DecimalishSchema.nullish(),\n percentPnl: z.number().nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n percentRealizedPnl: z.number().nullish(),\n curPrice: DecimalishSchema.nullish(),\n redeemable: z.boolean().nullish(),\n mergeable: z.boolean().nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.string().nullish(),\n eventId: z.string().nullish(),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n oppositeOutcome: z.string().nullish(),\n oppositeAsset: TokenIdSchema.nullish(),\n endDate: IsoCalendarDateStringSchema.nullish(),\n negativeRisk: z.boolean().nullish(),\n })\n .transform(({ asset, oppositeAsset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n oppositeTokenId: oppositeAsset,\n }));\n\nexport const ClosedPositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n curPrice: DecimalishSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.string().nullish(),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n oppositeOutcome: z.string().nullish(),\n oppositeAsset: TokenIdSchema.nullish(),\n endDate: MixedDateTimeStringSchema.nullish(),\n })\n .transform(({ asset, oppositeAsset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n oppositeTokenId: oppositeAsset,\n }));\n\nexport const ValueSchema = z.object({\n user: AddressSchema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const MarketPositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n name: z.string().nullish(),\n profileImage: z.string().nullish(),\n verified: z.boolean().nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n size: DecimalishSchema.nullish(),\n currPrice: DecimalishSchema.nullish(),\n currentValue: DecimalishSchema.nullish(),\n cashPnl: DecimalishSchema.nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n totalPnl: DecimalishSchema.nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nexport const MetaMarketPositionSchema = z.object({\n token: z.string().nullish(),\n positions: z.array(MarketPositionSchema).nullish(),\n});\n\nexport const ComboPositionMarketEventSchema = z\n .object({\n event_id: z.string().nullish(),\n event_slug: z.string().nullish(),\n event_title: z.string().nullish(),\n event_image: z.string().nullish(),\n })\n .transform(({ event_id, event_slug, event_title, event_image }) => ({\n eventId: event_id,\n eventSlug: event_slug,\n eventTitle: event_title,\n eventImage: event_image,\n }));\n\nexport const ComboPositionMarketSchema = z\n .object({\n market_id: z.string().nullish(),\n slug: z.string().nullish(),\n title: z.string().nullish(),\n outcome: z.string().nullish(),\n image_url: z.string().nullish(),\n icon_url: z.string().nullish(),\n category: z.string().nullish(),\n subcategory: z.string().nullish(),\n tags: z.array(z.string()).nullish(),\n end_date: IsoDateTimeStringSchema.nullish(),\n event: ComboPositionMarketEventSchema.nullish(),\n })\n .transform(({ market_id, image_url, icon_url, end_date, ...rest }) => ({\n ...rest,\n marketId: market_id,\n imageUrl: image_url,\n iconUrl: icon_url,\n endDate: end_date,\n }));\n\nexport const ComboPositionLegSchema = z\n .object({\n leg_index: z.number().int(),\n leg_position_id: PositionIdSchema,\n leg_condition_id: CtfConditionIdSchema,\n leg_outcome_index: z.number().int(),\n leg_outcome_label: z.string().nullish(),\n leg_status: ComboPositionStatusSchema,\n leg_resolved_at: IsoDateTimeStringSchema.nullish(),\n leg_current_price: DecimalishSchema.nullish(),\n market: ComboPositionMarketSchema.nullish(),\n })\n .transform(\n ({\n leg_index,\n leg_position_id,\n leg_condition_id,\n leg_outcome_index,\n leg_outcome_label,\n leg_status,\n leg_resolved_at,\n leg_current_price,\n ...rest\n }) => ({\n ...rest,\n legIndex: leg_index,\n legPositionId: leg_position_id,\n legConditionId: leg_condition_id,\n legOutcomeIndex: leg_outcome_index,\n legOutcomeLabel: leg_outcome_label,\n legStatus: leg_status,\n legResolvedAt: leg_resolved_at,\n legCurrentPrice: leg_current_price,\n }),\n );\n\nexport const ComboPositionSchema = z\n .object({\n combo_condition_id: ComboConditionIdSchema,\n combo_position_id: PositionIdSchema,\n module_id: z.number().int(),\n user_address: AddressSchema,\n shares_balance: DecimalishSchema,\n entry_avg_price_usdc: DecimalishSchema.nullish(),\n entry_cost_usdc: DecimalishSchema.nullish(),\n status: ComboPositionStatusSchema,\n first_entry_at: IsoDateTimeStringSchema,\n resolved_at: IsoDateTimeStringSchema.nullish(),\n legs_total: z.number().int(),\n legs_resolved: z.number().int(),\n legs_pending: z.number().int(),\n legs: z.array(ComboPositionLegSchema),\n })\n .transform(\n ({\n combo_condition_id,\n combo_position_id,\n module_id,\n user_address,\n shares_balance,\n entry_avg_price_usdc,\n entry_cost_usdc,\n first_entry_at,\n resolved_at,\n legs_total,\n legs_resolved,\n legs_pending,\n ...rest\n }) => ({\n ...rest,\n conditionId: combo_condition_id,\n positionId: combo_position_id,\n moduleId: module_id,\n userAddress: user_address,\n shares: shares_balance,\n entryAvgPriceUsdc: entry_avg_price_usdc,\n entryCostUsdc: entry_cost_usdc,\n firstEntryAt: first_entry_at,\n resolvedAt: resolved_at,\n legsTotal: legs_total,\n legsResolved: legs_resolved,\n legsPending: legs_pending,\n }),\n );\n\nexport const ListComboPositionsResponseSchema = z\n .object({\n combos: z.array(ComboPositionSchema),\n pagination: z.object({\n limit: z.number().int(),\n offset: z.number().int(),\n has_more: z.boolean(),\n next_cursor: PaginationCursorSchema.nullish(),\n }),\n })\n .transform(({ pagination, ...rest }) => ({\n ...rest,\n pagination: {\n limit: pagination.limit,\n offset: pagination.offset,\n hasMore: pagination.has_more,\n nextCursor: pagination.next_cursor,\n },\n }));\n\nexport const ListPositionsResponseSchema = z.array(PositionSchema);\nexport const ListClosedPositionsResponseSchema = z.array(ClosedPositionSchema);\nexport const FetchPortfolioValueResponseSchema = z.array(ValueSchema);\nexport const ListMarketPositionsResponseSchema = z.array(\n MetaMarketPositionSchema,\n);\n\nexport type Position = z.infer<typeof PositionSchema>;\nexport type ClosedPosition = z.infer<typeof ClosedPositionSchema>;\nexport type Value = z.infer<typeof ValueSchema>;\nexport type MarketPosition = z.infer<typeof MarketPositionSchema>;\nexport type MetaMarketPosition = z.infer<typeof MetaMarketPositionSchema>;\nexport type ComboPositionMarketEvent = z.infer<\n typeof ComboPositionMarketEventSchema\n>;\nexport type ComboPositionMarket = z.infer<typeof ComboPositionMarketSchema>;\nexport type ComboPositionLeg = z.infer<typeof ComboPositionLegSchema>;\nexport type ComboPosition = z.infer<typeof ComboPositionSchema>;\nexport type ListPositionsResponse = z.infer<typeof ListPositionsResponseSchema>;\nexport type ListClosedPositionsResponse = z.infer<\n typeof ListClosedPositionsResponseSchema\n>;\nexport type FetchPortfolioValueResponse = z.infer<\n typeof FetchPortfolioValueResponseSchema\n>;\nexport type ListMarketPositionsResponse = z.infer<\n typeof ListMarketPositionsResponseSchema\n>;\nexport type ListComboPositionsResponse = z.infer<\n typeof ListComboPositionsResponseSchema\n>;\n"]}
1
+ {"version":3,"sources":["../../src/data/common.ts","../../src/data/activity.ts","../../src/data/analytics.ts","../../src/data/leaderboard.ts","../../src/data/portfolio.ts"],"names":["AddressSchema","z","Hash64Schema","ActivityType","ActivityTypeSchema","SideSchema","TimePeriodSchema","LeaderboardCategorySchema","LeaderboardOrderBySchema","OptionalTextSchema","value","TradeSchema","TokenIdSchema","CtfConditionIdSchema","DecimalishSchema","EpochSecondsToMillisecondsSchema","emptyStringToNull","asset","proxyWallet","rest","RawActivitySchema","TxHashSchema","ActivitySchema","normalizeActivity","TradedSchema","ListTradesResponseSchema","ListActivityResponseSchema","activity","base","normalizeActivityBase","normalizeTradeActivity","expectPresent","inferAmount","trade","ComboConditionIdSchema","PositionIdSchema","field","HolderSchema","MetaHolderSchema","OpenInterestSchema","MarketVolumeSchema","LiveVolumeSchema","ListMarketHoldersResponseSchema","ListOpenInterestResponseSchema","FetchEventLiveVolumeResponseSchema","LeaderboardEntrySchema","BuilderVolumeEntrySchema","IsoDateTimeStringSchema","dt","TraderLeaderboardEntrySchema","ListBuilderLeaderboardResponseSchema","ListBuilderVolumeResponseSchema","ListTraderLeaderboardResponseSchema","ComboPositionStatus","ComboPositionStatusSchema","PositionSchema","IsoCalendarDateStringSchema","oppositeAsset","ClosedPositionSchema","MixedDateTimeStringSchema","ValueSchema","MarketPositionSchema","MetaMarketPositionSchema","ComboPositionMarketEventSchema","event_id","event_slug","event_title","event_image","ComboPositionMarketSchema","market_id","image_url","icon_url","end_date","ComboPositionLegSchema","leg_index","leg_position_id","leg_condition_id","leg_outcome_index","leg_outcome_label","leg_status","leg_resolved_at","leg_current_price","ComboPositionSchema","combo_condition_id","combo_position_id","module_id","user_address","shares_balance","entry_avg_price_usdc","entry_cost_usdc","first_entry_at","resolved_at","legs_total","legs_resolved","legs_pending","ListComboPositionsResponseSchema","PaginationCursorSchema","pagination","ListPositionsResponseSchema","ListClosedPositionsResponseSchema","FetchPortfolioValueResponseSchema","ListMarketPositionsResponseSchema"],"mappings":"uGAEO,IAAMA,CAAAA,CAAgBC,CAAAA,CAAE,MAAA,EAAO,CACzBC,EAAeD,CAAAA,CAAE,MAAA,EAAO,CAEzBE,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,YAAA,CAAe,cAAA,CACfA,CAAAA,CAAA,eAAA,CAAkB,iBAAA,CAClBA,CAAAA,CAAA,MAAQ,OAAA,CATEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAYCC,CAAAA,CAAqBH,CAAAA,CAAE,IAAA,CAAKE,CAAY,CAAA,CAExCE,CAAAA,CAAaJ,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,CAAO,MAAM,CAAC,CAAA,CAEnCK,EAAAA,CAAmBL,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,CAAO,OAAQ,OAAA,CAAS,KAAK,CAAC,CAAA,CAEzDM,EAAAA,CAA4BN,CAAAA,CAAE,KAAK,CAC9C,SAAA,CACA,UAAA,CACA,QAAA,CACA,QAAA,CACA,SAAA,CACA,UAAA,CACA,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C,EACd,WAAA,CAAaC,CACf,CAAA,CACF,CAAA,CAEWC,EAAAA,CAAmC9F,CAAAA,CAC7C,MAAA,CAAO,CACN,MAAA,CAAQA,CAAAA,CAAE,KAAA,CAAMiF,EAAmB,CAAA,CACnC,UAAA,CAAYjF,EAAE,MAAA,CAAO,CACnB,KAAA,CAAOA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CACtB,MAAA,CAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CACvB,SAAUA,CAAAA,CAAE,OAAA,EAAQ,CACpB,WAAA,CAAa+F,EAAAA,CAAuB,OAAA,EACtC,CAAC,CACH,CAAC,CAAA,CACA,SAAA,CAAU,CAAC,CAAE,WAAAC,CAAAA,CAAY,GAAG9E,CAAK,CAAA,IAAO,CACvC,GAAGA,CAAAA,CACH,UAAA,CAAY,CACV,KAAA,CAAO8E,CAAAA,CAAW,KAAA,CAClB,MAAA,CAAQA,CAAAA,CAAW,OACnB,OAAA,CAASA,CAAAA,CAAW,QAAA,CACpB,UAAA,CAAYA,CAAAA,CAAW,WACzB,CACF,CAAA,CAAE,CAAA,CAESC,EAAAA,CAA8BjG,CAAAA,CAAE,KAAA,CAAMsD,EAAc,CAAA,CACpD4C,GAAoClG,CAAAA,CAAE,KAAA,CAAMyD,EAAoB,CAAA,CAChE0C,EAAAA,CAAoCnG,CAAAA,CAAE,KAAA,CAAM2D,EAAW,CAAA,CACvDyC,EAAAA,CAAoCpG,CAAAA,CAAE,KAAA,CACjD6D,EACF","file":"index.js","sourcesContent":["import { z } from 'zod';\n\nexport const AddressSchema = z.string();\nexport const Hash64Schema = z.string();\n\nexport enum ActivityType {\n TRADE = 'TRADE',\n SPLIT = 'SPLIT',\n MERGE = 'MERGE',\n REDEEM = 'REDEEM',\n REWARD = 'REWARD',\n CONVERSION = 'CONVERSION',\n MAKER_REBATE = 'MAKER_REBATE',\n REFERRAL_REWARD = 'REFERRAL_REWARD',\n YIELD = 'YIELD',\n}\n\nexport const ActivityTypeSchema = z.enum(ActivityType);\n\nexport const SideSchema = z.enum(['BUY', 'SELL']);\n\nexport const TimePeriodSchema = z.enum(['DAY', 'WEEK', 'MONTH', 'ALL']);\n\nexport const LeaderboardCategorySchema = z.enum([\n 'OVERALL',\n 'POLITICS',\n 'SPORTS',\n 'CRYPTO',\n 'CULTURE',\n 'MENTIONS',\n 'WEATHER',\n 'ECONOMICS',\n 'TECH',\n 'FINANCE',\n]);\n\nexport const LeaderboardOrderBySchema = z.enum(['PNL', 'VOL']);\n\nexport type Address = z.infer<typeof AddressSchema>;\nexport type Hash64 = z.infer<typeof Hash64Schema>;\nexport type Side = z.infer<typeof SideSchema>;\nexport type TimePeriod = z.infer<typeof TimePeriodSchema>;\nexport type LeaderboardCategory = z.infer<typeof LeaderboardCategorySchema>;\nexport type LeaderboardOrderBy = z.infer<typeof LeaderboardOrderBySchema>;\n","import { z } from 'zod';\nimport {\n type ComboConditionId,\n ComboConditionIdSchema,\n type CtfConditionId,\n CtfConditionIdSchema,\n DecimalishSchema,\n type DecimalString,\n type EpochMilliseconds,\n EpochSecondsToMillisecondsSchema,\n emptyStringToNull,\n type PositionId,\n PositionIdSchema,\n type TokenId,\n TokenIdSchema,\n type TxHash,\n TxHashSchema,\n} from '../shared';\nimport {\n ActivityType,\n ActivityTypeSchema,\n type Address,\n AddressSchema,\n type Side,\n SideSchema,\n} from './common';\n\nexport type ActivityBase = {\n /** Wallet address whose account history contains this activity. */\n wallet: Address;\n /** Activity time as Unix epoch milliseconds. */\n timestamp: EpochMilliseconds;\n /** Polygon transaction hash that produced or records this activity. */\n transactionHash: TxHash;\n /** Display name of the wallet owner at the time returned by the API. */\n name: string | null;\n /** Public pseudonym of the wallet owner at the time returned by the API. */\n pseudonym: string | null;\n /** Profile biography of the wallet owner at the time returned by the API. */\n bio: string | null;\n /** Source profile image URL for the wallet owner. */\n profileImage: string | null;\n /** Optimized profile image URL for the wallet owner. */\n profileImageOptimized: string | null;\n};\n\ntype TradeActivityBase = ActivityBase & {\n /** A directional outcome-token trade. */\n type: ActivityType.TRADE;\n /** Whether this trade is for a Combo position instead of a binary market token. */\n isCombo: boolean;\n /** Direction of the wallet's trade. */\n side: Side;\n /** Number of shares traded by the wallet. */\n shares: DecimalString;\n /** The notional value of the traded shares in USD. */\n amount: DecimalString;\n /** The execution price per share in USD. */\n price: DecimalString;\n /** Human-readable title of the traded market or Combo. */\n title: string;\n /** Icon URL for the traded market or Combo, when available. */\n icon: string | null;\n};\n\nexport type ClobTradeActivity = TradeActivityBase & {\n /** CLOB market trades are binary market outcome-token trades. */\n isCombo: false;\n /** Condition id of the market traded by the wallet. */\n conditionId: CtfConditionId;\n /** Outcome token id bought or sold by the wallet. */\n tokenId: TokenId;\n /** Display label of the outcome token traded by the wallet. */\n outcome: string;\n /** Zero-based index of the outcome token in the market's outcome list. */\n outcomeIndex: number;\n /** URL slug of the market traded by the wallet. */\n slug: string;\n /** URL slug of the event containing the traded market. */\n eventSlug: string;\n};\n\nexport type ComboTradeActivity = TradeActivityBase & {\n /** Combo trades are protocol v2 Combo position trades. */\n isCombo: true;\n /** Combo condition id traded by the wallet. */\n conditionId: ComboConditionId;\n /** Combo position id bought or sold by the wallet. */\n positionId: PositionId;\n};\n\nexport type TradeActivity = ClobTradeActivity | ComboTradeActivity;\n\nexport type SplitActivity = ActivityBase & {\n /** Splitting collateral into a complete market set. */\n type: 'SPLIT';\n /** Condition id of the market whose complete set was created. */\n conditionId: CtfConditionId;\n /** The collateral amount split into the complete set in USD. */\n amount: DecimalString;\n /** Human-readable title of the market whose complete set was created. */\n title: string;\n /** URL slug of the market whose complete set was created. */\n slug: string;\n /** Icon URL for the market whose complete set was created, when available. */\n icon: string | null;\n /** URL slug of the event containing the split market. */\n eventSlug: string;\n};\n\nexport type MergeActivity = ActivityBase & {\n /** Merging a complete market set into collateral. */\n type: 'MERGE';\n /** Condition id of the market whose complete set was merged. */\n conditionId: CtfConditionId;\n /** The collateral amount received from merging the complete set in USD. */\n amount: DecimalString;\n /** Human-readable title of the market whose complete set was merged. */\n title: string;\n /** URL slug of the market whose complete set was merged. */\n slug: string;\n /** Icon URL for the market whose complete set was merged, when available. */\n icon: string | null;\n /** URL slug of the event containing the merged market. */\n eventSlug: string;\n};\n\nexport type RedeemActivity = ActivityBase & {\n /** Redeeming resolved market proceeds. */\n type: 'REDEEM';\n /** Condition id of the market redeemed by the wallet. */\n conditionId: CtfConditionId;\n /** The proceeds redeemed from the resolved market in USD. */\n amount: DecimalString;\n /** Human-readable title of the market redeemed by the wallet. */\n title: string;\n /** URL slug of the market redeemed by the wallet. */\n slug: string;\n /** Icon URL for the market redeemed by the wallet, when available. */\n icon: string | null;\n /** URL slug of the event containing the redeemed market. */\n eventSlug: string;\n};\n\nexport type ConversionActivity = ActivityBase & {\n /** A market conversion or migration activity. */\n type: 'CONVERSION';\n /** Condition id of the market involved in the conversion. */\n conditionId: CtfConditionId;\n /** The amount converted or migrated for the market in USD. */\n amount: DecimalString;\n /** Human-readable title of the market involved in the conversion. */\n title: string;\n /** URL slug of the market involved in the conversion. */\n slug: string;\n /** Icon URL for the market involved in the conversion, when available. */\n icon: string | null;\n /** URL slug of the event containing the converted market. */\n eventSlug: string;\n};\n\nexport type RewardActivity = ActivityBase & {\n /** An account-level reward credit. */\n type: 'REWARD';\n /** The reward amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type MakerRebateActivity = ActivityBase & {\n /** An account-level maker rebate credit. */\n type: 'MAKER_REBATE';\n /** The maker rebate amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type ReferralRewardActivity = ActivityBase & {\n /** An account-level referral reward credit. */\n type: 'REFERRAL_REWARD';\n /** The referral reward amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type YieldActivity = ActivityBase & {\n /** An account-level yield credit. */\n type: 'YIELD';\n /** The yield amount credited to the wallet in USD. */\n amount: DecimalString;\n};\n\nexport type Activity =\n | TradeActivity\n | SplitActivity\n | MergeActivity\n | RedeemActivity\n | ConversionActivity\n | RewardActivity\n | MakerRebateActivity\n | ReferralRewardActivity\n | YieldActivity;\n\nconst OptionalTextSchema = z.preprocess(\n (value) => (value === '' ? undefined : value),\n z.string().optional(),\n);\n\nexport const TradeSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n side: SideSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n size: DecimalishSchema.nullish(),\n price: DecimalishSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.preprocess(emptyStringToNull, z.string().nullish()),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n name: z.string().nullish(),\n pseudonym: z.string().nullish(),\n bio: z.string().nullish(),\n profileImage: z.string().nullish(),\n profileImageOptimized: z.string().nullish(),\n transactionHash: z.string().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nconst RawActivitySchema = z.object({\n proxyWallet: AddressSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n conditionId: z.preprocess(\n (value) => (value === '' ? undefined : value),\n z.string().optional(),\n ),\n type: ActivityTypeSchema,\n size: DecimalishSchema.nullish(),\n usdcSize: DecimalishSchema.nullish(),\n transactionHash: TxHashSchema.nullish(),\n price: DecimalishSchema.nullish(),\n asset: z.preprocess(\n (value) => (value === '' ? undefined : value),\n z.string().optional(),\n ),\n side: z.preprocess(\n (value) => (value === '' ? undefined : value),\n SideSchema.nullish(),\n ),\n isCombo: z.boolean().optional(),\n outcomeIndex: z.preprocess(\n (value) => (value === 999 ? undefined : value),\n z.number().int().optional(),\n ),\n title: OptionalTextSchema,\n slug: OptionalTextSchema,\n icon: OptionalTextSchema,\n eventSlug: OptionalTextSchema,\n outcome: OptionalTextSchema,\n name: OptionalTextSchema,\n pseudonym: OptionalTextSchema,\n bio: OptionalTextSchema,\n profileImage: OptionalTextSchema,\n profileImageOptimized: OptionalTextSchema,\n});\n\nexport const ActivitySchema: z.ZodType<Activity> =\n RawActivitySchema.transform(normalizeActivity);\n\nexport const TradedSchema = z.object({\n user: AddressSchema.nullish(),\n traded: z.number().int().nullish(),\n});\n\nexport const ListTradesResponseSchema = z.array(TradeSchema);\nexport const ListActivityResponseSchema = z.array(ActivitySchema);\n\nexport type Trade = z.infer<typeof TradeSchema>;\nexport type Traded = z.infer<typeof TradedSchema>;\nexport type ListTradesResponse = z.infer<typeof ListTradesResponseSchema>;\nexport type ListActivityResponse = z.infer<typeof ListActivityResponseSchema>;\n\ntype RawActivity = z.infer<typeof RawActivitySchema>;\n\nfunction normalizeActivity(activity: RawActivity): Activity {\n const base = normalizeActivityBase(activity);\n\n switch (activity.type) {\n case ActivityType.TRADE:\n return normalizeTradeActivity(activity, base);\n case ActivityType.SPLIT:\n case ActivityType.MERGE:\n case ActivityType.REDEEM:\n case ActivityType.CONVERSION:\n return {\n ...base,\n type: activity.type,\n conditionId: CtfConditionIdSchema.parse(\n expectPresent(activity.conditionId, 'conditionId'),\n ),\n amount: inferAmount(activity),\n title: expectPresent(activity.title, 'title'),\n slug: expectPresent(activity.slug, 'slug'),\n icon: activity.icon ?? null,\n eventSlug: expectPresent(activity.eventSlug, 'eventSlug'),\n };\n case ActivityType.REWARD:\n case ActivityType.MAKER_REBATE:\n case ActivityType.REFERRAL_REWARD:\n case ActivityType.YIELD:\n return {\n ...base,\n type: activity.type,\n amount: inferAmount(activity),\n };\n }\n}\n\nfunction normalizeTradeActivity(\n activity: RawActivity,\n base: ActivityBase,\n): TradeActivity {\n const trade = {\n ...base,\n type: ActivityType.TRADE as ActivityType.TRADE,\n side: expectPresent(activity.side, 'side'),\n shares: expectPresent(activity.size, 'size'),\n amount: inferAmount(activity),\n price: expectPresent(activity.price, 'price'),\n title: expectPresent(activity.title, 'title'),\n icon: activity.icon ?? null,\n };\n\n if (activity.isCombo === true) {\n return {\n ...trade,\n isCombo: true,\n conditionId: ComboConditionIdSchema.parse(\n expectPresent(activity.conditionId, 'conditionId'),\n ),\n positionId: PositionIdSchema.parse(\n expectPresent(activity.asset, 'asset'),\n ),\n };\n }\n\n return {\n ...trade,\n isCombo: false,\n conditionId: CtfConditionIdSchema.parse(\n expectPresent(activity.conditionId, 'conditionId'),\n ),\n tokenId: TokenIdSchema.parse(expectPresent(activity.asset, 'asset')),\n outcome: expectPresent(activity.outcome, 'outcome'),\n outcomeIndex: expectPresent(activity.outcomeIndex, 'outcomeIndex'),\n slug: expectPresent(activity.slug, 'slug'),\n eventSlug: expectPresent(activity.eventSlug, 'eventSlug'),\n };\n}\n\nfunction normalizeActivityBase(activity: RawActivity): ActivityBase {\n return {\n wallet: expectPresent(activity.proxyWallet, 'proxyWallet'),\n timestamp: expectPresent(activity.timestamp, 'timestamp'),\n transactionHash: expectPresent(activity.transactionHash, 'transactionHash'),\n name: activity.name ?? null,\n pseudonym: activity.pseudonym ?? null,\n bio: activity.bio ?? null,\n profileImage: activity.profileImage ?? null,\n profileImageOptimized: activity.profileImageOptimized ?? null,\n };\n}\n\nfunction inferAmount(activity: RawActivity): DecimalString {\n return expectPresent(activity.usdcSize ?? activity.size, 'usdcSize');\n}\n\nfunction expectPresent<T>(value: T | null | undefined, field: string): T {\n if (value === null || value === undefined) {\n throw new TypeError(`Expected activity.${field} to be present`);\n }\n\n return value;\n}\n","import { z } from 'zod';\nimport { DecimalishSchema, TokenIdSchema } from '../shared';\nimport { AddressSchema, Hash64Schema } from './common';\n\nexport const HolderSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n bio: z.string().nullish(),\n asset: TokenIdSchema.nullish(),\n pseudonym: z.string().nullish(),\n amount: DecimalishSchema.nullish(),\n displayUsernamePublic: z.boolean().nullish(),\n outcomeIndex: z.number().int().nullish(),\n name: z.string().nullish(),\n profileImage: z.string().nullish(),\n profileImageOptimized: z.string().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nexport const MetaHolderSchema = z.object({\n token: z.string().nullish(),\n holders: z.array(HolderSchema).nullish(),\n});\n\nexport const OpenInterestSchema = z.object({\n market: Hash64Schema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const MarketVolumeSchema = z.object({\n market: Hash64Schema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const LiveVolumeSchema = z.object({\n total: DecimalishSchema.nullish(),\n markets: z.array(MarketVolumeSchema).nullish(),\n});\n\nexport const ListMarketHoldersResponseSchema = z.array(MetaHolderSchema);\nexport const ListOpenInterestResponseSchema = z.array(OpenInterestSchema);\nexport const FetchEventLiveVolumeResponseSchema = z.array(LiveVolumeSchema);\n\nexport type Holder = z.infer<typeof HolderSchema>;\nexport type MetaHolder = z.infer<typeof MetaHolderSchema>;\nexport type OpenInterest = z.infer<typeof OpenInterestSchema>;\nexport type MarketVolume = z.infer<typeof MarketVolumeSchema>;\nexport type LiveVolume = z.infer<typeof LiveVolumeSchema>;\nexport type ListMarketHoldersResponse = z.infer<\n typeof ListMarketHoldersResponseSchema\n>;\nexport type ListOpenInterestResponse = z.infer<\n typeof ListOpenInterestResponseSchema\n>;\nexport type FetchEventLiveVolumeResponse = z.infer<\n typeof FetchEventLiveVolumeResponseSchema\n>;\n","import { z } from 'zod';\nimport { DecimalishSchema, IsoDateTimeStringSchema } from '../shared';\nimport { AddressSchema } from './common';\n\nexport const LeaderboardEntrySchema = z.object({\n rank: z.string().nullish(),\n builder: z.string().nullish(),\n volume: DecimalishSchema.nullish(),\n activeUsers: z.number().int().nullish(),\n verified: z.boolean().nullish(),\n builderLogo: z.string().nullish(),\n});\n\nexport const BuilderVolumeEntrySchema = z\n .object({\n dt: IsoDateTimeStringSchema.nullish(),\n builder: z.string().nullish(),\n builderLogo: z.string().nullish(),\n verified: z.boolean().nullish(),\n volume: DecimalishSchema.nullish(),\n activeUsers: z.number().int().nullish(),\n rank: z.string().nullish(),\n })\n .transform(({ dt, ...rest }) => ({\n ...rest,\n bucketAt: dt,\n }));\n\nexport const TraderLeaderboardEntrySchema = z\n .object({\n rank: z.string().nullish(),\n proxyWallet: AddressSchema.nullish(),\n userName: z.string().nullish(),\n vol: DecimalishSchema.nullish(),\n pnl: DecimalishSchema.nullish(),\n profileImage: z.string().nullish(),\n xUsername: z.string().nullish(),\n verifiedBadge: z.boolean().nullish(),\n })\n .transform(({ proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n }));\n\nexport const ListBuilderLeaderboardResponseSchema = z.array(\n LeaderboardEntrySchema,\n);\nexport const ListBuilderVolumeResponseSchema = z.array(\n BuilderVolumeEntrySchema,\n);\nexport const ListTraderLeaderboardResponseSchema = z.array(\n TraderLeaderboardEntrySchema,\n);\n\nexport type LeaderboardEntry = z.infer<typeof LeaderboardEntrySchema>;\nexport type BuilderVolumeEntry = z.infer<typeof BuilderVolumeEntrySchema>;\nexport type TraderLeaderboardEntry = z.infer<\n typeof TraderLeaderboardEntrySchema\n>;\nexport type ListBuilderLeaderboardResponse = z.infer<\n typeof ListBuilderLeaderboardResponseSchema\n>;\nexport type ListBuilderVolumeResponse = z.infer<\n typeof ListBuilderVolumeResponseSchema\n>;\nexport type ListTraderLeaderboardResponse = z.infer<\n typeof ListTraderLeaderboardResponseSchema\n>;\n","import { z } from 'zod';\nimport {\n ComboConditionIdSchema,\n CtfConditionIdSchema,\n DecimalishSchema,\n EpochSecondsToMillisecondsSchema,\n emptyStringToNull,\n IsoCalendarDateStringSchema,\n IsoDateTimeStringSchema,\n MixedDateTimeStringSchema,\n PaginationCursorSchema,\n PositionIdSchema,\n TokenIdSchema,\n} from '../shared';\nimport { AddressSchema } from './common';\n\nexport enum ComboPositionStatus {\n Open = 'OPEN',\n Partial = 'PARTIAL',\n ResolvedWin = 'RESOLVED_WIN',\n ResolvedLoss = 'RESOLVED_LOSS',\n}\n\nexport const ComboPositionStatusSchema = z.enum(ComboPositionStatus);\n\nexport const PositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema,\n size: DecimalishSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n initialValue: DecimalishSchema.nullish(),\n currentValue: DecimalishSchema.nullish(),\n cashPnl: DecimalishSchema.nullish(),\n percentPnl: z.number().nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n percentRealizedPnl: z.number().nullish(),\n curPrice: DecimalishSchema.nullish(),\n redeemable: z.boolean().nullish(),\n mergeable: z.boolean().nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.preprocess(emptyStringToNull, z.string().nullish()),\n eventId: z.string().nullish(),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n oppositeOutcome: z.string().nullish(),\n oppositeAsset: TokenIdSchema.nullish(),\n endDate: IsoCalendarDateStringSchema.nullish(),\n negativeRisk: z.boolean().nullish(),\n })\n .transform(({ asset, oppositeAsset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n oppositeTokenId: oppositeAsset,\n }));\n\nexport const ClosedPositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n curPrice: DecimalishSchema.nullish(),\n timestamp: EpochSecondsToMillisecondsSchema.nullish(),\n title: z.string().nullish(),\n slug: z.string().nullish(),\n icon: z.preprocess(emptyStringToNull, z.string().nullish()),\n eventSlug: z.string().nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n oppositeOutcome: z.string().nullish(),\n oppositeAsset: TokenIdSchema.nullish(),\n endDate: MixedDateTimeStringSchema.nullish(),\n })\n .transform(({ asset, oppositeAsset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n oppositeTokenId: oppositeAsset,\n }));\n\nexport const ValueSchema = z.object({\n user: AddressSchema.nullish(),\n value: DecimalishSchema.nullish(),\n});\n\nexport const MarketPositionSchema = z\n .object({\n proxyWallet: AddressSchema.nullish(),\n name: z.string().nullish(),\n profileImage: z.string().nullish(),\n verified: z.boolean().nullish(),\n asset: TokenIdSchema.nullish(),\n conditionId: CtfConditionIdSchema.nullish(),\n avgPrice: DecimalishSchema.nullish(),\n size: DecimalishSchema.nullish(),\n currPrice: DecimalishSchema.nullish(),\n currentValue: DecimalishSchema.nullish(),\n cashPnl: DecimalishSchema.nullish(),\n totalBought: DecimalishSchema.nullish(),\n realizedPnl: DecimalishSchema.nullish(),\n totalPnl: DecimalishSchema.nullish(),\n outcome: z.string().nullish(),\n outcomeIndex: z.number().int().nullish(),\n })\n .transform(({ asset, proxyWallet, ...rest }) => ({\n ...rest,\n wallet: proxyWallet,\n tokenId: asset,\n }));\n\nexport const MetaMarketPositionSchema = z.object({\n token: z.string().nullish(),\n positions: z.array(MarketPositionSchema).nullish(),\n});\n\nexport const ComboPositionMarketEventSchema = z\n .object({\n event_id: z.string().nullish(),\n event_slug: z.string().nullish(),\n event_title: z.string().nullish(),\n event_image: z.string().nullish(),\n })\n .transform(({ event_id, event_slug, event_title, event_image }) => ({\n eventId: event_id,\n eventSlug: event_slug,\n eventTitle: event_title,\n eventImage: event_image,\n }));\n\nexport const ComboPositionMarketSchema = z\n .object({\n market_id: z.string().nullish(),\n slug: z.string().nullish(),\n title: z.string().nullish(),\n outcome: z.string().nullish(),\n image_url: z.string().nullish(),\n icon_url: z.string().nullish(),\n category: z.string().nullish(),\n subcategory: z.string().nullish(),\n tags: z.array(z.string()).nullish(),\n end_date: IsoDateTimeStringSchema.nullish(),\n event: ComboPositionMarketEventSchema.nullish(),\n })\n .transform(({ market_id, image_url, icon_url, end_date, ...rest }) => ({\n ...rest,\n marketId: market_id,\n imageUrl: image_url,\n iconUrl: icon_url,\n endDate: end_date,\n }));\n\nexport const ComboPositionLegSchema = z\n .object({\n leg_index: z.number().int(),\n leg_position_id: PositionIdSchema,\n leg_condition_id: CtfConditionIdSchema,\n leg_outcome_index: z.number().int(),\n leg_outcome_label: z.string().nullish(),\n leg_status: ComboPositionStatusSchema,\n leg_resolved_at: IsoDateTimeStringSchema.nullish(),\n leg_current_price: DecimalishSchema.nullish(),\n market: ComboPositionMarketSchema.nullish(),\n })\n .transform(\n ({\n leg_index,\n leg_position_id,\n leg_condition_id,\n leg_outcome_index,\n leg_outcome_label,\n leg_status,\n leg_resolved_at,\n leg_current_price,\n ...rest\n }) => ({\n ...rest,\n legIndex: leg_index,\n legPositionId: leg_position_id,\n legConditionId: leg_condition_id,\n legOutcomeIndex: leg_outcome_index,\n legOutcomeLabel: leg_outcome_label,\n legStatus: leg_status,\n legResolvedAt: leg_resolved_at,\n legCurrentPrice: leg_current_price,\n }),\n );\n\nexport const ComboPositionSchema = z\n .object({\n combo_condition_id: ComboConditionIdSchema,\n combo_position_id: PositionIdSchema,\n module_id: z.number().int(),\n user_address: AddressSchema,\n shares_balance: DecimalishSchema,\n entry_avg_price_usdc: DecimalishSchema.nullish(),\n entry_cost_usdc: DecimalishSchema.nullish(),\n status: ComboPositionStatusSchema,\n first_entry_at: IsoDateTimeStringSchema,\n resolved_at: IsoDateTimeStringSchema.nullish(),\n legs_total: z.number().int(),\n legs_resolved: z.number().int(),\n legs_pending: z.number().int(),\n legs: z.array(ComboPositionLegSchema),\n })\n .transform(\n ({\n combo_condition_id,\n combo_position_id,\n module_id,\n user_address,\n shares_balance,\n entry_avg_price_usdc,\n entry_cost_usdc,\n first_entry_at,\n resolved_at,\n legs_total,\n legs_resolved,\n legs_pending,\n ...rest\n }) => ({\n ...rest,\n conditionId: combo_condition_id,\n positionId: combo_position_id,\n moduleId: module_id,\n userAddress: user_address,\n shares: shares_balance,\n entryAvgPriceUsdc: entry_avg_price_usdc,\n entryCostUsdc: entry_cost_usdc,\n firstEntryAt: first_entry_at,\n resolvedAt: resolved_at,\n legsTotal: legs_total,\n legsResolved: legs_resolved,\n legsPending: legs_pending,\n }),\n );\n\nexport const ListComboPositionsResponseSchema = z\n .object({\n combos: z.array(ComboPositionSchema),\n pagination: z.object({\n limit: z.number().int(),\n offset: z.number().int(),\n has_more: z.boolean(),\n next_cursor: PaginationCursorSchema.nullish(),\n }),\n })\n .transform(({ pagination, ...rest }) => ({\n ...rest,\n pagination: {\n limit: pagination.limit,\n offset: pagination.offset,\n hasMore: pagination.has_more,\n nextCursor: pagination.next_cursor,\n },\n }));\n\nexport const ListPositionsResponseSchema = z.array(PositionSchema);\nexport const ListClosedPositionsResponseSchema = z.array(ClosedPositionSchema);\nexport const FetchPortfolioValueResponseSchema = z.array(ValueSchema);\nexport const ListMarketPositionsResponseSchema = z.array(\n MetaMarketPositionSchema,\n);\n\nexport type Position = z.infer<typeof PositionSchema>;\nexport type ClosedPosition = z.infer<typeof ClosedPositionSchema>;\nexport type Value = z.infer<typeof ValueSchema>;\nexport type MarketPosition = z.infer<typeof MarketPositionSchema>;\nexport type MetaMarketPosition = z.infer<typeof MetaMarketPositionSchema>;\nexport type ComboPositionMarketEvent = z.infer<\n typeof ComboPositionMarketEventSchema\n>;\nexport type ComboPositionMarket = z.infer<typeof ComboPositionMarketSchema>;\nexport type ComboPositionLeg = z.infer<typeof ComboPositionLegSchema>;\nexport type ComboPosition = z.infer<typeof ComboPositionSchema>;\nexport type ListPositionsResponse = z.infer<typeof ListPositionsResponseSchema>;\nexport type ListClosedPositionsResponse = z.infer<\n typeof ListClosedPositionsResponseSchema\n>;\nexport type FetchPortfolioValueResponse = z.infer<\n typeof FetchPortfolioValueResponseSchema\n>;\nexport type ListMarketPositionsResponse = z.infer<\n typeof ListMarketPositionsResponseSchema\n>;\nexport type ListComboPositionsResponse = z.infer<\n typeof ListComboPositionsResponseSchema\n>;\n"]}