staking

package
v0.2601.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package staking implements the CometBFT backed staking backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventsFromCometBFT

func EventsFromCometBFT(
	tx cmttypes.Tx,
	height int64,
	tmEvents []cmtabcitypes.Event,
) ([]*api.Event, error)

EventsFromCometBFT extracts staking events from CometBFT events.

Types

type LightQueryFactory added in v0.2504.0

type LightQueryFactory struct {
	// contains filtered or unexported fields
}

LightQueryFactory is a staking light query factory.

func (*LightQueryFactory) QueryAt added in v0.2504.0

func (f *LightQueryFactory) QueryAt(ctx context.Context, height int64) (Query, error)

QueryAt returns a staking query for a specific height.

type Query added in v0.2504.0

type Query interface {
	// TotalSupply returns the total supply balance.
	TotalSupply(context.Context) (*quantity.Quantity, error)
	// CommonPool returns the balance of the global common pool.
	CommonPool(context.Context) (*quantity.Quantity, error)
	// LastBlockFees returns the last block fees balance.
	LastBlockFees(context.Context) (*quantity.Quantity, error)
	// GovernanceDeposits returns the governance deposits balance.
	GovernanceDeposits(context.Context) (*quantity.Quantity, error)
	// Threshold returns the currently configured threshold.
	Threshold(context.Context, staking.ThresholdKind) (*quantity.Quantity, error)
	// DebondingInterval returns the debonding interval.
	DebondingInterval(context.Context) (beacon.EpochTime, error)
	// Addresses returns the non-empty addresses from the staking ledger.
	Addresses(context.Context) ([]staking.Address, error)
	// CommissionScheduleAddresses returns addresses that have a non empty commission schedule configured.
	CommissionScheduleAddresses(context.Context) ([]staking.Address, error)
	// Account returns the staking account for the given account address.
	Account(context.Context, staking.Address) (*staking.Account, error)
	// DelegationsFor returns the list of (outgoing) delegations for the given
	// owner (delegator).
	DelegationsFor(context.Context, staking.Address) (map[staking.Address]*staking.Delegation, error)
	// DelegationInfosFor returns (outgoing) delegations with additional
	// information for the given owner (delegator).
	DelegationInfosFor(context.Context, staking.Address) (map[staking.Address]*staking.DelegationInfo, error)
	// DelegationsTo returns the list of (incoming) delegations to the given
	// account.
	DelegationsTo(context.Context, staking.Address) (map[staking.Address]*staking.Delegation, error)
	// DebondingDelegationsFor returns the list of (outgoing) debonding
	// delegations for the given owner (delegator).
	DebondingDelegationsFor(context.Context, staking.Address) (map[staking.Address][]*staking.DebondingDelegation, error)
	// DebondingDelegationInfosFor returns (outgoing) debonding delegations
	// with additional information for the given owner (delegator).
	DebondingDelegationInfosFor(context.Context, staking.Address) (map[staking.Address][]*staking.DebondingDelegationInfo, error)
	// DebondingDelegationsTo returns the list of (incoming) debonding
	// delegations to the given account.
	DebondingDelegationsTo(context.Context, staking.Address) (map[staking.Address][]*staking.DebondingDelegation, error)
	// Genesis returns the genesis state.
	Genesis(context.Context) (*staking.Genesis, error)
	// ConsensusParameters returns the consensus parameters.
	ConsensusParameters(context.Context) (*staking.ConsensusParameters, error)
}

Query is the staking query interface.

type QueryFactory added in v0.2504.0

type QueryFactory interface {
	// QueryAt returns a query for the given block height.
	QueryAt(ctx context.Context, height int64) (Query, error)
}

QueryFactory is a staking query factory implementation.

func NewLightQueryFactory added in v0.2504.0

func NewLightQueryFactory(rooter abciAPI.StateRooter, syncer syncer.ReadSyncer) QueryFactory

NewLightQueryFactory returns a new staking query factory backed by a trusted state root provider and an untrusted read syncer.

func NewStateQueryFactory added in v0.2504.0

func NewStateQueryFactory(state abciAPI.ApplicationState) QueryFactory

NewStateQueryFactory returns a new staking query factory backed by the given application state.

type ServiceClient

type ServiceClient struct {
	tmapi.BaseServiceClient
	// contains filtered or unexported fields
}

ServiceClient is the scheduler service client.

func New

func New(consensus consensus.Backend, querier QueryFactory) *ServiceClient

New constructs a new CometBFT backed staking service client.

func (*ServiceClient) Account added in v0.2502.0

func (sc *ServiceClient) Account(ctx context.Context, query *api.OwnerQuery) (*api.Account, error)

