Staking
API
- class terra_sdk.client.lcd.api.staking.StakingAPI(c)[source]
- bonded_validators(delegator, params=None)[source]
Fetches the list of validators a delegator is currently delegating to.
- Parameters
delegator (AccAddress) – delegator account address
params (APIParams, optional) – additional params for the API like pagination
- Returns
currently bonded validators dict: pagination info
- Return type
List[Validator]
- delegation(delegator, validator)[source]
Fetch a single delegation via a delegator, validator pair.
- Parameters
delegator (Optional[AccAddress) – delegator account address
validator (Optional[ValAddress], optional) – validator operator address
- Returns
delegation
- Return type
- delegations(delegator=None, validator=None, params=None)[source]
Fetches current delegations, filtering by delegator, validator, or both.
- Parameters
delegator (Optional[AccAddress], optional) – delegator account address.
validator (Optional[ValAddress], optional) – validator operator address.
params (APIParams, optional) – additional params for the API like pagination
- Raises
TypeError – if both
delegator
andvalidator
areNone
.- Returns
delegations dict: pagination info
- Return type
List[Delegation]
- parameters()[source]
Fetch Staking module parameters.
- Returns
Staking module parameters
- Return type
dict
- pool()[source]
Fetch current staking pool information.
- Returns
information about current staking pool
- Return type
StakingPool
- redelegations(delegator=None, validator_src=None, validator_dst=None, params=None)[source]
Fetch redelgations.
- Parameters
delegator (Optional[AccAddress], optional) – delegator account address.
validator_src (Optional[ValAddress], optional) – source validator operator address (from).
validator_dst (Optional[ValAddress], optional) – dest. validator operator address (to).
params (APIParams, optional) – additional params for the API like pagination
- Returns
redelegations dict: pagination info
- Return type
List[Redelegation]
- unbonding_delegation(delegator, validator)[source]
Fetch a single undelegation via a delegator, validator pair.
- Parameters
delegator (AccAddress) – delegator account address
validator (ValAddress) – validator operator address
- Returns
undelegation
- Return type
- unbonding_delegations(delegator=None, validator=None, params=None)[source]
Fetches current undelegations, filtering by delegator, validator, or both.
- Parameters
delegator (Optional[AccAddress], optional) – delegator account address.
validator (Optional[ValAddress], optional) – validator operator address.
params (APIParams, optional) – additional params for the API like pagination
- Raises
TypeError – if both
delegator
andvalidator
areNone
.- Returns
undelegations dict: pagination info
- Return type
List[UnbondingDelegation]
- validator(validator)[source]
Fetch information about a single validator.
- Parameters
validator (ValAddress) – validator operator address
- Returns
validator information
- Return type
Data
Delegation
- class terra_sdk.core.staking.data.delegation.Delegation(delegation, balance)[source]
Contains information about a current delegation pair (
delegator_address
,validator_address
)
- class terra_sdk.core.staking.data.delegation.Redelegation(redelegation, entries)[source]
Contains informations about a redelgation for delegation tuple (
delegator_address
,validator_src_address
,validator_dst_address
)- entries: List[terra_sdk.core.staking.data.delegation.RedelegationEntry]
- redelegation: terra_sdk.core.staking.data.delegation.RedelegationInfo
- class terra_sdk.core.staking.data.delegation.RedelegationEntry(redelegation_entry, balance)[source]
Contains information about an active redelegated lot of Luna.
- balance: int
- redelegation_entry: terra_sdk.core.staking.data.delegation.RedelegationEntryInfo
- class terra_sdk.core.staking.data.delegation.UnbondingDelegation(delegator_address, validator_address, entries)[source]
Contains information about undelegations for a delegation pair (
delegator_address
,validator_address
)- delegator_address: AccAddress
- validator_address: ValAddress
Validator
- class terra_sdk.core.staking.data.validator.BondStatus(value)[source]
BondStatus is the status of a validator.
- class terra_sdk.core.staking.data.validator.Commission(commission_rates, update_time)[source]
Contains information about validator’s commission rates.
- commission_rates: terra_sdk.core.staking.data.validator.CommissionRates
Validator commission rates.
- update_time: datetime.datetime
Last time commission rates were updated.
- class terra_sdk.core.staking.data.validator.CommissionRates(rate, max_rate, max_change_rate)[source]
Data structure for validator’s commission rates & policy.
- max_change_rate: terra_sdk.core.numeric.Dec
Maximum % change of commission per day.
- max_rate: terra_sdk.core.numeric.Dec
Maximum % commission rate permitted by policy.
- rate: terra_sdk.core.numeric.Dec
Current % commission rate.
- class terra_sdk.core.staking.data.validator.Description(moniker='', identity='', website='', details='', security_contact='')[source]
Validator description entry.
- Parameters
moniker (
str
) – validator name, aka: “Terran One”identity (
str
) – keybase.io identifier (used for setting logo)website (
str
) – validator websitedetails (
str
) – longer description of validatorsecurity_contact (
str
) – contact information for validator
- DO_NOT_MODIFY = '[do-not-modify]'
- class terra_sdk.core.staking.data.validator.Validator(operator_address, consensus_pubkey, jailed, status, tokens, delegator_shares, description, unbonding_height, unbonding_time, commission, min_self_delegation)[source]
Contains information about a registered validator.
- consensus_pubkey: terra_sdk.core.public_key.ValConsPubKey
- description: terra_sdk.core.staking.data.validator.Description
- jailed: bool
- min_self_delegation: int
- operator_address: ValAddress
- to_data()[source]
Converts the object to its JSON-serializable Python data representation.
- Return type
dict
- tokens: int
- unbonding_height: int
- unbonding_time: datetime.datetime
Messages
Staking module message types.
- class terra_sdk.core.staking.msgs.MsgBeginRedelegate(delegator_address, validator_src_address, validator_dst_address, amount)[source]
Redelegate staked Luna from
validator_src_address
tovaldiator_dst_address
.- Parameters
delegator_address (AccAddress) – delegator
validator_src_address (ValAddress) – validator to remove delegation FROM
validator_dst_address (ValAddress) – validator to transfer delegate TO
amount (Union[str, dict, Coin]) – coin (LUNA) to redelegate
- action = 'begin_redelegate'
- type_amino = 'staking/MsgBeginRedelegate'
- type_url: str = '/cosmos.staking.v1beta1.MsgBeginRedelegate'
- class terra_sdk.core.staking.msgs.MsgCreateValidator(description, commission, min_self_delegation, delegator_address, validator_address, pubkey, value)[source]
Register a new validator with the Terra protocol.
- Parameters
description (Description) – validator description
commission (CommissionRates) – validator commission rates
min_self_delegation (int) – minimum self-delegation policy
delegator_address (AccAddress) – validator’s account address
validator_address (ValAddress) – validator’s operator address
pubkey (ValConsPubKey) – validator consensus (Tendermint) public key
value (Coin.Input) – initial amount of Luna toi self-delegate
- action = 'create_validator'
- type: str = 'staking/MsgCreateValidator'
- type_url: str = '/cosmos.staking.v1beta1.MsgCreateValidator'
- class terra_sdk.core.staking.msgs.MsgDelegate(delegator_address, validator_address, amount)[source]
Delegate Luna to validator at
validator_address
.- Parameters
delegator_address (AccAddress) – delegator
validator_address (ValAddress) – validator to delegate to
amount (Union[str, dict, Coin]) – coin (LUNA) to delegate
- action = 'delegate'
- type_amino = 'staking/MsgDelegate'
- type_url: str = '/cosmos.staking.v1beta1.MsgDelegate'
- class terra_sdk.core.staking.msgs.MsgEditValidator(description, validator_address, commission_rate=None, min_self_delegation=None)[source]
Revise validator description and configuration.
- Parameters
description (
Description
) – updated validator descriptionvalidator_address (
NewType()
(ValAddress
,str
)) – validator operator addresscommission_rates – new validator commission rate,
min_self_delegation (
Optional
[int
]) – new minimum self delegation,
- action = 'edit_validator'
- type: str = 'staking/MsgEditValidator'
- type_url: str = '/cosmos.staking.v1beta1.MsgEditValidator'
- class terra_sdk.core.staking.msgs.MsgUndelegate(delegator_address, validator_address, amount)[source]
Undelegate Luna from staking position with
validator_address
.- Parameters
delegator_address (AccAddress) – delegator
validator_address (ValAddress) – validator to undelegate from
amount (Union[str, dict, Coin]) – coin (LUNA) to undelegate
- action = 'begin_unbonding'
- type_amino = 'staking/MsgUndelegate'
- type_url: str = '/cosmos.staking.v1beta1.MsgUndelegate'