Commit 003 - before merging with dev040 - with orchard spending key
This commit is contained in:
parent
9acbe5b98c
commit
7b65d322e6
3 changed files with 12 additions and 5 deletions
|
@ -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)'&
|
||||
}
|
||||
-> `()'
|
||||
|
|
|
@ -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
|
||||
|
|
11
test/Spec.hs
11
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."
|
||||
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."
|
Loading…
Reference in a new issue