Skip to content

Commit

Permalink
Fix JSON encoding for transaction metadata
Browse files Browse the repository at this point in the history
  Fixes #337.
  • Loading branch information
KtorZ committed Oct 6, 2023
1 parent deed380 commit 02adb6c
Show file tree
Hide file tree
Showing 46 changed files with 49 additions and 49 deletions.
8 changes: 4 additions & 4 deletions server/src/Ogmios/Data/Json/Shelley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -430,16 +430,16 @@ encodeMetadataBlob opts =
Sh.List xs ->
encodeList identity <$> traverse tryEncodeMetadatumAsJson xs
Sh.Map xs ->
encodeList identity <$> traverse tryEncodeKeyPairAsJson xs
encodeObject <$> foldMap tryEncodeKeyPairAsJson xs

tryEncodeKeyPairAsJson :: (Sh.Metadatum, Sh.Metadatum) -> StrictMaybe Json
tryEncodeKeyPairAsJson :: (Sh.Metadatum, Sh.Metadatum) -> StrictMaybe Series
tryEncodeKeyPairAsJson = \case
(Sh.I n, v) -> do
json <- tryEncodeMetadatumAsJson v
pure (encodeObject (show n .= json))
pure (show n .= json)
(Sh.S t, v) -> do
json <- tryEncodeMetadatumAsJson v
pure (encodeObject (t .= json))
pure (t .= json)
_ ->
SNothing

Expand Down
2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/007.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/008.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/009.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/026.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/032.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/test/vectors/NextBlockResponse/037.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 02adb6c

Please sign in to comment.