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

Commit af27e67

Browse files
committed
Merge pull request #3667 from input-output-hk/KtorZ/CO-394/remove-legacy-and-v0
[CO-394] Remove Legacy* and V0* stuff
2 parents 377c858 + 0188f06 commit af27e67

27 files changed

+41
-1497
lines changed

scripts/test/wallet/swaggerSchemaValidation.nix

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ let
1313
validate-json = "${iohkPkgs.validateJson}/bin/validate_json";
1414
schema = ./../../../tools/src/validate-json/swagger-meta-2.0.json;
1515
in pkgs.writeScript "validate-swagger-schema" ''
16-
${generate-swagger-file} --target wallet@v0 --output-file swagger.v0.json
1716
${generate-swagger-file} --target wallet@v1 --output-file swagger.v1.json
18-
${validate-json} --schema ${schema} swagger.v0.json && ${validate-json} --schema ${schema} swagger.v1.json
17+
${validate-json} --schema ${schema} swagger.v1.json
1918
EXIT_STATUS=$?
2019
rm -f swagger.*.json
2120
exit $EXIT_STATUS

wallet-new/cardano-sl-wallet-new.cabal

-17
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ cabal-version: >=1.10
1616
library
1717
hs-source-dirs: src
1818
exposed-modules: Cardano.Wallet.Action
19-
Cardano.Wallet.LegacyAction
2019
Cardano.Wallet.API
2120
Cardano.Wallet.API.Indices
2221
Cardano.Wallet.API.Internal
2322
Cardano.Wallet.API.Internal.Handlers
24-
Cardano.Wallet.API.Internal.LegacyHandlers
2523
Cardano.Wallet.API.Request
2624
Cardano.Wallet.API.Request.Filter
2725
Cardano.Wallet.API.Request.Pagination
@@ -33,9 +31,6 @@ library
3331
Cardano.Wallet.API.Response.Sort.IxSet
3432
Cardano.Wallet.API.Types
3533
Cardano.Wallet.API.Types.UnitOfMeasure
36-
Cardano.Wallet.API.V0
37-
Cardano.Wallet.API.V0.Handlers
38-
Cardano.Wallet.API.V0.Types
3934
Cardano.Wallet.API.V1
4035
Cardano.Wallet.API.V1.Accounts
4136
Cardano.Wallet.API.V1.Addresses
@@ -50,14 +45,6 @@ library
5045
Cardano.Wallet.API.V1.Handlers.Wallets
5146
Cardano.Wallet.API.V1.Headers
5247
Cardano.Wallet.API.V1.Info
53-
Cardano.Wallet.API.V1.LegacyHandlers
54-
Cardano.Wallet.API.V1.LegacyHandlers.Accounts
55-
Cardano.Wallet.API.V1.LegacyHandlers.Addresses
56-
Cardano.Wallet.API.V1.LegacyHandlers.Info
57-
Cardano.Wallet.API.V1.LegacyHandlers.Instances
58-
Cardano.Wallet.API.V1.LegacyHandlers.Settings
59-
Cardano.Wallet.API.V1.LegacyHandlers.Transactions
60-
Cardano.Wallet.API.V1.LegacyHandlers.Wallets
6148
Cardano.Wallet.API.V1.Migration
6249
Cardano.Wallet.API.V1.Migration.Monads
6350
Cardano.Wallet.API.V1.Migration.Types
@@ -132,7 +119,6 @@ library
132119
Cardano.Wallet.Kernel.Util.StrictNonEmpty
133120
Cardano.Wallet.Kernel.Util.StrictStateT
134121
Cardano.Wallet.Kernel.Wallets
135-
Cardano.Wallet.LegacyServer
136122
Cardano.Wallet.Orphans
137123
Cardano.Wallet.Orphans.Aeson
138124
Cardano.Wallet.Orphans.Arbitrary
@@ -142,7 +128,6 @@ library
142128
Cardano.Wallet.Server.Middlewares
143129
Cardano.Wallet.Server.Plugins
144130
Cardano.Wallet.Server.Plugins.AcidState
145-
Cardano.Wallet.Server.LegacyPlugins
146131
Cardano.Wallet.TypeLits
147132
Cardano.Wallet.Types.UtxoStatistics
148133
Cardano.Wallet.Client
@@ -561,11 +546,9 @@ test-suite wallet-new-specs
561546
hs-source-dirs: test test/unit
562547

563548
other-modules: APISpec
564-
InternalAPISpec
565549
MarshallingSpec
566550
SwaggerSpec
567551
RequestSpec
568-
WalletHandlersSpec
569552
WalletNewJson
570553
Cardano.Wallet.WalletLayer.QuickCheck
571554

wallet-new/generate-swagger-file/Main.hs

+3-10
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import Universum
66

