Add Orchard spending key functionality #20
2 changed files with 17 additions and 1 deletions
|
@ -133,3 +133,12 @@ import ZcashHaskell.Types
|
|||
}
|
||||
-> `()'
|
||||
#}
|
||||
|
||||
{# fun unsafe rust_wrapper_derive_orchard_spending_key as rustWrapperGenOrchardSpendKey
|
||||
{ toBorshVar* `BS.ByteString'&
|
||||
, `Word32'
|
||||
, `Word32'
|
||||
, getVarBuffer `Buffer (BS.ByteString)'&
|
||||
}
|
||||
-> `()'
|
||||
#}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
module ZcashHaskell.Orchard where
|
||||
|
||||
import C.Zcash
|
||||
( rustWrapperOrchardCheck
|
||||
( rustWrapperGenOrchardSpendKey
|
||||
, rustWrapperOrchardCheck
|
||||
, rustWrapperOrchardNoteDecode
|
||||
, rustWrapperUADecode
|
||||
, rustWrapperUfvkDecode
|
||||
|
@ -32,6 +33,12 @@ import Foreign.Rust.Marshall.Variable
|
|||
import ZcashHaskell.Types
|
||||
import ZcashHaskell.Utils (encodeBech32m, f4Jumble)
|
||||
|
||||
-- | Derives an Orchard spending key for the given seed and account ID
|
||||
genOrchardSpendingKey :: Seed -> CoinType -> AccountId -> BS.ByteString
|
||||
genOrchardSpendingKey s coinType accountId =
|
||||
withPureBorshVarBuffer $
|
||||
rustWrapperGenOrchardSpendKey s (getValue coinType) (fromIntegral accountId)
|
||||
|
||||
-- | Checks if given bytestring is a valid encoded unified address
|
||||
isValidUnifiedAddress :: BS.ByteString -> Maybe UnifiedAddress
|
||||
isValidUnifiedAddress str =
|
||||
|
|
Loading…
Reference in a new issue