Closed KtorZ closed 5 years ago
Add options for loading passphrases from files.
I don't believe this is necessary. My experience with CLI tools is that sometimes there is an option to read passphrase from stdin - and then user can redirect file to stdin or similar.
But adding option to store passphrase to the file might not be the wise thing - as it might lead to errors from the user:
We can protect user from the later but there are other ways user can mess up so I would rather not add this option or if we really have to have this feature then reading from stdin should be enough
I have added some integration tests for CLI #264 (however don't know if it's gonna work, in particular still not sure how to test cardano-wallet wallet create
since it is a responsive cli)
Also planning actually to create some manual regression test suite and make it part of the Release Checklist. (especially for anything that cannot be covered by integration tests)
Anyway still it would be good perhaps to improve on the code coverage here -> https://coveralls.io/builds/23377405/source?filename=lib/cli/src/Cardano/CLI.hs
@piotr-iohk I just realized that we won't get any code-coverage with the CLISpec integration tests. Because stack only collects code-coverage for code that is executed through the test-suites (and here, it's executed through a separate executable).
There seems to be a way to instrument stack to generate coverage reports with extra inputs from other executables. I'll have a look and see whether I can get this to work with shc/coveralls as well!
Added more integration tests. Still plan to add more, but we can close this one.
Context
We'll provide a CLI to interact with the wallet layer from the terminal. The CLI acts as a proxy to the wallet backend server (and therefore, requires the wallet server to be up-and-running) such that every endpoint from the API has an equivalent command in the CLI (which delegates the logic to the API via an HTTP call).
e.g.
POST /api/wallets
has a corresponding commandcardano-wallet wallets create --param1 --param2 --param3
Decision
This first iteration only concerns the following endpoints for which, at least mock API handlers should exists.
GET /wallets
POST /wallets
GET /wallets/{walletId}
POST /wallets/{walletId}/transactions
Acceptance Criteria
server start
)cardano-wallet-server
to simplycardano-wallet
for the CLI has a more general purpose than just being a web-server.Development Plan
Define an interface specification using thedocopt
format.Use thedocopt
Haskell library to parse thedocopt
-based specification.Useservant-client
to define a client interface based on the wallet Servant API.For each type in the API: extract out a smart constructor from itsFromJSON
instance, and reuse this smart constructor when parsing a user-supplied value within the CLI code.Reuse record types (such asWalletPostData
) defined within the API layer within the CLI layer.Share any user-facing error messages between the API and the CLI code.Pretty-print the JSON output of calling any API functions.Add functions that ask for passphrases: don't accept passphrases on the command line.Implement command for transaction endpoint. Because of docopt limitations, we may only allow one ellipse parameter and parse transaction's recipients as<coin value>@<address>
, for instance:PR
133
136
155
161
180
188
189
225
253
254
QA
https://github.com/input-output-hk/cardano-wallet/wiki/Wallet-command-line-interface