fix: optimize create transaction
This commit is contained in:
parent
1694898117
commit
24210b1e0b
1 changed files with 16 additions and 36 deletions
|
@ -132,28 +132,8 @@ 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
|
||||||
-> Either TxError HexString
|
-> HexString
|
||||||
createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing znet bh build =
|
createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing znet bh build =
|
||||||
processResult $! txResult
|
|
||||||
where
|
|
||||||
processResult :: HexString -> Either TxError HexString
|
|
||||||
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 $
|
withPureBorshVarBuffer $
|
||||||
rustWrapperCreateTx
|
rustWrapperCreateTx
|
||||||
(case sapAnchor of
|
(case sapAnchor of
|
||||||
|
|
Loading…
Reference in a new issue