diff --git a/lib/customer-deposit-wallet/rest/Cardano/Wallet/Deposit/REST/Start.hs b/lib/customer-deposit-wallet/rest/Cardano/Wallet/Deposit/REST/Start.hs index 62e6ec433e3..3a05974dab6 100644 --- a/lib/customer-deposit-wallet/rest/Cardano/Wallet/Deposit/REST/Start.hs +++ b/lib/customer-deposit-wallet/rest/Cardano/Wallet/Deposit/REST/Start.hs @@ -4,6 +4,7 @@ module Cardano.Wallet.Deposit.REST.Start ( loadDepositWalletFromDisk , newFakeBootEnv + , newBootEnv , mockFundTheWallet ) where @@ -16,6 +17,12 @@ import Cardano.Wallet.Deposit.IO import Cardano.Wallet.Deposit.IO.Network.Mock ( newNetworkEnvMock ) +import Cardano.Wallet.Deposit.IO.Network.NodeToClient + ( CardanoBlock + , NetworkLayer + , StandardCrypto + , fromNetworkLayer + ) import Cardano.Wallet.Deposit.IO.Network.Type ( NetworkEnv , mapBlock @@ -130,3 +137,23 @@ newFakeBootEnv genesisFile = do genesisData' . mapBlock Read.EraValue <$> newNetworkEnvMock + +newBootEnv + :: Maybe FilePath + -> NetworkLayer IO (CardanoBlock StandardCrypto) + -> IO (WalletBootEnv IO) +newBootEnv genesisFile nl = do + eGenesisData <- runExceptT $ case genesisFile of + Nothing -> ExceptT $ pure $ Right Read.mockGenesisDataMainnet + Just file -> fst <$> Byron.readGenesisData file + print genesisFile + print eGenesisData + print $ Read.getNetworkId <$> eGenesisData + case eGenesisData of + Left e -> error $ show e + Right genesisData' -> + return $ WalletBootEnv + (show >$< stdoutTracer) + genesisData' + (fromNetworkLayer nl) + diff --git a/lib/exe/lib/Cardano/Wallet/Application.hs b/lib/exe/lib/Cardano/Wallet/Application.hs index 43d7c2d109d..7fdb3048512 100644 --- a/lib/exe/lib/Cardano/Wallet/Application.hs +++ b/lib/exe/lib/Cardano/Wallet/Application.hs @@ -106,7 +106,7 @@ import Cardano.Wallet.Deposit.REST ) import Cardano.Wallet.Deposit.REST.Start ( loadDepositWalletFromDisk - , newFakeBootEnv + , newBootEnv ) import Cardano.Wallet.Flavor ( CredFromOf @@ -383,7 +383,7 @@ serveWallet eDepositUiSocket <- bindDepositUiSocket eDepositSocket <- bindDepositSocket eShelleySocket <- bindApiSocket - fakeBootEnv <- lift $ newFakeBootEnv depositByronGenesisFile + bootEnv <- lift $ newBootEnv depositByronGenesisFile netLayer callCC $ \exit -> do case eShelleyUiSocket of Left err -> do @@ -431,7 +431,7 @@ serveWallet >$< applicationTracer ) databaseDir' - fakeBootEnv + bootEnv resource ui <- Ui.withUILayer 1 resource REST.onResourceChange @@ -444,7 +444,7 @@ serveWallet let uiService = startDepositUiServer ui - fakeBootEnv + bootEnv databaseDir' socket sNetwork @@ -475,7 +475,7 @@ serveWallet >$< applicationTracer ) databaseDir' - fakeBootEnv + bootEnv resource pure (databaseDir', resource) Just (databaseDir', w) -> @@ -483,7 +483,7 @@ serveWallet let depositService = startDepositServer resource - fakeBootEnv + bootEnv databaseDir' socket ContT $ \k -> @@ -624,7 +624,7 @@ serveWallet -> IO () startDepositServer resource - fakeBootEnv + bootEnv databaseDir' socket = do @@ -635,7 +635,7 @@ serveWallet $ Deposit.server (DepositApplicationLog >$< applicationTracer) databaseDir' - fakeBootEnv + bootEnv resource start serverSettings @@ -657,7 +657,7 @@ serveWallet -> IO () startDepositUiServer ui - fakeBootEnv + bootEnv databaseDir' socket _proxy @@ -670,7 +670,7 @@ serveWallet $ DepositUi.serveUI (DepositUIApplicationLog >$< applicationTracer) ui - fakeBootEnv + bootEnv databaseDir' (PageConfig "" "Deposit Cardano Wallet") _proxy