View on GitHub
File Changes
import Control.Applicative
    ( optional, some, (<|>) )
import Control.Arrow
-
    ( first, left, second )
+
    ( first, left )
import Control.Exception
    ( bracket, catch )
import Control.Monad
    ( bimap )
import Data.Char
    ( toLower )
-
import Data.Functor
-
    ( (<$), (<&>) )
import Data.List.Extra
    ( enumerate )
import Data.List.NonEmpty
  where
    cmd = pure exec
    exec = do
-
        wSeed <- fst <$> do
+
        wSeed <- do
            let prompt = "Please enter your 15–24 word mnemonic sentence: "
-
            let parser = fromMnemonic @'[15,18,21,24] @"seed" . T.words
-
            getLine prompt parser
-
        wSndFactor <- maybe mempty fst <$> do
+
            let parser = fromMnemonic @'[15,18,21,24] . T.words
+
            fst <$> getLine prompt parser
+
        wSndFactor <- do
            let prompt =
                    "(Enter a blank line if you didn't use a second factor.)\n"
                    <> "Please enter your 9–12 word mnemonic second factor: "
-
            let parser =
-
                    optionalE (fromMnemonic @'[9,12] @"generation") . T.words
-
            getLine prompt parser <&> \case
-
                (Nothing, _) -> Nothing
-
                (Just a, t) -> Just (a, t)
+
            let parser = optionalE $ fromMnemonic @'[9,12] . T.words
+
            fst <$> getLine prompt parser

                      
        let rootXPrv = Shelley.generateKeyFromSeed (wSeed, wSndFactor) mempty
        let rewardAccountXPrv = deriveRewardAccount mempty rootXPrv
    exec (WalletCreateArgs wPort wName wGap) = do
        wSeed <- do
            let prompt = "Please enter a 15–24 word mnemonic sentence: "
-
            let parser = fromMnemonic @'[15,18,21,24] @"seed" . T.words
-
            getLine prompt parser
+
            let parser = fromMnemonic @'[15,18,21,24] . T.words
+
            fst <$> getLine prompt parser
        wSndFactor <- do
            let prompt =
                    "(Enter a blank line if you do not wish to use a second " <>
                    "factor.)\n" <>
                    "Please enter a 9–12 word mnemonic second factor: "
            let parser =
-
                    optionalE (fromMnemonic @'[9,12] @"generation") . T.words
-
            getLine prompt parser <&> \case
-
                (Nothing, _) -> Nothing
-
                (Just a, t) -> Just (a, t)
+
                    optionalE (fromMnemonic @'[9,12]) . T.words
+
            fst <$> getLine prompt parser
        wPwd <- getPassphraseWithConfirm "Please enter a passphrase: "
        runClient wPort Aeson.encodePretty $ postWallet (walletClient @t) $
            WalletPostData
                (Just $ ApiT wGap)
-
                (ApiMnemonicT . second T.words $ wSeed)
-
                (ApiMnemonicT . second T.words <$> wSndFactor)
+
                (ApiMnemonicT wSeed)
+
                (ApiMnemonicT <$> wSndFactor)
                (ApiT wName)
                (ApiT wPwd)

                      
    ( AccountingStyle (..)
    , HardDerivation (..)
    , NetworkDiscriminant (..)
-
    , Passphrase (..)
    , PaymentAddress (..)
+
    , SomeMnemonic (..)
    , publicKey
    )
import Cardano.Wallet.Primitive.AddressDerivation.Icarus
    ( generateKeyFromSeed )
import Cardano.Wallet.Primitive.Fee
    ( FeePolicy (..) )
import Cardano.Wallet.Primitive.Mnemonic
-
    ( Mnemonic
-
    , entropyToBytes
-
    , entropyToMnemonic
-
    , genEntropy
-
    , mnemonicToEntropy
-
    , mnemonicToText
-
    )
+
    ( Mnemonic, entropyToMnemonic, genEntropy, mnemonicToText )
import Cardano.Wallet.Primitive.Types
    ( Address (..), Coin (..), Hash (..), TxIn (..), TxOut (..) )
import Cardano.Wallet.Unsafe
    ( ByteString )
import Data.Text
    ( Text )
+
import GHC.TypeLits
+
    ( KnownNat )
import Network.Socket
    ( SockAddr (..) )
import System.FilePath
    appendFile :: Text -> IO ()
    appendFile txt = TIO.appendFile file (txt <> "\n")

                      
-
    addresses :: Mnemonic n -> [Address]
+
    addresses :: KnownNat n => Mnemonic n -> [Address]
    addresses mw =
        let
            (seed, pwd) =
-
                (Passphrase $ entropyToBytes $ mnemonicToEntropy mw, mempty)
+
                (SomeMnemonic mw, mempty)
            rootXPrv =
                generateKeyFromSeed seed pwd
            accXPrv =