Merge pull request 'Add host parameter for Zebra nodes' (#9) from fix080 into dev040

Reviewed-on: #9
This commit is contained in:
pitmutt 2024-02-14 14:22:16 +00:00 committed by Vergara Technologies LLC
commit 73d8125b83
Signed by: Vergara Technologies LLC
GPG Key ID: 99DB473BB4715618
4 changed files with 12 additions and 6 deletions

View File

@ -5,13 +5,15 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.4.0]
## [Unreleased]
### Added
- Function to encode a human-readable transparent address
- Function to generate a seed phrase
- Implementations of `Read` for types
- Function to make RPC calls to `zebrad`
### Changed

View File

@ -1,5 +1,5 @@
name: zcash-haskell
version: 0.4.1
version: 0.4.2
git: "https://git.vergara.tech/Vergara_Tech/zcash-haskell"
license: MIT
author: "Rene Vergara"

View File

@ -26,6 +26,7 @@ import Control.Monad.IO.Class
import Data.Aeson
import qualified Data.ByteString as BS
import qualified Data.Text as T
import qualified Data.Text.Encoding as E
import Foreign.Rust.Marshall.Variable
import Network.HTTP.Simple
import ZcashHaskell.Types
@ -62,13 +63,16 @@ makeZcashCall username password m p = do
-- | Make a Zebra RPC call
makeZebraCall ::
(MonadIO m, FromJSON a)
=> Int -- ^ Port for `zebrad`
=> T.Text -- ^ Hostname for `zebrad`
-> Int -- ^ Port for `zebrad`
-> T.Text -- ^ RPC method to call
-> [Data.Aeson.Value] -- ^ List of parameters
-> m (Response a)
makeZebraCall port m params = do
makeZebraCall host port m params = do
let payload = RpcCall "2.0" "zh" m params
let myRequest =
setRequestBodyJSON payload $
setRequestPort port $ setRequestMethod "POST" defaultRequest
setRequestPort port $
setRequestHost (E.encodeUtf8 host) $
setRequestMethod "POST" defaultRequest
httpJSON myRequest

View File

@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
name: zcash-haskell
version: 0.4.1
version: 0.4.2
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>
category: Blockchain