Skip to content

Commit

Permalink
Merge pull request #78 from input-output-hk/connect_to_staging
Browse files Browse the repository at this point in the history
Make it possible to connect wallet to staging
  • Loading branch information
KtorZ committed Mar 18, 2019
2 parents 0aafbf6 + ba2d8a8 commit d1c2a87
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/Cardano/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import qualified Data.Text as T
-- | Port number with a tag for describing what it is used for
newtype Port (tag :: Symbol) = Port Int

data Network = MainnetTestnet
data Network = MainnetTestnet | Staging
deriving (Show, Enum)


Expand Down Expand Up @@ -99,11 +99,13 @@ instance Decodable String (Port tag) where
instance Encodable Network String where
encode Mainnet = "mainnet"
encode Testnet = "testnet"
encode Staging = "staging"

instance Decodable String Network where
decode "mainnet" = Right Mainnet
decode "testnet" = Right Testnet
decode s = Left $ show s ++ " is neither \"mainnet\" nor \"testnet\"."
decode "staging" = Right Staging
decode s = Left $ show s ++ " is neither \"mainnet\", \"testnet\" nor \"staging\"."

instance Decodable [String] (Mnemonic 15) where
decode ws = first show $ mkMnemonic @15 (T.pack <$> ws)
9 changes: 5 additions & 4 deletions app/launcher/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Usage:
cardano-wallet-launcher --help

Options:
--network <NETWORK> mainnet or testnet [default: mainnet]
--network <NETWORK> mainnet, testnet or staging [default: mainnet]
--wallet-server-port <PORT> port used for serving the wallet API [default: 8090]
--http-bridge-port <PORT> port used for communicating with the http-bridge [default: 8080]
|]
Expand All @@ -66,19 +66,20 @@ main = do
sayErr "Starting..."
installSignalHandlers
let commands =
[ nodeHttpBridgeOn bridgePort
[ nodeHttpBridgeOn bridgePort network
, walletOn walletPort bridgePort network
]
sayErr $ fmt $ blockListF commands
(ProcessHasExited name code) <- launch commands
sayErr $ T.pack name <> " exited with code " <> T.pack (show code) 
exitWith code

nodeHttpBridgeOn :: Port "Node" -> Command
nodeHttpBridgeOn port = Command
nodeHttpBridgeOn :: Port "Node" -> Network -> Command
nodeHttpBridgeOn port net = Command
"cardano-http-bridge"
[ "start"
, "--port", encode port
, "--template", encode net
]
(return ())

Expand Down
2 changes: 1 addition & 1 deletion app/server/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Usage:
cardano-wallet-server --help

Options:
--network <NETWORK> mainnet or testnet [default: mainnet]
--network <NETWORK> mainnet, testnet or staging [default: mainnet]
--wallet-server-port <PORT> port used for serving the wallet API [default: 8090]
--http-bridge-port <PORT> port used for communicating with the http-bridge [default: 8080]
|]
Expand Down

0 comments on commit d1c2a87

Please sign in to comment.