Skip to content

Commit 95f4d90

Browse files
author
Aleksandr Penskoi
committed
Extract savePABConfigPartial from savePABConfig and document it.
1 parent 8c5d32b commit 95f4d90

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/BotPlutusInterface/Config.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module BotPlutusInterface.Config (
88
docPABConfig,
99
loadPABConfig,
1010
savePABConfig,
11+
savePABConfigPartial,
1112
) where
1213

1314
import BotPlutusInterface.Types (CLILocation (..), LogLevel (..), PABConfig (..))
@@ -230,7 +231,16 @@ loadPABConfig fn = do
230231
Left err -> Left $ "protocolParamsFile: " <> toString pcProtocolParamsFile <> ": " <> err
231232
Right pcProtocolParams -> Right conf {pcProtocolParams}
232233

234+
{- |Save 'PABConfig' into two files:
235+
236+
- Save 'PABConfig' into a file without `pcProtocolParams`, which specified as the argument
237+
- Save 'pcProtocolParams' into file, which specified in `pcProtocolParamsFile` field of 'PABConfig'
238+
-}
233239
savePABConfig :: FilePath -> PABConfig -> IO ()
234240
savePABConfig fn conf@PABConfig {pcProtocolParams, pcProtocolParamsFile} = do
235241
writeProtocolParametersJSON (toString pcProtocolParamsFile) pcProtocolParams
236-
writeFile fn $ serialize conf <> "\n"
242+
savePABConfigPartial fn conf
243+
244+
-- |Partly save 'PABConfig' to file, without `pcProtocolParams`
245+
savePABConfigPartial :: FilePath -> PABConfig -> IO ()
246+
savePABConfigPartial fn conf = writeFile fn $ serialize conf <> "\n"

0 commit comments

Comments
 (0)