module Main (main) where
import Cardano.Crypto.Init (cryptoInit)
import Cardano.Tools.DBSynthesizer.Run
import DBSynthesizer.Parsers
import Main.Utf8 (withStdTerminalHandles)
import System.Exit
main :: IO ()
IO ()
main = IO () -> IO ()
forall (m :: * -> *) r. (MonadIO m, MonadMask m) => m r -> m r
withStdTerminalHandles (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
IO ()
cryptoInit
(NodeFilePaths
paths, NodeCredentials
creds, DBSynthesizerOptions
forgeOpts) <- IO (NodeFilePaths, NodeCredentials, DBSynthesizerOptions)
parseCommandLine
let
genTxs :: p -> p -> p -> f [a]
genTxs p
_ p
_ p
_ = [a] -> f [a]
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
ForgeResult
result <- NodeFilePaths
-> NodeCredentials
-> DBSynthesizerOptions
-> IO
(Either
String (DBSynthesizerConfig, CardanoProtocolParams StandardCrypto))
initialize NodeFilePaths
paths NodeCredentials
creds DBSynthesizerOptions
forgeOpts IO
(Either
String (DBSynthesizerConfig, CardanoProtocolParams StandardCrypto))
-> (Either
String (DBSynthesizerConfig, CardanoProtocolParams StandardCrypto)
-> IO ForgeResult)
-> IO ForgeResult
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (String -> IO ForgeResult)
-> ((DBSynthesizerConfig, CardanoProtocolParams StandardCrypto)
-> IO ForgeResult)
-> Either
String (DBSynthesizerConfig, CardanoProtocolParams StandardCrypto)
-> IO ForgeResult
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either String -> IO ForgeResult
forall a. String -> IO a
die ((DBSynthesizerConfig
-> CardanoProtocolParams StandardCrypto -> IO ForgeResult)
-> (DBSynthesizerConfig, CardanoProtocolParams StandardCrypto)
-> IO ForgeResult
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((TopLevelConfig (CardanoBlock StandardCrypto)
-> GenTxs (CardanoBlock StandardCrypto))
-> DBSynthesizerConfig
-> CardanoProtocolParams StandardCrypto
-> IO ForgeResult
synthesize TopLevelConfig (CardanoBlock StandardCrypto)
-> GenTxs (CardanoBlock StandardCrypto)
forall {f :: * -> *} {p} {p} {p} {a}.
Applicative f =>
p -> p -> p -> f [a]
genTxs))
String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ String
"--> done; result: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ ForgeResult -> String
forall a. Show a => a -> String
show ForgeResult
result