{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Rpc.Server.Internal.Orphans () where

import Cardano.Api.Address
import Cardano.Api.Era
import Cardano.Api.Error
import Cardano.Api.Ledger qualified as L
import Cardano.Api.Plutus
import Cardano.Api.Pretty
import Cardano.Api.Serialise.Cbor
import Cardano.Api.Serialise.Raw
import Cardano.Api.Tx
import Cardano.Api.Value
import Cardano.Rpc.Proto.Api.UtxoRpc.Query qualified as UtxoRpc

import Cardano.Ledger.Api qualified as L
import Cardano.Ledger.BaseTypes qualified as L
import Cardano.Ledger.Conway.PParams qualified as L
import Cardano.Ledger.Plutus qualified as L

import RIO hiding (toList)

import Data.Default
import Data.Map.Strict qualified as M
import Data.ProtoLens (defMessage)
import Data.ProtoLens.Message (Message)
import Data.Ratio (denominator, numerator, (%))
import Data.Text.Encoding qualified as T
import GHC.IsList
import Network.GRPC.Spec

---------------
-- Conversion
---------------

-- It's easier to use 'Proto a' wrappers for RPC types, because it makes lens automatically available.

instance Inject (Proto UtxoRpc.RationalNumber) Rational where
  inject :: Proto RationalNumber -> Rational
inject Proto RationalNumber
r = Proto RationalNumber
r Proto RationalNumber
-> Getting Integer (Proto RationalNumber) Integer -> Integer
forall s a. s -> Getting a s a -> a
^. (Int64 -> Const Integer Int64)
-> Proto RationalNumber -> Const Integer (Proto RationalNumber)
#numerator ((Int64 -> Const Integer Int64)
 -> Proto RationalNumber -> Const Integer (Proto RationalNumber))
-> ((Integer -> Const Integer Integer)
    -> Int64 -> Const Integer Int64)
-> Getting Integer (Proto RationalNumber) Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int64 -> Integer) -> SimpleGetter Int64 Integer
forall s a. (s -> a) -> SimpleGetter s a
to Int64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% Proto RationalNumber
r Proto RationalNumber
-> Getting Integer (Proto RationalNumber) Integer -> Integer
forall s a. s -> Getting a s a -> a
^. (Word64 -> Const Integer Word64)
-> Proto RationalNumber -> Const Integer (Proto RationalNumber)
#denominator ((Word64 -> Const Integer Word64)
 -> Proto RationalNumber -> Const Integer (Proto RationalNumber))
-> ((Integer -> Const Integer Integer)
    -> Word64 -> Const Integer Word64)
-> Getting Integer (Proto RationalNumber) Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word64 -> Integer) -> SimpleGetter Word64 Integer
forall s a. (s -> a) -> SimpleGetter s a
to Word64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral

-- NB. this clips value in Integer -> Int64/Word64 conversion here
instance Inject Rational (Proto UtxoRpc.RationalNumber) where
  inject :: Rational -> Proto RationalNumber
inject Rational
r =
    Proto RationalNumber
forall msg. Message msg => msg
defMessage
      Proto RationalNumber
-> (Proto RationalNumber -> Proto RationalNumber)
-> Proto RationalNumber
forall a b. a -> (a -> b) -> b
& ASetter (Proto RationalNumber) (Proto RationalNumber) Int64 Int64
#numerator ASetter (Proto RationalNumber) (Proto RationalNumber) Int64 Int64
-> Int64 -> Proto RationalNumber -> Proto RationalNumber
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Rational -> Integer
forall a. Ratio a -> a
numerator Rational
r)
      Proto RationalNumber
-> (Proto RationalNumber -> Proto RationalNumber)
-> Proto RationalNumber
forall a b. a -> (a -> b) -> b
& ASetter (Proto RationalNumber) (Proto RationalNumber) Word64 Word64
#denominator ASetter (Proto RationalNumber) (Proto RationalNumber) Word64 Word64
-> Word64 -> Proto RationalNumber -> Proto RationalNumber
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Rational -> Integer
forall a. Ratio a -> a
denominator Rational
r)

instance Inject (Proto UtxoRpc.ExUnits) L.ExUnits where
  inject :: Proto ExUnits -> ExUnits
inject Proto ExUnits
r =
    L.ExUnits
      { exUnitsMem :: Natural
L.exUnitsMem = Proto ExUnits
r Proto ExUnits -> Getting Natural (Proto ExUnits) Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (Word64 -> Const Natural Word64)
-> Proto ExUnits -> Const Natural (Proto ExUnits)
#memory ((Word64 -> Const Natural Word64)
 -> Proto ExUnits -> Const Natural (Proto ExUnits))
-> ((Natural -> Const Natural Natural)
    -> Word64 -> Const Natural Word64)
-> Getting Natural (Proto ExUnits) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word64 -> Natural) -> SimpleGetter Word64 Natural
forall s a. (s -> a) -> SimpleGetter s a
to Word64 -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      , exUnitsSteps :: Natural
L.exUnitsSteps = Proto ExUnits
r Proto ExUnits -> Getting Natural (Proto ExUnits) Natural -> Natural
forall s a. s -> Getting a s a -> a
^. (Word64 -> Const Natural Word64)
-> Proto ExUnits -> Const Natural (Proto ExUnits)
#steps ((Word64 -> Const Natural Word64)
 -> Proto ExUnits -> Const Natural (Proto ExUnits))
-> ((Natural -> Const Natural Natural)
    -> Word64 -> Const Natural Word64)
-> Getting Natural (Proto ExUnits) Natural
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word64 -> Natural) -> SimpleGetter Word64 Natural
forall s a. (s -> a) -> SimpleGetter s a
to Word64 -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      }

instance Inject L.ExUnits (Proto UtxoRpc.ExUnits) where
  inject :: ExUnits -> Proto ExUnits
inject L.ExUnits{exUnitsMem :: ExUnits -> Natural
L.exUnitsMem = Natural
mem, exUnitsSteps :: ExUnits -> Natural
L.exUnitsSteps = Natural
steps} =
    Proto ExUnits
forall msg. Message msg => msg
defMessage
      Proto ExUnits -> (Proto ExUnits -> Proto ExUnits) -> Proto ExUnits
forall a b. a -> (a -> b) -> b
& ASetter (Proto ExUnits) (Proto ExUnits) Word64 Word64
#memory ASetter (Proto ExUnits) (Proto ExUnits) Word64 Word64
-> Word64 -> Proto ExUnits -> Proto ExUnits
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Natural
mem
      Proto ExUnits -> (Proto ExUnits -> Proto ExUnits) -> Proto ExUnits
forall a b. a -> (a -> b) -> b
& ASetter (Proto ExUnits) (Proto ExUnits) Word64 Word64
#steps ASetter (Proto ExUnits) (Proto ExUnits) Word64 Word64
-> Word64 -> Proto ExUnits -> Proto ExUnits
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Natural
steps

-- | Note that conversion is not total in the other direction
instance Inject TxIn (Proto UtxoRpc.TxoRef) where
  inject :: TxIn -> Proto TxoRef
inject (TxIn TxId
txId' (TxIx Word
txIx)) =
    Proto TxoRef
forall msg. Message msg => msg
defMessage
      Proto TxoRef -> (Proto TxoRef -> Proto TxoRef) -> Proto TxoRef
forall a b. a -> (a -> b) -> b
& ASetter (Proto TxoRef) (Proto TxoRef) ByteString ByteString
#hash ASetter (Proto TxoRef) (Proto TxoRef) ByteString ByteString
-> ByteString -> Proto TxoRef -> Proto TxoRef
forall s t a b. ASetter s t a b -> b -> s -> t
.~ TxId -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes TxId
txId'
      Proto TxoRef -> (Proto TxoRef -> Proto TxoRef) -> Proto TxoRef
forall a b. a -> (a -> b) -> b
& ASetter (Proto TxoRef) (Proto TxoRef) Word32 Word32
#index ASetter (Proto TxoRef) (Proto TxoRef) Word32 Word32
-> Word32 -> Proto TxoRef -> Proto TxoRef
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
txIx

instance Inject (ReferenceScript era) (Proto UtxoRpc.Script) where
  inject :: ReferenceScript era -> Proto Script
inject ReferenceScript era
ReferenceScriptNone = Proto Script
forall msg. Message msg => msg
defMessage
  inject (ReferenceScript BabbageEraOnwards era
_ (ScriptInAnyLang ScriptLanguage lang
_ Script lang
script)) =
    case Script lang
script of
      SimpleScript SimpleScript
_ ->
        Proto Script
forall msg. Message msg => msg
defMessage Proto Script -> (Proto Script -> Proto Script) -> Proto Script
forall a b. a -> (a -> b) -> b
& ASetter (Proto Script) (Proto Script) ByteString ByteString
#native ASetter (Proto Script) (Proto Script) ByteString ByteString
-> ByteString -> Proto Script -> Proto Script
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Script lang -> ByteString
forall a. SerialiseAsCBOR a => a -> ByteString
serialiseToCBOR Script lang
script
      PlutusScript PlutusScriptVersion lang
PlutusScriptV1 PlutusScript lang
ps ->
        Proto Script
forall msg. Message msg => msg
defMessage Proto Script -> (Proto Script -> Proto Script) -> Proto Script
forall a b. a -> (a -> b) -> b
& ASetter (Proto Script) (Proto Script) ByteString ByteString
#plutusV1 ASetter (Proto Script) (Proto Script) ByteString ByteString
-> ByteString -> Proto Script -> Proto Script
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PlutusScript lang -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes PlutusScript lang
ps
      PlutusScript PlutusScriptVersion lang
PlutusScriptV2 PlutusScript lang
ps ->
        Proto Script
forall msg. Message msg => msg
defMessage Proto Script -> (Proto Script -> Proto Script) -> Proto Script
forall a b. a -> (a -> b) -> b
& ASetter (Proto Script) (Proto Script) ByteString ByteString
#plutusV2 ASetter (Proto Script) (Proto Script) ByteString ByteString
-> ByteString -> Proto Script -> Proto Script
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PlutusScript lang -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes PlutusScript lang
ps
      PlutusScript PlutusScriptVersion lang
PlutusScriptV3 PlutusScript lang
ps ->
        Proto Script
