Compare commits

..

5 commits

7 changed files with 123 additions and 84 deletions

View file

@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.6.2.1]
### Changed
- Modified the parsing of raw transactions for shielded outputs
- Upgraded to GHC 9.6.5
## [0.6.2.0]
### Changed
- Performance enhancement for transaction creation
## [0.6.1.1] ## [0.6.1.1]
### Added ### Added

View file

@ -1,6 +1,6 @@
packages: ./*.cabal packages: ./*.cabal
with-compiler: ghc-9.4.8 with-compiler: ghc-9.6.5
source-repository-package source-repository-package
type: git type: git

View file

@ -1,40 +1,40 @@
active-repositories: hackage.haskell.org:merge active-repositories: hackage.haskell.org:merge
constraints: any.Cabal ==3.8.1.0, constraints: any.Cabal ==3.10.3.0,
any.Cabal-syntax ==3.8.1.0, any.Cabal-syntax ==3.10.3.0,
any.HUnit ==1.6.2.0, any.HUnit ==1.6.2.0,
any.OneTuple ==0.4.1.1, any.OneTuple ==0.4.2,
any.QuickCheck ==2.14.3, any.QuickCheck ==2.14.3,
QuickCheck -old-random +templatehaskell, QuickCheck -old-random +templatehaskell,
any.StateVar ==1.2.2, any.StateVar ==1.2.2,
any.aeson ==2.2.1.0, any.aeson ==2.2.3.0,
aeson +ordered-keymap, aeson +ordered-keymap,
any.alex ==3.5.1.0, any.alex ==3.5.1.0,
any.ansi-terminal ==1.1, any.ansi-terminal ==1.1.1,
ansi-terminal -example, ansi-terminal -example,
any.ansi-terminal-types ==1.1, any.ansi-terminal-types ==1.1,
any.appar ==0.1.8, any.appar ==0.1.8,
any.array ==0.5.4.0, any.array ==0.5.6.0,
any.asn1-encoding ==0.9.6, any.asn1-encoding ==0.9.6,
any.asn1-parse ==0.9.5, any.asn1-parse ==0.9.5,
any.asn1-types ==0.3.4, any.asn1-types ==0.3.4,
any.assoc ==1.1, any.assoc ==1.1.1,
assoc +tagged, assoc -tagged,
any.async ==2.2.5, any.async ==2.2.5,
async -bench, async -bench,
any.attoparsec ==0.14.4, any.attoparsec ==0.14.4,
attoparsec -developer, attoparsec -developer,
any.attoparsec-aeson ==2.2.0.1, any.attoparsec-aeson ==2.2.2.0,
any.base ==4.17.2.1, any.base ==4.18.2.1,
any.base-orphans ==0.9.1, any.base-orphans ==0.9.2,
any.base16 ==1.0, any.base16 ==1.0,
any.base16-bytestring ==1.0.2.0, any.base16-bytestring ==1.0.2.0,
any.base58-bytestring ==0.1.0, any.base58-bytestring ==0.1.0,
any.base64-bytestring ==1.2.1.0, any.base64-bytestring ==1.2.1.0,
any.basement ==0.0.16, any.basement ==0.0.16,
any.bifunctors ==5.6.1, any.bifunctors ==5.6.2,
bifunctors +tagged, bifunctors +tagged,
any.binary ==0.8.9.1, any.binary ==0.8.9.1,
any.binary-orphans ==1.0.4.1, any.binary-orphans ==1.0.5,
any.bitvec ==1.1.5.0, any.bitvec ==1.1.5.0,
bitvec +simd, bitvec +simd,
any.blaze-builder ==0.4.2.3, any.blaze-builder ==0.4.2.3,
@ -50,6 +50,7 @@ constraints: any.Cabal ==3.8.1.0,
cborg +optimize-gmp, cborg +optimize-gmp,
any.cereal ==0.5.8.3, any.cereal ==0.5.8.3,
cereal -bytestring-builder, cereal -bytestring-builder,
any.character-ps ==0.1,
any.colour ==2.3.6, any.colour ==2.3.6,
any.comonad ==5.0.8, any.comonad ==5.0.8,
comonad +containers +distributive +indexed-traversable, comonad +containers +distributive +indexed-traversable,
@ -59,10 +60,10 @@ constraints: any.Cabal ==3.8.1.0,
any.contravariant ==1.5.5, any.contravariant ==1.5.5,
contravariant +semigroups +statevar +tagged, contravariant +semigroups +statevar +tagged,
any.cookie ==0.5.0, any.cookie ==0.5.0,
any.crypton ==0.34, any.crypton ==1.0.0,
crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes, crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
any.crypton-connection ==0.3.2, any.crypton-connection ==0.4.1,
any.crypton-x509 ==1.7.6, any.crypton-x509 ==1.7.7,
any.crypton-x509-store ==1.6.9, any.crypton-x509-store ==1.6.9,
any.crypton-x509-system ==1.6.7, any.crypton-x509-system ==1.6.7,
any.crypton-x509-validation ==1.6.12, any.crypton-x509-validation ==1.6.12,
@ -73,49 +74,47 @@ constraints: any.Cabal ==3.8.1.0,
any.data-default-instances-containers ==0.0.1, any.data-default-instances-containers ==0.0.1,
any.data-default-instances-dlist ==0.0.1, any.data-default-instances-dlist ==0.0.1,
any.data-default-instances-old-locale ==0.0.1, any.data-default-instances-old-locale ==0.0.1,
any.data-fix ==0.3.2, any.data-fix ==0.3.3,
any.deepseq ==1.4.8.0, any.deepseq ==1.4.8.1,
any.directory ==1.3.7.1, any.directory ==1.3.8.4,
any.distributive ==0.6.2.1, any.distributive ==0.6.2.1,
distributive +semigroups +tagged, distributive +semigroups +tagged,
any.dlist ==1.0, any.dlist ==1.0,
dlist -werror, dlist -werror,
any.entropy ==0.4.1.10, any.entropy ==0.4.1.10,
entropy -donotgetentropy, entropy -donotgetentropy,
any.envy ==2.1.2.0, any.envy ==2.1.3.0,
any.exceptions ==0.10.5, any.exceptions ==0.10.7,
any.filepath ==1.4.2.2, any.filepath ==1.4.300.1,
any.foldable1-classes-compat ==0.1,
foldable1-classes-compat +tagged,
any.foreign-rust ==0.1.0, any.foreign-rust ==0.1.0,
any.generically ==0.1.1, any.generically ==0.1.1,
any.generics-sop ==0.5.1.4, any.generics-sop ==0.5.1.4,
any.ghc-bignum ==1.3, any.ghc-bignum ==1.3,
any.ghc-boot-th ==9.4.8, any.ghc-boot-th ==9.6.5,
any.ghc-prim ==0.9.1, any.ghc-prim ==0.10.0,
any.half ==0.3.1, any.half ==0.3.1,
any.happy ==1.20.1.1, any.happy ==1.20.1.1,
any.hashable ==1.4.3.0, any.hashable ==1.4.7.0,
hashable +integer-gmp -random-initial-seed, hashable -arch-native +integer-gmp -random-initial-seed,
any.haskell-lexer ==1.1.1, any.haskell-lexer ==1.1.1,
any.haskoin-core ==1.0.4, any.haskoin-core ==1.1.0,
any.hexstring ==0.12.1.0, any.hexstring ==0.12.1.0,
any.hourglass ==0.2.12, any.hourglass ==0.2.12,
any.hsc2hs ==0.68.10, any.hsc2hs ==0.68.10,
hsc2hs -in-ghc-tree, hsc2hs -in-ghc-tree,
any.hspec ==2.11.7, any.hspec ==2.11.9,
any.hspec-core ==2.11.7, any.hspec-core ==2.11.9,
any.hspec-discover ==2.11.7, any.hspec-discover ==2.11.9,
any.hspec-expectations ==0.8.4, any.hspec-expectations ==0.8.4,
any.http-client ==0.7.16, any.http-client ==0.7.17,
http-client +network-uri, http-client +network-uri,
any.http-client-tls ==0.3.6.3, any.http-client-tls ==0.3.6.3,
any.http-conduit ==2.3.8.3, any.http-conduit ==2.3.8.3,
http-conduit +aeson, http-conduit +aeson,
any.http-types ==0.12.4, any.http-types ==0.12.4,
any.indexed-traversable ==0.1.3, any.indexed-traversable ==0.1.4,
any.indexed-traversable-instances ==0.1.1.2, any.indexed-traversable-instances ==0.1.2,
any.integer-conversion ==0.1.0.1, any.integer-conversion ==0.1.1,
any.integer-gmp ==1.1, any.integer-gmp ==1.1,
any.integer-logarithms ==1.0.3.1, any.integer-logarithms ==1.0.3.1,
integer-logarithms -check-bounds +integer-gmp, integer-logarithms -check-bounds +integer-gmp,
@ -126,19 +125,21 @@ constraints: any.Cabal ==3.8.1.0,
memory +support_bytestring +support_deepseq, memory +support_bytestring +support_deepseq,
any.mime-types ==0.1.2.0, any.mime-types ==0.1.2.0,
any.mono-traversable ==1.0.17.0, any.mono-traversable ==1.0.17.0,
any.mtl ==2.2.2, any.mtl ==2.3.1,
any.murmur3 ==1.0.5, any.murmur3 ==1.0.5,
any.network ==3.1.4.0, any.network ==3.2.1.0,
network -devel, network -devel,
any.network-uri ==2.6.4.2, any.network-uri ==2.6.4.2,
any.old-locale ==1.0.0.7, any.old-locale ==1.0.0.7,
any.old-time ==1.1.0.4, any.old-time ==1.1.0.4,
any.os-string ==2.0.6,
any.parsec ==3.1.16.1, any.parsec ==3.1.16.1,
any.pem ==0.2.4, any.pem ==0.2.4,
any.pretty ==1.1.3.6, any.pretty ==1.1.3.6,
any.primitive ==0.9.0.0, any.primitive ==0.9.0.0,
any.process ==1.6.18.0, any.process ==1.6.19.0,
any.quickcheck-io ==0.2.0, any.quickcheck-io ==0.2.0,
any.quickcheck-transformer ==0.3.1.2,
any.random ==1.2.1.2, any.random ==1.2.1.2,
any.regex-base ==0.94.0.2, any.regex-base ==0.94.0.2,
any.regex-compat ==0.95.2.1, any.regex-compat ==0.95.2.1,
@ -147,12 +148,12 @@ constraints: any.Cabal ==3.8.1.0,
any.resourcet ==1.3.0, any.resourcet ==1.3.0,
any.rts ==1.0.2, any.rts ==1.0.2,
any.safe ==0.3.21, any.safe ==0.3.21,
any.scientific ==0.3.7.0, any.scientific ==0.3.8.0,
scientific -bytestring-builder -integer-simple, scientific -integer-simple,
any.secp256k1-haskell ==1.1.0, any.secp256k1-haskell ==1.2.0,
any.semialign ==1.3, any.semialign ==1.3.1,
semialign +semigroupoids, semialign +semigroupoids,
any.semigroupoids ==6.0.0.1, any.semigroupoids ==6.0.1,
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
any.serialise ==0.2.6.1, any.serialise ==0.2.6.1,
serialise +newtime15, serialise +newtime15,
@ -168,40 +169,39 @@ constraints: any.Cabal ==3.8.1.0,
any.string-conversions ==0.4.0.1, any.string-conversions ==0.4.0.1,
any.tagged ==0.8.8, any.tagged ==0.8.8,
tagged +deepseq +transformers, tagged +deepseq +transformers,
any.template-haskell ==2.19.0.0, any.template-haskell ==2.20.0.0,
any.text ==2.0.2, any.text ==2.0.2,
any.text-iso8601 ==0.1, any.text-iso8601 ==0.1.1,
any.text-short ==0.1.5, any.text-short ==0.1.6,
text-short -asserts, text-short -asserts,
any.tf-random ==0.5, any.tf-random ==0.5,
any.th-abstraction ==0.6.0.0, any.th-abstraction ==0.7.0.0,
any.th-compat ==0.1.4, any.th-compat ==0.1.5,
any.these ==1.2, any.these ==1.2.1,
any.time ==1.12.2, any.time ==1.12.2,
any.time-compat ==1.9.6.1, any.time-compat ==1.9.7,
time-compat -old-locale, any.tls ==2.1.0,
any.tls ==2.0.1,
tls -devel, tls -devel,
any.transformers ==0.5.6.2, any.transformers ==0.6.1.0,
any.transformers-compat ==0.7.2, any.transformers-compat ==0.7.2,
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
any.typed-process ==0.2.11.1, any.typed-process ==0.2.11.1,
any.unix ==2.7.3, any.unix ==2.8.4.0,
any.unix-time ==0.4.12, any.unix-time ==0.4.15,
any.unliftio-core ==0.2.1.0, any.unliftio-core ==0.2.1.0,
any.unordered-containers ==0.2.20, any.unordered-containers ==0.2.20,
unordered-containers -debug, unordered-containers -debug,
any.utf8-string ==1.0.2, any.utf8-string ==1.0.2,
any.uuid-types ==1.0.5.1, any.uuid-types ==1.0.6,
any.vector ==0.13.1.0, any.vector ==0.13.1.0,
vector +boundschecks -internalchecks -unsafechecks -wall, vector +boundschecks -internalchecks -unsafechecks -wall,
any.vector-algorithms ==0.9.0.1, any.vector-algorithms ==0.9.0.2,
vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
any.vector-stream ==0.1.0.1, any.vector-stream ==0.1.0.1,
any.void ==0.7.3, any.void ==0.7.3,
void -safe, void -safe,
any.wide-word ==0.1.6.0, any.wide-word ==0.1.6.0,
any.witherable ==0.4.2, any.witherable ==0.5,
any.zlib ==0.7.0.0, any.zlib ==0.7.1.0,
zlib -bundled-c-zlib +non-blocking-ffi +pkg-config zlib -bundled-c-zlib +non-blocking-ffi +pkg-config
index-state: hackage.haskell.org 2024-03-06T20:26:39Z index-state: hackage.haskell.org 2024-07-01T20:28:56Z

6
configure vendored
View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
echo -e "\n"
echo "export PKG_CONFIG_PATH=$HOME/.local/share/zcash-haskell:\$PKG_CONFIG_PATH" | tee -a ~/.bashrc echo "export PKG_CONFIG_PATH=$(pwd)/librustzcash-wrapper/target/x86_64-unknown-linux-gnu/debug:\$PKG_CONFIG_PATH" | tee -a ~/.bashrc
echo "export LD_LIBRARY_PATH=$HOME/.local/share/zcash-haskell:\$LD_LIBRARY_PATH" | tee -a ~/.bashrc echo "export LD_LIBRARY_PATH=$(pwd)/librustzcash-wrapper/target/x86_64-unknown-linux-gnu/debug:\$LD_LIBRARY_PATH" | tee -a ~/.bashrc
source ~/.bashrc source ~/.bashrc

View file

@ -95,12 +95,35 @@ instance FromJSON RawTxResponse where
c <- obj .: "confirmations" c <- obj .: "confirmations"
b <- obj .: "blocktime" b <- obj .: "blocktime"
sSpend <- obj .: "vShieldedSpend" sSpend <- obj .: "vShieldedSpend"
sOut <- obj .: "vShieldedOutput"
case o of case o of
Nothing -> Nothing ->
pure $ RawTxResponse i h sSpend (getShieldedOutputs h) [] ht c b pure $
RawTxResponse
i
h
sSpend
(if not (null (sOut :: [Object]))
then getShieldedOutputs h
else [])
[]
ht
c
b
Just o' -> do Just o' -> do
a <- o' .: "actions" a <- o' .: "actions"
pure $ RawTxResponse i h sSpend (getShieldedOutputs h) a ht c b pure $
RawTxResponse
i
h
sSpend
(if not (null sOut)
then getShieldedOutputs h
else [])
a
ht
c
b
-- | Attempt to decode the given raw tx with the given Sapling spending key -- | Attempt to decode the given raw tx with the given Sapling spending key
decodeSaplingOutputEsk :: decodeSaplingOutputEsk ::

View file

@ -136,22 +136,25 @@ createTransaction ::
-> Bool -- ^ True to build, False to estimate fee -> Bool -- ^ True to build, False to estimate fee
-> Either TxError HexString -> Either TxError HexString
createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oParams znet bh build = createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oParams znet bh build =
if BS.length (hexBytes txResult) > 1 processResult $! txResult
then Right txResult
else case head (BS.unpack $ hexBytes txResult) 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
where 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
txResult = txResult =
withPureBorshVarBuffer $ withPureBorshVarBuffer $
rustWrapperCreateTx rustWrapperCreateTx

View file

@ -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.6.1.1 version: 0.6.2.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
@ -58,7 +58,7 @@ library
, binary , binary
, text , text
, haskoin-core , haskoin-core
, secp256k1-haskell , secp256k1-haskell >= 1.1
, utf8-string , utf8-string
build-tool-depends: build-tool-depends:
c2hs:c2hs c2hs:c2hs