cosmosapp

package
v1.7.45 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const ACCOUNT_BASE = "/cosmos.auth.v1beta1.BaseAccount"
View Source
const ACCOUNT_MODULE = "/cosmos.auth.v1beta1.ModuleAccount"
View Source
const ACCOUNT_VESTING_CONTINUOUS = "/cosmos.vesting.v1beta1.ContinuousVestingAccount"
View Source
const ACCOUNT_VESTING_DELAYED = "/cosmos.vesting.v1beta1.DelayedVestingAccount"
View Source
const ACCOUNT_VESTING_PERIODIC = "/cosmos.vesting.v1beta1.PeriodicVestingAccount"

Variables

View Source
var ErrAccountNoDelegation = errors.New("account has no delegation")
View Source
var ErrAccountNotFound = errors.New("account not found")
View Source
var ErrProposalNotFound = errors.New("proposal not found")

Functions

This section is empty.

Types

type Account

type Account struct {
	Type          string  `json:"type"`
	Address       string  `json:"address"`
	MaybePubkey   *PubKey `json:"pubkey"`
	AccountNumber string  `json:"account_number"`
	Sequence      string  `json:"sequence"`

	MaybeModuleAccount            *ModuleAccount            `json:"module_account"`
	MaybeDelayedVestingAccount    *DelayedVestingAccount    `json:"delayed_vesting_account"`
	MaybeContinuousVestingAccount *ContinuousVestingAccount `json:"continuous_vesting_account"`
	MaybePeriodicVestingAccount   *PeriodicVestingAccount   `json:"periodic_vesting_account"`
}

type Change

type Change struct {
	Subspace string `json:"subspace"`
	Key      string `json:"key"`
	Value    string `json:"value"`
}

type Client

type Client interface {
	Account(accountAddress string) (*Account, error)
	Balances(accountAddress string) (coin.Coins, error)
	BalanceByDenom(accountAddresss string, denom string) (coin.Coin, error)
	BondedBalance(accountAddress string) (coin.Coins, error)
	RedelegatingBalance(accountAddress string) (coin.Coins, error)
	UnbondingBalance(accountAddress string) (coin.Coins, error)

	SupplyByDenom(denom string) (coin.Coin, error)

	TotalRewards(accountAddress string) (coin.DecCoins, error)
	Commission(validatorAddress string) (coin.DecCoins, error)
	CommunityPool() (coin.DecCoins, error)

	Validator(validatorAddress string) (*Validator, error)
	Delegation(delegator string, validator string) (*DelegationResponse, error)
	TotalBondedBalance() (coin.Coin, error)
	CommunityTax() (*big.Float, error)

	AnnualProvisions() (coin.DecCoin, error)

	Proposals() ([]Proposal, error)
	ProposalById(id string) (Proposal, error)
	ProposalTally(id string) (Tally, error)

	Tx(txHash string) (*model.Tx, error)
}

type Content