forall msg. Message msg => msg
defMessage Proto Script -> (Proto Script -> Proto Script) -> Proto Script
forall a b. a -> (a -> b) -> b
& ASetter (Proto Script) (Proto Script) ByteString ByteString
#plutusV3 ASetter (Proto Script) (Proto Script) ByteString ByteString
-> ByteString -> Proto Script -> Proto Script
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PlutusScript lang -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes PlutusScript lang
ps

instance IsCardanoEra era => Inject (UTxO era) [Proto UtxoRpc.AnyUtxoData] where
  inject :: UTxO era -> [Proto AnyUtxoData]
inject UTxO era
utxo =
    UTxO era -> [Item (UTxO era)]
forall l. IsList l => l -> [Item l]
toList UTxO era
utxo [(TxIn, TxOut CtxUTxO era)]
-> ((TxIn, TxOut CtxUTxO era) -> Proto AnyUtxoData)
-> [Proto AnyUtxoData]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(TxIn
txIn, TxOut AddressInEra era
addressInEra TxOutValue era
txOutValue TxOutDatum CtxUTxO era
datum ReferenceScript era
script) -> do
      let multiAsset :: [Proto MultiAsset]
multiAsset =
            [Item [Proto MultiAsset]] -> [Proto MultiAsset]
forall l. IsList l => [Item l] -> l
fromList ([Item [Proto MultiAsset]] -> [Proto MultiAsset])
-> [Item [Proto MultiAsset]] -> [Proto MultiAsset]
forall a b. (a -> b) -> a -> b
$
              Map PolicyId PolicyAssets -> [Item (Map PolicyId PolicyAssets)]
forall l. IsList l => l -> [Item l]
toList (Value -> Map PolicyId PolicyAssets
valueToPolicyAssets (Value -> Map PolicyId PolicyAssets)
-> Value -> Map PolicyId PolicyAssets
forall a b. (a -> b) -> a -> b
$ TxOutValue era -> Value
forall era. TxOutValue era -> Value
txOutValueToValue TxOutValue era
txOutValue) [(PolicyId, PolicyAssets)]
-> ((PolicyId, PolicyAssets) -> Item [Proto MultiAsset])
-> [Item [Proto MultiAsset]]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(PolicyId
pId, PolicyAssets
policyAssets) -> do
                let assets :: [Proto Asset]
assets =
                      PolicyAssets -> [Item PolicyAssets]
forall l. IsList l => l -> [Item l]
toList PolicyAssets
policyAssets [(AssetName, Quantity)]
-> ((AssetName, Quantity) -> Proto Asset) -> [Proto Asset]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(AssetName
assetName, Quantity Integer
qty) -> do
                        Proto Asset
forall msg. Message msg => msg
defMessage
                          Proto Asset -> (Proto Asset -> Proto Asset) -> Proto Asset
forall a b. a -> (a -> b) -> b
& ASetter (Proto Asset) (Proto Asset) ByteString ByteString
#name ASetter (Proto Asset) (Proto Asset) ByteString ByteString
-> ByteString -> Proto Asset -> Proto Asset
forall s t a b. ASetter s t a b -> b -> s -> t
.~ AssetName -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes AssetName
assetName
                          -- we don't have access to info it the coin was minted in the transaction,
                          -- maybe we should add it later
                          Proto Asset -> (Proto Asset -> Proto Asset) -> Proto Asset
forall a b. a -> (a -> b) -> b
& ASetter (Proto Asset) (Proto Asset) (Maybe Int64) (Maybe Int64)
#maybe'mintCoin ASetter (Proto Asset) (Proto Asset) (Maybe Int64) (Maybe Int64)
-> Maybe Int64 -> Proto Asset -> Proto Asset
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Maybe Int64
forall a. Maybe a
Nothing
                          Proto Asset -> (Proto Asset -> Proto Asset) -> Proto Asset
forall a b. a -> (a -> b) -> b
& ASetter (Proto Asset) (Proto Asset) Word64 Word64
#outputCoin ASetter (Proto Asset) (Proto Asset) Word64 Word64
-> Word64 -> Proto Asset -> Proto Asset
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
qty
                Item [Proto MultiAsset]
forall msg. Message msg => msg
defMessage
                  Item [Proto MultiAsset]
-> (Item [Proto MultiAsset] -> Item [Proto MultiAsset])
-> Item [Proto MultiAsset]
forall a b. a -> (a -> b) -> b
& ASetter
  (Item [Proto MultiAsset])
  (Item [Proto MultiAsset])
  ByteString
  ByteString
#policyId ASetter
  (Item [Proto MultiAsset])
  (Item [Proto MultiAsset])
  ByteString
  ByteString
-> ByteString -> Item [Proto MultiAsset] -> Item [Proto MultiAsset]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PolicyId -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes PolicyId
pId
                  Item [Proto MultiAsset]
-> (Item [Proto MultiAsset] -> Item [Proto MultiAsset])
-> Item [Proto MultiAsset]
forall a b. a -> (a -> b) -> b
& ASetter
  (Item [Proto MultiAsset])
  (Item [Proto MultiAsset])
  [Proto Asset]
  [Proto Asset]
#assets ASetter
  (Item [Proto MultiAsset])
  (Item [Proto MultiAsset])
  [Proto Asset]
  [Proto Asset]
-> [Proto Asset]
-> Item [Proto MultiAsset]
-> Item [Proto MultiAsset]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [Proto Asset]
assets
          datumRpc :: Proto Datum
