Compare commits
No commits in common. "47e3cf71cbace77b592906f086174af176b09191" and "e371fcdb724686bfb51157911c5d4c0fda433c53" have entirely different histories.
47e3cf71cb
...
e371fcdb72
6 changed files with 3 additions and 54 deletions
|
@ -17,8 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Function to encode unified addresses from receivers
|
- Function to encode unified addresses from receivers
|
||||||
- Function to generate an Orchard spending key
|
- Function to generate an Orchard spending key
|
||||||
- Constants for Zcash protocol
|
- Constants for Zcash protocol
|
||||||
- Types for Spending Keys and Receivers for Sapling and Orchard
|
|
||||||
- Function to generate an Orchard receiver
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -632,19 +632,3 @@ pub extern "C" fn rust_wrapper_derive_orchard_spending_key(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn rust_wrapper_derive_orchard_receiver(
|
|
||||||
spend_key: *const u8,
|
|
||||||
spend_key_len: usize,
|
|
||||||
add_id: u32,
|
|
||||||
out: *mut u8,
|
|
||||||
out_len: &mut usize
|
|
||||||
){
|
|
||||||
let sk_in: Vec<u8> = marshall_from_haskell_var(spend_key, spend_key_len, RW);
|
|
||||||
let sk = SpendingKey::from_bytes(sk_in[0..32].try_into().unwrap()).unwrap();
|
|
||||||
let fvk = FullViewingKey::from(&sk);
|
|
||||||
let o_rec = fvk.address_at(add_id, Scope::External);
|
|
||||||
marshall_to_haskell_var(&o_rec.to_raw_address_bytes().to_vec(), out, out_len, RW);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -142,11 +142,3 @@ import ZcashHaskell.Types
|
||||||
}
|
}
|
||||||
-> `()'
|
-> `()'
|
||||||
#}
|
#}
|
||||||
|
|
||||||
{# fun unsafe rust_wrapper_derive_orchard_receiver as rustWrapperGenOrchardReceiver
|
|
||||||
{ toBorshVar* `BS.ByteString'&
|
|
||||||
, `Word32'
|
|
||||||
, getVarBuffer `Buffer (BS.ByteString)'&
|
|
||||||
}
|
|
||||||
-> `()'
|
|
||||||
#}
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
module ZcashHaskell.Orchard where
|
module ZcashHaskell.Orchard where
|
||||||
|
|
||||||
import C.Zcash
|
import C.Zcash
|
||||||
( rustWrapperGenOrchardReceiver
|
( rustWrapperGenOrchardSpendKey
|
||||||
, rustWrapperGenOrchardSpendKey
|
|
||||||
, rustWrapperOrchardCheck
|
, rustWrapperOrchardCheck
|
||||||
, rustWrapperOrchardNoteDecode
|
, rustWrapperOrchardNoteDecode
|
||||||
, rustWrapperUADecode
|
, rustWrapperUADecode
|
||||||
|
@ -35,8 +34,7 @@ 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
|
-- | Derives an Orchard spending key for the given seed and account ID
|
||||||
genOrchardSpendingKey ::
|
genOrchardSpendingKey :: Seed -> CoinType -> AccountId -> Maybe BS.ByteString
|
||||||
Seed -> CoinType -> AccountId -> Maybe OrchardSpendingKey
|
|
||||||
genOrchardSpendingKey s coinType accountId =
|
genOrchardSpendingKey s coinType accountId =
|
||||||
if BS.length k /= 32
|
if BS.length k /= 32
|
||||||
then Nothing
|
then Nothing
|
||||||
|
@ -49,17 +47,6 @@ genOrchardSpendingKey s coinType accountId =
|
||||||
(getValue coinType)
|
(getValue coinType)
|
||||||
(fromIntegral accountId)
|
(fromIntegral accountId)
|
||||||
|
|
||||||
-- | Derives an Orchard receiver for the given spending key and index
|
|
||||||
genOrchardReceiver :: Int -> OrchardSpendingKey -> Maybe OrchardReceiver
|
|
||||||
genOrchardReceiver i osk =
|
|
||||||
if BS.length k /= 43
|
|
||||||
then Nothing
|
|
||||||
else Just k
|
|
||||||
where
|
|
||||||
k =
|
|
||||||
withPureBorshVarBuffer $
|
|
||||||
rustWrapperGenOrchardReceiver osk (fromIntegral i)
|
|
||||||
|
|
||||||
-- | 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 =
|
||||||
|
|
|
@ -45,18 +45,6 @@ type Seed = C.ByteString
|
||||||
-- | A mnemonic phrase used to derive seeds
|
-- | A mnemonic phrase used to derive seeds
|
||||||
type Phrase = BS.ByteString
|
type Phrase = BS.ByteString
|
||||||
|
|
||||||
-- | A spending key for Sapling
|
|
||||||
type SaplingSpendingKey = BS.ByteString
|
|
||||||
|
|
||||||
-- | A spending key for Orchard
|
|
||||||
type OrchardSpendingKey = BS.ByteString
|
|
||||||
|
|
||||||
-- | A Sapling receiver
|
|
||||||
type SaplingReceiver = BS.ByteString
|
|
||||||
|
|
||||||
-- | An Orchard receiver
|
|
||||||
type OrchardReceiver = BS.ByteString
|
|
||||||
|
|
||||||
-- | Type to represent data after Bech32 decoding
|
-- | Type to represent data after Bech32 decoding
|
||||||
data RawData = RawData
|
data RawData = RawData
|
||||||
{ hrp :: !BS.ByteString -- ^ Human-readable part of the Bech32 encoding
|
{ hrp :: !BS.ByteString -- ^ Human-readable part of the Bech32 encoding
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 3.0
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.4.3.2
|
version: 0.4.3.1
|
||||||
synopsis: Utilities to interact with the Zcash blockchain
|
synopsis: Utilities to interact with the Zcash blockchain
|
||||||
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
||||||
category: Blockchain
|
category: Blockchain
|
||||||
|
|
Loading…
Reference in a new issue