func (*ServiceClient) Addresses added in v0.2502.0

func (sc *ServiceClient) Addresses(ctx context.Context, height int64) ([]api.Address, error)

func (*ServiceClient) Allowance added in v0.2502.0

func (sc *ServiceClient) Allowance(ctx context.Context, query *api.AllowanceQuery) (*quantity.Quantity, error)

func (*ServiceClient) CommissionScheduleAddresses added in v0.2502.0

func (sc *ServiceClient) CommissionScheduleAddresses(ctx context.Context, height int64) ([]api.Address, error)

func (*ServiceClient) CommonPool added in v0.2502.0

func (sc *ServiceClient) CommonPool(ctx context.Context, height int64) (*quantity.Quantity, error)

func (*ServiceClient) ConsensusParameters added in v0.2502.0

func (sc *ServiceClient) ConsensusParameters(ctx context.Context, height int64) (*api.ConsensusParameters, error)

func (*ServiceClient) DebondingDelegationInfosFor added in v0.2502.0

func (sc *ServiceClient) DebondingDelegationInfosFor(ctx context.Context, query *api.OwnerQuery) (map[api.Address][]*api.DebondingDelegationInfo, error)

func (*ServiceClient) DebondingDelegationsFor added in v0.2502.0

func (sc *ServiceClient) DebondingDelegationsFor(ctx context.Context, query *api.OwnerQuery) (map[api.Address][]*api.DebondingDelegation, error)

func (*ServiceClient) DebondingDelegationsTo added in v0.2502.0

func (sc *ServiceClient) DebondingDelegationsTo(ctx context.Context, query *api.OwnerQuery) (map[api.Address][]*api.DebondingDelegation, error)

func (*ServiceClient) DelegationInfosFor added in v0.2502.0

func (sc *ServiceClient) DelegationInfosFor(ctx context.Context, query *api.OwnerQuery) (map[api.Address]*api.DelegationInfo, error)

func (*ServiceClient) DelegationsFor added in v0.2502.0

func (sc *ServiceClient) DelegationsFor(ctx context.Context, query *api.OwnerQuery) (map[api.Address]*api.Delegation, error)

func (*ServiceClient) DelegationsTo added in v0.2502.0

func (sc *ServiceClient) DelegationsTo(ctx context.Context, query *api.OwnerQuery) (map[api.Address]*api.Delegation, error)

func (*ServiceClient) DeliverEvent added in v0.2502.0

func (sc *ServiceClient) DeliverEvent(_ context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error

DeliverEvent implements api.ServiceClient.

func (*ServiceClient) GetEvents added in v0.2502.0

func (sc *ServiceClient) GetEvents(ctx context.Context, height int64) ([]*api.Event, error)

func (*ServiceClient) GovernanceDeposits added in v0.2502.0

func (sc *ServiceClient) GovernanceDeposits(ctx context.Context, height int64) (*quantity.Quantity, error)

func (*ServiceClient) LastBlockFees added in v0.2502.0

func (sc *ServiceClient) LastBlockFees(ctx context.Context, height int64) (*quantity.Quantity, error)

func (*ServiceClient) ServiceDescriptor added in v0.2502.0

func (sc *ServiceClient) ServiceDescriptor() *tmapi.ServiceDescriptor

ServiceDescriptor implements api.ServiceClient.

func (*ServiceClient) StateToGenesis added in v0.2502.0

func (sc *ServiceClient) StateToGenesis(ctx context.Context, height int64) (*api.Genesis, error)

func (*ServiceClient) Threshold added in v0.2502.0

func (sc *ServiceClient) Threshold(ctx context.Context, query *api.ThresholdQuery) (*quantity.Quantity, error)

func (*ServiceClient) TokenSymbol added in v0.2502.0

func (sc *ServiceClient) TokenSymbol(ctx context.Context, height int64) (string, error)

func (*ServiceClient) TokenValueExponent added in v0.2502.0

func (sc *ServiceClient) TokenValueExponent(ctx context.Context, height int64) (uint8, error)

func (*ServiceClient) TotalSupply added in v0.2502.0

func (sc *ServiceClient) TotalSupply(ctx context.Context, height int64) (*quantity.Quantity, error)

func (*ServiceClient) WatchEvents added in v0.2502.0

func (sc *ServiceClient) WatchEvents(context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error)

type StateQueryFactory added in v0.2504.0

type StateQueryFactory struct {
	// contains filtered or unexported fields
}

StateQueryFactory is a staking state query factory.

func (*StateQueryFactory) QueryAt added in v0.2504.0

func (f *StateQueryFactory) QueryAt(ctx context.Context, height int64) (Query, error)

QueryAt returns a staking query for a specific height.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL