Support for Zebra 2.1.0 #102
3 changed files with 24 additions and 0 deletions
|
@ -1602,6 +1602,18 @@ pub extern "C" fn rust_wrapper_combine_sapling_nodes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn rust_wrapper_get_sapling_root(
|
||||||
|
level: u8,
|
||||||
|
out: *mut u8,
|
||||||
|
out_len: &mut usize
|
||||||
|
){
|
||||||
|
let tree: CommitmentTree<Node, 32> = CommitmentTree::empty();
|
||||||
|
let root = tree.root();
|
||||||
|
let h = Hhex { bytes: root.to_bytes().to_vec() };
|
||||||
|
marshall_to_haskell_var(&h, out, out_len, RW);
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn rust_wrapper_read_orchard_frontier(
|
pub extern "C" fn rust_wrapper_read_orchard_frontier(
|
||||||
tree: *const u8,
|
tree: *const u8,
|
||||||
|
|
|
@ -262,6 +262,13 @@ import ZcashHaskell.Types
|
||||||
-> `()'
|
-> `()'
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
{# fun unsafe rust_wrapper_get_sapling_root as rustWrapperGetSaplingRootTest
|
||||||
|
{ `Int8'
|
||||||
|
, getVarBuffer `Buffer HexString'&
|
||||||
|
}
|
||||||
|
-> `()'
|
||||||
|
#}
|
||||||
|
|
||||||
{# fun unsafe rust_wrapper_read_orchard_node as rustWrapperReadOrchardNode
|
{# fun unsafe rust_wrapper_read_orchard_node as rustWrapperReadOrchardNode
|
||||||
{ toBorshVar* `BS.ByteString'&
|
{ toBorshVar* `BS.ByteString'&
|
||||||
, getVarBuffer `Buffer HexString'&
|
, getVarBuffer `Buffer HexString'&
|
||||||
|
|
|
@ -20,6 +20,7 @@ module ZcashHaskell.Sapling where
|
||||||
import C.Zcash
|
import C.Zcash
|
||||||
( rustWrapperCombineSaplingNodes
|
( rustWrapperCombineSaplingNodes
|
||||||
, rustWrapperDecodeSaplingAddress
|
, rustWrapperDecodeSaplingAddress
|
||||||
|
, rustWrapperGetSaplingRootTest
|
||||||
, rustWrapperIsShielded
|
, rustWrapperIsShielded
|
||||||
, rustWrapperReadSaplingCommitmentTree
|
, rustWrapperReadSaplingCommitmentTree
|
||||||
, rustWrapperReadSaplingFrontier
|
, rustWrapperReadSaplingFrontier
|
||||||
|
@ -206,6 +207,10 @@ combineSaplingNodes level n1 n2 =
|
||||||
withPureBorshVarBuffer $
|
withPureBorshVarBuffer $
|
||||||
rustWrapperCombineSaplingNodes level (toBytes n1) (toBytes n2)
|
rustWrapperCombineSaplingNodes level (toBytes n1) (toBytes n2)
|
||||||
|
|
||||||
|
getSaplingRootTest :: Int8 -> HexString
|
||||||
|
getSaplingRootTest level =
|
||||||
|
withPureBorshVarBuffer $ rustWrapperGetSaplingRootTest level
|
||||||
|
|
||||||
getSaplingFrontier :: SaplingCommitmentTree -> Maybe SaplingFrontier
|
getSaplingFrontier :: SaplingCommitmentTree -> Maybe SaplingFrontier
|
||||||
getSaplingFrontier tree =
|
getSaplingFrontier tree =
|
||||||
if sf_pos updatedTree > 1
|
if sf_pos updatedTree > 1
|
||||||
|
|
Loading…
Reference in a new issue