From 1694898117d3d0b211f9d3de224ca206bc30b166 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 29 Oct 2024 14:14:39 -0500 Subject: [PATCH] fix: correct transaction creation --- src/ZcashHaskell/Utils.hs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ZcashHaskell/Utils.hs b/src/ZcashHaskell/Utils.hs index e7e1aae..e060e18 100644 --- a/src/ZcashHaskell/Utils.hs +++ b/src/ZcashHaskell/Utils.hs @@ -137,22 +137,22 @@ createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing znet bh bui processResult $! txResult where processResult :: HexString -> Either TxError HexString - processResult input = - if BS.length (hexBytes input) > 1 - then Right input - else case head (BS.unpack $ hexBytes input) of - 0 -> Left InsufficientFunds - 1 -> Left ChangeRequired - 2 -> Left Fee - 3 -> Left Balance - 4 -> Left TransparentBuild - 5 -> Left SaplingBuild - 6 -> Left OrchardBuild - 7 -> Left OrchardSpend - 8 -> Left OrchardRecipient - 9 -> Left SaplingBuilderNotAvailable - 10 -> Left OrchardBuilderNotAvailable - _ -> Left ZHError + processResult input + | BS.length (hexBytes input) > 1 = Right input + | otherwise = + case head (BS.unpack $ hexBytes input) of + 0 -> Left InsufficientFunds + 1 -> Left ChangeRequired + 2 -> Left Fee + 3 -> Left Balance + 4 -> Left TransparentBuild + 5 -> Left SaplingBuild + 6 -> Left OrchardBuild + 7 -> Left OrchardSpend + 8 -> Left OrchardRecipient + 9 -> Left SaplingBuilderNotAvailable + 10 -> Left OrchardBuilderNotAvailable + _ -> Left ZHError txResult = withPureBorshVarBuffer $ rustWrapperCreateTx