Commit 003 - before merging with dev040 - with orchard spending key

This commit is contained in:
Rene V. Vergara A. 2024-03-05 17:01:17 -05:00
parent 9acbe5b98c
commit 7b65d322e6
3 changed files with 12 additions and 5 deletions

View file

@ -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)'&
}
-> `()'

View file

@ -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

View file

@ -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."
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."