Skip to content

Commit c3b71c3

Browse files
committed
Connect CardanoChainConfig in Options
Signed-off-by: Sasha Bogicevic <[email protected]>
1 parent dff0b17 commit c3b71c3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

hydra-node/src/Hydra/Options.hs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ defaultDirectBackend =
155155
, nodeSocket = "node.socket"
156156
}
157157

158+
defaultCardanoBackend :: ChainBackend
159+
defaultCardanoBackend =
160+
BlockfrostBackend
161+
{ projectPath = "/home/v0d1ch/code/hydra/blockfrost-project.txt"
162+
}
163+
158164
data ChainBackend
159165
= DirectBackend
160166
{ networkId :: NetworkId
@@ -282,6 +288,7 @@ runOptionsParser =
282288
chainConfigParser :: Parser ChainConfig
283289
chainConfigParser =
284290
Direct <$> directChainConfigParser
291+
<|> Cardano <$> cardanoChainConfigParser
285292
<|> Offline <$> offlineChainConfigParser
286293

287294
chainBackendParser :: Parser ChainBackend
@@ -393,6 +400,18 @@ data CardanoChainConfig = CardanoChainConfig
393400
deriving stock (Eq, Show, Generic)
394401
deriving anyclass (ToJSON, FromJSON)
395402

403+
defaultCardanoChainConfig :: CardanoChainConfig
404+
defaultCardanoChainConfig =
405+
CardanoChainConfig
406+
{ hydraScriptsTxId = []
407+
, cardanoSigningKey = "cardano.sk"
408+
, cardanoVerificationKeys = []
409+
, startChainFrom = Nothing
410+
, contestationPeriod = defaultContestationPeriod
411+
, depositDeadline = defaultDepositDeadline
412+
, chainBackend = defaultCardanoBackend
413+
}
414+
396415
data DirectChainConfig = DirectChainConfig
397416
{ networkId :: NetworkId
398417
-- ^ Network identifer to which we expect to connect.
@@ -436,6 +455,14 @@ data BlockfrostChainConfig = BlockfrostChainConfig
436455
}
437456
deriving stock (Eq, Show, Generic)
438457

458+
defaultBlockfrostChainConfig :: BlockfrostChainConfig
459+
defaultBlockfrostChainConfig =
460+
BlockfrostChainConfig
461+
{ projectPath = "/home/v0d1ch/code/hydra/blockfrost-project.txt"
462+
, hydraScriptsTxId = []
463+
, cardanoSigningKey = "cardano.sk"
464+
}
465+
439466
instance Arbitrary ChainConfig where
440467
arbitrary =
441468
oneof
@@ -525,6 +552,17 @@ directChainConfigParser =
525552
<*> contestationPeriodParser
526553
<*> depositDeadlineParser
527554

555+
cardanoChainConfigParser :: Parser CardanoChainConfig
556+
cardanoChainConfigParser =
557+
CardanoChainConfig
558+
<$> (hydraScriptsTxIdsParser <|> many hydraScriptsTxIdParser)
559+
<*> cardanoSigningKeyFileParser
560+
<*> many cardanoVerificationKeyFileParser
561+
<*> optional startChainFromParser
562+
<*> contestationPeriodParser
563+
<*> depositDeadlineParser
564+
<*> chainBackendParser
565+
528566
blockfrostProjectPathParser :: Parser FilePath
529567
blockfrostProjectPathParser =
530568
strOption

0 commit comments

Comments
 (0)