datumRpc = case TxOutDatum CtxUTxO era
datum of
            TxOutDatum CtxUTxO era
TxOutDatumNone ->
              Proto Datum
forall msg. Message msg => msg
defMessage
            TxOutDatumHash AlonzoEraOnwards era
_ Hash ScriptData
scriptDataHash ->
              Proto Datum
forall msg. Message msg => msg
defMessage
                Proto Datum -> (Proto Datum -> Proto Datum) -> Proto Datum
forall a b. a -> (a -> b) -> b
& ASetter (Proto Datum) (Proto Datum) ByteString ByteString
#hash ASetter (Proto Datum) (Proto Datum) ByteString ByteString
-> ByteString -> Proto Datum -> Proto Datum
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Hash ScriptData -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes Hash ScriptData
scriptDataHash
                Proto Datum -> (Proto Datum -> Proto Datum) -> Proto Datum
forall a b. a -> (a -> b) -> b
& ASetter (Proto Datum) (Proto Datum) ByteString ByteString
#originalCbor ASetter (Proto Datum) (Proto Datum) ByteString ByteString
-> ByteString -> Proto Datum -> Proto Datum
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ByteString
forall a. Monoid a => a
mempty -- we don't have it
            TxOutDatumInline BabbageEraOnwards era
_ HashableScriptData
hashableScriptData ->
              Proto Datum
forall msg. Message msg => msg
defMessage
                Proto Datum -> (Proto Datum -> Proto Datum) -> Proto Datum
forall a b. a -> (a -> b) -> b
& ASetter (Proto Datum) (Proto Datum) ByteString ByteString
#hash ASetter (Proto Datum) (Proto Datum) ByteString ByteString
-> ByteString -> Proto Datum -> Proto Datum
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Hash ScriptData -> ByteString
forall a. SerialiseAsRawBytes a => a -> ByteString
serialiseToRawBytes (HashableScriptData -> Hash ScriptData
hashScriptDataBytes HashableScriptData
hashableScriptData)
                Proto Datum -> (Proto Datum -> Proto Datum) -> Proto Datum
forall a b. a -> (a -> b) -> b
& ASetter (Proto Datum) (Proto Datum) ByteString ByteString
#originalCbor ASetter (Proto Datum) (Proto Datum) ByteString ByteString
-> ByteString -> Proto Datum -> Proto Datum
forall s t a b. ASetter s t a b -> b -> s -> t
.~ HashableScriptData -> ByteString
getOriginalScriptDataBytes HashableScriptData
hashableScriptData

          protoTxOut :: Proto TxOutput
protoTxOut =
            Proto TxOutput
forall msg. Message msg => msg
defMessage
              -- TODO we don't have serialiseToRawBytes for AddressInEra, so perhaps this is wrong, because 'address'
              -- has type bytes, but we're putting text there
              Proto TxOutput
-> (Proto TxOutput -> Proto TxOutput) -> Proto TxOutput
forall a b. a -> (a -> b) -> b
& ASetter (Proto TxOutput) (Proto TxOutput) ByteString ByteString
#address ASetter (Proto TxOutput) (Proto TxOutput) ByteString ByteString
-> ByteString -> Proto TxOutput -> Proto TxOutput
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Text -> ByteString
T.encodeUtf8 (CardanoEra era -> (CardanoEraConstraints era => Text) -> Text
forall era a.
CardanoEra era -> (CardanoEraConstraints era => a) -> a
cardanoEraConstraints (forall era. IsCardanoEra era => CardanoEra era
cardanoEra @era) ((CardanoEraConstraints era => Text) -> Text)
-> (CardanoEraConstraints era => Text) -> Text
forall a b. (a -> b) -> a -> b
$ AddressInEra era -> Text
forall addr. SerialiseAddress addr => addr -> Text
serialiseAddress AddressInEra era
addressInEra)
              Proto TxOutput
-> (Proto TxOutput -> Proto TxOutput) -> Proto TxOutput
forall a b. a -> (a -> b) -> b
& ASetter (Proto TxOutput) (Proto TxOutput) Word64 Word64
#coin ASetter (Proto TxOutput) (Proto TxOutput) Word64 Word64
-> Word64 -> Proto TxOutput -> Proto TxOutput
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Coin -> Integer
L.unCoin (TxOutValue era -> Coin
forall era. TxOutValue era -> Coin
txOutValueToLovelace TxOutValue era
txOutValue))
              Proto TxOutput
-> (Proto TxOutput -> Proto TxOutput) -> Proto TxOutput
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto TxOutput)
  (Proto TxOutput)
  [Proto MultiAsset]
  [Proto MultiAsset]
#assets ASetter
  (Proto TxOutput)
  (Proto TxOutput)
  [Proto MultiAsset]
  [Proto MultiAsset]
-> [Proto MultiAsset] -> Proto TxOutput -> Proto TxOutput
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [Proto MultiAsset]
multiAsset
              Proto TxOutput
-> (Proto TxOutput -> Proto TxOutput) -> Proto TxOutput
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto TxOutput) (Proto TxOutput) (Proto Datum) (Proto Datum)
#datum ASetter
  (Proto TxOutput) (Proto TxOutput) (Proto Datum) (Proto Datum)
-> Proto Datum -> Proto TxOutput -> Proto TxOutput
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Proto Datum
datumRpc
              Proto TxOutput