77
import Data.Swagger (Swagger)
88
import Options.Applicative
9-
import Servant ((:<|>))
109

11-
import Cardano.Wallet.API (InternalAPI, V1API, v0API)
10+
import Cardano.Wallet.API (walletDocAPI)
1211
import Pos.Chain.Update (ApplicationName (..), SoftwareVersion (..))
1312
import Pos.Util.CompileInfo (CompileTimeInfo (CompileTimeInfo),
1413
gitRev)
@@ -26,7 +25,6 @@ data Command = Command
2625

2726
data TargetAPI
2827
= TargetWalletV1
29-
| TargetWalletV0
3028
deriving (Show)
3129

3230

@@ -48,14 +46,13 @@ main =
4846
cmdParser :: Parser Command
4947
cmdParser = Command
5048
<$> targetAPIOption (short 't' <> long "target" <> metavar "API"
51-
<> help "Target API with version (e.g. 'wallet@v1', 'wallet@v0')")
49+
<> help "Target API with version (e.g. 'wallet@v1')")
5250

5351
<*> optional (strOption (short 'o' <> long "output-file" <> metavar "FILEPATH"
5452
<> help ("Output file, default to: " <> defaultOutputFilename)))
5553

5654
targetAPIOption :: Mod OptionFields TargetAPI -> Parser TargetAPI
5755
targetAPIOption = option $ maybeReader $ \case
58-
"wallet@v0" -> Just TargetWalletV0
5956
"wallet@v1" -> Just TargetWalletV1
6057
_ -> Nothing
6158
in do
@@ -69,12 +66,8 @@ main =
6966

7067
mkSwagger :: (CompileTimeInfo, SoftwareVersion) -> TargetAPI -> Swagger
7168
mkSwagger details = \case
72-
TargetWalletV0 ->
73-
Swagger.api details v0API Swagger.highLevelShortDescription
7469
TargetWalletV1 ->
75-
Swagger.api details v1API' Swagger.highLevelDescription
76-
where
77-
v1API' = Proxy :: Proxy (V1API :<|> InternalAPI)
70+
Swagger.api details walletDocAPI Swagger.highLevelDescription
7871

7972

8073
-- NOTE The software version is hard-coded here. Do determine the SoftwareVersion,

