cardano-ledger-shelley-1.18.0.0: Shelley Ledger Executable Model
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Shelley.API.Wallet

Synopsis

UTxOs

getUTxONewEpochState era → UTxO era Source #

Get the full UTxO.

getFilteredUTxOEraTxOut era ⇒ NewEpochState era → Set AddrUTxO era Source #

Get the UTxO filtered by address.

Stake Pools

getPoolsEraCertState era ⇒ NewEpochState era → Set (KeyHash 'StakePool) Source #

Get the current registered stake pools.

getTotalStakeGlobalsNewEpochState era → Coin Source #

Calculate the current total stake.

poolsByTotalStakeFraction ∷ (EraGov era, EraStake era, EraCertState era) ⇒ GlobalsNewEpochState era → PoolDistr Source #

Get pool sizes, but in terms of total stake

The stake distribution uses active stake (so that the leader schedule is not affected by undelegated stake), but the wallet wants to display pool saturation for rewards purposes. For that, it needs the fraction of total stake.

The fields individualTotalPoolStake and pdTotalActiveStake continue to remain based on active stake and not total stake.

This is not based on any snapshot, but uses the current ledger state.

data RewardInfoPool Source #

Information about a stake pool

Constructors

RewardInfoPool 

Fields

Instances

Instances details
FromJSON RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToJSON RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

DecCBOR RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

EncCBOR RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NFData RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Methods

rnfRewardInfoPool → () #

Generic RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Associated Types

type Rep RewardInfoPool 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardInfoPool = D1 ('MetaData "RewardInfoPool" "Cardano.Ledger.Shelley.API.Wallet" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "RewardInfoPool" 'PrefixI 'True) ((S1 ('MetaSel ('Just "stake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "ownerPledge") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "ownerStake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))) :*: (S1 ('MetaSel ('Just "cost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "margin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "performanceEstimate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))))
Show RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Eq RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NoThunks RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardInfoPool = D1 ('MetaData "RewardInfoPool" "Cardano.Ledger.Shelley.API.Wallet" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "RewardInfoPool" 'PrefixI 'True) ((S1 ('MetaSel ('Just "stake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "ownerPledge") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "ownerStake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))) :*: (S1 ('MetaSel ('Just "cost") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "margin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "performanceEstimate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))))

data RewardParams Source #

Global information that influences stake pool rewards

Constructors

RewardParams 

Fields

Instances

Instances details
FromJSON RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToJSON RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

DecCBOR RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

EncCBOR RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NFData RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Methods

rnfRewardParams → () #

Generic RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Associated Types

type Rep RewardParams 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardParams = D1 ('MetaData "RewardParams" "Cardano.Ledger.Shelley.API.Wallet" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "RewardParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "nOpt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16) :*: S1 ('MetaSel ('Just "a0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NonNegativeInterval)) :*: (S1 ('MetaSel ('Just "rPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "totalStake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))))
Show RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Eq RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NoThunks RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

type Rep RewardParams = D1 ('MetaData "RewardParams" "Cardano.Ledger.Shelley.API.Wallet" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "RewardParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "nOpt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16) :*: S1 ('MetaSel ('Just "a0") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NonNegativeInterval)) :*: (S1 ('MetaSel ('Just "rPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "totalStake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))))

getRewardInfoPools ∷ (EraGov era, EraStake era, EraCertState era) ⇒ GlobalsNewEpochState era → (RewardParams, Map (KeyHash 'StakePool) RewardInfoPool) Source #

Retrieve the information necessary to calculate stake pool member rewards from the current stake distribution.

This information includes the current stake distribution aggregated by stake pools and pool owners, the current pool costs and margins, and performance estimates. Also included are global information such as the total stake or protocol parameters.

getRewardProvenance ∷ (EraGov era, EraCertState era) ⇒ GlobalsNewEpochState era → (RewardUpdate, RewardProvenance) Source #

Calculate stake pool rewards from the snapshot labeled go. Also includes information on how the rewards were calculated (RewardProvenance).

For a calculation of rewards based on the current stake distribution, see getRewardInfoPools.

TODO: Deprecate getRewardProvenance, because wallets are more likely to use getRewardInfoPools for up-to-date information on stake pool rewards.

getNonMyopicMemberRewards ∷ (EraGov era, EraStake era, EraCertState era) ⇒ GlobalsNewEpochState era → Set (Either Coin (Credential 'Staking)) → Map (Either Coin (Credential 'Staking)) (Map (KeyHash 'StakePool) Coin) Source #

Calculate the Non-Myopic Pool Member Rewards for a set of credentials. For each given credential, this function returns a map from each stake pool (identified by the key hash of the pool operator) to the non-myopic pool member reward for that stake pool.

This is not based on any snapshot, but uses the current ledger state.

Transaction helpers

addKeyWitnesses ∷ ∀ era (t ∷ TxLevel). EraTx era ⇒ Tx t era → Set (WitVKey 'Witness) → Tx t era Source #

Ada pots

data AdaPots Source #

Instances

Instances details
NFData AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Methods

rnfAdaPots → () #

Generic AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Associated Types

type Rep AdaPots 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

type Rep AdaPots = D1 ('MetaData "AdaPots" "Cardano.Ledger.Shelley.AdaPots" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "AdaPots" 'PrefixI 'True) ((S1 ('MetaSel ('Just "treasuryAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "reservesAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "rewardsAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))) :*: (S1 ('MetaSel ('Just "utxoAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "feesAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "obligationsPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Obligations)))))

Methods

fromAdaPotsRep AdaPots x #

toRep AdaPots x → AdaPots #

Show AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Methods

showsPrecIntAdaPotsShowS #

showAdaPotsString #

showList ∷ [AdaPots] → ShowS #

Eq AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Methods

(==)AdaPotsAdaPotsBool #

(/=)AdaPotsAdaPotsBool #

type Rep AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

type Rep AdaPots = D1 ('MetaData "AdaPots" "Cardano.Ledger.Shelley.AdaPots" "cardano-ledger-shelley-1.18.0.0-inplace" 'False) (C1 ('MetaCons "AdaPots" 'PrefixI 'True) ((S1 ('MetaSel ('Just "treasuryAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "reservesAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "rewardsAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin))) :*: (S1 ('MetaSel ('Just "utxoAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: (S1 ('MetaSel ('Just "feesAdaPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Coin) :*: S1 ('MetaSel ('Just "obligationsPot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Obligations)))))

totalAdaES ∷ (EraTxOut era, EraGov era, EraCertState era) ⇒ EpochState era → Coin Source #

Calculate the total ada in the epoch state

totalAdaPotsES ∷ (EraTxOut era, EraGov era, EraCertState era) ⇒ EpochState era → AdaPots Source #

Calculate the total ada pots in the epoch state

getStakePoolsEraCertState era ⇒ NewEpochState era → Set (KeyHash 'StakePool) → Map (KeyHash 'StakePool) StakePoolState Source #

Get the current registered stake pool state for a given set of stake pools. The result map will contain entries for all the given stake pools that are currently registered.