-> (Proto TxOutput -> Proto TxOutput) -> Proto TxOutput
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto TxOutput) (Proto TxOutput) (Proto Script) (Proto Script)
#script ASetter
  (Proto TxOutput) (Proto TxOutput) (Proto Script) (Proto Script)
-> Proto Script -> Proto TxOutput -> Proto TxOutput
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ReferenceScript era -> Proto Script
forall t s. Inject t s => t -> s
inject ReferenceScript era
script
      Proto AnyUtxoData
forall msg. Message msg => msg
defMessage
        Proto AnyUtxoData
-> (Proto AnyUtxoData -> Proto AnyUtxoData) -> Proto AnyUtxoData
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto AnyUtxoData) (Proto AnyUtxoData) ByteString ByteString
#nativeBytes ASetter
  (Proto AnyUtxoData) (Proto AnyUtxoData) ByteString ByteString
-> ByteString -> Proto AnyUtxoData -> Proto AnyUtxoData
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ByteString
"" -- TODO where to get that from? run cbor serialisation of utxos list?
        Proto AnyUtxoData
-> (Proto AnyUtxoData -> Proto AnyUtxoData) -> Proto AnyUtxoData
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto AnyUtxoData)
  (Proto AnyUtxoData)
  (Proto TxoRef)
  (Proto TxoRef)
#txoRef ASetter
  (Proto AnyUtxoData)
  (Proto AnyUtxoData)
  (Proto TxoRef)
  (Proto TxoRef)
-> Proto TxoRef -> Proto AnyUtxoData -> Proto AnyUtxoData
forall s t a b. ASetter s t a b -> b -> s -> t
.~ TxIn -> Proto TxoRef
forall t s. Inject t s => t -> s
inject TxIn
txIn
        Proto AnyUtxoData
-> (Proto AnyUtxoData -> Proto AnyUtxoData) -> Proto AnyUtxoData
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto AnyUtxoData)
  (Proto AnyUtxoData)
  (Proto TxOutput)
  (Proto TxOutput)
#cardano ASetter
  (Proto AnyUtxoData)
  (Proto AnyUtxoData)
  (Proto TxOutput)
  (Proto TxOutput)
-> Proto TxOutput -> Proto AnyUtxoData -> Proto AnyUtxoData
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Proto TxOutput
protoTxOut

instance L.ConwayEraPParams lera => Inject (L.PParams lera) (Proto UtxoRpc.PParams) where
  inject :: PParams lera -> Proto PParams
inject PParams lera
pparams = do
    let Map Language [Int64]
pparamsCostModels :: Map L.Language [Int64] =
          CostModel -> [Int64]
L.getCostModelParams (CostModel -> [Int64])
-> Map Language CostModel -> Map Language [Int64]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> PParams lera
pparams PParams lera
-> Getting
     (Map Language CostModel) (PParams lera) (Map Language CostModel)
-> Map Language CostModel
forall s a. s -> Getting a s a -> a
^. (CostModels -> Const (Map Language CostModel) CostModels)
-> PParams lera -> Const (Map Language CostModel) (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) CostModels
Lens' (PParams lera) CostModels
L.ppCostModelsL ((CostModels -> Const (Map Language CostModel) CostModels)
 -> PParams lera -> Const (Map Language CostModel) (PParams lera))
-> ((Map Language CostModel
     -> Const (Map Language CostModel) (Map Language CostModel))
    -> CostModels -> Const (Map Language CostModel) CostModels)
-> Getting
     (Map Language CostModel) (PParams lera) (Map Language CostModel)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CostModels -> Map Language CostModel)
-> SimpleGetter CostModels (Map Language CostModel)
forall s a. (s -> a) -> SimpleGetter s a
to CostModels -> Map Language CostModel
L.costModelsValid
        PoolVotingThresholds
poolVotingThresholds :: L.PoolVotingThresholds =
          PParams lera
pparams PParams lera
-> Getting PoolVotingThresholds (PParams lera) PoolVotingThresholds
-> PoolVotingThresholds
forall s a. s -> Getting a s a -> a
^. Getting PoolVotingThresholds (PParams lera) PoolVotingThresholds
forall era.
ConwayEraPParams era =>
Lens' (PParams era) PoolVotingThresholds
Lens' (PParams lera) PoolVotingThresholds
L.ppPoolVotingThresholdsL
        DRepVotingThresholds
drepVotingThresholds :: L.DRepVotingThresholds =
          PParams lera
pparams PParams lera
-> Getting DRepVotingThresholds (PParams lera) DRepVotingThresholds
-> DRepVotingThresholds
forall s a. s -> Getting a s a -> a
^. Getting DRepVotingThresholds (PParams lera) DRepVotingThresholds
forall era.
ConwayEraPParams era =>
Lens' (PParams era) DRepVotingThresholds
Lens' (PParams lera) DRepVotingThresholds
L.ppDRepVotingThresholdsL
    Proto PParams
