cardano-ledger-shelley-0.1.0.0
Safe Haskell None
Language Haskell2010

Cardano.Ledger.Shelley.API.Wallet

Synopsis

UTxOs

getUTxO :: NewEpochState era -> UTxO era Source #

Get the full UTxO.

getFilteredUTxO :: Era era => NewEpochState era -> Set ( Addr ( Crypto era)) -> UTxO era Source #

Get the UTxO filtered by address.

Stake Pools

getPools :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era)) Source #

Get the current registered stake pools.

getPoolParameters :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era)) -> Map ( KeyHash ' StakePool ( Crypto era)) ( PoolParams ( Crypto 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.

getTotalStake :: Globals -> NewEpochState era -> Coin Source #

Calculate the current total stake.

poolsByTotalStakeFraction :: forall era. Globals -> NewEpochState era -> PoolDistr ( Crypto 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.

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
Eq RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Show RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Generic RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NFData RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToJSON RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

FromJSON RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToCBOR RewardInfoPool Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

FromCBOR 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

data RewardParams Source #

Global information that influences stake pool rewards

Constructors

RewardParams

Fields

Instances

Instances details
Eq RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Show RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

Generic RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

NFData RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToJSON RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

FromJSON RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

ToCBOR RewardParams Source #
Instance details

Defined in Cardano.Ledger.Shelley.API.Wallet

FromCBOR 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

getRewardInfoPools :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> ( RewardParams , Map ( KeyHash ' StakePool ( Crypto 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 :: forall era. ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_d" ( PParams era) UnitInterval , HasField "_nOpt" ( PParams era) Natural , HasField "_protocolVersion" ( PParams era) ProtVer , HasField "_rho" ( PParams era) UnitInterval , HasField "_tau" ( PParams era) UnitInterval ) => Globals -> NewEpochState era -> ( RewardUpdate ( Crypto era), RewardProvenance ( Crypto 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.

getNonMyopicMemberRewards :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> Set ( Either Coin ( Credential ' Staking ( Crypto era))) -> Map ( Either Coin ( Credential ' Staking ( Crypto era))) ( Map ( KeyHash ' StakePool ( Crypto 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

class ( Era era, HasField "_minfeeA" ( PParams era) Natural , HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era)))) => CLI era where Source #

A collection of functons to help construction transactions from the cardano-cli.

Methods

evaluateMinFee :: PParams era -> Tx era -> Coin Source #

The minimum fee calculation. Used for the default implentation of evaluateTransactionFee .

evaluateConsumed :: PParams era -> UTxO era -> TxBody era -> Value era Source #

The consumed calculation. Used for the default implentation of evaluateTransactionBalance .

addKeyWitnesses :: Tx era -> Set ( WitVKey ' Witness ( Crypto era)) -> Tx era Source #

evaluateTransactionBalance Source #

Arguments

:: PParams era

The current protocol parameters.

-> UTxO era

The UTxO relevant to the transaction.

-> ( KeyHash ' StakePool ( Crypto era) -> Bool )

A predicate that a stake pool ID is new (i.e. unregistered). Typically this will be:

  (notMember stakepools)
-> TxBody era

The transaction being evaluated for balance.

-> Value era

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

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.

evaluateTransactionFee Source #

Arguments

:: PParams era

The current protocol parameters.

-> Tx era

The transaction.

-> Word

The number of key witnesses still to be added to the transaction.

-> Coin

The required fee.

Evaluate the fee for a given transaction.

evaluateMinLovelaceOutput :: PParams era -> TxOut era -> Coin Source #

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

totalAdaES :: UsesValue era => EpochState era -> Coin Source #

Calculate the total ada in the epoch state

totalAdaPotsES :: UsesValue era => EpochState era -> AdaPots Source #

Calculate the total ada pots in the epoch state