Skip to content

Commit f81cd03

Browse files
committed
Fix warnings
1 parent d684ae4 commit f81cd03

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

src/Commands/WalletSign.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ module Commands.WalletSign
77

88
------------------------------------------------------------------------------
99
import Control.Error
10-
import Control.Lens
1110
import Control.Monad
1211
import Control.Monad.Trans
1312
import Control.Monad.Except
14-
import Data.Aeson.Lens
1513
import Data.List
1614
import qualified Data.Set as S
1715
import Data.String.Conv
@@ -33,7 +31,6 @@ import Text.Printf
3331
import Types.Encoding
3432
import Types.Env
3533
import Utils
36-
import Pact.JSON.Legacy.Value (LegacyValue(_getLegacyValue))
3734
------------------------------------------------------------------------------
3835

3936
walletSignCommand :: Env -> WalletSignArgs -> IO ()

src/Kadena/SigningApi.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Data.Aeson
1010
import Data.Proxy
1111
import Data.Text (Text)
1212
import GHC.Generics
13-
import Pact.Core.Command.SigData
1413
import Pact.Core.Command.Types
1514
import Pact.Core.Command.Client
1615

src/Kadena/SigningTypes.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ compactEncoding = defaultOptions
206206
}
207207
where
208208
-- As long as names are not empty or just underscores this head should be fine:
209-
shortener = head . reverse . filter (/= "") . L.splitOn "_"
209+
shortener = fromMaybe "" . listToMaybe . reverse . filter (/= "") . L.splitOn "_"
210210

211211
------------------- ORPHANS -------------------
212212
-- We're defining these orphans here because Pact moved away from `ToJSON` to

src/Keys.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ fromKeyIndex = fromIntegral . naturalToInteger . unKeyIndex
9797
phraseToSeed :: MnemonicPhrase -> Crypto.Seed
9898
phraseToSeed (MnemonicPhrase lst) =
9999
let phraseMap = wordsToPhraseMap lst
100-
Right phrase = Crypto.mnemonicPhrase @12 $ textTo <$> Map.elems phraseMap
101-
Right sentence = Crypto.mnemonicPhraseToMnemonicSentence Crypto.english phrase
100+
phrase = catchMnemonicError $ Crypto.mnemonicPhrase @12 $ textTo <$> Map.elems phraseMap
101+
sentence = catchMnemonicError $ Crypto.mnemonicPhraseToMnemonicSentence Crypto.english phrase
102102
in sentenceToSeed sentence
103+
where
104+
catchMnemonicError = either (error "Invalid Mnemonic") id
103105

104106
phraseToEitherSeed :: MnemonicPhrase -> Either String Crypto.Seed
105107
phraseToEitherSeed (MnemonicPhrase lst) = do
@@ -224,7 +226,9 @@ verify :: PublicKey -> Signature -> ByteString -> Bool
224226
verify (PublicKey pub) (Signature sig) msg = Crypto.verify xpub msg sig
225227
where
226228
dummyChainCode = BS.replicate 32 minBound
227-
Right xpub = Crypto.xpub $ pub <> dummyChainCode
229+
xpub = case Crypto.xpub $ pub <> dummyChainCode of
230+
Right x -> x
231+
Left _ -> error "Invalid Public key"
228232

229233
baToText :: ByteArrayAccess b => b -> Text
230234
baToText = T.decodeUtf8 . BA.pack . BA.unpack

src/Types/TxInputs.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import qualified Data.Text.Encoding as T
1717
import qualified Data.Text.IO as T
1818
import Kadena.SigningTypes ()
1919
import qualified Pact.JSON.Encode as J
20-
import Pact.JSON.Legacy.Value
2120
import Pact.Core.Command.RPC
2221
import Pact.Core.Command.Client
2322
import Pact.Core.Command.Types

0 commit comments

Comments
 (0)