RPC Server #103

Merged
pitmutt merged 129 commits from rav001 into milestone3 2024-11-21 15:30:22 +00:00
Showing only changes of commit 339c93905f - Show all commits

View file

@ -10,9 +10,11 @@
module Zenith.Types where
import Data.Aeson
import Data.Aeson.TH (deriveJSON)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Base64 as B64
import qualified Data.ByteString.Char8 as C
import Data.Char (toLower)
import Data.HexString
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
@ -110,25 +112,7 @@ data ZcashWalletAPI = ZcashWalletAPI
, zw_lastSync :: !Int
} deriving (Eq, Prelude.Show)
instance ToJSON ZcashWalletAPI where
toJSON (ZcashWalletAPI i n net b l) =
object
[ "index" .= i
, "name" .= n
, "network" .= net
, "birthday" .= b
, "lastSync" .= l
]
instance FromJSON ZcashWalletAPI where
parseJSON =
withObject "ZcashWalletAPI" $ \obj -> do
i <- obj .: "index"
n <- obj .: "name"
net <- obj .: "network"
b <- obj .: "birthday"
l <- obj .: "lastSync"
pure $ ZcashWalletAPI i n net b l
$(deriveJSON defaultOptions {fieldLabelModifier = drop 3} ''ZcashWalletAPI)
data ZcashAccountAPI = ZcashAccountAPI
{ za_index :: !Int
@ -136,17 +120,18 @@ data ZcashAccountAPI = ZcashAccountAPI
, za_name :: !T.Text
} deriving (Eq, Prelude.Show)
instance ToJSON ZcashAccountAPI where
toJSON (ZcashAccountAPI i w n) =
object ["index" .= i, "wallet" .= w, "name" .= n]
$(deriveJSON defaultOptions {fieldLabelModifier = drop 3} ''ZcashAccountAPI)
instance FromJSON ZcashAccountAPI where
parseJSON =
withObject "ZcashAccountAPI" $ \obj -> do
i <- obj .: "index"
w <- obj .: "wallet"
n <- obj .: "name"
pure $ ZcashAccountAPI i w n
data ZcashAddressAPI = ZcashAddressAPI
{ zd_index :: !Int
, zd_account :: !Int
, zd_name :: !T.Text
, zd_ua :: !T.Text
, zd_legacy :: !(Maybe T.Text)
, zd_transparent :: !(Maybe T.Text)
} deriving (Eq, Prelude.Show)
$(deriveJSON defaultOptions {fieldLabelModifier = drop 3} ''ZcashAddressAPI)
-- ** `zebrad`
-- | Type for modeling the tree state response