Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

[CO-405] Remove old wallet code from API.V1.Types #3688

Merged
merged 2 commits into from
Oct 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions wallet-new/src/Cardano/Wallet/API/V1/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ import Pos.Infra.Util.LogSafe (BuildableSafeGen (..), SecureLog (..),
buildSafe, buildSafeList, buildSafeMaybe,
deriveSafeBuildable, plainOrSecureF)
import Pos.Util.Servant (Flaggable (..))
import Pos.Wallet.Web.ClientTypes.Instances ()
import qualified Pos.Wallet.Web.State.Storage as OldStorage
import Test.Pos.Core.Arbitrary ()


Expand Down Expand Up @@ -928,31 +926,31 @@ instance ToSchema EstimatedCompletionTime where
)
)


newtype SyncThroughput = SyncThroughput (MeasuredIn 'BlocksPerSecond OldStorage.SyncThroughput)
newtype SyncThroughput
= SyncThroughput (MeasuredIn 'BlocksPerSecond Core.BlockCount)
deriving (Show, Eq)

mkSyncThroughput :: Core.BlockCount -> SyncThroughput
mkSyncThroughput = SyncThroughput . MeasuredIn . OldStorage.SyncThroughput
mkSyncThroughput = SyncThroughput . MeasuredIn

instance Ord SyncThroughput where
compare (SyncThroughput (MeasuredIn (OldStorage.SyncThroughput (Core.BlockCount b1))))
(SyncThroughput (MeasuredIn (OldStorage.SyncThroughput (Core.BlockCount b2)))) =
compare (SyncThroughput (MeasuredIn (Core.BlockCount b1)))
(SyncThroughput (MeasuredIn (Core.BlockCount b2))) =
compare b1 b2

instance Arbitrary SyncThroughput where
arbitrary = SyncThroughput . MeasuredIn . OldStorage.SyncThroughput <$> arbitrary
arbitrary = SyncThroughput . MeasuredIn <$> arbitrary

deriveSafeBuildable ''SyncThroughput
instance BuildableSafeGen SyncThroughput where
buildSafeGen _ (SyncThroughput (MeasuredIn (OldStorage.SyncThroughput (Core.BlockCount blocks)))) = bprint ("{"
buildSafeGen _ (SyncThroughput (MeasuredIn (Core.BlockCount blocks))) = bprint ("{"
%" quantity="%build
%" unit=blocksPerSecond"
%" }")
blocks

instance ToJSON SyncThroughput where
toJSON (SyncThroughput (MeasuredIn (OldStorage.SyncThroughput (Core.BlockCount blocks)))) =
toJSON (SyncThroughput (MeasuredIn (Core.BlockCount blocks))) =
object [ "quantity" .= toJSON blocks
, "unit" .= String "blocksPerSecond"
]
Expand Down