Skip to content

Commit b5d2e80

Browse files
committed
Rename RawTx fields
Change-type: patch Signed-off-by: Giovanni Garufi <giovanni@mlabs.city>
1 parent bc89ade commit b5d2e80

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/BotPlutusInterface/Types.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ instance Default PABConfig where
109109
}
110110

111111
data RawTx = RawTx
112-
{ rawType :: Text
113-
, rawDescription :: Text
114-
, rawCborHex :: Text
112+
{ _type :: Text
113+
, _description :: Text
114+
, _cborHex :: Text
115115
}
116116
deriving (Generic, Eq, Show)
117117

118-
$(deriveJSON defaultOptions {fieldLabelModifier = drop 3} ''RawTx)
118+
-- type is a reserved keyword in haskell and can not be used as a field name
119+
-- when converting this to JSON we drop the _ prefix from each field
120+
$(deriveJSON defaultOptions {fieldLabelModifier = drop 1} ''RawTx)

test/Spec/BotPlutusInterface/Server.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ txFileName = "tx-" <> unpack txHash <> ".raw"
116116
rawTx :: RawTx
117117
rawTx =
118118
RawTx
119-
{ rawType = "TxBodyAlonzo"
120-
, rawDescription = "description"
121-
, rawCborHex = "hex"
119+
{ _type = "TxBodyAlonzo"
120+
, _description = "description"
121+
, _cborHex = "hex"
122122
}
123123

124124
txFileContents :: LBS.ByteString

0 commit comments

Comments
 (0)