Add new Orchard spending key generation
This commit is contained in:
parent
f09c3c500b
commit
694ab8fd17
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
|
module ZcashHaskell.Orchard where
|
||||||
|
|
||||||
import C.Zcash
|
import C.Zcash
|
||||||
( rustWrapperOrchardCheck
|
( rustWrapperGenOrchardSpendKey
|
||||||
|
, rustWrapperOrchardCheck
|
||||||
, rustWrapperOrchardNoteDecode
|
, rustWrapperOrchardNoteDecode
|
||||||
, rustWrapperUADecode
|
, rustWrapperUADecode
|
||||||
, rustWrapperUfvkDecode
|
, rustWrapperUfvkDecode
|
||||||
|
@ -32,6 +33,12 @@ import Foreign.Rust.Marshall.Variable
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
import ZcashHaskell.Utils (encodeBech32m, f4Jumble)
|
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
|
-- | Checks if given bytestring is a valid encoded unified address
|
||||||
isValidUnifiedAddress :: BS.ByteString -> Maybe UnifiedAddress
|
isValidUnifiedAddress :: BS.ByteString -> Maybe UnifiedAddress
|
||||||
isValidUnifiedAddress str =
|
isValidUnifiedAddress str =
|
||||||
|
|
Loading…
Reference in a new issue