Skip to content

Commit

Permalink
Rename to Cardano.Environment.{HttpBridge, Jormungandr}
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed May 9, 2019
1 parent 8ad8c48 commit 55389e4
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion exe/launcher/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Prelude

import Cardano.CLI
( Port, parseArgWith )
import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network, network )
import Cardano.Launcher
( Command (Command)
Expand Down
2 changes: 1 addition & 1 deletion exe/wallet/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Cardano.CLI
, parseArgWith
, putErrLn
)
import Cardano.Environment
import Cardano.Environment.HttpBridge
( network )
import Cardano.Wallet
( mkWalletLayer )
Expand Down
4 changes: 2 additions & 2 deletions lib/http-bridge/cardano-wallet-http-bridge.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ library
hs-source-dirs:
src
exposed-modules:
Cardano.Environment
Cardano.Environment.HttpBridge
Cardano.Wallet.Binary.HttpBridge
Cardano.Wallet.Compatibility.HttpBridge
Cardano.Wallet.Network.HttpBridge
Expand Down Expand Up @@ -105,7 +105,7 @@ test-suite unit
main-is:
Main.hs
other-modules:
Cardano.EnvironmentSpec
Cardano.Environment.HttpBridgeSpec
Cardano.Wallet.Binary.HttpBridgeSpec
Cardano.Wallet.Network.HttpBridge.ApiSpec
Cardano.Wallet.Network.HttpBridgeSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-- rely on a `.env` file to bundle configuration settings together for a given
-- target environment.

module Cardano.Environment
module Cardano.Environment.HttpBridge
(
-- * Networking
Network(..)
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/src/Cardano/Wallet/Binary/HttpBridge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import Prelude

import Cardano.Crypto.Wallet
( ChainCode (..), XPub (..) )
import Cardano.Environment
import Cardano.Environment.HttpBridge
( ProtocolMagic (..) )
import Cardano.Wallet.Primitive.Types
( Address (..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Cardano.Wallet.Compatibility.HttpBridge

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (Mainnet, Staging, Testnet), network, protocolMagic )
import Cardano.Wallet.Binary.HttpBridge
( encodeAddress, encodeProtocolMagic, encodeTx )
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/src/Cardano/Wallet/Network/HttpBridge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Cardano.Wallet.Network.HttpBridge

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( network )
import Cardano.Wallet.Network
( ErrNetworkTip (..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Cardano.Wallet.Transaction.HttpBridge

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (..), ProtocolMagic (..), network, protocolMagic )
import Cardano.Wallet.Binary.HttpBridge
( toByteString )
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/test/bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Main where

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( network )
import Cardano.Launcher
( Command (Command), StdStream (..), installSignalHandlers, launch )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Cardano.Wallet.Network.HttpBridgeSpec

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (..), network )
import Cardano.Launcher
( Command (..), StdStream (..), launch )
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/test/integration/Cardano/WalletSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Cardano.WalletSpec

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( network )
import Cardano.Launcher
( Command (..), StdStream (..), launch )
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Main where

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (..), network )
import Cardano.Launcher
( Command (..), StdStream (..), launch )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

{-# OPTIONS_GHC -fno-warn-orphans #-}

module Cardano.EnvironmentSpec where
module Cardano.Environment.HttpBridgeSpec where

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( ErrMissingOrInvalidEnvVar (..), Network, unsafeLookupEnv )
import Data.Maybe
( isNothing )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Cardano.Wallet.Primitive.AddressDerivationSpec

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (..), network )
import Cardano.Wallet.Compatibility.HttpBridge
( HttpBridge )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Cardano.Wallet.Transaction.HttpBridgeSpec

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( Network (..), network )
import Cardano.Wallet.Binary.HttpBridge
( encodeSignedTx, toByteString )
Expand Down
2 changes: 1 addition & 1 deletion lib/http-bridge/test/unit/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Main where

import Prelude

import Cardano.Environment
import Cardano.Environment.HttpBridge
( network )
import Test.Hspec.Runner
( hspecWith )
Expand Down
2 changes: 1 addition & 1 deletion lib/jormungandr/cardano-wallet-jormungandr.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ library
hs-source-dirs:
src
exposed-modules:
Cardano.Environment
Cardano.Environment.Jormungandr
Cardano.Wallet.Binary.Jormungandr
Cardano.Wallet.Compatibility.Jormungandr
Cardano.Wallet.Transaction.Jormungandr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
-- rely on a `.env` file to bundle configuration settings together for a given
-- target environment.

module Cardano.Environment
module Cardano.Environment.Jormungandr
(
-- * Networking
Network(..)
Expand Down Expand Up @@ -130,22 +130,20 @@ unsafeLookupEnv k = unsafePerformIO $ do
-------------------------------------------------------------------------------}

-- | Available network options.
data Network = Mainnet | Testnet | Staging
data Network = Mainnet | Testnet
deriving (Generic, Show, Eq, Enum)

instance FromText Network where
fromText = \case
"mainnet" -> Right Mainnet
"testnet" -> Right Testnet
"staging" -> Right Staging
s -> Left $ TextDecodingError $ T.unpack s
<> " is neither \"mainnet\", \"testnet\" nor \"staging\"."
<> " is neither \"mainnet\" nor \"testnet\""

instance ToText Network where
toText = \case
Mainnet -> "mainnet"
Testnet -> "testnet"
Staging -> "staging"

-- | Get the current target 'Network' from the Environment.
--
Expand All @@ -162,5 +160,4 @@ newtype ProtocolMagic = ProtocolMagic Int32
protocolMagic :: Network -> ProtocolMagic
protocolMagic = \case
Mainnet -> ProtocolMagic 764824073
Staging -> ProtocolMagic 633343913
Testnet -> ProtocolMagic 1097911063
2 changes: 1 addition & 1 deletion lib/jormungandr/test/unit/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Main where

import Prelude

import Cardano.Environment
import Cardano.Environment.Jormungandr
( network )
import Test.Hspec.Runner
( hspecWith )
Expand Down

0 comments on commit 55389e4

Please sign in to comment.