View on GitHub
File Changes
        }
  where
      getSeqState mnemonic password =
-
          let (Right seed) = fromMnemonic @'[15] @"seed" mnemonic
+
          let (Right seed) = fromMnemonic @'[15] mnemonic
              pwd = Passphrase $ BA.convert $ T.encodeUtf8 password
-
              rootXPrv = generateKeyFromSeed (seed, mempty) pwd
+
              rootXPrv = generateKeyFromSeed (seed, Nothing) pwd
          in (rootXPrv
             , pwd
             , mkSeqState @n (rootXPrv, pwd) defaultAddressPoolGap
    ( Depth (..)
    , FromMnemonic (..)
    , NetworkDiscriminant (..)
-
    , Passphrase
+
    , SomeMnemonic
    , WalletKey (..)
    , XPrv
    , XPub (..)
        -- ^ An encoded address
mnemonicsToAccountAddress m1 m2 = do
    seed <- unsafeFromMnemonic  @'[15,18,21,24] m1
-
    sndFactor <- if m2 == "\n" then mempty else (unsafeFromMnemonic @'[9,12]) m2
+
    sndFactor <- if m2 == "\n"
+
        then return Nothing
+
        else Just <$> (unsafeFromMnemonic @'[9,12] m2)
    pure $ mkAccountAddress $ generateKeyFromSeed (seed, sndFactor) mempty
  where
    unsafeFromMnemonic
-
        :: forall (mz :: [Nat]) any. (FromMnemonic mz any)
+
        :: forall (mz :: [Nat]). (FromMnemonic mz)
        => Text
-
        -> IO (Passphrase any)
+
        -> IO SomeMnemonic
    unsafeFromMnemonic = either (fail . show) pure . fromMnemonic @mz . T.words

                      
    -- Derive an account address corresponding to a reward account, from a root key
    , NetworkDiscriminantVal
    , Passphrase (..)
    , PaymentAddress (..)
+
    , SomeMnemonic (..)
    , XPrv
    , networkDiscriminantVal
    , paymentAddress
    ( ShelleyKey )
import Cardano.Wallet.Primitive.CoinSelection
    ( CoinSelection (..) )
+
import Cardano.Wallet.Primitive.Mnemonic
+
    ( EntropySize, entropyToMnemonic, mkEntropy )
import Cardano.Wallet.Primitive.Types
    ( Address (..)
    , Coin (..)

                      
import qualified Cardano.Wallet.Primitive.AddressDerivation.Byron as Rnd
import qualified Cardano.Wallet.Primitive.AddressDerivation.Shelley as Seq
-
import qualified Data.ByteArray as BA
import qualified Data.ByteString.Char8 as B8
import qualified Data.Map as Map
import qualified Data.Text as T
xprvSeqFromSeed
    :: ByteString
    -> (ShelleyKey depth XPrv, Passphrase "encryption")
-
xprvSeqFromSeed seed =
-
    ( Seq.unsafeGenerateKeyFromSeed (Passphrase (BA.convert seed), mempty) pwd
+
xprvSeqFromSeed bytes =
+
    ( Seq.unsafeGenerateKeyFromSeed (seed, Nothing) pwd
    , pwd
    )
  where
    pwd = mempty
+
    seed = SomeMnemonic $ entropyToMnemonic @12 ent
+
    ent = either (error . show) id $ mkEntropy @(EntropySize 12) bytes

                      
xprvRndFromSeed
    :: ByteString
    -> (ByronKey 'AddressK XPrv, Passphrase "encryption")
-
xprvRndFromSeed seed =
-
    ( Rnd.unsafeGenerateKeyFromSeed derPath (Passphrase $ BA.convert seed) pwd
+
xprvRndFromSeed bytes =
+
    ( Rnd.unsafeGenerateKeyFromSeed derPath seed pwd
    , pwd
    )
  where
    pwd = mempty
    derPath = (minBound, minBound)
+
    seed = SomeMnemonic $ entropyToMnemonic ent
+
    ent = either (error . show) id $ mkEntropy @(EntropySize 12) bytes

                      
mkKeystore :: Ord k => [(k,v)] -> (k -> Maybe v)
mkKeystore pairs k =