Skip to content

Commit

Permalink
cardano-api: Export Block, Tx, and related types
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEichmann committed Jan 28, 2021
1 parent feda23d commit 2e0990f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
19 changes: 18 additions & 1 deletion cardano-api/src/Cardano/Api.hs
Expand Up @@ -121,6 +121,22 @@ module Cardano.Api (
lovelaceToValue,
valueToLovelace,

-- * Blocks

-- ** Blocks in the context of an era
Block(Block),
BlockHeader(..),

-- ** Points on the chain
ChainPoint,
EpochNo(..),

-- ** Tip of the chain
ChainTip(..),
BlockNo(..),

-- * Building transactions

-- * Building transactions
-- | Constructing and inspecting transactions

Expand Down Expand Up @@ -182,7 +198,7 @@ module Cardano.Api (

-- * Signing transactions
-- | Creating transaction witnesses one by one, or all in one go.
Tx,
Tx(Tx),
getTxBody,
getTxWitnesses,

Expand Down Expand Up @@ -426,4 +442,5 @@ module Cardano.Api (
toNetworkMagic,
) where

import Cardano.Api.Block
import Cardano.Api.Typed
10 changes: 5 additions & 5 deletions cardano-api/src/Cardano/Api/Block.hs
Expand Up @@ -14,24 +14,24 @@ module Cardano.Api.Block (

-- * Blocks in the context of an era
Block(.., Block),
BlockHeader,
BlockHeader(..),

-- ** Blocks in the context of a consensus mode
BlockInMode(..),
fromConsensusBlock,

-- * Points on the chain
ChainPoint(..),
SlotNo,
EpochNo,
SlotNo(..),
EpochNo(..),
toConsensusPoint,
fromConsensusPoint,
toConsensusPointInMode,
fromConsensusPointInMode,

-- * Tip of the chain
ChainTip(..),
BlockNo,
BlockNo(..),
chainTipToChainPoint,
fromConsensusTip,

Expand All @@ -45,7 +45,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Short as SBS
import Data.Foldable (Foldable(toList))

import Cardano.Slotting.Block (BlockNo)
import Cardano.Slotting.Block (BlockNo(..))
import Cardano.Slotting.Slot (SlotNo, EpochNo)

import qualified Ouroboros.Network.Block as Consensus
Expand Down
10 changes: 9 additions & 1 deletion cardano-api/src/Cardano/Api/IPC.hs
Expand Up @@ -15,14 +15,22 @@
-- | Node IPC protocols
--
module Cardano.Api.IPC (

-- * Node interaction
-- | Operations that involve talking to a local Cardano node.
connectToLocalNode,
LocalNodeConnectInfo(..),
localConsensusMode,
LocalNodeClientProtocols(..),
LocalNodeClientProtocolsInMode,

-- ** Modes
-- | TODO move to Cardano.Api
ByronMode,
ShelleyMode,
CardanoMode,
ConsensusModeParams(..),
EpochSlots(..),

-- connectToRemoteNode,

-- *** Chain sync protocol
Expand Down
4 changes: 2 additions & 2 deletions cardano-api/src/Cardano/Api/Modes.hs
Expand Up @@ -27,7 +27,7 @@ module Cardano.Api.Modes (
-- * Connection paramaters for each mode
ConsensusModeParams(..),
AnyConsensusModeParams(..),
Byron.EpochSlots,
Byron.EpochSlots(..),

-- * Conversions to and from types in the consensus library
ConsensusBlockForMode,
Expand All @@ -45,7 +45,7 @@ import qualified Ouroboros.Consensus.Cardano.Block as Consensus
import qualified Ouroboros.Consensus.Cardano.ByronHFC as Consensus (ByronBlockHFC)
import qualified Ouroboros.Consensus.Cardano.ShelleyHFC as Consensus (ShelleyBlockHFC)
import Ouroboros.Consensus.HardFork.Combinator as Consensus (EraIndex (..), eraIndexSucc,
eraIndexZero)
eraIndexZero)
import Ouroboros.Consensus.Shelley.Eras (StandardAllegra, StandardMary, StandardShelley)
import qualified Ouroboros.Consensus.Shelley.Ledger as Consensus
import Ouroboros.Consensus.Shelley.Protocol (StandardCrypto)
Expand Down
4 changes: 1 addition & 3 deletions cardano-api/src/Cardano/Api/Typed.hs
Expand Up @@ -519,8 +519,6 @@ import Control.Tracer (nullTracer)
--
-- Common types, consensus, network
--
import Cardano.Slotting.Slot (EpochNo (..), SlotNo (..))

-- TODO: it'd be nice if the network imports needed were a bit more coherent
import Ouroboros.Network.Block (Point, Tip)
import Ouroboros.Network.Mux (MuxMode (InitiatorMode), MuxPeer (..),
Expand Down Expand Up @@ -575,7 +573,7 @@ import qualified Shelley.Spec.Ledger.PParams as Shelley

--
-- Other config and common types
--
import Cardano.Api.Block
import Cardano.Api.Protocol.Byron (mkNodeClientProtocolByron)
import Cardano.Api.Protocol.Cardano (mkNodeClientProtocolCardano)
import Cardano.Api.Protocol.Shelley (mkNodeClientProtocolShelley)
Expand Down

0 comments on commit 2e0990f

Please sign in to comment.