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

Commit fd801a7

Browse files
committed
[CO-319] Solve rebase conflicts
1 parent 2813d97 commit fd801a7

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

wallet-new/src/Cardano/Wallet/API/Response.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Cardano.Wallet.API.Response (
1515
) where
1616

1717
import Prelude
18-
import Universum (Buildable, Text, decodeUtf8, toText, (<>))
18+
import Universum (Buildable, Exception, Text, decodeUtf8, toText, (<>))
1919

2020
import Cardano.Wallet.API.Indices (Indexable', IxSet')
2121
import Cardano.Wallet.API.Request (RequestParams (..))

wallet-new/src/Cardano/Wallet/API/V1/LegacyHandlers/Transactions.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import qualified Cardano.Wallet.API.V1.Transactions as Transactions
2828
import Cardano.Wallet.API.V1.Types
2929

3030

31-
convertTxError :: V0.TxError -> WalletErrorV1
31+
convertTxError :: V0.TxError -> WalletError
3232
convertTxError err = case err of
3333
V0.NotEnoughMoney coin ->
3434
NotEnoughMoney . fromIntegral . Core.getCoin $ coin

wallet-new/src/Cardano/Wallet/API/V1/Swagger.hs

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ import Control.Lens ((?~))
2727
import Data.Aeson (ToJSON (..), encode)
2828
import Data.Aeson.Encode.Pretty
2929
import Data.Map (Map)
30-
import Data.String.Conv
3130
import Data.Swagger hiding (Example, Header, example)
3231
import Data.Swagger.Declare
3332
import Data.Typeable
3433
import Formatting (build, sformat)
3534
import NeatInterpolation
3635
import Pos.Core.Update (SoftwareVersion)
37-
import Pos.Util.BackupPhrase (BackupPhrase (bpToList))
3836
import Pos.Util.CompileInfo (CompileTimeInfo, ctiGitRevision)
3937
import Pos.Util.Mnemonic (Mnemonic)
4038
import Pos.Util.Servant (LoggingApi)
@@ -879,7 +877,7 @@ api (compileInfo, curSoftwareVersion) walletAPI mkDescription = toSwagger wallet
879877
& info.title .~ "Cardano Wallet API"
880878
& info.version .~ fromString (show curSoftwareVersion)
881879
& host ?~ "127.0.0.1:8090"
882-
& info.description ?~ mkDescription $ DescriptionEnvironment
880+
& info.description ?~ mkDescription DescriptionEnvironment
883881
{ deErrorExample = decodeUtf8 $ encodePretty WalletNotFound
884882
, deMnemonicExample = decodeUtf8 $ encode (genExample @(Mnemonic 12))
885883
, deDefaultPerPage = fromString (show defaultPerPageEntries)

wallet-new/src/Cardano/Wallet/API/V1/Types.hs

+20-22
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ module Cardano.Wallet.API.V1.Types (
4343
, getAccIndex
4444
, mkAccountIndex
4545
, AccountIndexError(..)
46-
, renderAccountIndexError
4746
-- * Addresses
4847
, WalletAddress (..)
4948
, NewAddress (..)
@@ -115,20 +114,17 @@ import Test.QuickCheck.Random (mkQCGen)
115114

116115
import Cardano.Wallet.API.Response.JSend (ResponseStatus (ErrorStatus))
117116
import Cardano.Wallet.API.Types.UnitOfMeasure (MeasuredIn (..), UnitOfMeasure (..))
118-
import Cardano.Wallet.API.V1.Errors (ToHttpErrorStatus (..), ToServantError (..),
119-
WalletError (..))
117+
import Cardano.Wallet.API.V1.Errors (ToHttpErrorStatus (..), ToServantError (..))
120118
import Cardano.Wallet.API.V1.Generic (gparseJsend, gtoJsend)
121119
import Cardano.Wallet.Orphans.Aeson ()
122120
import Cardano.Wallet.Util (showApiUtcTime)
123121
import Pos.Aeson.Core ()
124-
import Pos.Arbitrary.Core ()
125122
import Pos.Core (addressF)
126123
import Pos.Crypto (decodeHash, hashHexF)
127124
import Pos.Infra.Diffusion.Subscription.Status (SubscriptionStatus (..))
128125
import Pos.Infra.Util.LogSafe (BuildableSafeGen (..), SecureLog (..), buildSafe,
129126
buildSafeList, buildSafeMaybe, deriveSafeBuildable,
130127
plainOrSecureF)
131-
import Pos.Util.BackupPhrase (BackupPhrase (..))
132128
import Pos.Util.Mnemonic (Mnemonic)
133129
import Pos.Wallet.Web.ClientTypes.Instances ()
134130

@@ -890,12 +886,7 @@ instance Arbitrary WalletAddress where
890886
newtype AccountIndex = AccountIndex { getAccIndex :: Word32 }
891887
deriving (Show, Eq, Ord, Generic)
892888

893-
instance Bounded AccountIndex where
894-
-- NOTE: minimum for hardened key. See https://iohk.myjetbrains.com/youtrack/issue/CO-309
895-
minBound = AccountIndex 2147483648
896-
maxBound = AccountIndex maxBound
897-
898-
data AccountIndexError = AccountIndexError Word32
889+
newtype AccountIndexError = AccountIndexError Word32
899890
deriving (Eq, Show)
900891

901892
instance Buildable AccountIndexError where
@@ -911,26 +902,29 @@ mkAccountIndex index
911902
| index >= getAccIndex minBound = Right $ AccountIndex index
912903
| otherwise = Left $ AccountIndexError index
913904

914-
renderAccountIndexError :: AccountIndexError -> Text
915-
renderAccountIndexError =
916-
sformat build
905+
instance Bounded AccountIndex where
906+
-- NOTE: minimum for hardened key. See https://iohk.myjetbrains.com/youtrack/issue/CO-309
907+
minBound = AccountIndex 2147483648
908+
maxBound = AccountIndex maxBound
917909

918910
instance ToJSON AccountIndex where
919911
toJSON = toJSON . getAccIndex
920912

921913
instance FromJSON AccountIndex where
922914
parseJSON =
923-
either (fail . toString . sformat build) pure
924-
. mkAccountIndex
925-
<=< parseJSON
915+
either fmtFail pure . mkAccountIndex <=< parseJSON
916+
where
917+
fmtFail = fail . toString . sformat build
926918

927919
instance Arbitrary AccountIndex where
928-
arbitrary = AccountIndex <$> choose (getAccIndex minBound, getAccIndex maxBound)
920+
arbitrary =
921+
AccountIndex <$> choose (getAccIndex minBound, getAccIndex maxBound)
929922

930923
deriveSafeBuildable ''AccountIndex
931924
-- Nothing secret to redact for a AccountIndex.
932925
instance BuildableSafeGen AccountIndex where
933-
buildSafeGen _ = bprint build . getAccIndex
926+
buildSafeGen _ =
927+
bprint build . getAccIndex
934928

935929
instance ToParamSchema AccountIndex where
936930
toParamSchema _ = mempty
@@ -939,13 +933,17 @@ instance ToParamSchema AccountIndex where
939933
& maximum_ .~ Just (fromIntegral $ getAccIndex maxBound)
940934

941935
instance ToSchema AccountIndex where
942-
declareNamedSchema = pure . paramSchemaToNamedSchema defaultSchemaOptions
936+
declareNamedSchema =
937+
pure . paramSchemaToNamedSchema defaultSchemaOptions
943938

944939
instance FromHttpApiData AccountIndex where
945-
parseQueryParam = first (sformat build) . mkAccountIndex <=< parseQueryParam
940+
parseQueryParam =
941+
first (sformat build) . mkAccountIndex <=< parseQueryParam
946942

947943
instance ToHttpApiData AccountIndex where
948-
toQueryParam = fromString . show . getAccIndex
944+
toQueryParam =
945+
fromString . show . getAccIndex
946+
949947

950948
-- | A wallet 'Account'.
951949
data Account = Account

0 commit comments

Comments
 (0)