forall a. Default a => a
def
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#coinsPerUtxoByte ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (CoinPerByte -> Const Word64 CoinPerByte)
-> PParams lera -> Const Word64 (PParams lera)
forall era.
BabbageEraPParams era =>
Lens' (PParams era) CoinPerByte
Lens' (PParams lera) CoinPerByte
L.ppCoinsPerUTxOByteL ((CoinPerByte -> Const Word64 CoinPerByte)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> CoinPerByte -> Const Word64 CoinPerByte)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CoinPerByte -> Coin) -> SimpleGetter CoinPerByte Coin
forall s a. (s -> a) -> SimpleGetter s a
to CoinPerByte -> Coin
L.unCoinPerByte Getting Word64 CoinPerByte Coin
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> (Word64 -> Const Word64 Word64)
-> CoinPerByte
-> Const Word64 CoinPerByte
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxTxSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word32 -> Const Word64 Word32)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Word32
Lens' (PParams lera) Word32
L.ppMaxTxSizeL ((Word32 -> Const Word64 Word32)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minFeeCoefficient ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppMinFeeBL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minFeeConstant ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppMinFeeAL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxBlockBodySize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word32 -> Const Word64 Word32)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Word32
Lens' (PParams lera) Word32
L.ppMaxBBSizeL ((Word32 -> Const Word64 Word32)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxBlockHeaderSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word16 -> Const Word64 Word16)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Word16
Lens' (PParams lera) Word16
L.ppMaxBHSizeL ((Word16 -> Const Word64 Word16)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Word16 -> Const Word64 Word16)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word16 -> Word64) -> SimpleGetter Word16 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#stakeKeyDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppKeyDepositL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#poolDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppPoolDepositL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#poolRetirementEpochBound ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) EpochInterval
Lens' (PParams lera) EpochInterval
L.ppEMaxL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#desiredNumberOfPools ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word16 -> Const Word64 Word16)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Word16
Lens' (PParams lera) Word16
L.ppNOptL ((Word16 -> Const Word64 Word16)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Word16 -> Const Word64 Word16)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word16 -> Word64) -> SimpleGetter Word16 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#poolInfluence ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (NonNegativeInterval
 -> Const (Proto RationalNumber) NonNegativeInterval)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era.
EraPParams era =>
Lens' (PParams era) NonNegativeInterval
Lens' (PParams lera) NonNegativeInterval
L.ppA0L ((NonNegativeInterval
  -> Const (Proto RationalNumber) NonNegativeInterval)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#monetaryExpansion ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era. EraPParams era => Lens' (PParams era) UnitInterval
Lens' (PParams lera) UnitInterval
L.ppRhoL ((UnitInterval -> Const (Proto RationalNumber) UnitInterval)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitInterval -> Rational) -> SimpleGetter UnitInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) UnitInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> UnitInterval
-> Const (Proto RationalNumber) UnitInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#treasuryExpansion ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era. EraPParams era => Lens' (PParams era) UnitInterval
Lens' (PParams lera) UnitInterval
L.ppTauL ((UnitInterval -> Const (Proto RationalNumber) UnitInterval)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitInterval -> Rational) -> SimpleGetter UnitInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) UnitInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> UnitInterval
-> Const (Proto RationalNumber) UnitInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minPoolCost ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppMinPoolCostL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> Proto PParams -> Identity (Proto PParams)
#protocolVersion ((Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Word32 -> Identity Word32)
    -> Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> ASetter (Proto PParams) (Proto PParams) Word32 Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Identity Word32)
-> Proto ProtocolVersion -> Identity (Proto ProtocolVersion)
#major ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word32 (PParams lera) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (ProtVer -> Const Word32 ProtVer)
-> PParams lera -> Const Word32 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) ProtVer
Lens' (PParams lera) ProtVer
L.ppProtocolVersionL ((ProtVer -> Const Word32 ProtVer)
 -> PParams lera -> Const Word32 (PParams lera))
-> ((Word32 -> Const Word32 Word32)
    -> ProtVer -> Const Word32 ProtVer)
-> Getting Word32 (PParams lera) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer -> Version) -> SimpleGetter ProtVer Version
forall s a. (s -> a) -> SimpleGetter s a
to ProtVer -> Version
L.pvMajor Getting Word32 ProtVer Version
-> ((Word32 -> Const Word32 Word32)
    -> Version -> Const Word32 Version)
-> (Word32 -> Const Word32 Word32)
-> ProtVer
-> Const Word32 ProtVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Version -> Word32) -> SimpleGetter Version Word32
forall s a. (s -> a) -> SimpleGetter s a
to Version -> Word32
forall i. Integral i => Version -> i
L.getVersion
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> Proto PParams -> Identity (Proto PParams)
#protocolVersion ((Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Word32 -> Identity Word32)
    -> Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> ASetter (Proto PParams) (Proto PParams) Word32 Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Identity Word32)
-> Proto ProtocolVersion -> Identity (Proto ProtocolVersion)
#minor ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word32 (PParams lera) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (ProtVer -> Const Word32 ProtVer)
-> PParams lera -> Const Word32 (PParams lera)
forall era. EraPParams era => Lens' (PParams era) ProtVer
Lens' (PParams lera) ProtVer
L.ppProtocolVersionL ((ProtVer -> Const Word32 ProtVer)
 -> PParams lera -> Const Word32 (PParams lera))
-> ((Word32 -> Const Word32 Word32)
    -> ProtVer -> Const Word32 ProtVer)
