cosmos

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MsgSend                        TxType = "cosmos-sdk/MsgSend"
	MsgMultiSend                   TxType = "cosmos-sdk/MsgMultiSend"
	MsgCreateValidator             TxType = "cosmos-sdk/MsgCreateValidator"
	MsgDelegate                    TxType = "cosmos-sdk/MsgDelegate"
	MsgUndelegate                  TxType = "cosmos-sdk/MsgUndelegate"
	MsgBeginRedelegate             TxType = "cosmos-sdk/MsgBeginRedelegate"
	MsgWithdrawDelegationReward    TxType = "cosmos-sdk/MsgWithdrawDelegationReward"
	MsgWithdrawValidatorCommission TxType = "cosmos-sdk/MsgWithdrawValidatorCommission"
	MsgSubmitProposal              TxType = "cosmos-sdk/MsgSubmitProposal"
	MsgDeposit                     TxType = "cosmos-sdk/MsgDeposit"
	MsgVote                        TxType = "cosmos-sdk/MsgVote"
	TextProposal                   TxType = "cosmos-sdk/TextProposal"
	MsgUnjail                      TxType = "cosmos-sdk/MsgUnjail"

	EventTransfer        EventType = "transfer"
	EventWithdrawRewards EventType = "withdraw_rewards"

	AttributeAmount    AttributeKey = "amount"
	AttributeValidator AttributeKey = "validator"

	DenomAtom DenomType = "uatom"
	DenomKava DenomType = "ukava"
)

Types of messages

Variables

This section is empty.

Functions

func CalculateAnnualReward added in v1.0.37

func CalculateAnnualReward(p Pool, inflation float64, validator Validator) float64

func NormalizeDelegations added in v1.0.37

func NormalizeDelegations(delegations []Delegation, validators blockatlas.ValidatorMap) []blockatlas.Delegation

func NormalizeUnbondingDelegations added in v1.0.37

func NormalizeUnbondingDelegations(delegations []UnbondingDelegation, validators blockatlas.ValidatorMap) []blockatlas.Delegation

Types

type Account added in v1.0.37

type Account struct {
	Value AccountValue `json:"value"`
}

type AccountValue added in v1.0.37

type AccountValue struct {
	Coins []Balance `json:"coins"`
}

type Amount

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

Amount - the asset & quantity. Always seems to be enclosed in an array/list for some reason. Perhaps used for multiple tokens transferred in a single sender/reciever transfer?

type Attribute added in v1.0.37

type Attribute struct {
	Key   AttributeKey `json:"key"`
	Value string       `json:"value"`
}

type AttributeKey added in v1.0.37

type AttributeKey string

type Attributes added in v1.0.37

type Attributes []Attribute

func (Attributes) GetWithdrawRewardValue added in v1.0.37

func (a Attributes) GetWithdrawRewardValue() int64

type AuthAccount added in v1.0.37

type AuthAccount struct {
	Account Account `json:"result"`
}

type Balance added in v1.0.37

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

type Block added in v1.0.37

type Block struct {
	Meta BlockMeta `json:"block_meta"`
}

Block - top object of get las block request

type BlockHeader added in v1.0.37

type BlockHeader struct {
	Height string `json:"height"`
}

BlockHeader - "BlockMeta" sub object, height

type BlockMeta added in v1.0.37

type BlockMeta struct {
	Header BlockHeader `json:"header"`
}

BlockMeta - "Block" sub object

type Client

type Client struct {
	client.Request
}

Client - the HTTP client

func (*Client) CurrentBlockNumber added in v1.0.37

func (c *Client) CurrentBlockNumber() (num int64, err error)

func (*Client) GetAccount added in v1.0.37

func (c *Client) GetAccount(address string) (result AuthAccount, err error)

func (*Client) GetAddrTxs added in v1.0.37

func (c *Client) GetAddrTxs(address, tag string, page int) (txs TxPage, err error)

GetAddrTxs - get all ATOM transactions for a given address

func (*Client) GetBlockByNumber added in v1.0.37

func (c *Client) GetBlockByNumber(num int64) (txs TxPage, err error)

func (*Client) GetDelegations added in v1.0.37

func (c *Client) GetDelegations(address string) (delegations Delegations, err error)

func (*Client) GetInflation added in v1.0.37

func (c *Client) GetInflation() (inflation Inflation, err error)

func (*Client) GetPool added in v1.0.37

func (c *Client) GetPool() (result StakingPool, err error)

func (*Client) GetUnbondingDelegations added in v1.0.37

func (c *Client) GetUnbondingDelegations(address string) (delegations UnbondingDelegations, err error)

func (*Client) GetValidators added in v1.0.37

func (c *Client) GetValidators() (validators Validators, err error)

type Contents

type Contents struct {
	Message []Message `json:"msg"`
	Fee     Fee       `json:"fee"`
	Memo    string    `json:"memo"`
}

Contents - amount, fee, and memo

type CosmosCommission added in v1.0.37

type CosmosCommission struct {
	Commision CosmosCommissionRates `json:"commission_rates"`
}

type CosmosCommissionRates added in v1.0.37

type CosmosCommissionRates struct {
	Rate string `json:"rate"`
}

type Data

type Data struct {
	Contents Contents `json:"value"`
}

Data - "tx" sub object

type Delegation added in v1.0.37

