Compare commits

...

2 Commits

Author SHA1 Message Date
Adriaan Leijnse
2ae761edc1 Always reset Devnet directory 2022-10-25 13:52:46 +01:00
Adriaan Leijnse
3b9fb22a36 Clean up UI 2022-10-25 13:52:40 +01:00
2 changed files with 3 additions and 3 deletions

View File

@ -56,6 +56,7 @@ devnetMagic = 42
prepareDevnet :: IO () prepareDevnet :: IO ()
prepareDevnet = do prepareDevnet = do
_ <- readCreateProcess (shell "rm -rf devnet") ""
output <- readCreateProcess (shell "[ -d devnet ] || ./demo/prepare-devnet.sh") "" output <- readCreateProcess (shell "[ -d devnet ] || ./demo/prepare-devnet.sh") ""
putStrLn output putStrLn output

View File

@ -195,7 +195,7 @@ runHydraDemo nodes = do
liftIO . putStrLn $ "Publishing reference scripts" liftIO . putStrLn $ "Publishing reference scripts"
hstxid <- publishReferenceScripts hstxid <- publishReferenceScripts
handles <- standupDemoHydraNetwork hstxid (fmap fst keysAddresses) handles <- standupDemoHydraNetwork hstxid (fmap fst keysAddresses)
liftIO . putStrLn $ [i|"Hydra Network Running for nodes #{Map.keys nodes}|] liftIO . putStrLn $ [i|Hydra Network Running for nodes #{Map.keys nodes}|]
pure $ Map.merge Map.dropMissing Map.dropMissing (Map.zipWithMatched (\_ addr (handle, nodeInfo) -> (handle, addr, nodeInfo))) (fmap snd keysAddresses) handles pure $ Map.merge Map.dropMissing Map.dropMissing (Map.zipWithMatched (\_ addr (handle, nodeInfo) -> (handle, addr, nodeInfo))) (fmap snd keysAddresses) handles
@ -220,7 +220,6 @@ main = liftIO $ do
makeTx :: () => IORef State -> Text makeTx :: () => IORef State -> Text
-> Map TxIn TxInInfo -> Lovelace -> Text -> IO Text -> Map TxIn TxInInfo -> Lovelace -> Text -> IO Text
makeTx hydraProcessHandlesRef fromName utxos lovelace toName = do makeTx hydraProcessHandlesRef fromName utxos lovelace toName = do
print (fromName, utxos, toName)
let lovelaceUtxos = mapMaybe (Map.lookup "lovelace" . HT.value) utxos let lovelaceUtxos = mapMaybe (Map.lookup "lovelace" . HT.value) utxos
actors <- readIORef hydraProcessHandlesRef actors <- readIORef hydraProcessHandlesRef
jsonStr <- jsonStr <-
@ -466,7 +465,7 @@ app = do
<=< buttonClass "bg-green-400 hover:bg-green-400 active:bg-green-200 text-white font-bold text-xl my-2 px-4 py-2 rounded-md w-32" $ text "Do fanout" <=< buttonClass "bg-green-400 hover:bg-green-400 active:bg-green-200 text-white font-bold text-xl my-2 px-4 py-2 rounded-md w-32" $ text "Do fanout"
elClass "div" "mt-4" $ do elClass "div" "mt-4" $ do
elClass "div" "mb-1 font-semibold text-sm" $ text "Hydra Node Log" elClass "div" "mb-1 font-semibold text-sm" $ text "Hydra Node Log"
elClass "div" "p-2 bg-gray-800 rounded-md drop-shadow" $ elClass "div" "p-2 bg-gray-800 rounded-md drop-shadow break-all" $
el "ul" $ do el "ul" $ do
comms <- foldDyn (++) [] $ comms <- foldDyn (++) [] $
((:[]) . ("Rcv: " <>) . toStrict . toLazyText . encodeToTextBuilder . toJSON <$> webSocketMessage) ((:[]) . ("Rcv: " <>) . toStrict . toLazyText . encodeToTextBuilder . toJSON <$> webSocketMessage)