@@ -27,12 +27,11 @@ parent: Modules
2727 - [ Integer (interface)] ( #integer-interface )
2828 - [ Literal] ( #literal )
2929 - [ Literal (interface)] ( #literal-interface )
30+ - [ LiteralOptions (interface)] ( #literaloptions-interface )
3031 - [ Map] ( #map )
3132 - [ Map (interface)] ( #map-interface )
3233 - [ NullOr] ( #nullor )
3334 - [ NullOr (interface)] ( #nullor-interface )
34- - [ OneLiteral] ( #oneliteral )
35- - [ OneLiteral (interface)] ( #oneliteral-interface )
3635 - [ Struct] ( #struct )
3736 - [ Struct (interface)] ( #struct-interface )
3837 - [ StructOptions (interface)] ( #structoptions-interface )
@@ -85,7 +84,7 @@ export declare const TaggedStruct: <
8584 tagValue : TagValue ,
8685 fields : Fields ,
8786 options ? : StructOptions & { tagField? : TagField }
88- ) => Struct <{ [K in TagField ]: OneLiteral < TagValue > } & Fields >
87+ ) => Struct <{ [K in TagField ]: Literal <[ TagValue ] > } & Fields >
8988` ` `
9089
9190Added in v2.0.0
@@ -203,9 +202,12 @@ Creates a schema for literal types with Plutus Data Constructor transformation
203202** Signature**
204203
205204``` ts
206- export declare const Literal: <Literals extends NonEmptyReadonlyArray <Exclude <SchemaAST .LiteralValue , null | bigint >>>(
205+ export declare function Literal<Literals extends NonEmptyReadonlyArray <Exclude <SchemaAST .LiteralValue , null | bigint >>>(
207206 ... self : Literals
208- ) => Literal <Literals >
207+ ): Literal <Literals >
208+ export declare function Literal<Literals extends NonEmptyReadonlyArray <Exclude <SchemaAST .LiteralValue , null | bigint >>>(
209+ ... args : [... Literals , LiteralOptions ]
210+ ): Literal <Literals >
209211```
210212
211213Added in v2 .0.0
@@ -219,6 +221,30 @@ export interface Literal<Literals extends NonEmptyReadonlyArray<SchemaAST.Litera
219221 extends Schema.transform<Schema.SchemaClass<Data.Constr, Data.Constr, never>, Schema.Literal<[...Literals]>> {}
220222` ` `
221223
224+ ## LiteralOptions (interface )
225+
226+ Options for Literal schema
227+
228+ ** Signature **
229+
230+ ` ` ` ts
231+ export interface LiteralOptions {
232+ /**
233+ * Custom Constr index for this literal (default: auto-incremented from 0)
234+ * Useful when matching Plutus contract constructor indices
235+ */
236+ index?: number
237+ /**
238+ * When used in a Union, controls whether this Literal should be "flattened" (unwrapped).
239+ * - true: Encodes as Constr(index, []) directly
240+ * - false: Encodes as Constr(unionPos, [Constr(index, [])]) (nested)
241+ *
242+ * Default: true when index is specified, false otherwise
243+ */
244+ flatInUnion?: boolean
245+ }
246+ ` ` `
247+
222248## Map
223249
224250Creates a schema for maps with Plutus Map type annotation
@@ -270,25 +296,6 @@ export interface NullOr<S extends Schema.Schema.All>
270296 extends Schema.transform<Schema.SchemaClass<Data.Constr, Data.Constr, never>, Schema.NullOr<S>> {}
271297` ` `
272298
273- ## OneLiteral
274-
275- ** Signature**
276-
277- ``` ts
278- export declare const OneLiteral: <Single extends Exclude <SchemaAST .LiteralValue , null | bigint >>(
279- self : Single
280- ) => OneLiteral <Single >
281- ` ` `
282-
283- ## OneLiteral (interface)
284-
285- **Signature**
286-
287- ` ` ` ts
288- export interface OneLiteral <Single extends Exclude <SchemaAST .LiteralValue , null | bigint >>
289- extends Schema .transform <Schema .SchemaClass <Data .Constr , Data .Constr , never >, Schema .Literal <[Single ]>> {}
290- ```
291-
292299## Struct
293300
294301Creates a schema for struct types using Plutus Data Constructor
0 commit comments