-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mnemonic sentence support #975
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I want feedback from the rest of the team before we approve and merge.
cardano-cli/test/cardano-cli-golden/files/golden/help/shelley_key_key-from-mnemonic.cli
Show resolved
Hide resolved
cardano-cli/test/cardano-cli-golden/files/golden/help/allegra_key.cli
Outdated
Show resolved
Hide resolved
This PR is stale because it has been open 45 days with no activity. |
Update stanza
9dd7301
to
eab669b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I just have one concern regarding haskeline
. If we don't need it lets not use it.
import System.Console.Haskeline.Completion (CompletionFunc) | ||
|
||
-- | Generate a mnemonic and write it to a file or stdout. | ||
generateMnemonicImpl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Impl
suffix is unnecessary. It would be similar to naming it generateMnemonicFunction
.
completeMnemonicWord prefix = return $ map (simpleCompletion . T.unpack . fst) $ findMnemonicWordsWithPrefix (T.pack prefix) | ||
|
||
inputT :: (String, String) -> [Text] -> InputT IO [Text] | ||
inputT prefill mnemonic = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use readLine
then run the validation on the input? What do we gain by using haskeline
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍 . One final question.
let newWords = map (T.toLower . T.pack) $ filter (not . null) $ words input | ||
in case span isValidMnemonicWord newWords of | ||
(allWords, []) -> inputT ("", "") (reverse allWords ++ mnemonic) | ||
(validWords, invalidWord : notValidatedWords) -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should notValidatedWords
be remainingInvalidWords
?
Changelog
Context
This PR is associated to: IntersectMBO/cardano-api#678.
It is part of an effort to integrate
cardano-addresses
functionalities into thecardano-cli
.How to trust this PR
I would look mainly at the logic, the changes in the help golden files, and probably testing it is the best way.
Checklist