Skip to content

Commit

Permalink
Also conditionally include cbor for Byron transactions.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Oct 6, 2023
1 parent 02adb6c commit c7b6869
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions server/src/Ogmios/Data/Json/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,24 @@ encodeATxAux
-> By.ATxAux any
-> Json
encodeATxAux opts x =
"id" .= encodeHash (By.serializeCborHash (By.taTx x))
<>
"inputSource" .= encodeText "inputs"
<>
encodeAnnotated (encodeTx @crypto opts) (By.aTaTx x)
<>
"signatories" .= encodeAnnotated (encodeFoldable encodeTxInWitness) (By.aTaWitness x)
<>
"cbor" .=
( let bytes = encodeListLen 2 <> toCBOR (By.taTx x) <> toCBOR (By.taWitness x)
in encodeByteStringBase16 (toStrictByteString bytes)
encodeObject
( "id" .=
encodeHash (By.serializeCborHash (By.taTx x))
<> "inputSource" .=
encodeText "inputs"
<> encodeAnnotated
(encodeTx @crypto opts)
(By.aTaTx x)
<> "signatories" .=
encodeAnnotated (encodeFoldable encodeTxInWitness) (By.aTaWitness x)
<> if includeTransactionCbor opts then
"cbor" .=
( let bytes = encodeListLen 2 <> toCBOR (By.taTx x) <> toCBOR (By.taWitness x)
in encodeByteStringBase16 (toStrictByteString bytes)
)
else
mempty
)
& encodeObject

encodeTx
:: forall crypto. (Era (ByronEra crypto))
Expand Down

0 comments on commit c7b6869

Please sign in to comment.