# Staking

# Delegations

Terra.staking.delegations(delegator=None, validator=None)

Queries all delegations, filtering by delegator, validator, or both.

# get all delegations for a delegator
terra.staking.delegations(delegator="terra...")

# get all delegations for a validator
terra.staking.delegations(validator="terravaloper...")

# get delegation between delegator & validator (list of 1)
terra.staking.delegations(delegator="terra...", validator="terravaloper...")

# Parameters

At least one of the following must be provided.

AccAddress
delegator
optional

Delegator's account address.


ValAddress
validator
optional

Validator's operator address.


DEFAULT None

# Returns

Delegation[]

List of delegations with the delegator and/or validator queried.

# Unbonding Delegations

Terra.staking.unbonding_delegations(delegator=None, validator=None)

Queries all unbonding delegations, filtering by delegator, validator, or both.

# get all unbonding delegations for a delegator
terra.staking.unbonding_delegations(delegator="terra...")

# get all unbonding delegations for a validator
terra.staking.unbonding_delegations(validator="terravaloper...")

# get unbonding delegation between delegator & validator (list of 1)
terra.staking.unbonding_delegations(
    delegator="terra...",
    validator="terravaloper..."
)

# Parameters

At least one of the following must be provided.

AccAddress
delegator
optional

Delegator's account address.


DEFAULT None
ValAddress
validator
optional

Validator's operator address.


DEFAULT None

# Returns

UnbondingDelegation[]

List of unbonding delegations with the delegator and/or validator queried.

# Redelegations

Terra.staking.redelegations(delegator=None, validator_src=None, validator_dst=None)

Queries all redelegations, filterable by delegator, source validator, and target validator.

# get all redelegations
terra.staking.redelegations()

# get all redelegations for a delegator
terra.staking.redelegations(delegator="terra...")

# get all redelegations for a validator
terra.staking.redelegations(validator_src="terravaloper...")

# get the redelegation between delegator & src validator
terra.staking.redelegations(
    delegator="terra...",
    validator_src="terravaloper..."
)

# ... similar examples for target validator

# Parameters

AccAddress
delegator
optional

Delegator's account address.


DEFAULT None
ValAddress
validator_src
optional

Source validator's operator address (from).


DEFAULT None
ValAddress
validator_dst
optional

Destination validator's operator address (to).


DEFAULT None

# Returns

Redelegation[]

List of redelegations with the queried conditions. If no filters were applied, all existing redelegations are gathered.

# Bonded Validators

Terra.staking.bonded_validators_for(delegator)

Gets all bonded validators for a delegator given its address.

terra.staking.bonded_validators_for("terra...") # -> list

# Parameters

AccAddress
delegator

Delegator's account address.


# Returns

Validator[]

List of validators that the delegator is currently bonded to.

# Staking Transactions

Terra.staking.staking_txs_for(delegator)

Get the list of staking-transactions associated with an account.

WARNING

Currently not implemented.

# Validators

Terra.staking.validators()

Get all current registered validators, including validators that are not currently in the validating set, which can be found with Terra.delegates().

terra.staking.validators() # -> List[Validator]

# Returns

Validator[]

List of all current registered validators.

# Validator Info

Terra.staking.val_info_for(validator)

Look up a validator's information by its operator address.

terra.staking.val_info_for("terravaloper...") # -> Validator

# Parameters

ValAddress
validator
Validator's operator address

# Returns

Validator

Validator's information.

# Staking Pool

Terra.staking.pool(key=None)

Gets the current value of the Staking Pool.

terra.staking.pool() # -> dict
terra.staking.pool("not_bonded") # -> Coin in Luna

# Parameters

str
key
optional

One of "bonded", "not_bonded".


# Returns

JiguBox with the following keys:

Coin
bonded

Amount of Luna currently staked (is bonded).

Coin
not_bonded

Amount of Luna currently not staked or unbonding.

# Module Params

Terra.staking.params(key=None)

Gets the current value of the staking module params.

terra.staking.params() # -> dict
terra.staking.params("max_validators") # -> int

# Parameters

str
key
optional

One of "unbonding_time", "max_validators", "max_entries", or "bond_denom".


# Returns

JiguBox with the following keys:

int
unbonding_time

Amount of time, in seconds, for bonded staking tokens to be unbonded.

int
max_validators

Max number of validators for the validating set (delegates).

int
max_entries

Maximum entries for unbonding delegations and redelegations.

str
bond_denom

The denomination used as the staking token (probably Luna).

Updated on: 3/10/2020, 12:51:48 PM