Skip to content

Commit

Permalink
wip Cardano.Api → Cardano.Api.Typed and HardForkBlock support
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Jul 18, 2020
1 parent 50a95e2 commit d8c7ea2
Show file tree
Hide file tree
Showing 8 changed files with 858 additions and 269 deletions.
7 changes: 4 additions & 3 deletions lib/core/src/Cardano/Wallet/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ data NetworkLayer m target block = NetworkLayer
:: SealedTx -> ExceptT ErrPostTx m ()
-- ^ Broadcast a transaction to the chain producer

, stakeDistribution
:: GetStakeDistribution target m
-- adding block causes issues in Functor instance
-- , stakeDistribution
-- :: GetStakeDistribution target block m

, getAccountBalance
:: ChimericAccount
Expand Down Expand Up @@ -237,7 +238,7 @@ defaultRetryPolicy =
Queries
-------------------------------------------------------------------------------}

type family GetStakeDistribution target (m :: * -> *) :: *
type family GetStakeDistribution target block (m :: * -> *) :: *

{-------------------------------------------------------------------------------
Chain Sync
Expand Down
19 changes: 4 additions & 15 deletions lib/core/src/Cardano/Wallet/Primitive/Slotting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ import GHC.Generics
( Generic )
import Numeric.Natural
( Natural )
import Ouroboros.Consensus.HardFork.History.EraParams
( EraParams (..), noLowerBoundSafeZone )
import Ouroboros.Consensus.HardFork.History.Qry
( Qry, runQuery, slotToEpoch )
import Ouroboros.Consensus.HardFork.History.Summary
Expand All @@ -89,25 +87,16 @@ epochOf slot = do
-- TODO: The type should be changed to @Interpreter@ when we bump
-- ouroboros-consensus.
singleEraInterpreter :: GenesisParameters -> Summary '[x]
singleEraInterpreter gp = neverForksSummary $
EraParams
{ eraEpochSize =
Cardano.EpochSize
singleEraInterpreter gp = neverForksSummary sz len
where
sz = Cardano.EpochSize
. fromIntegral
. unEpochLength
$ gp ^. #getEpochLength

, eraSlotLength =
Cardano.mkSlotLength
len = Cardano.mkSlotLength
. unSlotLength
$ gp ^. #getSlotLength

, eraSafeZone =
noLowerBoundSafeZone (k * 2)
}
where
k = fromIntegral $ getQuantity $ getEpochStability gp

-- -----------------------------------------------------------------------------
-- Legacy functions
-- These only work for a single era. We need to stop using them
Expand Down
3 changes: 3 additions & 0 deletions lib/shelley/cardano-wallet-shelley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ library
, network-mux
, optparse-applicative
, ouroboros-consensus
, ouroboros-consensus-byron
, ouroboros-consensus-cardano
, ouroboros-consensus-shelley
, ouroboros-network
, ouroboros-network-framework
Expand All @@ -85,6 +87,7 @@ library
hs-source-dirs:
src
exposed-modules:
Cardano.Wallet.Byron.Compatibility
Cardano.Wallet.Shelley
Cardano.Wallet.Shelley.Api.Server
Cardano.Wallet.Shelley.Compatibility
Expand Down
Loading

0 comments on commit d8c7ea2

Please sign in to comment.