Skip to content

Commit

Permalink
Fixes. Reduce export surface area
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Feb 28, 2021
1 parent d2a6a4f commit fa02fe5
Show file tree
Hide file tree
Showing 21 changed files with 389 additions and 549 deletions.
14 changes: 6 additions & 8 deletions cardano-api/cardano-api.cabal
Expand Up @@ -17,9 +17,9 @@ library

exposed-modules: Cardano.Api
Cardano.Api.Byron
Cardano.Api.Crypto.Ed25519Bip32
Cardano.Api.Shelley

Cardano.Api.Crypto.Ed25519Bip32
-- TODO: Eliminate in the future when
-- we create wrapper types for the ledger types
-- in this modulde
Expand All @@ -31,12 +31,7 @@ library
Cardano.Api.Protocol.Shelley
Cardano.Api.Protocol.Types

-- TODO Review this. Made public to compile cardano-rest
Cardano.Api.TxBody

other-modules: Cardano.Api.TxSubmit.ErrorRender
Cardano.Api.TxSubmit.Types

other-modules:
-- Splitting up the big Typed module:
Cardano.Api.Address
Cardano.Api.Block
Expand All @@ -49,8 +44,8 @@ library
Cardano.Api.IPC
Cardano.Api.Key
Cardano.Api.KeysByron
Cardano.Api.KeysShelley
Cardano.Api.KeysPraos
Cardano.Api.KeysShelley
Cardano.Api.Modes
Cardano.Api.NetworkId
Cardano.Api.OperationalCertificate
Expand All @@ -66,8 +61,11 @@ library
Cardano.Api.SpecialByron
Cardano.Api.StakePoolMetadata
Cardano.Api.Tx
Cardano.Api.TxBody
Cardano.Api.TxInMode
Cardano.Api.TxMetadata
Cardano.Api.TxSubmit.ErrorRender
Cardano.Api.TxSubmit.Types
Cardano.Api.Utils
Cardano.Api.Value