wallet-new/generate-swagger-file/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ $ cardano-generate-swagger-file --help
1111
Usage: cardano-generate-swagger-file (-t|--target API) [-o|--output-file FILEPATH]
1212
1313
Available options:
14-
-t,--target API Target API with version (e.g. 'wallet@v1', 'wallet@v0', 'wallet@dev'...)
14+
-t,--target API Target API with version (e.g. 'wallet@v1'...)
1515
-o,--output-file FILEPATH Output file, default to: swagger.json
1616
-h,--help Show this help text
1717
1818
Examples:
1919
cardano-generate-swagger-file --target wallet@v1
20-
cardano-generate-swagger-file -t wallet@dev -o dev.json
20+
cardano-generate-swagger-file -t wallet@v1 -o v1.json
2121
```
2222

2323

wallet-new/server/Main.hs

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Pos.Launcher (launchNode)
77
import Pos.Util.CompileInfo (withCompileInfo)
88

99
import Cardano.Wallet.Action (actionWithWallet)
10-
import qualified Cardano.Wallet.LegacyAction as Legacy
1110
import Cardano.Wallet.Server.CLI (ChooseWalletBackend (..),
1211
WalletStartupOptions (..), getWalletNodeOptions)
1312

@@ -22,8 +21,8 @@ main = withCompileInfo $ do
2221
putText "Wallet is starting..."
2322

2423
launchNode nArgs cArgs lArgs $ case wArgs of
25-
WalletLegacy p ->
26-
Legacy.actionWithWallet p
24+
WalletLegacy _ ->
25+
error "Legacy wallet is now disabled. This option will be removed soon."
2726

2827
WalletNew p ->
2928
actionWithWallet p

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

+28-42
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
module Cardano.Wallet.API
2-
( V0API
3-
, V0API'
4-
, v0API
2+
( -- * Wallet API Top-Level Representations
3+
WalletAPI
4+
, walletAPI
5+
, WalletDoc
6+
, walletDoc
7+
, walletDocAPI
8+
9+
-- * Components Representations
510
, V1API
611
, v1API
712
, InternalAPI
813
, internalAPI
9-
, WalletAPI
10-
, walletAPI
11-
, WalletDocAPI
12-
, walletDocAPI
1314
, WIPAPI
14-
, NewWalletDocAPI
15-
, newWalletDocAPI
16-
, NewWalletAPI
17-
, newWalletAPI
15+
, wipAPI
1816
) where
1917

2018
import Cardano.Wallet.API.Types (WalletLoggingConfig)
@@ -23,34 +21,36 @@ import Servant ((:<|>), (:>), Proxy (..))
2321
import Servant.Swagger.UI (SwaggerSchemaUI)
2422

2523
import qualified Cardano.Wallet.API.Internal as Internal
26-
import qualified Cardano.Wallet.API.V0 as V0
2724
import qualified Cardano.Wallet.API.V1 as V1
2825
import qualified Cardano.Wallet.API.WIP as WIP
2926

30-
-- | The complete API, qualified by its versions. For backward compatibility's sake, we still expose
31-
-- the old API under @/api/@. Specification is split under separate modules.
27+
-- | The complete API, qualified by its versions. For backward compatibility's
28+
-- sake, we still expose the old API under @/api/@. Specification is split under
29+
-- separate modules.
30+
--
3231
-- Unsurprisingly:
3332
--
34-
-- * 'Cardano.Wallet.API.V0' hosts the full specification of the V0 (Legacy) API;
3533
-- * 'Cardano.Wallet.API.V1' hosts the full specification of the V1 API;
3634
--
37-
-- This project uses Servant, which means the logic is separated from the implementation (i.e. the Server).
38-
-- Such server, together with all its web handlers lives in an executable which contains the aptly-named
39-
-- modules:
35+
-- This project uses Servant, which means the logic is separated from the
36+
-- implementation (i.e. the Server). Such server, together with all its web
37+
-- handlers lives in an executable which contains the aptly-named modules:
4038
--
4139
-- * 'Cardano.Wallet.Server' contains the main server;
42-
-- * 'Cardano.Wallet.API.V0.Handlers' contains all the @Handler@s serving the V0 API;
4340
-- * 'Cardano.Wallet.API.V1.Handlers' contains all the @Handler@s serving the V1 API;
44-
-- * 'Cardano.Wallet.API.Internalelopment.Handlers' contains all the @Handler@s serving the Internal API;
41+
-- * 'Cardano.Wallet.API.Internal.Handlers' contains all the @Handler@s serving the Internal API;
42+
-- * 'Cardano.Wallet.API.WIP.Handlers' contains @Handler@s still being worked on;
4543

46-
type V0Doc = "docs" :> "v0" :> SwaggerSchemaUI "index" "swagger.json"
47-
type V1Doc = "docs" :> "v1" :> SwaggerSchemaUI "index" "swagger.json"
44+
type WalletAPI = LoggingApi WalletLoggingConfig (V1API :<|> InternalAPI :<|> WIPAPI)
45+
walletAPI :: Proxy WalletAPI
46+
walletAPI = Proxy
4847

48+
type WalletDoc = "docs" :> "v1" :> SwaggerSchemaUI "index" "swagger.json"
49+
walletDoc :: Proxy WalletDoc
50+
walletDoc = Proxy
51+
walletDocAPI :: Proxy (V1API :<|> InternalAPI)
52+
walletDocAPI = Proxy
4953

50-
type V0API = "api" :> V0.API
51-
type V0API' = "api" :> "v0" :> V0.API
52-
v0API :: Proxy V0API
53-
v0API = Proxy
5454

5555
type V1API = "api" :> "v1" :> V1.API
5656
v1API :: Proxy V1API
@@ -61,19 +61,5 @@ internalAPI :: Proxy InternalAPI
6161
internalAPI = Proxy
6262

6363
type WIPAPI = "api" :> "unimplemented" :> WIP.API
64-
65-
type WalletAPI = LoggingApi WalletLoggingConfig (V0API' :<|> V0API :<|> V1API :<|> InternalAPI :<|> WIPAPI)
66-
walletAPI :: Proxy WalletAPI
67-
walletAPI = Proxy
68-
69-
type WalletDocAPI = V0Doc :<|> V1Doc
70-
walletDocAPI :: Proxy WalletDocAPI
71-
walletDocAPI = Proxy
72-
73-
type NewWalletAPI = LoggingApi WalletLoggingConfig (V1API :<|> InternalAPI :<|> WIPAPI)
74-
newWalletAPI :: Proxy NewWalletAPI
75-
newWalletAPI = Proxy
76-
77-
type NewWalletDocAPI = V1Doc
78-
newWalletDocAPI :: Proxy NewWalletDocAPI
79-
newWalletDocAPI = Proxy
64+
wipAPI :: Proxy WIPAPI
65+
wipAPI = Proxy

wallet-new/src/Cardano/Wallet/API/Internal/LegacyHandlers.hs

-88
This file was deleted.

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

-9
This file was deleted.

wallet-new/src/Cardano/Wallet/API/V0/Handlers.hs

-31
This file was deleted.

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

-2
This file was deleted.

0 commit comments

Comments
 (0)