module Cardano.Api.Internal.LedgerEvents.Rule.TICK.RUPD ( handleLedgerRUPDEvents ) where import Cardano.Api.Internal.Address (fromShelleyStakeCredential) import Cardano.Api.Internal.LedgerEvents.LedgerEvent ( LedgerEvent (IncrementalRewardsDistribution) ) import Cardano.Ledger.Shelley.Rules import Data.Map.Strict qualified as Map handleLedgerRUPDEvents :: RupdEvent -> Maybe LedgerEvent handleLedgerRUPDEvents :: RupdEvent -> Maybe LedgerEvent handleLedgerRUPDEvents (RupdEvent EpochNo epochNum Map (Credential 'Staking) (Set Reward) rewards) = LedgerEvent -> Maybe LedgerEvent forall a. a -> Maybe a Just (LedgerEvent -> Maybe LedgerEvent) -> LedgerEvent -> Maybe LedgerEvent forall a b. (a -> b) -> a -> b $ EpochNo -> Map StakeCredential (Set Reward) -> LedgerEvent IncrementalRewardsDistribution EpochNo epochNum ((Credential 'Staking -> StakeCredential) -> Map (Credential 'Staking) (Set Reward) -> Map StakeCredential (Set Reward) forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a Map.mapKeys Credential 'Staking -> StakeCredential fromShelleyStakeCredential Map (Credential 'Staking) (Set Reward) rewards)