Compare commits
No commits in common. "e7050f03c0423a3f0682aa2d26bbb06683630d67" and "5a6f31573cf57951ea2f1dcd26579ce3cbab3b93" have entirely different histories.
e7050f03c0
...
5a6f31573c
5 changed files with 9 additions and 29 deletions
|
@ -5,13 +5,8 @@ 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.5.1.0]
|
|
||||||
|
|
||||||
### Changed
|
## [Unreleased]
|
||||||
|
|
||||||
- Modified the `makeZebraCall` function to handle errors explicitly
|
|
||||||
|
|
||||||
## [0.5.0.1]
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ genSaplingPaymentAddress i extspk =
|
||||||
-- | Generate an internal Sapling address
|
-- | Generate an internal Sapling address
|
||||||
genSaplingInternalAddress :: SaplingSpendingKey -> Maybe SaplingReceiver
|
genSaplingInternalAddress :: SaplingSpendingKey -> Maybe SaplingReceiver
|
||||||
genSaplingInternalAddress sk =
|
genSaplingInternalAddress sk =
|
||||||
if BS.length res == 43
|
if BS.length res > 0
|
||||||
then Just $ SaplingReceiver res
|
then Just $ SaplingReceiver res
|
||||||
else Nothing
|
else Nothing
|
||||||
where
|
where
|
||||||
|
|
|
@ -44,7 +44,7 @@ import Haskoin.Crypto.Keys.Extended (XPrvKey)
|
||||||
--
|
--
|
||||||
-- | A seed for generating private keys
|
-- | A seed for generating private keys
|
||||||
newtype Seed =
|
newtype Seed =
|
||||||
Seed BS.ByteString
|
Seed C.ByteString
|
||||||
deriving stock (Eq, Prelude.Show, GHC.Generic)
|
deriving stock (Eq, Prelude.Show, GHC.Generic)
|
||||||
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
||||||
deriving anyclass (Data.Structured.Show)
|
deriving anyclass (Data.Structured.Show)
|
||||||
|
@ -55,7 +55,7 @@ instance ToBytes Seed where
|
||||||
|
|
||||||
-- | A mnemonic phrase used to derive seeds
|
-- | A mnemonic phrase used to derive seeds
|
||||||
newtype Phrase =
|
newtype Phrase =
|
||||||
Phrase C.ByteString
|
Phrase BS.ByteString
|
||||||
deriving stock (Eq, Prelude.Show, GHC.Generic, Read)
|
deriving stock (Eq, Prelude.Show, GHC.Generic, Read)
|
||||||
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
||||||
deriving anyclass (Data.Structured.Show)
|
deriving anyclass (Data.Structured.Show)
|
||||||
|
@ -191,7 +191,7 @@ data BlockResponse = BlockResponse
|
||||||
{ bl_confirmations :: !Integer -- ^ Block confirmations
|
{ bl_confirmations :: !Integer -- ^ Block confirmations
|
||||||
, bl_height :: !Integer -- ^ Block height
|
, bl_height :: !Integer -- ^ Block height
|
||||||
, bl_time :: !Integer -- ^ Block time
|
, bl_time :: !Integer -- ^ Block time
|
||||||
, bl_txs :: ![HexString] -- ^ List of transaction IDs in the block
|
, bl_txs :: ![T.Text] -- ^ List of transaction IDs in the block
|
||||||
} deriving (Prelude.Show, Eq)
|
} deriving (Prelude.Show, Eq)
|
||||||
|
|
||||||
instance FromJSON BlockResponse where
|
instance FromJSON BlockResponse where
|
||||||
|
|
|
@ -23,14 +23,12 @@ import C.Zcash
|
||||||
, rustWrapperF4Jumble
|
, rustWrapperF4Jumble
|
||||||
, rustWrapperF4UnJumble
|
, rustWrapperF4UnJumble
|
||||||
)
|
)
|
||||||
import Control.Exception (try)
|
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import Foreign.Rust.Marshall.Variable
|
import Foreign.Rust.Marshall.Variable
|
||||||
import Network.HTTP.Client (HttpException(..))
|
|
||||||
import Network.HTTP.Simple
|
import Network.HTTP.Simple
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
|
|
||||||
|
@ -76,12 +74,12 @@ makeZcashCall username password m p = do
|
||||||
|
|
||||||
-- | Make a Zebra RPC call
|
-- | Make a Zebra RPC call
|
||||||
makeZebraCall ::
|
makeZebraCall ::
|
||||||
FromJSON a
|
(MonadIO m, FromJSON a)
|
||||||
=> T.Text -- ^ Hostname for `zebrad`
|
=> T.Text -- ^ Hostname for `zebrad`
|
||||||
-> Int -- ^ Port for `zebrad`
|
-> Int -- ^ Port for `zebrad`
|
||||||
-> T.Text -- ^ RPC method to call
|
-> T.Text -- ^ RPC method to call
|
||||||
-> [Data.Aeson.Value] -- ^ List of parameters
|
-> [Data.Aeson.Value] -- ^ List of parameters
|
||||||
-> IO (Either String a)
|
-> m (Response a)
|
||||||
makeZebraCall host port m params = do
|
makeZebraCall host port m params = do
|
||||||
let payload = RpcCall "2.0" "zh" m params
|
let payload = RpcCall "2.0" "zh" m params
|
||||||
let myRequest =
|
let myRequest =
|
||||||
|
@ -89,16 +87,4 @@ makeZebraCall host port m params = do
|
||||||
setRequestPort port $
|
setRequestPort port $
|
||||||
setRequestHost (E.encodeUtf8 host) $
|
setRequestHost (E.encodeUtf8 host) $
|
||||||
setRequestMethod "POST" defaultRequest
|
setRequestMethod "POST" defaultRequest
|
||||||
r <-
|
httpJSON myRequest
|
||||||
try $ httpJSON myRequest :: FromJSON a1 =>
|
|
||||||
IO (Either HttpException (Response (RpcResponse a1)))
|
|
||||||
case r of
|
|
||||||
Left ex -> return $ Left $ show ex
|
|
||||||
Right res -> do
|
|
||||||
let zebraResp = getResponseBody res
|
|
||||||
case err zebraResp of
|
|
||||||
Just zErr -> return $ Left $ T.unpack $ emessage zErr
|
|
||||||
Nothing ->
|
|
||||||
case result zebraResp of
|
|
||||||
Nothing -> return $ Left "Empty response from Zebra"
|
|
||||||
Just zR -> return $ Right zR
|
|
||||||
|
|
|
@ -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.5.1.0
|
version: 0.5.0.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
|
||||||
|
@ -53,7 +53,6 @@ library
|
||||||
, generics-sop
|
, generics-sop
|
||||||
, hexstring >=0.12.1
|
, hexstring >=0.12.1
|
||||||
, http-conduit
|
, http-conduit
|
||||||
, http-client
|
|
||||||
, memory
|
, memory
|
||||||
, text
|
, text
|
||||||
, haskoin-core
|
, haskoin-core
|
||||||
|
|
Loading…
Reference in a new issue