cardano-ledger-shelley-1.11.0.0: Shelley Ledger Executable Model
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Shelley.API.Wallet

Synopsis

UTxOs

getUTxONewEpochState era → UTxO era Source #

Get the full UTxO.

getFilteredUTxOEraTxOut era ⇒ NewEpochState era → Set (Addr (EraCrypto era)) → UTxO era Source #

Get the UTxO filtered by address.

Stake Pools

getPoolsNewEpochState era → Set (KeyHash 'StakePool (EraCrypto era)) Source #

Get the current registered stake pools.

getPoolParametersNewEpochState era → Set (KeyHash 'StakePool (EraCrypto era)) → Map (KeyHash 'StakePool (EraCrypto era)) (PoolParams (EraCrypto era)) Source #

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

getTotalStakeGlobalsNewEpochState era → Coin Source #

Calculate the current total stake.

poolsByTotalStakeFraction ∷ ∀ era. EraGov era ⇒ GlobalsNewEpochState era → PoolDistr (EraCrypto era) 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

Generic RewardInfoPool Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Associated Types

type Rep RewardInfoPoolTypeType Source #

Show 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 → () Source #

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.11.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

Generic RewardParams Source # 
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Associated Types

type Rep RewardParamsTypeType Source #

Show 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 → () Source #

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.11.0.0-inplace" 'False) (C1 ('MetaCons "RewardParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "nOpt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: 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))))

getRewardInfoPoolsEraGov era ⇒ GlobalsNewEpochState era → (RewardParams, Map (KeyHash 'StakePool (EraCrypto era)) 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 ∷ ∀ era. EraGov era ⇒ GlobalsNewEpochState era → (RewardUpdate (EraCrypto era), RewardProvenance (EraCrypto era)) 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.

getNonMyopicMemberRewardsEraGov era ⇒ GlobalsNewEpochState era → Set (Either Coin (Credential 'Staking (EraCrypto era))) → Map (Either Coin (Credential 'Staking (EraCrypto era))) (Map (KeyHash 'StakePool (EraCrypto era)) 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

addKeyWitnessesEraTx era ⇒ Tx era → Set (WitVKey 'Witness (EraCrypto era)) → Tx era Source #

evaluateTransactionBalance Source #

Arguments

EraUTxO era 
PParams era

Current protocol parameters

CertState era

Where the deposit info is stored

UTxO era

The UTxO relevant to the transaction.

TxBody era

The transaction being evaluated for balance.

Value era

The difference between what the transaction consumes and what it produces.

Deprecated: In favor of new API function evalBalanceTxBody

Evaluate the difference between the value currently being consumed by a transaction and the number of lovelace being produced. This value will be zero for a valid transaction.

evaluateMinLovelaceOutputEraTxOut era ⇒ PParams era → TxOut era → Coin Source #

Deprecated: In favor of getMinCoinTxOut

Evaluate the minimum lovelace that a given transaction output must contain.

addShelleyKeyWitnesses ∷ (EraTx era, Tx era ~ ShelleyTx era) ⇒ ShelleyTx era → Set (WitVKey 'Witness (EraCrypto era)) → ShelleyTx era Source #

Deprecated: In favor of addKeyWitnesses

Ada pots

data AdaPots Source #

Instances

Instances details
Generic AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Associated Types

type Rep AdaPotsTypeType Source #

Methods

fromAdaPotsRep AdaPots x Source #

toRep AdaPots x → AdaPots Source #

Show AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

NFData AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Methods

rnfAdaPots → () Source #

Eq AdaPots Source # 
Instance details

Defined in Cardano.Ledger.Shelley.AdaPots

Methods

(==)AdaPotsAdaPotsBool Source #

(/=)AdaPotsAdaPotsBool Source #

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.11.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) ⇒ EpochState era → Coin Source #

Calculate the total ada in the epoch state

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

Calculate the total ada pots in the epoch state