morley-client-0.4.0: Client to interact with the Tezos blockchain
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Client.TezosClient.Helpers

Description

Helpers used to call octez-client.

Synopsis

Documentation

data CallMode Source #

Datatype that represents modes for calling node from octez-client.

Constructors

MockupMode

Mode in which octez-client doesn't perform any actual RPC calls to the node and use mock instead.

ClientMode

Normal mode in which octez-client performs all necessary RPC calls to the node.

callTezosClient :: forall env m. (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => (Text -> Text -> IO Bool) -> [String] -> CallMode -> Maybe ScrubbedBytes -> m Text Source #

Call octez-client with given arguments. Arguments defined by config are added automatically. The second argument specifies what should be done in failure case. It takes stdout and stderr output. Possible handling:

  1. Parse a specific error and throw it.
  2. Parse an expected error that shouldn't cause a failure. Return True in this case.
  3. Detect an unexpected error, return False. In this case UnexpectedClientFailure will be throw.

callTezosClientStrict :: (WithClientLog env m, HasTezosClientEnv env, MonadIO m, MonadCatch m) => [String] -> CallMode -> Maybe ScrubbedBytes -> m Text Source #

Call octez-client and expect success.

readProcessWithExitCode' :: FilePath -> [String] -> String -> IO (ExitCode, String, String) Source #

Variant of readProcessWithExitCode that prints a better error in case of an exception in the inner readProcessWithExitCode call.