Add host parameter for Zebra nodes #9
4 changed files with 12 additions and 6 deletions
|
@ -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/),
|
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.4.0]
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Function to encode a human-readable transparent address
|
- Function to encode a human-readable transparent address
|
||||||
- Function to generate a seed phrase
|
- Function to generate a seed phrase
|
||||||
- Implementations of `Read` for types
|
- Implementations of `Read` for types
|
||||||
|
- Function to make RPC calls to `zebrad`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.4.1
|
version: 0.4.2
|
||||||
git: "https://git.vergara.tech/Vergara_Tech/zcash-haskell"
|
git: "https://git.vergara.tech/Vergara_Tech/zcash-haskell"
|
||||||
license: MIT
|
license: MIT
|
||||||
author: "Rene Vergara"
|
author: "Rene Vergara"
|
||||||
|
|
|
@ -26,6 +26,7 @@ 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 Foreign.Rust.Marshall.Variable
|
import Foreign.Rust.Marshall.Variable
|
||||||
import Network.HTTP.Simple
|
import Network.HTTP.Simple
|
||||||
import ZcashHaskell.Types
|
import ZcashHaskell.Types
|
||||||
|
@ -62,13 +63,16 @@ makeZcashCall username password m p = do
|
||||||
-- | Make a Zebra RPC call
|
-- | Make a Zebra RPC call
|
||||||
makeZebraCall ::
|
makeZebraCall ::
|
||||||
(MonadIO m, FromJSON a)
|
(MonadIO m, FromJSON a)
|
||||||
=> Int -- ^ Port for `zebrad`
|
=> T.Text -- ^ Hostname 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
|
||||||
-> m (Response a)
|
-> m (Response a)
|
||||||
makeZebraCall 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 =
|
||||||
setRequestBodyJSON payload $
|
setRequestBodyJSON payload $
|
||||||
setRequestPort port $ setRequestMethod "POST" defaultRequest
|
setRequestPort port $
|
||||||
|
setRequestHost (E.encodeUtf8 host) $
|
||||||
|
setRequestMethod "POST" defaultRequest
|
||||||
httpJSON myRequest
|
httpJSON myRequest
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 1.12
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.4.1
|
version: 0.4.2
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue