Rust dependencies update #103

Merged
pitmutt merged 99 commits from rav001 into master 2024-12-19 15:23:13 +00:00
Showing only changes of commit f4ecfe9d11 - Show all commits

View file

@ -132,20 +132,36 @@ createTransaction ::
-> ZcashNet -- ^ the network to be used -> ZcashNet -- ^ the network to be used
-> Int -- ^ target block height -> Int -- ^ target block height
-> Bool -- ^ True to build, False to estimate fee -> Bool -- ^ True to build, False to estimate fee
-> HexString -> IO (Either TxError HexString)
createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing znet bh build = createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing znet bh build = do
withPureBorshVarBuffer $ txResult <-
rustWrapperCreateTx withBorshBufferOfInitSize 5120 $
(case sapAnchor of rustWrapperCreateTx
Nothing -> "0" (case sapAnchor of
Just sA -> toBytes $ sapTree sA) Nothing -> "0"
(case orchAnchor of Just sA -> toBytes $ sapTree sA)
Nothing -> "0" (case orchAnchor of
Just oA -> toBytes $ orchTree oA) Nothing -> "0"
tSpend Just oA -> toBytes $ orchTree oA)
sSpend tSpend
oSpend sSpend
outgoing oSpend
(znet == MainNet) outgoing
(fromIntegral bh) (znet == MainNet)
build (fromIntegral bh)
build
if BS.length (hexBytes txResult) > 1
then pure $ Right txResult
else case head (BS.unpack $ hexBytes txResult) of
0 -> pure $ Left InsufficientFunds
1 -> pure $ Left ChangeRequired
2 -> pure $ Left Fee
3 -> pure $ Left Balance
4 -> pure $ Left TransparentBuild
5 -> pure $ Left SaplingBuild
6 -> pure $ Left OrchardBuild
7 -> pure $ Left OrchardSpend
8 -> pure $ Left OrchardRecipient
9 -> pure $ Left SaplingBuilderNotAvailable
10 -> pure $ Left OrchardBuilderNotAvailable
_ -> pure $ Left ZHError