type Content struct {
	Type        string   `json:"@type"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Changes     []Change `json:"changes"`
}

type ContinuousVestingAccount

type ContinuousVestingAccount struct {
	OriginalVesting  []VestingBalance `json:"original_vesting"`
	DelegatedFree    []VestingBalance `json:"delegated_free"`
	DelegatedVesting []VestingBalance `json:"delegated_vesting"`
	StartTime        string           `json:"start_time"`
	EndTime          string           `json:"end_time"`
}

type DelayedVestingAccount

type DelayedVestingAccount struct {
	OriginalVesting  []VestingBalance `json:"original_vesting"`
	DelegatedFree    []VestingBalance `json:"delegated_free"`
	DelegatedVesting []VestingBalance `json:"delegated_vesting"`
	EndTime          string           `json:"end_time"`
}

type Delegation

type Delegation struct {
	DelegatorAddress string `json:"delegator_address"`
	ValidatorAddress string `json:"validator_address"`
	Shares           string `json:"shares"`
}

type DelegationBalance

type DelegationBalance struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type DelegationResponse

type DelegationResponse struct {
	Delegation Delegation        `json:"delegation"`
	Balance    DelegationBalance `json:"balance"`
}

type FinalTallyResult

type FinalTallyResult struct {
	Yes        string `json:"yes"`
	Abstain    string `json:"abstain"`
	No         string `json:"no"`
	NoWithVeto string `json:"no_with_veto"`
}

type MockClient

type MockClient struct {
	mock.Mock
}

func NewMockClient

func NewMockClient() *MockClient

func (*MockClient) Account

func (conn *MockClient) Account(accountAddress string) (*Account, error)

func (*MockClient) AnnualProvisions

func (conn *MockClient) AnnualProvisions() (coin.DecCoin, error)

func (*MockClient) BalanceByDenom

func (conn *MockClient) BalanceByDenom(accountAddress string, denom string) (coin.Coin, error)

func (*MockClient) Balances

func (conn *MockClient) Balances(accountAddress string) (coin.Coins, error)

func (*MockClient) BondedBalance

func (conn *MockClient) BondedBalance(accountAddress string) (coin.Coins, error)

func (*MockClient) Commission

func (conn *MockClient) Commission(validatorAddress string) (coin.DecCoins, error)

func (*MockClient) CommunityPool added in v1.7.42

func (conn *MockClient) CommunityPool() (coin.DecCoins, error)

func (*MockClient) CommunityTax added in v1.7.15

func (conn *MockClient) CommunityTax() (*big.Float, error)

func (*MockClient) Delegation

func (conn *MockClient) Delegation(delegator string, validator string) (*DelegationResponse, error)

func (*MockClient) ProposalById

func (conn *MockClient) ProposalById(id string) (Proposal, error)

func (*MockClient) ProposalTally

func (conn *MockClient) ProposalTally(id string) (Tally, error)

func (*MockClient) Proposals

func (conn *MockClient) Proposals() ([]Proposal, error)

func (*MockClient) RedelegatingBalance

func (conn *MockClient) RedelegatingBalance(accountAddress string) (coin.Coins, error)

func (*MockClient) SupplyByDenom added in v1.7.42

func (conn *MockClient) SupplyByDenom(denom string) (coin.Coin, error)

func (*MockClient) TotalBondedBalance

func (conn *MockClient) TotalBondedBalance() (coin.Coin, error)

func (*MockClient) TotalRewards

func (conn *MockClient) TotalRewards(accountAddress string) (coin.DecCoins, error)

func (*MockClient) Tx added in v1.5.1

func (conn *MockClient) Tx(txHash string) (*model.Tx, error)

func (*MockClient) UnbondingBalance

func (conn *MockClient) UnbondingBalance(accountAddress string) (coin.Coins, error)

func (*MockClient) Validator

func (conn *MockClient) Validator(validatorAddress string) (*Validator, error)

type ModuleAccount

type ModuleAccount struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
}

type PeriodicVestingAccount

type PeriodicVestingAccount struct {
	OriginalVesting  []VestingBalance `json:"original_vesting"`
	DelegatedFree    []VestingBalance `json:"delegated_free"`
	DelegatedVesting []VestingBalance `json:"delegated_vesting"`
	StartTime        string           `json:"start_time"`
	EndTime          string           `json:"end_time"`
	VestingPeriods   []VestingPeriod  `json:"vesting_periods"`
}

type Proposal

type Proposal struct {
	ProposalID       string           `json:"proposal_id"`
	Content          Content          `json:"content"`
	Status           string           `json:"status"`
	FinalTallyResult FinalTallyResult `json:"final_tally_result"`
	SubmitTime       string           `json:"submit_time"`
	DepositEndTime   string           `json:"deposit_end_time"`
	TotalDeposit     []TotalDeposit   `json:"total_deposit"`
	VotingStartTime  string           `json:"voting_start_time"`
	VotingEndTime    string           `json:"voting_end_time"`
}

type PubKey

type PubKey struct {
	Type string `json:"@type"`
	Key  string `json:"key"`
}

type Tally

type Tally struct {
	Yes        string `json:"yes"`
	Abstain    string `json:"abstain"`
	No         string `json:"no"`
	NoWithVeto string `json:"no_with_veto"`
}

type TotalDeposit

type TotalDeposit struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type Validator

type Validator struct {
	OperatorAddress   string               `json:"operator_address"`
	ConsensusPubkey   PubKey               `json:"consensus_pubkey"`
	Jailed            bool                 `json:"jailed"`
	Status            string               `json:"status"`
	Tokens            string               `json:"tokens"`
	DelegatorShares   string               `json:"delegator_shares"`
	Description       ValidatorDescription `json:"description"`
	UnbondingHeight   string               `json:"unbonding_height"`
	UnbondingTime     string               `json:"unbonding_time"`
	Commission        ValidatorCommission  `json:"commission"`
	MinSelfDelegation string               `json:"min_self_delegation"`
}

type ValidatorCommission

type ValidatorCommission struct {
	CommissionRates ValidatorCommissionRates `json:"commission_rates"`
	UpdateTime      string                   `json:"update_time"`
}

type ValidatorCommissionRates

type ValidatorCommissionRates struct {
	Rate          string `json:"rate"`
	MaxRate       string `json:"max_rate"`
	MaxChangeRate string `json:"max_change_rate"`
}

type ValidatorDescription

type ValidatorDescription struct {
	Moniker         string `json:"moniker"`
	Identity        string `json:"identity"`
	Website         string `json:"website"`
	SecurityContact string `json:"security_contact"`
	Details         string `json:"details"`
}

type VestingBalance

type VestingBalance struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type VestingPeriod

type VestingPeriod struct {
	Amount []VestingBalance `json:"amount"`
	Length string           `json:"length"`
}

Jump to

Keyboard shortcuts

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