Fix compilation for Spending Key
This commit is contained in:
parent
a6c358cd5d
commit
9acbe5b98c
3 changed files with 18 additions and 13 deletions
|
@ -612,9 +612,14 @@ pub extern "C" fn rust_wrapper_recover_seed(
|
|||
pub extern "C" fn rust_wrapper_sapling_spendingkey(
|
||||
input: *const u8,
|
||||
input_len: usize,
|
||||
coin: u32,
|
||||
acc_id: u32,
|
||||
out: *mut u8,
|
||||
out_len: &mut usize
|
||||
){
|
||||
let seed: Vec<u8> = marshall_from_haskell_var(input, input_len, RW);
|
||||
let fake_response = "It's working";
|
||||
marshall_to_haskell_var(&fake_response.as_bytes().to_vec(), out, out_len, RW);
|
||||
// - Retrieve parameters
|
||||
|
||||
// let extsk = sapling::spending_key(&seed[0..32],
|
||||
|
|
|
@ -128,9 +128,9 @@ import ZcashHaskell.Types
|
|||
|
||||
{# fun unsafe rust_wrapper_sapling_spendingkey as rustWrapperSaplingSpendingkey
|
||||
{ toBorshVar* `BS.ByteString'&
|
||||
, toBorshFixed Int
|
||||
, toBorshFixed Int
|
||||
, `Int'
|
||||
, `Int'
|
||||
, getVarBuffer `Buffer (BS.ByteString)'&
|
||||
}
|
||||
-> `()'
|
||||
#}
|
||||
#}
|
||||
|
|
|
@ -21,15 +21,16 @@ import C.Zcash
|
|||
( rustWrapperIsShielded
|
||||
, rustWrapperSaplingCheck
|
||||
, rustWrapperSaplingNoteDecode
|
||||
, rustWrapperSaplingSpendingkey
|
||||
, rustWrapperSaplingVkDecode
|
||||
, rustWrapperTxParse
|
||||
, rustWrapperSaplingSpendingkey
|
||||
)
|
||||
import Data.Aeson
|
||||
import qualified Data.ByteString as BS
|
||||
import Data.ByteString.Lazy as BL
|
||||
import Data.ByteString.Lazy as BL
|
||||
import Data.HexString (HexString(..), toBytes)
|
||||
import Foreign.Rust.Marshall.Variable
|
||||
import Data.Word
|
||||
import Foreign.Rust.Marshall.Variable
|
||||
( withPureBorshVarBuffer
|
||||
, withPureBorshVarBuffer
|
||||
)
|
||||
|
@ -37,12 +38,11 @@ import ZcashHaskell.Types
|
|||
( DecodedNote(..)
|
||||
, RawData(..)
|
||||
, RawTxResponse(..)
|
||||
, SaplingSKeyParams(..)
|
||||
, ShieldedOutput(..)
|
||||
, decodeHexText
|
||||
, SaplingSKeyParams(..)
|
||||
)
|
||||
import ZcashHaskell.Utils
|
||||
import Data.Word
|
||||
import ZcashHaskell.Utils
|
||||
|
||||
-- | Check if given bytesting is a valid encoded shielded address
|
||||
isValidShieldedAddress :: BS.ByteString -> Bool
|
||||
|
@ -90,12 +90,12 @@ 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 -> Word32 -> Word32 -> Maybe BS.ByteString
|
||||
genSaplingSpendingKey :: BS.ByteString -> Int -> Int -> Maybe BS.ByteString
|
||||
genSaplingSpendingKey seed coin_type account_id = do
|
||||
if BS.length res > 0
|
||||
then Just res
|
||||
else Nothing
|
||||
where
|
||||
res = (withPureBorshVarBuffer . rustWrapperSaplingSpendingkey) seed coin_type account_id
|
||||
|
||||
res =
|
||||
withPureBorshVarBuffer
|
||||
(rustWrapperSaplingSpendingkey seed coin_type account_id)
|
||||
|
|
Loading…
Reference in a new issue