hydra-cluster-0.15.0: Integration test suite using a local cluster of cardano and hydra nodes
Safe HaskellSafe-Inferred
LanguageGHC2021

HydraNode

Synopsis

Documentation

data HydraClient Source #

Constructors

HydraClient 

Fields

input :: Text -> [Pair] -> Value Source #

Create an input as expected by send.

send :: HydraClient -> Value -> IO () Source #

output :: Text -> [Pair] -> Value Source #

Create an output as expected by waitFor and waitForAll.

waitFor :: HasCallStack => Tracer IO HydraNodeLog -> NominalDiffTime -> [HydraClient] -> Value -> IO () Source #

Wait some time for a single API server output from each of given nodes. This function waits for delay seconds for message expected to be seen by all given nodes.

waitMatch :: HasCallStack => NominalDiffTime -> HydraClient -> (Value -> Maybe a) -> IO a Source #

Wait up to some time for an API server output to match the given predicate.

waitForAllMatch :: (Eq a, Show a, HasCallStack) => NominalDiffTime -> [HydraClient] -> (Value -> Maybe a) -> IO a Source #

Wait up to some delay for some JSON Value to match given function.

This is a generalisation of waitMatch to multiple nodes.

waitForAll :: HasCallStack => Tracer IO HydraNodeLog -> NominalDiffTime -> [HydraClient] -> [Value] -> IO () Source #

Wait some time for a list of outputs from each of given nodes. This function is the generalised version of waitFor, allowing several messages to be waited for and received in any order.

requestCommitTx' :: HydraClient -> UTxO' TxOutWithWitness -> IO Tx Source #

Create a commit tx using the hydra-node for later submission

requestCommitTx :: HydraClient -> UTxO -> IO Tx Source #

Helper to make it easy to obtain a commit tx using a wallet utxo

data HydraNodeLog Source #

Constructors

HydraNodeCommandSpec 

Fields

NodeStarted 

Fields

SentMessage 

Fields

StartWaiting 

Fields

ReceivedMessage 

Fields

EndWaiting 

Fields

Instances

Instances details
FromJSON HydraNodeLog Source # 
Instance details

Defined in HydraNode

Methods

parseJSON :: Value -> Parser HydraNodeLog

parseJSONList :: Value -> Parser [HydraNodeLog]

ToJSON HydraNodeLog Source # 
Instance details

Defined in HydraNode

Methods

toJSON :: HydraNodeLog -> Value

toEncoding :: HydraNodeLog -> Encoding

toJSONList :: [HydraNodeLog] -> Value

toEncodingList :: [HydraNodeLog] -> Encoding

Generic HydraNodeLog Source # 
Instance details

Defined in HydraNode

Associated Types

type Rep HydraNodeLog :: Type -> Type Source #

Show HydraNodeLog Source # 
Instance details

Defined in HydraNode

Eq HydraNodeLog Source # 
Instance details

Defined in HydraNode

ToObject HydraNodeLog Source # 
Instance details

Defined in HydraNode

Methods

toObject :: TracingVerbosity -> HydraNodeLog -> Object

textTransformer :: HydraNodeLog -> Object -> Text

type Rep HydraNodeLog Source # 
Instance details

Defined in HydraNode

type Rep HydraNodeLog = D1 ('MetaData "HydraNodeLog" "HydraNode" "hydra-cluster-0.15.0-6wC0CDUAdXtKpPV6Ce5BEP" 'False) ((C1 ('MetaCons "HydraNodeCommandSpec" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: (C1 ('MetaCons "NodeStarted" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "SentMessage" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))) :+: (C1 ('MetaCons "StartWaiting" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Int]) :*: S1 ('MetaSel ('Just "messages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value])) :+: (C1 ('MetaCons "ReceivedMessage" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "EndWaiting" 'PrefixI 'True) (S1 ('MetaSel ('Just "nodeId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))

withHydraCluster Source #

Arguments

:: HasCallStack 
=> Tracer IO HydraNodeLog 
-> FilePath 
-> SocketPath 
-> Int

First node id This sets the starting point for assigning ports

-> [(VerificationKey PaymentKey, SigningKey PaymentKey)]

NOTE: This decides on the size of the cluster!

-> [SigningKey HydraKey] 
-> TxId

Transaction id at which Hydra scripts should have been published.

-> ContestationPeriod 
-> (NonEmpty HydraClient -> IO a) 
-> IO a 

withHydraNode :: Tracer IO HydraNodeLog -> ChainConfig -> FilePath -> Int -> SigningKey HydraKey -> [VerificationKey HydraKey] -> [Int] -> (HydraClient -> IO a) -> IO a Source #

Run a hydra-node with given ChainConfig and using the config from config/.

withHydraNode' Source #

Arguments

:: Tracer IO HydraNodeLog 
-> ChainConfig 
-> FilePath 
-> Int 
-> SigningKey HydraKey 
-> [VerificationKey HydraKey] 
-> [Int] 
-> Maybe Handle

If given use this as std out.

-> (Handle -> Handle -> ProcessHandle -> IO a) 
-> IO a 

Run a hydra-node with given ChainConfig and using the config from config/.