| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
CardanoNode
Synopsis
- data HydraNodeLog
- = HydraNodeCommandSpec {
- cmd :: Text
- | NodeStarted { }
- | SentMessage { }
- | StartWaiting { }
- | ReceivedMessage { }
- | EndWaiting { }
- = HydraNodeCommandSpec {
- data EndToEndLog
- = ClusterOptions { }
- | FromCardanoNode NodeLog
- | FromFaucet FaucetLog
- | FromHydraNode HydraNodeLog
- | FromMithril MithrilLog
- | StartingFunds { }
- | RefueledFunds {
- actor :: String
- refuelingAmount :: Coin
- utxo :: UTxO
- | RemainingFunds { }
- | PublishedHydraScriptsAt {
- hydraScriptsTxId :: [TxId]
- | UsingHydraScriptsAt {
- hydraScriptsTxId :: [TxId]
- | CreatedKey { }
- data NodeLog
- = MsgNodeCmdSpec {
- cmd :: Text
- | MsgCLI [Text]
- | MsgCLIStatus Text Text
- | MsgCLIRetry Text
- | MsgCLIRetryResult Text Int
- | MsgNodeStarting { }
- | MsgSocketIsReady SocketPath
- | MsgSynchronizing { }
- | MsgQueryGenesisParametersFailed {
- err :: Text
- = MsgNodeCmdSpec {
- type Port = Int
- newtype NodeId = NodeId Int
- data CardanoNodeArgs = CardanoNodeArgs {
- nodeSocket :: FilePath
- nodeConfigFile :: FilePath
- nodeByronGenesisFile :: FilePath
- nodeShelleyGenesisFile :: FilePath
- nodeAlonzoGenesisFile :: FilePath
- nodeConwayGenesisFile :: FilePath
- nodeDijkstraGenesisFile :: FilePath
- nodeTopologyFile :: FilePath
- nodeDatabaseDir :: FilePath
- nodeDlgCertFile :: Maybe FilePath
- nodeSignKeyFile :: Maybe FilePath
- nodeOpCertFile :: Maybe FilePath
- nodeKesKeyFile :: Maybe FilePath
- nodeVrfKeyFile :: Maybe FilePath
- nodePort :: Maybe Port
- defaultCardanoNodeArgs :: CardanoNodeArgs
- getCardanoNodeVersion :: IO String
- findRunningCardanoNode :: Tracer IO NodeLog -> FilePath -> KnownNetwork -> IO (Maybe (NominalDiffTime, DirectOptions))
- findRunningCardanoNode' :: Tracer IO NodeLog -> NetworkId -> SocketPath -> IO (Maybe (NominalDiffTime, DirectOptions))
- runBackend :: ChainBackendOptions -> (forall m. (ChainBackend m, MonadIO m, MonadThrow m, MonadCatch m) => m a) -> IO a
- withCardanoNodeDevnet :: Tracer IO NodeLog -> FilePath -> (NominalDiffTime -> DirectOptions -> IO a) -> IO a
- withBlockfrostBackend :: Tracer IO EndToEndLog -> FilePath -> (NominalDiffTime -> ChainBackendOptions -> IO a) -> IO a
- findFileStartingAtDirectory :: Int -> FilePath -> IO FilePath
- withBackend :: forall a. Tracer IO EndToEndLog -> FilePath -> (NominalDiffTime -> ChainBackendOptions -> IO a) -> IO a
- withHydraScriptsAndBackendRunning :: forall a. Tracer IO EndToEndLog -> FilePath -> (ChainBackendOptions -> [TxId] -> IO a) -> IO a
- withCardanoNodeOnKnownNetwork :: Tracer IO NodeLog -> FilePath -> KnownNetwork -> (NominalDiffTime -> DirectOptions -> IO a) -> IO a
- setupCardanoDevnet :: FilePath -> IO CardanoNodeArgs
- withCardanoNode :: Tracer IO NodeLog -> FilePath -> CardanoNodeArgs -> (NominalDiffTime -> DirectOptions -> IO a) -> IO a
- getShelleyGenesisBlockTime :: Value -> NominalDiffTime
- waitForFullySynchronized :: Tracer IO NodeLog -> ChainBackendOptions -> IO ()
- waitForSocket :: SocketPath -> IO ()
- cardanoNodeProcess :: Maybe FilePath -> CardanoNodeArgs -> CreateProcess
- initSystemStart :: IO UTCTime
- refreshSystemStart :: FilePath -> CardanoNodeArgs -> IO ()
- mkTopology :: [Port] -> Value
- data ProcessHasExited = ProcessHasExited Text ExitCode
- cliQueryProtocolParameters :: SocketPath -> NetworkId -> IO Value
- unsafeDecodeJson :: FromJSON a => ByteString -> IO a
- unsafeDecodeJsonFile :: FromJSON a => FilePath -> IO a
Documentation
data HydraNodeLog Source #
Constructors
| HydraNodeCommandSpec | |
Fields
| |
| NodeStarted | |
| SentMessage | |
| StartWaiting | |
| ReceivedMessage | |
| EndWaiting | |
Instances
data EndToEndLog Source #
Constructors
| ClusterOptions | |
| FromCardanoNode NodeLog | |
| FromFaucet FaucetLog | |
| FromHydraNode HydraNodeLog | |
| FromMithril MithrilLog | |
| StartingFunds | |
| RefueledFunds | |
Fields
| |
| RemainingFunds | |
| PublishedHydraScriptsAt | |
Fields
| |
| UsingHydraScriptsAt | |
Fields
| |
| CreatedKey | |
Instances
Constructors
| MsgNodeCmdSpec | |
Fields
| |
| MsgCLI [Text] | |
| MsgCLIStatus Text Text | |
| MsgCLIRetry Text | |
| MsgCLIRetryResult Text Int | |
| MsgNodeStarting | |
Fields | |
| MsgSocketIsReady SocketPath | |
| MsgSynchronizing | |
Fields | |
| MsgQueryGenesisParametersFailed | |
Fields
| |
Instances
data CardanoNodeArgs Source #
Arguments given to the 'cardano-node' command-line to run a node.
Constructors
findRunningCardanoNode :: Tracer IO NodeLog -> FilePath -> KnownNetwork -> IO (Maybe (NominalDiffTime, DirectOptions)) Source #
Tries to find an communicate with an existing cardano-node running in given
work directory. NOTE: This is using the default node socket name as defined
by defaultCardanoNodeArgs.
findRunningCardanoNode' :: Tracer IO NodeLog -> NetworkId -> SocketPath -> IO (Maybe (NominalDiffTime, DirectOptions)) Source #
Tries to find an communicate with an existing cardano-node running in given network id and socket path.
runBackend :: ChainBackendOptions -> (forall m. (ChainBackend m, MonadIO m, MonadThrow m, MonadCatch m) => m a) -> IO a Source #
Run a backend action using the given ChainBackendOptions.
withCardanoNodeDevnet Source #
Arguments
| :: Tracer IO NodeLog | |
| -> FilePath | State directory in which credentials, db & logs are persisted. |
| -> (NominalDiffTime -> DirectOptions -> IO a) | |
| -> IO a |
Start a single cardano-node devnet using the config from config/ and
credentials from configcredentials. Only the Faucet actor will receive
"initialFunds". Use seedFromFaucet to distribute funds other wallets.
withBlockfrostBackend Source #
Arguments
| :: Tracer IO EndToEndLog | |
| -> FilePath | State directory in which credentials, db & logs are persisted. |
| -> (NominalDiffTime -> ChainBackendOptions -> IO a) | |
| -> IO a |
findFileStartingAtDirectory :: Int -> FilePath -> IO FilePath Source #
Find the given file in the current directory or its parents.
This function starts from the current working directory and checks if the specified file exists there. If not found, it recursively checks the parent directories up to the given maximum depth.
withBackend :: forall a. Tracer IO EndToEndLog -> FilePath -> (NominalDiffTime -> ChainBackendOptions -> IO a) -> IO a Source #
withHydraScriptsAndBackendRunning :: forall a. Tracer IO EndToEndLog -> FilePath -> (ChainBackendOptions -> [TxId] -> IO a) -> IO a Source #
Like withBackend, but also publishes (or reuses cached) Hydra scripts.
On public testnets the cache file is stored in the persistent HYDRA_WORK_DIR,
so scripts are published once and reused across test runs. On local devnet,
the per-test $sel:stateDirectory:MsgNodeCmdSpec is used, so scripts are always published fresh.
withCardanoNodeOnKnownNetwork Source #
Arguments
| :: Tracer IO NodeLog | |
| -> FilePath | State directory in which node db & logs are persisted. |
| -> KnownNetwork | A well-known Cardano network to connect to. |
| -> (NominalDiffTime -> DirectOptions -> IO a) | |
| -> IO a |
Run a cardano-node as normal network participant on a known network.
setupCardanoDevnet :: FilePath -> IO CardanoNodeArgs Source #
Setup the cardano-node to run a local devnet producing blocks. This copies
the appropriate files and prepares CardanoNodeArgs for withCardanoNode.
withCardanoNode :: Tracer IO NodeLog -> FilePath -> CardanoNodeArgs -> (NominalDiffTime -> DirectOptions -> IO a) -> IO a Source #
getShelleyGenesisBlockTime :: Value -> NominalDiffTime Source #
waitForFullySynchronized :: Tracer IO NodeLog -> ChainBackendOptions -> IO () Source #
Wait until the node is fully caught up with the network. This can take a while!
waitForSocket :: SocketPath -> IO () Source #
Wait for the node socket file to become available.
cardanoNodeProcess :: Maybe FilePath -> CardanoNodeArgs -> CreateProcess Source #
Generate command-line arguments for launching cardano-node.
initSystemStart :: IO UTCTime Source #
Initialize the system start time to now (modulo a small offset needed to give time to the system to bootstrap correctly).
Arguments
| :: FilePath | Working directory in which paths of |
| -> CardanoNodeArgs | |
| -> IO () |
Re-generate configuration and genesis files with fresh system start times.
mkTopology :: [Port] -> Value Source #
Generate a topology file from a list of peers.
data ProcessHasExited Source #
Constructors
| ProcessHasExited Text ExitCode |
Instances
| Show ProcessHasExited Source # | |
Defined in CardanoNode | |
cliQueryProtocolParameters :: SocketPath -> NetworkId -> IO Value Source #
Cardano-cli wrapper to query protocol parameters. While we have also client functions in Hydra.Chain.CardanoClient and Hydra.Cluster.CardanoClient, sometimes we deliberately want to use the cardano-cli to ensure compatibility.
unsafeDecodeJson :: FromJSON a => ByteString -> IO a Source #
unsafeDecodeJsonFile :: FromJSON a => FilePath -> IO a Source #