-> Getting Word32 (PParams lera) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer -> Natural) -> SimpleGetter ProtVer Natural
forall s a. (s -> a) -> SimpleGetter s a
to ProtVer -> Natural
L.pvMinor Getting Word32 ProtVer Natural
-> ((Word32 -> Const Word32 Word32)
    -> Natural -> Const Word32 Natural)
-> (Word32 -> Const Word32 Word32)
-> ProtVer
-> Const Word32 ProtVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word32) -> SimpleGetter Natural Word32
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxValueSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams lera -> Const Word64 (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams lera) Natural
L.ppMaxValSizeL ((Natural -> Const Word64 Natural)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#collateralPercentage ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams lera -> Const Word64 (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams lera) Natural
L.ppCollateralPercentageL ((Natural -> Const Word64 Natural)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxCollateralInputs ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams lera -> Const Word64 (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams lera) Natural
L.ppMaxCollateralInputsL ((Natural -> Const Word64 Natural)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV1 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV1 Map Language [Int64]
pparamsCostModels)
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV2 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV2 Map Language [Int64]
pparamsCostModels)
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV3 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV3 Map Language [Int64]
pparamsCostModels)
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ExPrices -> Identity (Proto ExPrices))
-> Proto PParams -> Identity (Proto PParams)
#prices ((Proto ExPrices -> Identity (Proto ExPrices))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Proto RationalNumber -> Identity (Proto RationalNumber))
    -> Proto ExPrices -> Identity (Proto ExPrices))
-> ASetter
     (Proto PParams)
     (Proto PParams)
     (Proto RationalNumber)
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto RationalNumber -> Identity (Proto RationalNumber))
-> Proto ExPrices -> Identity (Proto ExPrices)
#steps ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (Prices -> Const (Proto RationalNumber) Prices)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
Lens' (PParams lera) Prices
L.ppPricesL ((Prices -> Const (Proto RationalNumber) Prices)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Prices -> Const (Proto RationalNumber) Prices)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Prices -> NonNegativeInterval)
-> SimpleGetter Prices NonNegativeInterval
forall s a. (s -> a) -> SimpleGetter s a
to Prices -> NonNegativeInterval
L.prSteps Getting (Proto RationalNumber) Prices NonNegativeInterval
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> Prices
-> Const (Proto RationalNumber) Prices
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ExPrices -> Identity (Proto ExPrices))
-> Proto PParams -> Identity (Proto PParams)
#prices ((Proto ExPrices -> Identity (Proto ExPrices))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Proto RationalNumber -> Identity (Proto RationalNumber))
    -> Proto ExPrices -> Identity (Proto ExPrices))
-> ASetter
     (Proto PParams)
     (Proto PParams)
     (Proto RationalNumber)
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto RationalNumber -> Identity (Proto RationalNumber))
-> Proto ExPrices -> Identity (Proto ExPrices)
#memory ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (Prices -> Const (Proto RationalNumber) Prices)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
Lens' (PParams lera) Prices
L.ppPricesL ((Prices -> Const (Proto RationalNumber) Prices)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Prices -> Const (Proto RationalNumber) Prices)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Prices -> NonNegativeInterval)
-> SimpleGetter Prices NonNegativeInterval
forall s a. (s -> a) -> SimpleGetter s a
to Prices -> NonNegativeInterval
L.prMem Getting (Proto RationalNumber) Prices NonNegativeInterval
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> Prices
-> Const (Proto RationalNumber) Prices
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
#maxExecutionUnitsPerTransaction ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
-> Proto ExUnits -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting (Proto ExUnits) (PParams lera) (Proto ExUnits)
-> Proto ExUnits
forall s a. s -> Getting a s a -> a
^. (ExUnits -> Const (Proto ExUnits) ExUnits)
-> PParams lera -> Const (Proto ExUnits) (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
Lens' (PParams lera) ExUnits
L.ppMaxTxExUnitsL ((ExUnits -> Const (Proto ExUnits) ExUnits)
 -> PParams lera -> Const (Proto ExUnits) (PParams lera))
-> ((Proto ExUnits -> Const (Proto ExUnits) (Proto ExUnits))
    -> ExUnits -> Const (Proto ExUnits) ExUnits)
-> Getting (Proto ExUnits) (PParams lera) (Proto ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ExUnits -> Proto ExUnits) -> SimpleGetter ExUnits (Proto ExUnits)
forall s a. (s -> a) -> SimpleGetter s a
to ExUnits -> Proto ExUnits
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
#maxExecutionUnitsPerBlock ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
-> Proto ExUnits -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting (Proto ExUnits) (PParams lera) (Proto ExUnits)
-> Proto ExUnits
forall s a. s -> Getting a s a -> a
^. (ExUnits -> Const (Proto ExUnits) ExUnits)
-> PParams lera -> Const (Proto ExUnits) (PParams lera)
forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
Lens' (PParams lera) ExUnits
L.ppMaxBlockExUnitsL ((ExUnits -> Const (Proto ExUnits) ExUnits)
 -> PParams lera -> Const (Proto ExUnits) (PParams lera))
-> ((Proto ExUnits -> Const (Proto ExUnits) (Proto ExUnits))
    -> ExUnits -> Const (Proto ExUnits) ExUnits)
-> Getting (Proto ExUnits) (PParams lera) (Proto ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ExUnits -> Proto ExUnits) -> SimpleGetter ExUnits (Proto ExUnits)
forall s a. (s -> a) -> SimpleGetter s a
to ExUnits -> Proto ExUnits
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#minFeeScriptRefCostPerByte
        ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (NonNegativeInterval
 -> Const (Proto RationalNumber) NonNegativeInterval)
-> PParams lera -> Const (Proto RationalNumber) (PParams lera)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) NonNegativeInterval
Lens' (PParams lera) NonNegativeInterval
L.ppMinFeeRefScriptCostPerByteL ((NonNegativeInterval
  -> Const (Proto RationalNumber) NonNegativeInterval)
 -> PParams lera -> Const (Proto RationalNumber) (PParams lera))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> Getting
     (Proto RationalNumber) (PParams lera) (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> Proto PParams -> Identity (Proto PParams)
#poolVotingThresholds ((Proto VotingThresholds -> Identity (Proto VotingThresholds))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Proto RationalNumber] -> Identity [Proto RationalNumber])
    -> Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto VotingThresholds -> Identity (Proto VotingThresholds)
#thresholds
        (([Proto RationalNumber] -> Identity [Proto RationalNumber])
 -> Proto PParams -> Identity (Proto PParams))
-> [Proto RationalNumber] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ( Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject (Rational -> Proto RationalNumber)
-> (UnitInterval -> Rational)
-> UnitInterval
-> Proto RationalNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational
               -- order taken from https://github.com/cardano-foundation/CIPs/blob/acb4b2348c968003dfc370cd3769615bfca1f159/CIP-1694/README.md#requirements
               (UnitInterval -> Proto RationalNumber)
-> [UnitInterval] -> [Proto RationalNumber]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtMotionNoConfidenceL
                   , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtCommitteeNormalL
                   , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtCommitteeNoConfidenceL
                   , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtHardForkInitiationL
                   , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtPPSecurityGroupL
                   ]
           )
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> Proto PParams -> Identity (Proto PParams)
#drepVotingThresholds ((Proto VotingThresholds -> Identity (Proto VotingThresholds))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Proto RationalNumber] -> Identity [Proto RationalNumber])
    -> Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto VotingThresholds -> Identity (Proto VotingThresholds)
