module Blockfrost.Types.Cardano.Pools
( Pool (..)
, PoolEpoch (..)
, PoolInfo (..)
, PoolHistory (..)
, PoolMetadata (..)
, PoolRelay (..)
, PoolDelegator (..)
, PoolUpdate (..)
, PoolRegistrationAction (..)
, samplePoolRelay
) where
import Data.Aeson (FromJSON (..), ToJSON (..), object, pairs, withText)
import Data.Text (Text)
import Deriving.Aeson
import Servant.Docs (ToSample (..), samples, singleSample)
import Blockfrost.Types.Shared
data Pool = Pool
{ Pool -> PoolId
_poolPoolId :: PoolId
, Pool -> Text
_poolHex :: Text
, Pool -> Lovelaces
_poolActiveStake :: Lovelaces
, Pool -> Lovelaces
_poolLiveStake :: Lovelaces
}
deriving stock (Int -> Pool -> ShowS
[Pool] -> ShowS
Pool -> String
(Int -> Pool -> ShowS)
-> (Pool -> String) -> ([Pool] -> ShowS) -> Show Pool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Pool -> ShowS
showsPrec :: Int -> Pool -> ShowS
$cshow :: Pool -> String
show :: Pool -> String
$cshowList :: [Pool] -> ShowS
showList :: [Pool] -> ShowS
Show, Pool -> Pool -> Bool
(Pool -> Pool -> Bool) -> (Pool -> Pool -> Bool) -> Eq Pool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Pool -> Pool -> Bool
== :: Pool -> Pool -> Bool
$c/= :: Pool -> Pool -> Bool
/= :: Pool -> Pool -> Bool
Eq, (forall x. Pool -> Rep Pool x)
-> (forall x. Rep Pool x -> Pool) -> Generic Pool
forall x. Rep Pool x -> Pool
forall x. Pool -> Rep Pool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Pool -> Rep Pool x
from :: forall x. Pool -> Rep Pool x
$cto :: forall x. Rep Pool x -> Pool
to :: forall x. Rep Pool x -> Pool
Generic)
deriving (Maybe Pool
Value -> Parser [Pool]
Value -> Parser Pool
(Value -> Parser Pool)
-> (Value -> Parser [Pool]) -> Maybe Pool -> FromJSON Pool
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser Pool
parseJSON :: Value -> Parser Pool
$cparseJSONList :: Value -> Parser [Pool]
parseJSONList :: Value -> Parser [Pool]
$comittedField :: Maybe Pool
omittedField :: Maybe Pool
FromJSON, [Pool] -> Value
[Pool] -> Encoding
Pool -> Bool
Pool -> Value
Pool -> Encoding
(Pool -> Value)
-> (Pool -> Encoding)
-> ([Pool] -> Value)
-> ([Pool] -> Encoding)
-> (Pool -> Bool)
-> ToJSON Pool
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: Pool -> Value
toJSON :: Pool -> Value
$ctoEncoding :: Pool -> Encoding
toEncoding :: Pool -> Encoding
$ctoJSONList :: [Pool] -> Value
toJSONList :: [Pool] -> Value
$ctoEncodingList :: [Pool] -> Encoding
toEncodingList :: [Pool] -> Encoding
$comitField :: Pool -> Bool
omitField :: Pool -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_pool", CamelToSnake]] Pool
instance ToSample Pool where
toSamples :: Proxy Pool -> [(Text, Pool)]
toSamples = [(Text, Pool)] -> Proxy Pool -> [(Text, Pool)]
forall a. a -> Proxy Pool -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, Pool)] -> Proxy Pool -> [(Text, Pool)])
-> [(Text, Pool)] -> Proxy Pool -> [(Text, Pool)]
forall a b. (a -> b) -> a -> b
$ [Pool] -> [(Text, Pool)]
forall a. [a] -> [(Text, a)]
samples
[ Pool
{ _poolPoolId :: PoolId
_poolPoolId = PoolId
"pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q"
, _poolHex :: Text
_poolHex = Text
"2f355f79ee007502d116ecb07e36f985b34cebf2d84118f5c6b455a1"
, _poolActiveStake :: Lovelaces
_poolActiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
1541200000
, _poolLiveStake :: Lovelaces
_poolLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
1541400000
}
, Pool
{ _poolPoolId :: PoolId
_poolPoolId = PoolId
"pool1dvla4zq98hpvacv20snndupjrqhuc79zl6gjap565nku6et5zdx"
, _poolHex :: Text
_poolHex = Text
"6b3fda88053dc2cee18a7c2736f032182fcc78a2fe912e869aa4edcd"
, _poolActiveStake :: Lovelaces
_poolActiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
22200000
, _poolLiveStake :: Lovelaces
_poolLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
48955550
}
, Pool
{ _poolPoolId :: PoolId
_poolPoolId = PoolId
"pool1wvccajt4eugjtf3k0ja3exjqdj7t8egsujwhcw4tzj4rzsxzw5w"
, _poolHex :: Text
_poolHex = Text
"73318ec975cf1125a6367cbb1c9a406cbcb3e510e49d7c3aab14aa31"
, _poolActiveStake :: Lovelaces
_poolActiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
9989541215
, _poolLiveStake :: Lovelaces
_poolLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
168445464878
}
]
data PoolEpoch = PoolEpoch
{ PoolEpoch -> PoolId
_poolEpochPoolId :: PoolId
, PoolEpoch -> Epoch
_poolEpochEpoch :: Epoch
}
deriving stock (Int -> PoolEpoch -> ShowS
[PoolEpoch] -> ShowS
PoolEpoch -> String
(Int -> PoolEpoch -> ShowS)
-> (PoolEpoch -> String)
-> ([PoolEpoch] -> ShowS)
-> Show PoolEpoch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolEpoch -> ShowS
showsPrec :: Int -> PoolEpoch -> ShowS
$cshow :: PoolEpoch -> String
show :: PoolEpoch -> String
$cshowList :: [PoolEpoch] -> ShowS
showList :: [PoolEpoch] -> ShowS
Show, PoolEpoch -> PoolEpoch -> Bool
(PoolEpoch -> PoolEpoch -> Bool)
-> (PoolEpoch -> PoolEpoch -> Bool) -> Eq PoolEpoch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolEpoch -> PoolEpoch -> Bool
== :: PoolEpoch -> PoolEpoch -> Bool
$c/= :: PoolEpoch -> PoolEpoch -> Bool
/= :: PoolEpoch -> PoolEpoch -> Bool
Eq, (forall x. PoolEpoch -> Rep PoolEpoch x)
-> (forall x. Rep PoolEpoch x -> PoolEpoch) -> Generic PoolEpoch
forall x. Rep PoolEpoch x -> PoolEpoch
forall x. PoolEpoch -> Rep PoolEpoch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolEpoch -> Rep PoolEpoch x
from :: forall x. PoolEpoch -> Rep PoolEpoch x
$cto :: forall x. Rep PoolEpoch x -> PoolEpoch
to :: forall x. Rep PoolEpoch x -> PoolEpoch
Generic)
deriving (Maybe PoolEpoch
Value -> Parser [PoolEpoch]
Value -> Parser PoolEpoch
(Value -> Parser PoolEpoch)
-> (Value -> Parser [PoolEpoch])
-> Maybe PoolEpoch
-> FromJSON PoolEpoch
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolEpoch
parseJSON :: Value -> Parser PoolEpoch
$cparseJSONList :: Value -> Parser [PoolEpoch]
parseJSONList :: Value -> Parser [PoolEpoch]
$comittedField :: Maybe PoolEpoch
omittedField :: Maybe PoolEpoch
FromJSON, [PoolEpoch] -> Value
[PoolEpoch] -> Encoding
PoolEpoch -> Bool
PoolEpoch -> Value
PoolEpoch -> Encoding
(PoolEpoch -> Value)
-> (PoolEpoch -> Encoding)
-> ([PoolEpoch] -> Value)
-> ([PoolEpoch] -> Encoding)
-> (PoolEpoch -> Bool)
-> ToJSON PoolEpoch
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolEpoch -> Value
toJSON :: PoolEpoch -> Value
$ctoEncoding :: PoolEpoch -> Encoding
toEncoding :: PoolEpoch -> Encoding
$ctoJSONList :: [PoolEpoch] -> Value
toJSONList :: [PoolEpoch] -> Value
$ctoEncodingList :: [PoolEpoch] -> Encoding
toEncodingList :: [PoolEpoch] -> Encoding
$comitField :: PoolEpoch -> Bool
omitField :: PoolEpoch -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolEpoch", CamelToSnake]] PoolEpoch
instance ToSample PoolEpoch where
toSamples :: Proxy PoolEpoch -> [(Text, PoolEpoch)]
toSamples = [(Text, PoolEpoch)] -> Proxy PoolEpoch -> [(Text, PoolEpoch)]
forall a. a -> Proxy PoolEpoch -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolEpoch)] -> Proxy PoolEpoch -> [(Text, PoolEpoch)])
-> [(Text, PoolEpoch)] -> Proxy PoolEpoch -> [(Text, PoolEpoch)]
forall a b. (a -> b) -> a -> b
$ [PoolEpoch] -> [(Text, PoolEpoch)]
forall a. [a] -> [(Text, a)]
samples
[ PoolId -> Epoch -> PoolEpoch
PoolEpoch PoolId
"pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q" Epoch
225
, PoolId -> Epoch -> PoolEpoch
PoolEpoch PoolId
"pool1dvla4zq98hpvacv20snndupjrqhuc79zl6gjap565nku6et5zdx" Epoch
215
, PoolId -> Epoch -> PoolEpoch
PoolEpoch PoolId
"pool1wvccajt4eugjtf3k0ja3exjqdj7t8egsujwhcw4tzj4rzsxzw5w" Epoch
231
]
data PoolInfo = PoolInfo
{ PoolInfo -> PoolId
_poolInfoPoolId :: PoolId
, PoolInfo -> Text
_poolInfoHex :: Text
, PoolInfo -> Text
_poolInfoVrfKey :: Text
, PoolInfo -> Integer
_poolInfoBlocksMinted :: Integer
, PoolInfo -> Integer
_poolInfoBlocksEpoch :: Integer
, PoolInfo -> Lovelaces
_poolInfoLiveStake :: Lovelaces
, PoolInfo -> Double
_poolInfoLiveSize :: Double
, PoolInfo -> Double
_poolInfoLiveSaturation :: Double
, PoolInfo -> Double
_poolInfoLiveDelegators :: Double
, PoolInfo -> Lovelaces
_poolInfoActiveStake :: Lovelaces
, PoolInfo -> Double
_poolInfoActiveSize :: Double
, PoolInfo -> Lovelaces
_poolInfoDeclaredPledge :: Lovelaces
, PoolInfo -> Lovelaces
_poolInfoLivePledge :: Lovelaces
, PoolInfo -> Rational
_poolInfoMarginCost :: Rational
, PoolInfo -> Lovelaces
_poolInfoFixedCost :: Lovelaces
, PoolInfo -> Address
_poolInfoRewardAccount :: Address
, PoolInfo -> [Address]
_poolInfoOwners :: [Address]
, PoolInfo -> [Text]
_poolInfoRegistration :: [Text]
, PoolInfo -> [Text]
_poolInfoRetirement :: [Text]
}
deriving stock (Int -> PoolInfo -> ShowS
[PoolInfo] -> ShowS
PoolInfo -> String
(Int -> PoolInfo -> ShowS)
-> (PoolInfo -> String) -> ([PoolInfo] -> ShowS) -> Show PoolInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolInfo -> ShowS
showsPrec :: Int -> PoolInfo -> ShowS
$cshow :: PoolInfo -> String
show :: PoolInfo -> String
$cshowList :: [PoolInfo] -> ShowS
showList :: [PoolInfo] -> ShowS
Show, PoolInfo -> PoolInfo -> Bool
(PoolInfo -> PoolInfo -> Bool)
-> (PoolInfo -> PoolInfo -> Bool) -> Eq PoolInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolInfo -> PoolInfo -> Bool
== :: PoolInfo -> PoolInfo -> Bool
$c/= :: PoolInfo -> PoolInfo -> Bool
/= :: PoolInfo -> PoolInfo -> Bool
Eq, (forall x. PoolInfo -> Rep PoolInfo x)
-> (forall x. Rep PoolInfo x -> PoolInfo) -> Generic PoolInfo
forall x. Rep PoolInfo x -> PoolInfo
forall x. PoolInfo -> Rep PoolInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolInfo -> Rep PoolInfo x
from :: forall x. PoolInfo -> Rep PoolInfo x
$cto :: forall x. Rep PoolInfo x -> PoolInfo
to :: forall x. Rep PoolInfo x -> PoolInfo
Generic)
deriving (Maybe PoolInfo
Value -> Parser [PoolInfo]
Value -> Parser PoolInfo
(Value -> Parser PoolInfo)
-> (Value -> Parser [PoolInfo])
-> Maybe PoolInfo
-> FromJSON PoolInfo
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolInfo
parseJSON :: Value -> Parser PoolInfo
$cparseJSONList :: Value -> Parser [PoolInfo]
parseJSONList :: Value -> Parser [PoolInfo]
$comittedField :: Maybe PoolInfo
omittedField :: Maybe PoolInfo
FromJSON, [PoolInfo] -> Value
[PoolInfo] -> Encoding
PoolInfo -> Bool
PoolInfo -> Value
PoolInfo -> Encoding
(PoolInfo -> Value)
-> (PoolInfo -> Encoding)
-> ([PoolInfo] -> Value)
-> ([PoolInfo] -> Encoding)
-> (PoolInfo -> Bool)
-> ToJSON PoolInfo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolInfo -> Value
toJSON :: PoolInfo -> Value
$ctoEncoding :: PoolInfo -> Encoding
toEncoding :: PoolInfo -> Encoding
$ctoJSONList :: [PoolInfo] -> Value
toJSONList :: [PoolInfo] -> Value
$ctoEncodingList :: [PoolInfo] -> Encoding
toEncodingList :: [PoolInfo] -> Encoding
$comitField :: PoolInfo -> Bool
omitField :: PoolInfo -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolInfo", CamelToSnake]] PoolInfo
instance ToSample PoolInfo where
toSamples :: Proxy PoolInfo -> [(Text, PoolInfo)]
toSamples = [(Text, PoolInfo)] -> Proxy PoolInfo -> [(Text, PoolInfo)]
forall a. a -> Proxy PoolInfo -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolInfo)] -> Proxy PoolInfo -> [(Text, PoolInfo)])
-> [(Text, PoolInfo)] -> Proxy PoolInfo -> [(Text, PoolInfo)]
forall a b. (a -> b) -> a -> b
$ PoolInfo -> [(Text, PoolInfo)]
forall a. a -> [(Text, a)]
singleSample
PoolInfo
{ _poolInfoPoolId :: PoolId
_poolInfoPoolId = PoolId
"pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
, _poolInfoHex :: Text
_poolInfoHex = Text
"0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735"
, _poolInfoVrfKey :: Text
_poolInfoVrfKey = Text
"0b5245f9934ec2151116fb8ec00f35fd00e0aa3b075c4ed12cce440f999d8233"
, _poolInfoBlocksMinted :: Integer
_poolInfoBlocksMinted = Integer
69
, _poolInfoBlocksEpoch :: Integer
_poolInfoBlocksEpoch = Integer
4
, _poolInfoLiveStake :: Lovelaces
_poolInfoLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
6900000000
, _poolInfoLiveSize :: Double
_poolInfoLiveSize = Double
0.42
, _poolInfoLiveSaturation :: Double
_poolInfoLiveSaturation = Double
0.93
, _poolInfoLiveDelegators :: Double
_poolInfoLiveDelegators = Double
127
, _poolInfoActiveStake :: Lovelaces
_poolInfoActiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
4200000000
, _poolInfoActiveSize :: Double
_poolInfoActiveSize = Double
0.43
, _poolInfoDeclaredPledge :: Lovelaces
_poolInfoDeclaredPledge = Discrete' "ADA" '(1000000, 1)
Lovelaces
5000000000
, _poolInfoLivePledge :: Lovelaces
_poolInfoLivePledge = Discrete' "ADA" '(1000000, 1)
Lovelaces
5000000001
, _poolInfoMarginCost :: Rational
_poolInfoMarginCost = Rational
0.05
, _poolInfoFixedCost :: Lovelaces
_poolInfoFixedCost = Discrete' "ADA" '(1000000, 1)
Lovelaces
340000000
, _poolInfoRewardAccount :: Address
_poolInfoRewardAccount = Address
"stake1uxkptsa4lkr55jleztw43t37vgdn88l6ghclfwuxld2eykgpgvg3f"
, _poolInfoOwners :: [Address]
_poolInfoOwners = [ Address
"stake1u98nnlkvkk23vtvf9273uq7cph5ww6u2yq2389psuqet90sv4xv9v" ]
, _poolInfoRegistration :: [Text]
_poolInfoRegistration =
[ Text
"9f83e5484f543e05b52e99988272a31da373f3aab4c064c76db96643a355d9dc"
, Text
"7ce3b8c433bf401a190d58c8c483d8e3564dfd29ae8633c8b1b3e6c814403e95"
, Text
"3e6e1200ce92977c3fe5996bd4d7d7e192bcb7e231bc762f9f240c76766535b9"
]
, _poolInfoRetirement :: [Text]
_poolInfoRetirement = [ Text
"252f622976d39e646815db75a77289cf16df4ad2b287dd8e3a889ce14c13d1a8" ]
}
data PoolHistory = PoolHistory
{ PoolHistory -> Epoch
_poolHistoryEpoch :: Epoch
, PoolHistory -> Integer
_poolHistoryBlocks :: Integer
, PoolHistory -> Lovelaces
_poolHistoryActiveStake :: Lovelaces
, PoolHistory -> Double
_poolHistoryActiveSize :: Double
, PoolHistory -> Integer
_poolHistoryDelegatorsCount :: Integer
, PoolHistory -> Lovelaces
_poolHistoryRewards :: Lovelaces
, PoolHistory -> Lovelaces
_poolHistoryFees :: Lovelaces
}
deriving stock (Int -> PoolHistory -> ShowS
[PoolHistory] -> ShowS
PoolHistory -> String
(Int -> PoolHistory -> ShowS)
-> (PoolHistory -> String)
-> ([PoolHistory] -> ShowS)
-> Show PoolHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolHistory -> ShowS
showsPrec :: Int -> PoolHistory -> ShowS
$cshow :: PoolHistory -> String
show :: PoolHistory -> String
$cshowList :: [PoolHistory] -> ShowS
showList :: [PoolHistory] -> ShowS
Show, PoolHistory -> PoolHistory -> Bool
(PoolHistory -> PoolHistory -> Bool)
-> (PoolHistory -> PoolHistory -> Bool) -> Eq PoolHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolHistory -> PoolHistory -> Bool
== :: PoolHistory -> PoolHistory -> Bool
$c/= :: PoolHistory -> PoolHistory -> Bool
/= :: PoolHistory -> PoolHistory -> Bool
Eq, (forall x. PoolHistory -> Rep PoolHistory x)
-> (forall x. Rep PoolHistory x -> PoolHistory)
-> Generic PoolHistory
forall x. Rep PoolHistory x -> PoolHistory
forall x. PoolHistory -> Rep PoolHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolHistory -> Rep PoolHistory x
from :: forall x. PoolHistory -> Rep PoolHistory x
$cto :: forall x. Rep PoolHistory x -> PoolHistory
to :: forall x. Rep PoolHistory x -> PoolHistory
Generic)
deriving (Maybe PoolHistory
Value -> Parser [PoolHistory]
Value -> Parser PoolHistory
(Value -> Parser PoolHistory)
-> (Value -> Parser [PoolHistory])
-> Maybe PoolHistory
-> FromJSON PoolHistory
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolHistory
parseJSON :: Value -> Parser PoolHistory
$cparseJSONList :: Value -> Parser [PoolHistory]
parseJSONList :: Value -> Parser [PoolHistory]
$comittedField :: Maybe PoolHistory
omittedField :: Maybe PoolHistory
FromJSON, [PoolHistory] -> Value
[PoolHistory] -> Encoding
PoolHistory -> Bool
PoolHistory -> Value
PoolHistory -> Encoding
(PoolHistory -> Value)
-> (PoolHistory -> Encoding)
-> ([PoolHistory] -> Value)
-> ([PoolHistory] -> Encoding)
-> (PoolHistory -> Bool)
-> ToJSON PoolHistory
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolHistory -> Value
toJSON :: PoolHistory -> Value
$ctoEncoding :: PoolHistory -> Encoding
toEncoding :: PoolHistory -> Encoding
$ctoJSONList :: [PoolHistory] -> Value
toJSONList :: [PoolHistory] -> Value
$ctoEncodingList :: [PoolHistory] -> Encoding
toEncodingList :: [PoolHistory] -> Encoding
$comitField :: PoolHistory -> Bool
omitField :: PoolHistory -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolHistory", CamelToSnake]] PoolHistory
instance ToSample PoolHistory where
toSamples :: Proxy PoolHistory -> [(Text, PoolHistory)]
toSamples = [(Text, PoolHistory)] -> Proxy PoolHistory -> [(Text, PoolHistory)]
forall a. a -> Proxy PoolHistory -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolHistory)]
-> Proxy PoolHistory -> [(Text, PoolHistory)])
-> [(Text, PoolHistory)]
-> Proxy PoolHistory
-> [(Text, PoolHistory)]
forall a b. (a -> b) -> a -> b
$ PoolHistory -> [(Text, PoolHistory)]
forall a. a -> [(Text, a)]
singleSample
PoolHistory
{ _poolHistoryEpoch :: Epoch
_poolHistoryEpoch = Epoch
233
, _poolHistoryBlocks :: Integer
_poolHistoryBlocks = Integer
22
, _poolHistoryActiveStake :: Lovelaces
_poolHistoryActiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
20485965693569
, _poolHistoryActiveSize :: Double
_poolHistoryActiveSize = Double
1.2345
, _poolHistoryDelegatorsCount :: Integer
_poolHistoryDelegatorsCount = Integer
115
, _poolHistoryRewards :: Lovelaces
_poolHistoryRewards = Discrete' "ADA" '(1000000, 1)
Lovelaces
206936253674159
, _poolHistoryFees :: Lovelaces
_poolHistoryFees = Discrete' "ADA" '(1000000, 1)
Lovelaces
1290968354
}
data PoolMetadata = PoolMetadata
{ PoolMetadata -> PoolId
_poolMetadataPoolId :: PoolId
, PoolMetadata -> Text
_poolMetadataHex :: Text
, PoolMetadata -> Maybe Text
_poolMetadataUrl :: Maybe Text
, PoolMetadata -> Maybe Text
_poolMetadataHash :: Maybe Text
, PoolMetadata -> Maybe Text
_poolMetadataTicker :: Maybe Text
, PoolMetadata -> Maybe Text
_poolMetadataName :: Maybe Text
, PoolMetadata -> Maybe Text
_poolMetadataDescription :: Maybe Text
, PoolMetadata -> Maybe Text
_poolMetadataHomepage :: Maybe Text
}
deriving stock (Int -> PoolMetadata -> ShowS
[PoolMetadata] -> ShowS
PoolMetadata -> String
(Int -> PoolMetadata -> ShowS)
-> (PoolMetadata -> String)
-> ([PoolMetadata] -> ShowS)
-> Show PoolMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolMetadata -> ShowS
showsPrec :: Int -> PoolMetadata -> ShowS
$cshow :: PoolMetadata -> String
show :: PoolMetadata -> String
$cshowList :: [PoolMetadata] -> ShowS
showList :: [PoolMetadata] -> ShowS
Show, PoolMetadata -> PoolMetadata -> Bool
(PoolMetadata -> PoolMetadata -> Bool)
-> (PoolMetadata -> PoolMetadata -> Bool) -> Eq PoolMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolMetadata -> PoolMetadata -> Bool
== :: PoolMetadata -> PoolMetadata -> Bool
$c/= :: PoolMetadata -> PoolMetadata -> Bool
/= :: PoolMetadata -> PoolMetadata -> Bool
Eq, (forall x. PoolMetadata -> Rep PoolMetadata x)
-> (forall x. Rep PoolMetadata x -> PoolMetadata)
-> Generic PoolMetadata
forall x. Rep PoolMetadata x -> PoolMetadata
forall x. PoolMetadata -> Rep PoolMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolMetadata -> Rep PoolMetadata x
from :: forall x. PoolMetadata -> Rep PoolMetadata x
$cto :: forall x. Rep PoolMetadata x -> PoolMetadata
to :: forall x. Rep PoolMetadata x -> PoolMetadata
Generic)
deriving (Maybe PoolMetadata
Value -> Parser [PoolMetadata]
Value -> Parser PoolMetadata
(Value -> Parser PoolMetadata)
-> (Value -> Parser [PoolMetadata])
-> Maybe PoolMetadata
-> FromJSON PoolMetadata
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolMetadata
parseJSON :: Value -> Parser PoolMetadata
$cparseJSONList :: Value -> Parser [PoolMetadata]
parseJSONList :: Value -> Parser [PoolMetadata]
$comittedField :: Maybe PoolMetadata
omittedField :: Maybe PoolMetadata
FromJSON, [PoolMetadata] -> Value
[PoolMetadata] -> Encoding
PoolMetadata -> Bool
PoolMetadata -> Value
PoolMetadata -> Encoding
(PoolMetadata -> Value)
-> (PoolMetadata -> Encoding)
-> ([PoolMetadata] -> Value)
-> ([PoolMetadata] -> Encoding)
-> (PoolMetadata -> Bool)
-> ToJSON PoolMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolMetadata -> Value
toJSON :: PoolMetadata -> Value
$ctoEncoding :: PoolMetadata -> Encoding
toEncoding :: PoolMetadata -> Encoding
$ctoJSONList :: [PoolMetadata] -> Value
toJSONList :: [PoolMetadata] -> Value
$ctoEncodingList :: [PoolMetadata] -> Encoding
toEncodingList :: [PoolMetadata] -> Encoding
$comitField :: PoolMetadata -> Bool
omitField :: PoolMetadata -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolMetadata", CamelToSnake]] PoolMetadata
instance {-# OVERLAPS #-} ToJSON (Maybe PoolMetadata) where
toJSON :: Maybe PoolMetadata -> Value
toJSON Maybe PoolMetadata
Nothing = [Pair] -> Value
object [Pair]
forall a. Monoid a => a
mempty
toJSON (Just PoolMetadata
pm) = PoolMetadata -> Value
forall a. ToJSON a => a -> Value
toJSON PoolMetadata
pm
toEncoding :: Maybe PoolMetadata -> Encoding
toEncoding Maybe PoolMetadata
Nothing = Series -> Encoding
pairs Series
forall a. Monoid a => a
mempty
toEncoding (Just PoolMetadata
pm) = PoolMetadata -> Encoding
forall a. ToJSON a => a -> Encoding
toEncoding PoolMetadata
pm
instance {-# OVERLAPS #-} FromJSON (Maybe PoolMetadata) where
parseJSON :: Value -> Parser (Maybe PoolMetadata)
parseJSON Value
x | Value
x Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
== [Pair] -> Value
object [] = Maybe PoolMetadata -> Parser (Maybe PoolMetadata)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe PoolMetadata
forall a. Maybe a
Nothing
parseJSON Value
x = PoolMetadata -> Maybe PoolMetadata
forall a. a -> Maybe a
Just (PoolMetadata -> Maybe PoolMetadata)
-> Parser PoolMetadata -> Parser (Maybe PoolMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser PoolMetadata
forall a. FromJSON a => Value -> Parser a
parseJSON Value
x
instance ToSample PoolMetadata where
toSamples :: Proxy PoolMetadata -> [(Text, PoolMetadata)]
toSamples = [(Text, PoolMetadata)]
-> Proxy PoolMetadata -> [(Text, PoolMetadata)]
forall a. a -> Proxy PoolMetadata -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolMetadata)]
-> Proxy PoolMetadata -> [(Text, PoolMetadata)])
-> [(Text, PoolMetadata)]
-> Proxy PoolMetadata
-> [(Text, PoolMetadata)]
forall a b. (a -> b) -> a -> b
$ PoolMetadata -> [(Text, PoolMetadata)]
forall a. a -> [(Text, a)]
singleSample PoolMetadata
samplePoolMetadata
samplePoolMetadata :: PoolMetadata
samplePoolMetadata :: PoolMetadata
samplePoolMetadata =
PoolMetadata
{ _poolMetadataPoolId :: PoolId
_poolMetadataPoolId = PoolId
"pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
, _poolMetadataHex :: Text
_poolMetadataHex = Text
"0f292fcaa02b8b2f9b3c8f9fd8e0bb21abedb692a6d5058df3ef2735"
, _poolMetadataUrl :: Maybe Text
_poolMetadataUrl = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"https://stakenuts.com/mainnet.json"
, _poolMetadataHash :: Maybe Text
_poolMetadataHash = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"47c0c68cb57f4a5b4a87bad896fc274678e7aea98e200fa14a1cb40c0cab1d8c"
, _poolMetadataTicker :: Maybe Text
_poolMetadataTicker = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"NUTS"
, _poolMetadataName :: Maybe Text
_poolMetadataName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"Stake Nuts"
, _poolMetadataDescription :: Maybe Text
_poolMetadataDescription = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"The best pool ever"
, _poolMetadataHomepage :: Maybe Text
_poolMetadataHomepage = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"https://stakentus.com/"
}
data PoolRelay = PoolRelay
{ PoolRelay -> Maybe Text
_poolRelayIpv4 :: Maybe Text
, PoolRelay -> Maybe Text
_poolRelayIpv6 :: Maybe Text
, PoolRelay -> Maybe Text
_poolRelayDns :: Maybe Text
, PoolRelay -> Maybe Text
_poolRelayDnsSrv :: Maybe Text
, PoolRelay -> Integer
_poolRelayPort :: Integer
}
deriving stock (Int -> PoolRelay -> ShowS
[PoolRelay] -> ShowS
PoolRelay -> String
(Int -> PoolRelay -> ShowS)
-> (PoolRelay -> String)
-> ([PoolRelay] -> ShowS)
-> Show PoolRelay
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolRelay -> ShowS
showsPrec :: Int -> PoolRelay -> ShowS
$cshow :: PoolRelay -> String
show :: PoolRelay -> String
$cshowList :: [PoolRelay] -> ShowS
showList :: [PoolRelay] -> ShowS
Show, PoolRelay -> PoolRelay -> Bool
(PoolRelay -> PoolRelay -> Bool)
-> (PoolRelay -> PoolRelay -> Bool) -> Eq PoolRelay
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolRelay -> PoolRelay -> Bool
== :: PoolRelay -> PoolRelay -> Bool
$c/= :: PoolRelay -> PoolRelay -> Bool
/= :: PoolRelay -> PoolRelay -> Bool
Eq, (forall x. PoolRelay -> Rep PoolRelay x)
-> (forall x. Rep PoolRelay x -> PoolRelay) -> Generic PoolRelay
forall x. Rep PoolRelay x -> PoolRelay
forall x. PoolRelay -> Rep PoolRelay x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolRelay -> Rep PoolRelay x
from :: forall x. PoolRelay -> Rep PoolRelay x
$cto :: forall x. Rep PoolRelay x -> PoolRelay
to :: forall x. Rep PoolRelay x -> PoolRelay
Generic)
deriving (Maybe PoolRelay
Value -> Parser [PoolRelay]
Value -> Parser PoolRelay
(Value -> Parser PoolRelay)
-> (Value -> Parser [PoolRelay])
-> Maybe PoolRelay
-> FromJSON PoolRelay
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolRelay
parseJSON :: Value -> Parser PoolRelay
$cparseJSONList :: Value -> Parser [PoolRelay]
parseJSONList :: Value -> Parser [PoolRelay]
$comittedField :: Maybe PoolRelay
omittedField :: Maybe PoolRelay
FromJSON, [PoolRelay] -> Value
[PoolRelay] -> Encoding
PoolRelay -> Bool
PoolRelay -> Value
PoolRelay -> Encoding
(PoolRelay -> Value)
-> (PoolRelay -> Encoding)
-> ([PoolRelay] -> Value)
-> ([PoolRelay] -> Encoding)
-> (PoolRelay -> Bool)
-> ToJSON PoolRelay
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolRelay -> Value
toJSON :: PoolRelay -> Value
$ctoEncoding :: PoolRelay -> Encoding
toEncoding :: PoolRelay -> Encoding
$ctoJSONList :: [PoolRelay] -> Value
toJSONList :: [PoolRelay] -> Value
$ctoEncodingList :: [PoolRelay] -> Encoding
toEncodingList :: [PoolRelay] -> Encoding
$comitField :: PoolRelay -> Bool
omitField :: PoolRelay -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolRelay", CamelToSnake]] PoolRelay
instance ToSample PoolRelay where
toSamples :: Proxy PoolRelay -> [(Text, PoolRelay)]
toSamples = [(Text, PoolRelay)] -> Proxy PoolRelay -> [(Text, PoolRelay)]
forall a. a -> Proxy PoolRelay -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolRelay)] -> Proxy PoolRelay -> [(Text, PoolRelay)])
-> [(Text, PoolRelay)] -> Proxy PoolRelay -> [(Text, PoolRelay)]
forall a b. (a -> b) -> a -> b
$ PoolRelay -> [(Text, PoolRelay)]
forall a. a -> [(Text, a)]
singleSample PoolRelay
samplePoolRelay
samplePoolRelay :: PoolRelay
samplePoolRelay :: PoolRelay
samplePoolRelay =
PoolRelay
{ _poolRelayIpv4 :: Maybe Text
_poolRelayIpv4 = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"4.4.4.4"
, _poolRelayIpv6 :: Maybe Text
_poolRelayIpv6 = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"https://stakenuts.com/mainnet.json"
, _poolRelayDns :: Maybe Text
_poolRelayDns = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"relay1.stakenuts.com"
, _poolRelayDnsSrv :: Maybe Text
_poolRelayDnsSrv = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"_relays._tcp.relays.stakenuts.com"
, _poolRelayPort :: Integer
_poolRelayPort = Integer
3001
}
data PoolDelegator = PoolDelegator
{ PoolDelegator -> Text
_poolDelegatorAddress :: Text
, PoolDelegator -> Lovelaces
_poolDelegatorLiveStake :: Lovelaces
}
deriving stock (Int -> PoolDelegator -> ShowS
[PoolDelegator] -> ShowS
PoolDelegator -> String
(Int -> PoolDelegator -> ShowS)
-> (PoolDelegator -> String)
-> ([PoolDelegator] -> ShowS)
-> Show PoolDelegator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolDelegator -> ShowS
showsPrec :: Int -> PoolDelegator -> ShowS
$cshow :: PoolDelegator -> String
show :: PoolDelegator -> String
$cshowList :: [PoolDelegator] -> ShowS
showList :: [PoolDelegator] -> ShowS
Show, PoolDelegator -> PoolDelegator -> Bool
(PoolDelegator -> PoolDelegator -> Bool)
-> (PoolDelegator -> PoolDelegator -> Bool) -> Eq PoolDelegator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolDelegator -> PoolDelegator -> Bool
== :: PoolDelegator -> PoolDelegator -> Bool
$c/= :: PoolDelegator -> PoolDelegator -> Bool
/= :: PoolDelegator -> PoolDelegator -> Bool
Eq, (forall x. PoolDelegator -> Rep PoolDelegator x)
-> (forall x. Rep PoolDelegator x -> PoolDelegator)
-> Generic PoolDelegator
forall x. Rep PoolDelegator x -> PoolDelegator
forall x. PoolDelegator -> Rep PoolDelegator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolDelegator -> Rep PoolDelegator x
from :: forall x. PoolDelegator -> Rep PoolDelegator x
$cto :: forall x. Rep PoolDelegator x -> PoolDelegator
to :: forall x. Rep PoolDelegator x -> PoolDelegator
Generic)
deriving (Maybe PoolDelegator
Value -> Parser [PoolDelegator]
Value -> Parser PoolDelegator
(Value -> Parser PoolDelegator)
-> (Value -> Parser [PoolDelegator])
-> Maybe PoolDelegator
-> FromJSON PoolDelegator
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolDelegator
parseJSON :: Value -> Parser PoolDelegator
$cparseJSONList :: Value -> Parser [PoolDelegator]
parseJSONList :: Value -> Parser [PoolDelegator]
$comittedField :: Maybe PoolDelegator
omittedField :: Maybe PoolDelegator
FromJSON, [PoolDelegator] -> Value
[PoolDelegator] -> Encoding
PoolDelegator -> Bool
PoolDelegator -> Value
PoolDelegator -> Encoding
(PoolDelegator -> Value)
-> (PoolDelegator -> Encoding)
-> ([PoolDelegator] -> Value)
-> ([PoolDelegator] -> Encoding)
-> (PoolDelegator -> Bool)
-> ToJSON PoolDelegator
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolDelegator -> Value
toJSON :: PoolDelegator -> Value
$ctoEncoding :: PoolDelegator -> Encoding
toEncoding :: PoolDelegator -> Encoding
$ctoJSONList :: [PoolDelegator] -> Value
toJSONList :: [PoolDelegator] -> Value
$ctoEncodingList :: [PoolDelegator] -> Encoding
toEncodingList :: [PoolDelegator] -> Encoding
$comitField :: PoolDelegator -> Bool
omitField :: PoolDelegator -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolDelegator", CamelToSnake]] PoolDelegator
instance ToSample PoolDelegator where
toSamples :: Proxy PoolDelegator -> [(Text, PoolDelegator)]
toSamples = [(Text, PoolDelegator)]
-> Proxy PoolDelegator -> [(Text, PoolDelegator)]
forall a. a -> Proxy PoolDelegator -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolDelegator)]
-> Proxy PoolDelegator -> [(Text, PoolDelegator)])
-> [(Text, PoolDelegator)]
-> Proxy PoolDelegator
-> [(Text, PoolDelegator)]
forall a b. (a -> b) -> a -> b
$ [PoolDelegator] -> [(Text, PoolDelegator)]
forall a. [a] -> [(Text, a)]
samples
[ PoolDelegator
{ _poolDelegatorAddress :: Text
_poolDelegatorAddress = Text
"stake1ux4vspfvwuus9uwyp5p3f0ky7a30jq5j80jxse0fr7pa56sgn8kha"
, _poolDelegatorLiveStake :: Lovelaces
_poolDelegatorLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
1137959159981411
}
, PoolDelegator
{ _poolDelegatorAddress :: Text
_poolDelegatorAddress = Text
"stake1uylayej7esmarzd4mk4aru37zh9yz0luj3g9fsvgpfaxulq564r5u"
, _poolDelegatorLiveStake :: Lovelaces
_poolDelegatorLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
16958865648
}
, PoolDelegator
{ _poolDelegatorAddress :: Text
_poolDelegatorAddress = Text
"stake1u8lr2pnrgf8f7vrs9lt79hc3sxm8s2w4rwvgpncks3axx6q93d4ck"
, _poolDelegatorLiveStake :: Lovelaces
_poolDelegatorLiveStake = Discrete' "ADA" '(1000000, 1)
Lovelaces
18605647
}
]
data PoolRegistrationAction = PoolRegistered | PoolDeregistered
deriving stock (Int -> PoolRegistrationAction -> ShowS
[PoolRegistrationAction] -> ShowS
PoolRegistrationAction -> String
(Int -> PoolRegistrationAction -> ShowS)
-> (PoolRegistrationAction -> String)
-> ([PoolRegistrationAction] -> ShowS)
-> Show PoolRegistrationAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolRegistrationAction -> ShowS
showsPrec :: Int -> PoolRegistrationAction -> ShowS
$cshow :: PoolRegistrationAction -> String
show :: PoolRegistrationAction -> String
$cshowList :: [PoolRegistrationAction] -> ShowS
showList :: [PoolRegistrationAction] -> ShowS
Show, PoolRegistrationAction -> PoolRegistrationAction -> Bool
(PoolRegistrationAction -> PoolRegistrationAction -> Bool)
-> (PoolRegistrationAction -> PoolRegistrationAction -> Bool)
-> Eq PoolRegistrationAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolRegistrationAction -> PoolRegistrationAction -> Bool
== :: PoolRegistrationAction -> PoolRegistrationAction -> Bool
$c/= :: PoolRegistrationAction -> PoolRegistrationAction -> Bool
/= :: PoolRegistrationAction -> PoolRegistrationAction -> Bool
Eq, (forall x. PoolRegistrationAction -> Rep PoolRegistrationAction x)
-> (forall x.
Rep PoolRegistrationAction x -> PoolRegistrationAction)
-> Generic PoolRegistrationAction
forall x. Rep PoolRegistrationAction x -> PoolRegistrationAction
forall x. PoolRegistrationAction -> Rep PoolRegistrationAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolRegistrationAction -> Rep PoolRegistrationAction x
from :: forall x. PoolRegistrationAction -> Rep PoolRegistrationAction x
$cto :: forall x. Rep PoolRegistrationAction x -> PoolRegistrationAction
to :: forall x. Rep PoolRegistrationAction x -> PoolRegistrationAction
Generic)
instance ToJSON PoolRegistrationAction where
toJSON :: PoolRegistrationAction -> Value
toJSON PoolRegistrationAction
PoolRegistered = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text
"registered" :: Text)
toJSON PoolRegistrationAction
PoolDeregistered = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text
"deregistered" :: Text)
toEncoding :: PoolRegistrationAction -> Encoding
toEncoding PoolRegistrationAction
PoolRegistered = Text -> Encoding
forall a. ToJSON a => a -> Encoding
toEncoding (Text
"registered" :: Text)
toEncoding PoolRegistrationAction
PoolDeregistered = Text -> Encoding
forall a. ToJSON a => a -> Encoding
toEncoding (Text
"deregistered" :: Text)
instance FromJSON PoolRegistrationAction where
parseJSON :: Value -> Parser PoolRegistrationAction
parseJSON = String
-> (Text -> Parser PoolRegistrationAction)
-> Value
-> Parser PoolRegistrationAction
forall a. String -> (Text -> Parser a) -> Value -> Parser a
withText String
"action" ((Text -> Parser PoolRegistrationAction)
-> Value -> Parser PoolRegistrationAction)
-> (Text -> Parser PoolRegistrationAction)
-> Value
-> Parser PoolRegistrationAction
forall a b. (a -> b) -> a -> b
$ \case
Text
"registered" -> PoolRegistrationAction -> Parser PoolRegistrationAction
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PoolRegistrationAction
PoolRegistered
Text
"deregistered" -> PoolRegistrationAction -> Parser PoolRegistrationAction
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PoolRegistrationAction
PoolDeregistered
Text
x -> String -> Parser PoolRegistrationAction
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"Expected registration action got " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
forall a. Show a => a -> String
show Text
x)
instance ToSample PoolRegistrationAction where
toSamples :: Proxy PoolRegistrationAction -> [(Text, PoolRegistrationAction)]
toSamples = [(Text, PoolRegistrationAction)]
-> Proxy PoolRegistrationAction -> [(Text, PoolRegistrationAction)]
forall a. a -> Proxy PoolRegistrationAction -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolRegistrationAction)]
-> Proxy PoolRegistrationAction
-> [(Text, PoolRegistrationAction)])
-> [(Text, PoolRegistrationAction)]
-> Proxy PoolRegistrationAction
-> [(Text, PoolRegistrationAction)]
forall a b. (a -> b) -> a -> b
$ [PoolRegistrationAction] -> [(Text, PoolRegistrationAction)]
forall a. [a] -> [(Text, a)]
samples [ PoolRegistrationAction
PoolRegistered, PoolRegistrationAction
PoolDeregistered ]
data PoolUpdate = PoolUpdate
{ PoolUpdate -> TxHash
_poolUpdateTxHash :: TxHash
, PoolUpdate -> Integer
_poolUpdateCertIndex :: Integer
, PoolUpdate -> PoolRegistrationAction
_poolUpdateAction :: PoolRegistrationAction
}
deriving stock (Int -> PoolUpdate -> ShowS
[PoolUpdate] -> ShowS
PoolUpdate -> String
(Int -> PoolUpdate -> ShowS)
-> (PoolUpdate -> String)
-> ([PoolUpdate] -> ShowS)
-> Show PoolUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PoolUpdate -> ShowS
showsPrec :: Int -> PoolUpdate -> ShowS
$cshow :: PoolUpdate -> String
show :: PoolUpdate -> String
$cshowList :: [PoolUpdate] -> ShowS
showList :: [PoolUpdate] -> ShowS
Show, PoolUpdate -> PoolUpdate -> Bool
(PoolUpdate -> PoolUpdate -> Bool)
-> (PoolUpdate -> PoolUpdate -> Bool) -> Eq PoolUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PoolUpdate -> PoolUpdate -> Bool
== :: PoolUpdate -> PoolUpdate -> Bool
$c/= :: PoolUpdate -> PoolUpdate -> Bool
/= :: PoolUpdate -> PoolUpdate -> Bool
Eq, (forall x. PoolUpdate -> Rep PoolUpdate x)
-> (forall x. Rep PoolUpdate x -> PoolUpdate) -> Generic PoolUpdate
forall x. Rep PoolUpdate x -> PoolUpdate
forall x. PoolUpdate -> Rep PoolUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PoolUpdate -> Rep PoolUpdate x
from :: forall x. PoolUpdate -> Rep PoolUpdate x
$cto :: forall x. Rep PoolUpdate x -> PoolUpdate
to :: forall x. Rep PoolUpdate x -> PoolUpdate
Generic)
deriving (Maybe PoolUpdate
Value -> Parser [PoolUpdate]
Value -> Parser PoolUpdate
(Value -> Parser PoolUpdate)
-> (Value -> Parser [PoolUpdate])
-> Maybe PoolUpdate
-> FromJSON PoolUpdate
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PoolUpdate
parseJSON :: Value -> Parser PoolUpdate
$cparseJSONList :: Value -> Parser [PoolUpdate]
parseJSONList :: Value -> Parser [PoolUpdate]
$comittedField :: Maybe PoolUpdate
omittedField :: Maybe PoolUpdate
FromJSON, [PoolUpdate] -> Value
[PoolUpdate] -> Encoding
PoolUpdate -> Bool
PoolUpdate -> Value
PoolUpdate -> Encoding
(PoolUpdate -> Value)
-> (PoolUpdate -> Encoding)
-> ([PoolUpdate] -> Value)
-> ([PoolUpdate] -> Encoding)
-> (PoolUpdate -> Bool)
-> ToJSON PoolUpdate
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PoolUpdate -> Value
toJSON :: PoolUpdate -> Value
$ctoEncoding :: PoolUpdate -> Encoding
toEncoding :: PoolUpdate -> Encoding
$ctoJSONList :: [PoolUpdate] -> Value
toJSONList :: [PoolUpdate] -> Value
$ctoEncodingList :: [PoolUpdate] -> Encoding
toEncodingList :: [PoolUpdate] -> Encoding
$comitField :: PoolUpdate -> Bool
omitField :: PoolUpdate -> Bool
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_poolUpdate", CamelToSnake]] PoolUpdate
instance ToSample PoolUpdate where
toSamples :: Proxy PoolUpdate -> [(Text, PoolUpdate)]
toSamples = [(Text, PoolUpdate)] -> Proxy PoolUpdate -> [(Text, PoolUpdate)]
forall a. a -> Proxy PoolUpdate -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, PoolUpdate)] -> Proxy PoolUpdate -> [(Text, PoolUpdate)])
-> [(Text, PoolUpdate)] -> Proxy PoolUpdate -> [(Text, PoolUpdate)]
forall a b. (a -> b) -> a -> b
$ [PoolUpdate] -> [(Text, PoolUpdate)]
forall a. [a] -> [(Text, a)]
samples
[ PoolUpdate
{ _poolUpdateTxHash :: TxHash
_poolUpdateTxHash = TxHash
"6804edf9712d2b619edb6ac86861fe93a730693183a262b165fcc1ba1bc99cad"
, _poolUpdateCertIndex :: Integer
_poolUpdateCertIndex = Integer
0
, _poolUpdateAction :: PoolRegistrationAction
_poolUpdateAction = PoolRegistrationAction
PoolRegistered
}
, PoolUpdate
{ _poolUpdateTxHash :: TxHash
_poolUpdateTxHash = TxHash
"9c190bc1ac88b2ab0c05a82d7de8b71b67a9316377e865748a89d4426c0d3005"
, _poolUpdateCertIndex :: Integer
_poolUpdateCertIndex = Integer
0
, _poolUpdateAction :: PoolRegistrationAction
_poolUpdateAction = PoolRegistrationAction
PoolDeregistered
}
, PoolUpdate
{ _poolUpdateTxHash :: TxHash
_poolUpdateTxHash = TxHash
"e14a75b0eb2625de7055f1f580d70426311b78e0d36dd695a6bdc96c7b3d80e0"
, _poolUpdateCertIndex :: Integer
_poolUpdateCertIndex = Integer
1
, _poolUpdateAction :: PoolRegistrationAction
_poolUpdateAction = PoolRegistrationAction
PoolRegistered
}
]