Cardanoex.StakePool (cardanoex v0.6.0)
The stake pool module let's you manage stake pools.
Link to this section Summary
Functions
Estimate fee for joining or leaving a stake pool. Note that it is an estimation because a delegation induces a transaction for which coins have to be selected randomly within the wallet. Because of this randomness, fees can only be estimated.
Delegate all (current and future) addresses from the given wallet to the given stake pool.
List all known stake pools ordered by descending non_myopic_member_rewards. The non_myopic_member_rewards — and thus the ordering — depends on the stake
parameter.
List stake-keys relevant to the wallet, and how much ada is associated with each.
Stop delegating completely. The wallet's stake will become inactive.
Performs maintenance actions on stake pools, such as triggering metadata garbage collection.
Returns the current status of the stake pools maintenance actions.
Link to this section Types
fee_estimation()
Specs
fee_estimation() :: %{ estimated_min: %{quantity: non_neg_integer(), unit: String.t()}, estimated_max: %{quantity: non_neg_integer(), unit: String.t()}, minimum_coins: [%{quantity: non_neg_integer(), unit: String.t()}], deposit: %{quantity: non_neg_integer(), unit: String.t()} }
stake_key()
Specs
stake_key() :: %{ ours: [ %{ index: non_neg_integer(), key: String.t(), stake: %{quantity: non_neg_integer(), unit: String.t()}, reward_balance: %{quantity: non_neg_integer(), unit: String.t()}, delegation: %{ active: %{status: String.t(), target: String.t()}, next: [ %{ status: String.t(), target: String.t(), changes_at: %{ epoch_number: non_neg_integer(), epoch_start_time: String.t() } } ] } } ], foreign: [ %{ key: String.t(), stake: %{quantity: non_neg_integer(), unit: String.t()}, reward_balance: %{quantity: non_neg_integer(), unit: String.t()} } ], none: %{stake: %{quantity: non_neg_integer(), unit: String.t()}} }
stake_pool()
Specs
stake_pool() :: %{ id: String.t(), metrics: %{ non_myopic_member_rewards: %{quantity: non_neg_integer(), unit: String.t()} }, relative_stake: %{quantity: float(), unit: String.t()}, saturation: float(), produced_blocks: %{quantity: non_neg_integer(), unit: String.t()}, cost: %{quantity: non_neg_integer(), unit: String.t()}, margin: %{quantity: float(), unit: String.t()}, pledge: %{quantity: non_neg_integer(), unit: String.t()}, metadata: %{ ticker: String.t(), name: String.t(), description: String.t(), homepage: String.t() }, retirement: %{epoch_number: non_neg_integer(), epoch_start_time: String.t()}, flags: [String.t()] }
Link to this section Functions
estimate_fee(wallet_id)
Specs
estimate_fee(String.t()) :: {:error, String.t()} | {:ok, fee_estimation()}
Estimate fee for joining or leaving a stake pool. Note that it is an estimation because a delegation induces a transaction for which coins have to be selected randomly within the wallet. Because of this randomness, fees can only be estimated.
Options
wallet_id
- hex based string. 40 characters
join(wallet_id, stake_pool_id, passphrase)
Specs
join(String.t(), String.t(), String.t()) :: {:error, String.t()} | {:ok, Cardanoex.Transaction.transaction()}
Delegate all (current and future) addresses from the given wallet to the given stake pool.
Note: Bech32-encoded stake pool identifiers can vary in length.
Options
wallet_id
- hex based string. 40 charactersstake_pool_id
- hex|bech32 stringpassphrase
- Wallet passphrase
list(stake)
Specs
list(non_neg_integer()) :: {:error, String.t()} | {:ok, [stake_pool()]}
List all known stake pools ordered by descending non_myopic_member_rewards. The non_myopic_member_rewards — and thus the ordering — depends on the stake
parameter.
Some pools may also have metadata attached to them.
Options
- stake - The stake the user intends to delegate in Lovelace. Required.
list_stake_keys(wallet_id)
Specs
List stake-keys relevant to the wallet, and how much ada is associated with each.
Options
wallet_id
- hex based string. 40 characters
quit(wallet_id, passphrase)
Specs
quit(String.t(), String.t()) :: {:error, String.t()} | {:ok, Cardanoex.Transaction.transaction()}
Stop delegating completely. The wallet's stake will become inactive.
Options
wallet_id
- hex based string. 40 characterspassphrase
- Wallet passphrase
trigger_maintenance_action(action)
Specs
Performs maintenance actions on stake pools, such as triggering metadata garbage collection.
Actions may not be instantaneous.
view_maintenance_actions()
Specs
view_maintenance_actions() :: {:error, String.t()} | {:ok, %{gc_stake_pools: %{status: String.t(), last_run: String.t()}}}
Returns the current status of the stake pools maintenance actions.