#thresholds
        (([Proto RationalNumber] -> Identity [Proto RationalNumber])
 -> Proto PParams -> Identity (Proto PParams))
-> [Proto RationalNumber] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ( Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject (Rational -> Proto RationalNumber)
-> (UnitInterval -> Rational)
-> UnitInterval
-> Proto RationalNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational
               -- order taken from https://github.com/cardano-foundation/CIPs/blob/acb4b2348c968003dfc370cd3769615bfca1f159/CIP-1694/README.md#requirements
               (UnitInterval -> Proto RationalNumber)
-> [UnitInterval] -> [Proto RationalNumber]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtMotionNoConfidenceL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtCommitteeNormalL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtCommitteeNoConfidenceL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtUpdateToConstitutionL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtHardForkInitiationL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPNetworkGroupL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPEconomicGroupL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPTechnicalGroupL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPGovGroupL
                   , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtTreasuryWithdrawalL
                   ]
           )
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word32 Word32
#minCommitteeSize ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word32 (PParams lera) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word32 Natural)
-> PParams lera -> Const Word32 (PParams lera)
forall era. ConwayEraPParams era => Lens' (PParams era) Natural
Lens' (PParams lera) Natural
L.ppCommitteeMinSizeL ((Natural -> Const Word32 Natural)
 -> PParams lera -> Const Word32 (PParams lera))
-> ((Word32 -> Const Word32 Word32)
    -> Natural -> Const Word32 Natural)
-> Getting Word32 (PParams lera) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word32) -> SimpleGetter Natural Word32
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#committeeTermLimit
        ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams lera -> Const Word64 (PParams lera)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams lera) EpochInterval
L.ppCommitteeMaxTermLengthL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#governanceActionValidityPeriod
        ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams lera -> Const Word64 (PParams lera)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams lera) EpochInterval
L.ppGovActionLifetimeL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#governanceActionDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. ConwayEraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppGovActionDepositL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#drepDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams lera -> Const Word64 (PParams lera)
forall era. ConwayEraPParams era => Lens' (PParams era) Coin
Lens' (PParams lera) Coin
L.ppDRepDepositL ((Coin -> Const Word64 Coin)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#drepInactivityPeriod ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams lera
pparams PParams lera -> Getting Word64 (PParams lera) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams lera -> Const Word64 (PParams lera)
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams lera) EpochInterval
L.ppDRepActivityL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams lera -> Const Word64 (PParams lera))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams lera) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral

instance Message a => Default (Proto a) where
  def :: Proto a
def = Proto a
forall msg. Message msg => msg
defMessage

-----------
-- Errors
-----------

-- TODO add RIO to cardano-api and move this instance there

instance Error StringException where
  prettyError :: forall ann. StringException -> Doc ann
prettyError = StringException -> Doc ann
forall a ann. Show a => a -> Doc ann
pshow

instance IsString e => MonadFail (Either e) where
  fail :: forall a. String -> Either e a
fail = e -> Either e a
forall a b. a -> Either a b
Left (e -> Either e a) -> (String -> e) -> String -> Either e a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> e
forall a. IsString a => String -> a
fromString