Skip to content

Commit

Permalink
Fixed endianness in Agda.TxId toExpr implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Apr 23, 2024
1 parent caa07bd commit 9d3d16d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ instance NFData Tx

instance NFData UTxOEnv

reverseEndianness :: String -> String
reverseEndianness (x : y : t) = reverseEndianness t <> [x, y]
reverseEndianness (x : t) = reverseEndianness t <> ['0', x]
reverseEndianness [] = []

instance ToExpr Credential where
toExpr (KeyHashObj h) = App "KeyHashObj" [toExpr $ showHex h ""]
toExpr (ScriptObj h) = App "ScriptObj" [toExpr $ showHex h ""]
toExpr (KeyHashObj h) = App "KeyHashObj" [toExpr . reverseEndianness $ showHex h ""]
toExpr (ScriptObj h) = App "ScriptObj" [toExpr . reverseEndianness $ showHex h ""]

instance ToExpr GovAction

Expand All @@ -115,7 +120,7 @@ instance ToExpr GovRole
instance ToExpr Vote

instance ToExpr TxId where
toExpr (MkTxId x) = App "TxId" [toExpr $ showHex x ""]
toExpr (MkTxId x) = App "TxId" [toExpr . reverseEndianness $ showHex x ""]

instance ToExpr GovActionState

Expand Down

0 comments on commit 9d3d16d

Please sign in to comment.