Expand Down
2 changes: 1 addition & 1 deletion cardano-api/src/Cardano/Api.hs
Expand Up @@ -152,7 +152,7 @@ module Cardano.Api (
TxBodyError(..),

-- ** Transaction Ids
TxId,
TxId(..),
getTxId,

-- ** Transaction inputs
Expand Down
3 changes: 2 additions & 1 deletion cardano-api/src/Cardano/Api/TxSubmit/Types.hs
Expand Up @@ -3,13 +3,14 @@ module Cardano.Api.TxSubmit.Types
( NodeApiEnv (..)
, SocketPath (..)
, TxSubmitStatus (..)
, ApplyMempoolPayloadErr(..)
, renderTxSubmitStatus
, textShow
) where

import Cardano.Api.TxSubmit.ErrorRender
import Cardano.Binary (DecoderError)
import Cardano.Chain.Byron.API (ApplyMempoolPayloadErr)
import Cardano.Chain.Byron.API (ApplyMempoolPayloadErr(..))
import qualified Cardano.Chain.Genesis as Genesis
import qualified Cardano.Chain.UTxO as Utxo

Expand Down
2 changes: 1 addition & 1 deletion cardano-submit-api/LICENSE
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2021 Input Output (Hong Kong) Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
13 changes: 8 additions & 5 deletions cardano-submit-api/cardano-submit-api.cabal
Expand Up @@ -4,8 +4,8 @@ name: cardano-submit-api
version: 3.1.2
synopsis: A web server that allows transactions to be POSTed to the cardano chain
description:
homepage: https://github.com/input-output-hk/cardano-explorer
bug-reports: https://github.com/input-output-hk/cardano-explorer/issues
homepage: https://github.com/input-output-hk/cardano-node
bug-reports: https://github.com/input-output-hk/cardano-node/issues
license: Apache-2.0
license-file: LICENSE
author: IOHK Engineering Team
Expand Down Expand Up @@ -45,12 +45,14 @@ common ouroboros-consensus-shelley { build-depends: ouroboros-consensus-shelley
common ouroboros-network { build-depends: ouroboros-network >= 0.1.0.0 }
common ouroboros-network-framework { build-depends: ouroboros-network-framework >= 0.1.0.0 }
common prometheus { build-depends: prometheus >= 2.2.2 }
common protolude { build-depends: protolude >= 0.3.0 }
common servant { build-depends: servant >= 0.18.2 }
common servant-server { build-depends: servant-server >= 0.18.2 }
common shelley-spec-ledger { build-depends: shelley-spec-ledger >= 0.1.0.0 }
common streaming-commons { build-depends: streaming-commons >= 0.2.2.1 }
common text { build-depends: text >= 1.2.3.2 }
common transformers { build-depends: transformers >= 0.5.6.2 }
common transformers-except { build-depends: transformers-except >= 0.1.1 }
common warp { build-depends: warp >= 3.3.13 }
common yaml { build-depends: yaml >= 0.11.5.0 }

Expand Down Expand Up @@ -97,13 +99,14 @@ library
, ouroboros-network
, ouroboros-network-framework
, prometheus
, protolude
, servant
, servant-server
, shelley-spec-ledger
, streaming-commons
, text
, text
, transformers
, transformers-except
, warp
, yaml

Expand All @@ -115,19 +118,18 @@ library
, Cardano.TxSubmit.CLI.Types
, Cardano.TxSubmit.Config
, Cardano.TxSubmit.ErrorRender
, Cardano.TxSubmit.JsonOrphans
, Cardano.TxSubmit.Metrics
, Cardano.TxSubmit.Rest.Parsers
, Cardano.TxSubmit.Rest.Types
, Cardano.TxSubmit.Rest.Web
, Cardano.TxSubmit.Tracing.ToObjectOrphans
, Cardano.TxSubmit.Tx
, Cardano.TxSubmit.Types
, Cardano.TxSubmit.Util
, Cardano.TxSubmit.Web

executable cardano-submit-api
import: base, project-config
, cardano-api
, cardano-submit-api
, optparse-applicative
main-is: Main.hs
Expand All @@ -136,6 +138,7 @@ executable cardano-submit-api

test-suite unit
import: base, project-config
, cardano-api
, cardano-submit-api
type: exitcode-stdio-1.0
main-is: test.hs
Expand Down
31 changes: 17 additions & 14 deletions cardano-submit-api/src/Cardano/TxSubmit.hs
Expand Up @@ -3,20 +3,24 @@
{-# LANGUAGE OverloadedStrings #-}

module Cardano.TxSubmit
( module X
, runTxSubmitWebapi
( runTxSubmitWebapi
, opts
) where

import Cardano.BM.Trace (Trace, logInfo)
import Cardano.Prelude
import Cardano.TxSubmit.CLI.Parsers as X
import Cardano.TxSubmit.CLI.Types as X
import Cardano.TxSubmit.Config as X
import Cardano.TxSubmit.CLI.Parsers (opts)
import Cardano.TxSubmit.CLI.Types (ConfigFile (unConfigFile), TxSubmitNodeParams (..))
import Cardano.TxSubmit.Config (GenTxSubmitNodeConfig (..), ToggleLogging (..),
TxSubmitNodeConfig, readTxSubmitNodeConfig)
import Cardano.TxSubmit.Metrics (registerMetricsServer)
import Cardano.TxSubmit.Tx as X
import Cardano.TxSubmit.Types as X
import Cardano.TxSubmit.Util as X
import Cardano.TxSubmit.Web as X
import Cardano.TxSubmit.Web (runTxSubmitServer)
import Control.Applicative (Applicative (..))
import Control.Monad (void)
import Control.Monad.IO.Class (MonadIO (liftIO))
import Data.Either (Either (..))
import Data.Function (($))
import Data.Text (Text)
import System.IO (IO)

import qualified Cardano.BM.Setup as Logging
import qualified Cardano.BM.Trace as Logging
Expand All @@ -43,7 +47,6 @@ runTxSubmitWebapi tsnp = do
} = tsnp

mkTracer :: TxSubmitNodeConfig -> IO (Trace IO Text)
mkTracer enc =
if not (tscEnableLogging enc)
then pure Logging.nullTracer
else liftIO $ Logging.setupTrace (Right $ tscLoggingConfig enc) "cardano-tx-submit"
mkTracer enc = case tscToggleLogging enc of
LoggingOn -> liftIO $ Logging.setupTrace (Right $ tscLoggingConfig enc) "cardano-tx-submit"
LoggingOff -> pure Logging.nullTracer

0 comments on commit fa02fe5

Please sign in to comment.