type Delegation struct {
	DelegatorAddress string `json:"delegator_address"`
	ValidatorAddress string `json:"validator_address"`
	Balance          string `json:"balance,omitempty"`
}

func (*Delegation) Value added in v1.0.37

func (d *Delegation) Value() string

type Delegations added in v1.0.37

type Delegations struct {
	List []Delegation `json:"result"`
}

type DenomType added in v1.0.37

type DenomType string

type Event added in v1.0.37

type Event struct {
	Type       EventType
	Attributes Attributes `json:"Attributes"`
}

Events

type EventType added in v1.0.37

type EventType string

type Events added in v1.0.37

type Events []*Event

func (Events) GetWithdrawRewardValue added in v1.0.37

func (e Events) GetWithdrawRewardValue() string

type Fee

type Fee struct {
	FeeAmount []Amount `json:"amount"`
}

Fee - also references the "amount" struct

type Inflation added in v1.0.37

type Inflation struct {
	Result string `json:"result"`
}

type Message

type Message struct {
	Type  TxType
	Value interface{}
}

Message - an array that holds multiple 'particulars' entries. Possibly used for multiple transfers in one transaction?

func (*Message) UnmarshalJSON added in v1.0.37

func (m *Message) UnmarshalJSON(buf []byte) error

UnmarshalJSON reads different message types

type MessageValueDelegate added in v1.0.37

type MessageValueDelegate struct {
	DelegatorAddr string `json:"delegator_address"`
	ValidatorAddr string `json:"validator_address"`
	Amount        Amount `json:"amount,omitempty"`
}

MessageValueDelegate - from, to, and amount

type MessageValueTransfer added in v1.0.37

type MessageValueTransfer struct {
	FromAddr string   `json:"from_address"`
	ToAddr   string   `json:"to_address"`
	Amount   []Amount `json:"amount,omitempty"`
}

MessageValueTransfer - from, to, and amount

type Platform

type Platform struct {
	CoinIndex uint
	// contains filtered or unexported fields
}

func Init added in v1.1.0

func Init(coin uint, api string) *Platform

func (*Platform) Coin

func (p *Platform) Coin() coin.Coin

func (*Platform) CurrentBlockNumber added in v1.0.37

func (p *Platform) CurrentBlockNumber() (int64, error)

func (*Platform) Denom added in v1.0.37

func (p *Platform) Denom() DenomType

func (*Platform) GetActiveValidators added in v1.1.4

func (p *Platform) GetActiveValidators() (blockatlas.StakeValidators, error)

func (*Platform) GetBlockByNumber added in v1.0.37

func (p *Platform) GetBlockByNumber(num int64) (*types.Block, error)

func (*Platform) GetDelegations added in v1.0.37

func (p *Platform) GetDelegations(address string) (blockatlas.DelegationsPage, error)

func (*Platform) GetDetails added in v1.0.37

func (p *Platform) GetDetails() blockatlas.StakingDetails

func (*Platform) GetMaxAPR added in v1.0.37

func (p *Platform) GetMaxAPR() float64

func (*Platform) GetTxsByAddress

func (p *Platform) GetTxsByAddress(address string) (types.TxPage, error)

func (*Platform) GetValidators added in v1.0.37

func (p *Platform) GetValidators() (blockatlas.ValidatorPage, error)

func (*Platform) Normalize added in v1.0.37

func (p *Platform) Normalize(srcTx *Tx) (tx types.Tx, ok bool)

Normalize converts an Cosmos transaction into the generic model

func (*Platform) NormalizeTxs added in v1.0.37

func (p *Platform) NormalizeTxs(srcTxs []Tx) types.TxPage

NormalizeTxs converts multiple Cosmos transactions

func (*Platform) UndelegatedBalance added in v1.0.37

func (p *Platform) UndelegatedBalance(address string) (string, error)

type Pool added in v1.0.37

type Pool struct {
	NotBondedTokens string `json:"not_bonded_tokens"`
	BondedTokens    string `json:"bonded_tokens"`
}

type StakingPool added in v1.0.37

type StakingPool struct {
	Pool Pool `json:"result"`
}

type Tx

type Tx struct {
	Block  string `json:"height"`
	Code   int    `json:"code"`
	Date   string `json:"timestamp"`
	ID     string `json:"txhash"`
	Data   Data   `json:"tx"`
	Events Events `json:"events"`
}

Tx - Base transaction object. Always returned as part of an array

type TxPage added in v1.0.37

type TxPage struct {
	PageTotal string `json:"page_total"`
	Txs       []Tx   `json:"txs"`
}

type TxType added in v1.0.37

type TxType string

type UnbondingDelegation added in v1.0.37

type UnbondingDelegation struct {
	Delegation
	Entries []UnbondingDelegationEntry `json:"entries"`
}

type UnbondingDelegationEntry added in v1.0.37

type UnbondingDelegationEntry struct {
	DelegatorAddress string `json:"creation_height"`
	CompletionTime   string `json:"completion_time"`
	Balance          string `json:"balance"`
}

type UnbondingDelegations added in v1.0.37

type UnbondingDelegations struct {
	List []UnbondingDelegation `json:"result"`
}

type Validator added in v1.0.37

type Validator struct {
	Status     int              `json:"status"`
	Address    string           `json:"operator_address"`
	Commission CosmosCommission `json:"commission"`
}

type Validators added in v1.0.37

type Validators struct {
	Result []Validator `json:"result"`
}

Jump to

Keyboard shortcuts

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