@@ -191,7 +191,8 @@ const decodeAuxiliaryDataHash = ParseResult.decodeEither(AuxiliaryDataHash.FromB
191191const decodeScriptDataHash = ParseResult . decodeEither ( ScriptDataHash . FromBytes )
192192const decodeKeyHash = ParseResult . decodeEither ( KeyHash . FromBytes )
193193
194- const decodeInputs = ParseResult . decodeUnknownEither ( CBOR . tag ( 258 , Schema . Array ( TransactionInput . FromCDDL ) ) )
194+ const decodeTaggedInputs = ParseResult . decodeUnknownEither ( CBOR . tag ( 258 , Schema . Array ( TransactionInput . FromCDDL ) ) )
195+ const decodeUntaggedInputs = ParseResult . decodeUnknownEither ( Schema . Array ( TransactionInput . FromCDDL ) )
195196
196197/**
197198 * CDDL schema for TransactionBody struct structure.
@@ -314,10 +315,12 @@ export const FromCDDL = Schema.transformOrFail(CDDLSchema, Schema.typeSchema(Tra
314315 } ) ,
315316 decode : ( fromA ) =>
316317 E . gen ( function * ( ) {
317- // Required fields - access via helper
318- const inputsTag = fromA . get ( 0n )
319- const decodedInputs = yield * decodeInputs ( inputsTag )
320- const inputs = decodedInputs . value
318+ // Required fields - accept both tag-258 (Conway) and plain array (Babbage)
319+ const inputsRaw = fromA . get ( 0n )
320+ const taggedResult = decodeTaggedInputs ( inputsRaw )
321+ const inputs = E . isRight ( taggedResult )
322+ ? taggedResult . right . value
323+ : yield * decodeUntaggedInputs ( inputsRaw )
321324
322325 // const inputsArray = inputsTag.value
323326 // const inputsLen = inputsArray.length
@@ -370,14 +373,16 @@ export const FromCDDL = Schema.transformOrFail(CDDLSchema, Schema.typeSchema(Tra
370373 const scriptDataHashBytes = fromA . get ( 11n ) as Uint8Array | undefined
371374 const scriptDataHash = scriptDataHashBytes ? yield * decodeScriptDataHash ( scriptDataHashBytes ) : undefined
372375
373- const collateralInputsTag = fromA . get ( 13n ) as
374- | {
375- _tag : "Tag"
376- tag : 258
377- value : ReadonlyArray < typeof TransactionInput . CDDLSchema . Type >
378- }
376+ // Accept both tag-258 (Conway) and plain array (Babbage) for collateral inputs
377+ const collateralInputsRaw = fromA . get ( 13n ) as
378+ | { _tag : "Tag" ; tag : 258 ; value : ReadonlyArray < typeof TransactionInput . CDDLSchema . Type > }
379+ | ReadonlyArray < typeof TransactionInput . CDDLSchema . Type >
379380 | undefined
380- const collateralInputsArray = collateralInputsTag ? collateralInputsTag . value : undefined
381+ const collateralInputsArray = collateralInputsRaw
382+ ? ( collateralInputsRaw as any ) . _tag === "Tag"
383+ ? ( collateralInputsRaw as any ) . value
384+ : collateralInputsRaw
385+ : undefined
381386 let collateralInputs : NonEmptyArray < TransactionInput . TransactionInput > | undefined
382387 if ( collateralInputsArray ) {
383388 const len = collateralInputsArray . length
@@ -388,14 +393,16 @@ export const FromCDDL = Schema.transformOrFail(CDDLSchema, Schema.typeSchema(Tra
388393 collateralInputs = arr as NonEmptyArray < TransactionInput . TransactionInput >
389394 }
390395
391- const requiredSignersTag = fromA . get ( 14n ) as
392- | {
393- _tag : "Tag"
394- tag : 258
395- value : ReadonlyArray < Uint8Array >
396- }
396+ // Accept both tag-258 (Conway) and plain array (Babbage) for required signers
397+ const requiredSignersRaw = fromA . get ( 14n ) as
398+ | { _tag : "Tag" ; tag : 258 ; value : ReadonlyArray < Uint8Array > }
399+ | ReadonlyArray < Uint8Array >
397400 | undefined
398- const requiredSignersArray = requiredSignersTag ? requiredSignersTag . value : undefined
401+ const requiredSignersArray = requiredSignersRaw
402+ ? ( requiredSignersRaw as any ) . _tag === "Tag"
403+ ? ( requiredSignersRaw as any ) . value
404+ : requiredSignersRaw
405+ : undefined
399406 let requiredSigners : NonEmptyArray < KeyHash . KeyHash > | undefined
400407 if ( requiredSignersArray ) {
401408 const len = requiredSignersArray . length
@@ -411,14 +418,16 @@ export const FromCDDL = Schema.transformOrFail(CDDLSchema, Schema.typeSchema(Tra
411418 const collateralReturn = collateralReturnData ? yield * decodeTxOutput ( collateralReturnData ) : undefined
412419 const totalCollateral = fromA . get ( 17n ) as Coin . Coin | undefined
413420
414- const referenceInputsTag = fromA . get ( 18n ) as
415- | {
416- _tag : "Tag"
417- tag : 258
418- value : ReadonlyArray < typeof TransactionInput . CDDLSchema . Type >
419- }
421+ // Accept both tag-258 (Conway) and plain array (Babbage) for reference inputs
422+ const referenceInputsRaw = fromA . get ( 18n ) as
423+ | { _tag : "Tag" ; tag : 258 ; value : ReadonlyArray < typeof TransactionInput . CDDLSchema . Type > }
424+ | ReadonlyArray < typeof TransactionInput . CDDLSchema . Type >
420425 | undefined
421- const referenceInputsArray = referenceInputsTag ? referenceInputsTag . value : undefined
426+ const referenceInputsArray : ReadonlyArray < typeof TransactionInput . CDDLSchema . Type > | undefined = referenceInputsRaw
427+ ? ( referenceInputsRaw as any ) . _tag === "Tag"
428+ ? ( referenceInputsRaw as any ) . value
429+ : referenceInputsRaw
430+ : undefined
422431 let referenceInputs : NonEmptyArray < TransactionInput . TransactionInput > | undefined
423432 if ( referenceInputsArray ) {
424433 const len = referenceInputsArray . length
@@ -430,15 +439,15 @@ export const FromCDDL = Schema.transformOrFail(CDDLSchema, Schema.typeSchema(Tra
430439 }
431440 const votingProceduresData = fromA . get ( 19n ) as typeof VotingProcedures . CDDLSchema . Type | undefined
432441 const votingProcedures = votingProceduresData ? yield * decodeVotingProcedures ( votingProceduresData ) : undefined
433- const proposalProceduresTag = fromA . get ( 20n ) as
434- | {
435- _tag : "Tag"
436- tag : 258
437- value : ReadonlyArray < typeof ProposalProcedure . CDDLSchema . Type >
438- }
442+ // Accept both tag-258 (Conway) and plain array (Babbage) for proposal procedures
443+ const proposalProceduresRaw = fromA . get ( 20n ) as
444+ | { _tag : "Tag" ; tag : 258 ; value : ReadonlyArray < typeof ProposalProcedure . CDDLSchema . Type > }
445+ | ReadonlyArray < typeof ProposalProcedure . CDDLSchema . Type >
439446 | undefined
440- const proposalProceduresArray = proposalProceduresTag
441- ? ( proposalProceduresTag . value as ReadonlyArray < typeof ProposalProcedure . CDDLSchema . Type > )
447+ const proposalProceduresArray : ReadonlyArray < typeof ProposalProcedure . CDDLSchema . Type > | undefined = proposalProceduresRaw
448+ ? ( proposalProceduresRaw as any ) . _tag === "Tag"
449+ ? ( proposalProceduresRaw as any ) . value
450+ : proposalProceduresRaw
442451 : undefined
443452 const proposalProcedures = proposalProceduresArray
444453 ? new ProposalProcedures . ProposalProcedures ( {
0 commit comments