11import { z } from 'zod' ;
2- import { MarketIdSchema , TickSizeValueSchema } from '../shared' ;
2+ import { MarketIdSchema , TickSizeValueSchema , TokenIdSchema } from '../shared' ;
33import {
44 CategoryReferenceSchema ,
55 ClobRewardsSchema ,
@@ -11,11 +11,21 @@ import {
1111 TagReferenceSchema ,
1212} from './common' ;
1313
14- const TwoStringTupleSchema = z
14+ const OutcomePairSchema = z
1515 . string ( )
1616 . transform ( ( val ) => JSON . parse ( val ) )
1717 . pipe ( z . tuple ( [ z . string ( ) , z . string ( ) ] ) ) ;
1818
19+ const OutcomePricePairSchema = z
20+ . string ( )
21+ . transform ( ( val ) => JSON . parse ( val ) )
22+ . pipe ( z . tuple ( [ z . string ( ) , z . string ( ) ] ) ) ;
23+
24+ const TokenIdPairSchema = z
25+ . string ( )
26+ . transform ( ( val ) => JSON . parse ( val ) )
27+ . pipe ( z . tuple ( [ TokenIdSchema , TokenIdSchema ] ) ) ;
28+
1929export const MarketSchema = z . looseObject ( {
2030 id : MarketIdSchema ,
2131 question : z . string ( ) . nullish ( ) ,
@@ -39,8 +49,8 @@ export const MarketSchema = z.looseObject({
3949 lowerBound : z . string ( ) . nullish ( ) ,
4050 upperBound : z . string ( ) . nullish ( ) ,
4151 description : z . string ( ) . nullish ( ) ,
42- outcomes : TwoStringTupleSchema . nullish ( ) ,
43- outcomePrices : TwoStringTupleSchema . nullish ( ) ,
52+ outcomes : OutcomePairSchema . nullish ( ) ,
53+ outcomePrices : OutcomePricePairSchema . nullish ( ) ,
4454 volume : z . string ( ) . nullish ( ) ,
4555 active : z . boolean ( ) . nullish ( ) ,
4656 marketType : z . string ( ) . nullish ( ) ,
@@ -92,7 +102,7 @@ export const MarketSchema = z.looseObject({
92102 volume1yr : z . number ( ) . nullish ( ) ,
93103 gameStartTime : z . string ( ) . nullish ( ) ,
94104 secondsDelay : z . number ( ) . int ( ) . nullish ( ) ,
95- clobTokenIds : TwoStringTupleSchema . nullish ( ) ,
105+ clobTokenIds : TokenIdPairSchema . nullish ( ) ,
96106 disqusThread : z . string ( ) . nullish ( ) ,
97107 shortOutcomes : z . string ( ) . nullish ( ) ,
98108 teamAID : z . string ( ) . nullish ( ) ,
0 commit comments