Skip to content
Permalink
Browse files

Rename unsafeSomeMnemonicFromEntropy -> unsafeMkSomeMnemonicFromEntropy

  • Loading branch information
Anviking committed Feb 14, 2020
1 parent c9a8ed4 commit 58820d432087246a565f45884549b82bb1ced254
@@ -16,7 +16,7 @@ module Cardano.Wallet.Unsafe
, unsafeXPrv
, unsafeMkMnemonic
, unsafeMkEntropy
, unsafeSomeMnemonicFromEntropy
, unsafeMkSomeMnemonicFromEntropy
, unsafeDeserialiseCbor
, unsafeBech32DecodeFile
, unsafeBech32Decode
@@ -151,7 +151,7 @@ unsafeMkEntropy
-> Entropy ent
unsafeMkEntropy = either (error . show) id . mkEntropy

unsafeSomeMnemonicFromEntropy
unsafeMkSomeMnemonicFromEntropy
:: forall mw ent csz.
( HasCallStack
, ValidEntropySize ent
@@ -163,7 +163,7 @@ unsafeSomeMnemonicFromEntropy
=> Proxy mw
-> ByteString
-> SomeMnemonic
unsafeSomeMnemonicFromEntropy _ = SomeMnemonic
unsafeMkSomeMnemonicFromEntropy _ = SomeMnemonic
. entropyToMnemonic
. unsafeMkEntropy @ent

@@ -100,7 +100,7 @@ import Cardano.Wallet.Primitive.Types
, fromFlatSlot
)
import Cardano.Wallet.Unsafe
( unsafeRunExceptT, unsafeSomeMnemonicFromEntropy )
( unsafeMkSomeMnemonicFromEntropy, unsafeRunExceptT )
import Control.DeepSeq
( NFData (..), force )
import Control.Exception
@@ -635,12 +635,12 @@ testPk = PrimaryKey testWid
ourAccount :: ShelleyKey 'AccountK XPub
ourAccount = publicKey $ unsafeGenerateKeyFromSeed (seed, Nothing) mempty
where
seed = unsafeSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)
seed = unsafeMkSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)

rewardAccount :: ShelleyKey 'AddressK XPub
rewardAccount = publicKey $ unsafeGenerateKeyFromSeed (seed, Nothing) mempty
where
seed = unsafeSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)
seed = unsafeMkSomeMnemonicFromEntropy (Proxy @15) (BS.replicate 32 0)

-- | Make a prefixed bytestring for use as a Hash or Address.
label :: Show n => String -> n -> B8.ByteString
@@ -48,7 +48,7 @@ import Cardano.Wallet.Primitive.Mnemonic
import Cardano.Wallet.Primitive.Types
( Address )
import Cardano.Wallet.Unsafe
( unsafeSomeMnemonicFromEntropy )
( unsafeMkSomeMnemonicFromEntropy )
import Control.Monad
( forM_ )
import Data.Proxy
@@ -74,7 +74,7 @@ import qualified Data.Text as T
spec :: Spec
spec = do
describe "Golden Tests - Icarus' style addresses" $ do
let seed0 = unsafeSomeMnemonicFromEntropy (Proxy @15)
let seed0 = unsafeMkSomeMnemonicFromEntropy (Proxy @15)
"4\175\242L\184\243\191 \169]\171 \207\r\v\233\NUL~&\ETB"

goldenAddressGeneration $ GoldenAddressGeneration
@@ -67,7 +67,7 @@ import Cardano.Wallet.Primitive.Mnemonic
import Cardano.Wallet.Primitive.Types
( Address (..), ShowFmt (..) )
import Cardano.Wallet.Unsafe
( unsafeMkEntropy, unsafeSomeMnemonicFromEntropy )
( unsafeMkEntropy, unsafeMkSomeMnemonicFromEntropy )
import Control.Monad
( forM, forM_, unless )
import Control.Monad.IO.Class
@@ -382,7 +382,7 @@ prop_lookupDiscovered
prop_lookupDiscovered (s0, addr) =
let (ours, s) = isOurs addr s0 in ours ==> prop s
where
mw = unsafeSomeMnemonicFromEntropy (Proxy @12) "0000000000000000"
mw = unsafeMkSomeMnemonicFromEntropy (Proxy @12) "0000000000000000"
key = Shelley.unsafeGenerateKeyFromSeed (mw, Nothing) mempty
prop s = monadicIO $ liftIO $ do
unless (isJust $ isOwned s (key, mempty) addr) $ do
@@ -654,4 +654,4 @@ instance Show Key where show (Key proxy) = show (typeRep proxy)

dummyMnemonic :: SomeMnemonic
dummyMnemonic =
unsafeSomeMnemonicFromEntropy (Proxy @12) (BS.pack $ replicate 16 0)
unsafeMkSomeMnemonicFromEntropy (Proxy @12) (BS.pack $ replicate 16 0)
@@ -96,7 +96,7 @@ import Cardano.Wallet.Primitive.Types
, wholeRange
)
import Cardano.Wallet.Unsafe
( unsafeFromHex, unsafeSomeMnemonicFromEntropy )
( unsafeFromHex, unsafeMkSomeMnemonicFromEntropy )
import Control.DeepSeq
( deepseq )
import Control.Exception
@@ -212,7 +212,7 @@ spec = do

describe "Buildable" $ do
it "WalletId" $ do
let mw = unsafeSomeMnemonicFromEntropy (Proxy @12)
let mw = unsafeMkSomeMnemonicFromEntropy (Proxy @12)
"0000000000000000"
let xprv = generateKeyFromSeed
(mw, Nothing) mempty :: ShelleyKey 'RootK XPrv
@@ -44,7 +44,7 @@ import Cardano.Wallet.Primitive.Types
import Cardano.Wallet.Transaction
( ErrMkTx (..), TransactionLayer (..) )
import Cardano.Wallet.Unsafe
( unsafeFromHex, unsafeSomeMnemonicFromEntropy )
( unsafeFromHex, unsafeMkSomeMnemonicFromEntropy )
import Data.ByteArray.Encoding
( Base (Base16), convertToBase )
import Data.ByteString
@@ -534,7 +534,7 @@ xprvSeqFromSeed bytes =
)
where
pwd = mempty
seed = unsafeSomeMnemonicFromEntropy (Proxy @12) bytes
seed = unsafeMkSomeMnemonicFromEntropy (Proxy @12) bytes

xprvRndFromSeed
:: ByteString
@@ -546,7 +546,7 @@ xprvRndFromSeed bytes =
where
pwd = mempty
derPath = (minBound, minBound)
seed = unsafeSomeMnemonicFromEntropy (Proxy @12) bytes
seed = unsafeMkSomeMnemonicFromEntropy (Proxy @12) bytes

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

0 comments on commit 58820d4

Please sign in to comment.
You can’t perform that action at this time.