{-# LANGUAGE NumericUnderscores #-}
module Blockfrost.Types.Cardano.Network
( Network (..)
, NetworkStake (..)
, NetworkSupply (..)
, NetworkEraSummary (..)
, NetworkEraBound (..)
, NetworkEraParameters (..)
) where
import Data.Time (NominalDiffTime)
import Data.Word (Word64)
import Deriving.Aeson
import Servant.Docs (ToSample (..), samples, singleSample)
import Blockfrost.Types.Shared
data NetworkSupply = NetworkSupply
{ NetworkSupply -> Lovelaces
_supplyMax :: Lovelaces
, NetworkSupply -> Lovelaces
_supplyTotal :: Lovelaces
, NetworkSupply -> Lovelaces
_supplyCirculating :: Lovelaces
, NetworkSupply -> Lovelaces
_supplyLocked :: Lovelaces
, NetworkSupply -> Lovelaces
_supplyTreasury :: Lovelaces
, NetworkSupply -> Lovelaces
_supplyReserves :: Lovelaces
}
deriving stock (Int -> NetworkSupply -> ShowS
[NetworkSupply] -> ShowS
NetworkSupply -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkSupply] -> ShowS
$cshowList :: [NetworkSupply] -> ShowS
show :: NetworkSupply -> String
$cshow :: NetworkSupply -> String
showsPrec :: Int -> NetworkSupply -> ShowS
$cshowsPrec :: Int -> NetworkSupply -> ShowS
Show, NetworkSupply -> NetworkSupply -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkSupply -> NetworkSupply -> Bool
$c/= :: NetworkSupply -> NetworkSupply -> Bool
== :: NetworkSupply -> NetworkSupply -> Bool
$c== :: NetworkSupply -> NetworkSupply -> Bool
Eq, forall x. Rep NetworkSupply x -> NetworkSupply
forall x. NetworkSupply -> Rep NetworkSupply x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkSupply x -> NetworkSupply
$cfrom :: forall x. NetworkSupply -> Rep NetworkSupply x
Generic)
deriving (Value -> Parser [NetworkSupply]
Value -> Parser NetworkSupply
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [NetworkSupply]
$cparseJSONList :: Value -> Parser [NetworkSupply]
parseJSON :: Value -> Parser NetworkSupply
$cparseJSON :: Value -> Parser NetworkSupply
FromJSON, [NetworkSupply] -> Encoding
[NetworkSupply] -> Value
NetworkSupply -> Encoding
NetworkSupply -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [NetworkSupply] -> Encoding
$ctoEncodingList :: [NetworkSupply] -> Encoding
toJSONList :: [NetworkSupply] -> Value
$ctoJSONList :: [NetworkSupply] -> Value
toEncoding :: NetworkSupply -> Encoding
$ctoEncoding :: NetworkSupply -> Encoding
toJSON :: NetworkSupply -> Value
$ctoJSON :: NetworkSupply -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_supply", CamelToSnake]] NetworkSupply
netSupplySample :: NetworkSupply
netSupplySample :: NetworkSupply
netSupplySample =
NetworkSupply
{ _supplyMax :: Lovelaces
_supplyMax = Discrete' "ADA" '(1000000, 1)
45_000_000_000_000_000
, _supplyTotal :: Lovelaces
_supplyTotal = Discrete' "ADA" '(1000000, 1)
32_890_715_183_299_160
, _supplyCirculating :: Lovelaces
_supplyCirculating = Discrete' "ADA" '(1000000, 1)
32_412_601_976_210_393
, _supplyLocked :: Lovelaces
_supplyLocked = Discrete' "ADA" '(1000000, 1)
125_006_953_355
, _supplyTreasury :: Lovelaces
_supplyTreasury = Discrete' "ADA" '(1000000, 1)
98_635_632_000_000
, _supplyReserves :: Lovelaces
_supplyReserves = Discrete' "ADA" '(1000000, 1)
46_635_632_000_000
}
instance ToSample NetworkSupply where
toSamples :: Proxy NetworkSupply -> [(Text, NetworkSupply)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample NetworkSupply
netSupplySample
data NetworkStake = NetworkStake
{ NetworkStake -> Lovelaces
_stakeLive :: Lovelaces
, NetworkStake -> Lovelaces
_stakeActive :: Lovelaces
}
deriving stock (Int -> NetworkStake -> ShowS
[NetworkStake] -> ShowS
NetworkStake -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkStake] -> ShowS
$cshowList :: [NetworkStake] -> ShowS
show :: NetworkStake -> String
$cshow :: NetworkStake -> String
showsPrec :: Int -> NetworkStake -> ShowS
$cshowsPrec :: Int -> NetworkStake -> ShowS
Show, NetworkStake -> NetworkStake -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkStake -> NetworkStake -> Bool
$c/= :: NetworkStake -> NetworkStake -> Bool
== :: NetworkStake -> NetworkStake -> Bool
$c== :: NetworkStake -> NetworkStake -> Bool
Eq, forall x. Rep NetworkStake x -> NetworkStake
forall x. NetworkStake -> Rep NetworkStake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkStake x -> NetworkStake
$cfrom :: forall x. NetworkStake -> Rep NetworkStake x
Generic)
deriving (Value -> Parser [NetworkStake]
Value -> Parser NetworkStake
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [NetworkStake]
$cparseJSONList :: Value -> Parser [NetworkStake]
parseJSON :: Value -> Parser NetworkStake
$cparseJSON :: Value -> Parser NetworkStake
FromJSON, [NetworkStake] -> Encoding
[NetworkStake] -> Value
NetworkStake -> Encoding
NetworkStake -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [NetworkStake] -> Encoding
$ctoEncodingList :: [NetworkStake] -> Encoding
toJSONList :: [NetworkStake] -> Value
$ctoJSONList :: [NetworkStake] -> Value
toEncoding :: NetworkStake -> Encoding
$ctoEncoding :: NetworkStake -> Encoding
toJSON :: NetworkStake -> Value
$ctoJSON :: NetworkStake -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_stake", CamelToSnake]] NetworkStake
netStakeSample :: NetworkStake
netStakeSample :: NetworkStake
netStakeSample =
NetworkStake
{ _stakeLive :: Lovelaces
_stakeLive = Discrete' "ADA" '(1000000, 1)
23_204_950_463_991_654
, _stakeActive :: Lovelaces
_stakeActive = Discrete' "ADA" '(1000000, 1)
22_210_233_523_456_321
}
instance ToSample NetworkStake where
toSamples :: Proxy NetworkStake -> [(Text, NetworkStake)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample NetworkStake
netStakeSample
data Network = Network
{ Network -> NetworkSupply
_networkSupply :: NetworkSupply
, Network -> NetworkStake
_networkStake :: NetworkStake
}
deriving stock (Int -> Network -> ShowS
[Network] -> ShowS
Network -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Network] -> ShowS
$cshowList :: [Network] -> ShowS
show :: Network -> String
$cshow :: Network -> String
showsPrec :: Int -> Network -> ShowS
$cshowsPrec :: Int -> Network -> ShowS
Show, Network -> Network -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Network -> Network -> Bool
$c/= :: Network -> Network -> Bool
== :: Network -> Network -> Bool
$c== :: Network -> Network -> Bool
Eq, forall x. Rep Network x -> Network
forall x. Network -> Rep Network x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Network x -> Network
$cfrom :: forall x. Network -> Rep Network x
Generic)
deriving (Value -> Parser [Network]
Value -> Parser Network
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Network]
$cparseJSONList :: Value -> Parser [Network]
parseJSON :: Value -> Parser Network
$cparseJSON :: Value -> Parser Network
FromJSON, [Network] -> Encoding
[Network] -> Value
Network -> Encoding
Network -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Network] -> Encoding
$ctoEncodingList :: [Network] -> Encoding
toJSONList :: [Network] -> Value
$ctoJSONList :: [Network] -> Value
toEncoding :: Network -> Encoding
$ctoEncoding :: Network -> Encoding
toJSON :: Network -> Value
$ctoJSON :: Network -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_network", CamelToSnake]] Network
instance ToSample Network where
toSamples :: Proxy Network -> [(Text, Network)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$
NetworkSupply -> NetworkStake -> Network
Network NetworkSupply
netSupplySample NetworkStake
netStakeSample
data NetworkEraBound = NetworkEraBound
{ NetworkEraBound -> Epoch
_boundEpoch :: Epoch,
NetworkEraBound -> Slot
_boundSlot :: Slot,
NetworkEraBound -> NominalDiffTime
_boundTime :: NominalDiffTime
}
deriving stock (Int -> NetworkEraBound -> ShowS
[NetworkEraBound] -> ShowS
NetworkEraBound -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkEraBound] -> ShowS
$cshowList :: [NetworkEraBound] -> ShowS
show :: NetworkEraBound -> String
$cshow :: NetworkEraBound -> String
showsPrec :: Int -> NetworkEraBound -> ShowS
$cshowsPrec :: Int -> NetworkEraBound -> ShowS
Show, NetworkEraBound -> NetworkEraBound -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkEraBound -> NetworkEraBound -> Bool
$c/= :: NetworkEraBound -> NetworkEraBound -> Bool
== :: NetworkEraBound -> NetworkEraBound -> Bool
$c== :: NetworkEraBound -> NetworkEraBound -> Bool
Eq, forall x. Rep NetworkEraBound x -> NetworkEraBound
forall x. NetworkEraBound -> Rep NetworkEraBound x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkEraBound x -> NetworkEraBound
$cfrom :: forall x. NetworkEraBound -> Rep NetworkEraBound x
Generic)
deriving (Value -> Parser [NetworkEraBound]
Value -> Parser NetworkEraBound
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [NetworkEraBound]
$cparseJSONList :: Value -> Parser [NetworkEraBound]
parseJSON :: Value -> Parser NetworkEraBound
$cparseJSON :: Value -> Parser NetworkEraBound
FromJSON, [NetworkEraBound] -> Encoding
[NetworkEraBound] -> Value
NetworkEraBound -> Encoding
NetworkEraBound -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [NetworkEraBound] -> Encoding
$ctoEncodingList :: [NetworkEraBound] -> Encoding
toJSONList :: [NetworkEraBound] -> Value
$ctoJSONList :: [NetworkEraBound] -> Value
toEncoding :: NetworkEraBound -> Encoding
$ctoEncoding :: NetworkEraBound -> Encoding
toJSON :: NetworkEraBound -> Value
$ctoJSON :: NetworkEraBound -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_bound", CamelToSnake]] NetworkEraBound
netEraBoundSample0 :: NetworkEraBound
netEraBoundSample0 :: NetworkEraBound
netEraBoundSample0 =
NetworkEraBound
{ _boundEpoch :: Epoch
_boundEpoch = Epoch
4
, _boundSlot :: Slot
_boundSlot = Slot
86_400
, _boundTime :: NominalDiffTime
_boundTime = NominalDiffTime
1_728_000
}
netEraBoundSample1 :: NetworkEraBound
netEraBoundSample1 :: NetworkEraBound
netEraBoundSample1 =
NetworkEraBound
{ _boundEpoch :: Epoch
_boundEpoch = Epoch
5
, _boundSlot :: Slot
_boundSlot = Slot
518_400
, _boundTime :: NominalDiffTime
_boundTime = NominalDiffTime
2_160_00
}
instance ToSample NetworkEraBound where
toSamples :: Proxy NetworkEraBound -> [(Text, NetworkEraBound)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [(Text, a)]
samples [NetworkEraBound
netEraBoundSample0, NetworkEraBound
netEraBoundSample1]
data NetworkEraParameters = NetworkEraParameters
{ NetworkEraParameters -> EpochLength
_parametersEpochLength :: EpochLength,
:: NominalDiffTime,
:: Word64
}
deriving stock (Int -> NetworkEraParameters -> ShowS
[NetworkEraParameters] -> ShowS
NetworkEraParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkEraParameters] -> ShowS
$cshowList :: [NetworkEraParameters] -> ShowS
show :: NetworkEraParameters -> String
$cshow :: NetworkEraParameters -> String
showsPrec :: Int -> NetworkEraParameters -> ShowS
$cshowsPrec :: Int -> NetworkEraParameters -> ShowS
Show, NetworkEraParameters -> NetworkEraParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkEraParameters -> NetworkEraParameters -> Bool
$c/= :: NetworkEraParameters -> NetworkEraParameters -> Bool
== :: NetworkEraParameters -> NetworkEraParameters -> Bool
$c== :: NetworkEraParameters -> NetworkEraParameters -> Bool
Eq, forall x. Rep NetworkEraParameters x -> NetworkEraParameters
forall x. NetworkEraParameters -> Rep NetworkEraParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkEraParameters x -> NetworkEraParameters
$cfrom :: forall x. NetworkEraParameters -> Rep NetworkEraParameters x
Generic)
deriving (Value -> Parser [NetworkEraParameters]
Value -> Parser NetworkEraParameters
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [NetworkEraParameters]
$cparseJSONList :: Value -> Parser [NetworkEraParameters]
parseJSON :: Value -> Parser NetworkEraParameters
$cparseJSON :: Value -> Parser NetworkEraParameters
FromJSON, [NetworkEraParameters] -> Encoding
[NetworkEraParameters] -> Value
NetworkEraParameters -> Encoding
NetworkEraParameters -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [NetworkEraParameters] -> Encoding
$ctoEncodingList :: [NetworkEraParameters] -> Encoding
toJSONList :: [NetworkEraParameters] -> Value
$ctoJSONList :: [NetworkEraParameters] -> Value
toEncoding :: NetworkEraParameters -> Encoding
$ctoEncoding :: NetworkEraParameters -> Encoding
toJSON :: NetworkEraParameters -> Value
$ctoJSON :: NetworkEraParameters -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_parameters", CamelToSnake]] NetworkEraParameters
netEraParamSample :: NetworkEraParameters
netEraParamSample :: NetworkEraParameters
netEraParamSample =
NetworkEraParameters
{ _parametersEpochLength :: EpochLength
_parametersEpochLength = EpochLength
432_000
, _parametersSlotLength :: NominalDiffTime
_parametersSlotLength = NominalDiffTime
1
, _parametersSafeZone :: Word64
_parametersSafeZone = Word64
129_600
}
instance ToSample NetworkEraParameters where
toSamples :: Proxy NetworkEraParameters -> [(Text, NetworkEraParameters)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample NetworkEraParameters
netEraParamSample
data NetworkEraSummary = NetworkEraSummary
{ NetworkEraSummary -> NetworkEraBound
_networkEraStart :: NetworkEraBound,
NetworkEraSummary -> NetworkEraBound
_networkEraEnd :: NetworkEraBound,
NetworkEraSummary -> NetworkEraParameters
_networkEraParameters :: NetworkEraParameters
}
deriving stock (Int -> NetworkEraSummary -> ShowS
[NetworkEraSummary] -> ShowS
NetworkEraSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkEraSummary] -> ShowS
$cshowList :: [NetworkEraSummary] -> ShowS
show :: NetworkEraSummary -> String
$cshow :: NetworkEraSummary -> String
showsPrec :: Int -> NetworkEraSummary -> ShowS
$cshowsPrec :: Int -> NetworkEraSummary -> ShowS
Show, NetworkEraSummary -> NetworkEraSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkEraSummary -> NetworkEraSummary -> Bool
$c/= :: NetworkEraSummary -> NetworkEraSummary -> Bool
== :: NetworkEraSummary -> NetworkEraSummary -> Bool
$c== :: NetworkEraSummary -> NetworkEraSummary -> Bool
Eq, forall x. Rep NetworkEraSummary x -> NetworkEraSummary
forall x. NetworkEraSummary -> Rep NetworkEraSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkEraSummary x -> NetworkEraSummary
$cfrom :: forall x. NetworkEraSummary -> Rep NetworkEraSummary x
Generic)
deriving (Value -> Parser [NetworkEraSummary]
Value -> Parser NetworkEraSummary
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [NetworkEraSummary]
$cparseJSONList :: Value -> Parser [NetworkEraSummary]
parseJSON :: Value -> Parser NetworkEraSummary
$cparseJSON :: Value -> Parser NetworkEraSummary
FromJSON, [NetworkEraSummary] -> Encoding
[NetworkEraSummary] -> Value
NetworkEraSummary -> Encoding
NetworkEraSummary -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [NetworkEraSummary] -> Encoding
$ctoEncodingList :: [NetworkEraSummary] -> Encoding
toJSONList :: [NetworkEraSummary] -> Value
$ctoJSONList :: [NetworkEraSummary] -> Value
toEncoding :: NetworkEraSummary -> Encoding
$ctoEncoding :: NetworkEraSummary -> Encoding
toJSON :: NetworkEraSummary -> Value
$ctoJSON :: NetworkEraSummary -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_networkEra", CamelToSnake]] NetworkEraSummary
instance ToSample NetworkEraSummary where
toSamples :: Proxy NetworkEraSummary -> [(Text, NetworkEraSummary)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [(Text, a)]
singleSample forall a b. (a -> b) -> a -> b
$
NetworkEraSummary
{ _networkEraStart :: NetworkEraBound
_networkEraStart = NetworkEraBound
netEraBoundSample0
, _networkEraEnd :: NetworkEraBound
_networkEraEnd = NetworkEraBound
netEraBoundSample1
, _networkEraParameters :: NetworkEraParameters
_networkEraParameters = NetworkEraParameters
netEraParamSample
}