diff --git a/src/C/Zcash.chs b/src/C/Zcash.chs index f0ad1b8..fcabf7c 100644 --- a/src/C/Zcash.chs +++ b/src/C/Zcash.chs @@ -128,8 +128,8 @@ import ZcashHaskell.Types {# fun unsafe rust_wrapper_sapling_spendingkey as rustWrapperSaplingSpendingkey { toBorshVar* `BS.ByteString'& - , `Int' - , `Int' + , `Word32' + , `Word32' , getVarBuffer `Buffer (BS.ByteString)'& } -> `()' diff --git a/src/ZcashHaskell/Sapling.hs b/src/ZcashHaskell/Sapling.hs index 81d6507..d32668e 100644 --- a/src/ZcashHaskell/Sapling.hs +++ b/src/ZcashHaskell/Sapling.hs @@ -90,7 +90,7 @@ instance FromJSON RawTxResponse where pure $ RawTxResponse i h (getShieldedOutputs h) a ht c b -- | Attempts to obtain a sapling SpendinKey using a HDSeed, a Coin Type and an Account ID -genSaplingSpendingKey :: BS.ByteString -> Int -> Int -> Maybe BS.ByteString +genSaplingSpendingKey :: BS.ByteString -> Word32 -> Word32 -> Maybe BS.ByteString genSaplingSpendingKey seed coin_type account_id = do if BS.length res > 0 then Just res diff --git a/test/Spec.hs b/test/Spec.hs index c9ceab8..8032b6d 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -62,6 +62,10 @@ import Foreign.C.Types import Data.Word import Haskoin.Crypto.Keys.Extended +m2bs :: Maybe BS.ByteString -> BS.ByteString +m2bs x = fromMaybe "" x + + main :: IO () main = do hspec $ do @@ -512,5 +516,8 @@ main = do ] :: [Word8] let coin = 1 :: Word32 let account = 0 :: Word32 - res <- genSaplingSpendingKey (word8ArrayToByteString hdseed) coin account - res `shouldBe` "genSaplingSpendingKey Function called." \ No newline at end of file + let msg = genSaplingSpendingKey (word8ArrayToByteString hdseed) coin account + case msg of + Nothing -> "Bad response from genSapingSpendingKey" + Just msg -> fromMaybe "BadResponse" msg + "mm " `shouldBe` "genSaplingSpendingKey Function called." \ No newline at end of file