kava

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

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

func NormalizeDelegations

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

func NormalizeUnbondingDelegations

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

Types

type Account

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

type AccountValue

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

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

type AttributeKey

type AttributeKey string

type Attributes

type Attributes []Attribute

func (Attributes) GetWithdrawRewardValue

func (a Attributes) GetWithdrawRewardValue() int64

type AuthAccount

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

type Balance

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

type Block

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

Block - top object of get las block request

type BlockHeader

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

BlockHeader - "BlockMeta" sub object, height

type BlockMeta

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

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

func (*Client) GetAccount

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

func (*Client) GetAddrTxs

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

GetAddrTxs - get all KAVA transactions for a given address

func (*Client) GetBlockByNumber

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

func (*Client) GetDelegations

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

func (*Client) GetInflation

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

func (*Client) GetPool

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

func (*Client) GetUnbondingDelegations

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

func (*Client) GetValidators

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

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

type CosmosCommissionRates

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

type Data

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

Data - "tx" sub object

type Delegation

type Delegation struct {
	DelegatorAddress string `json:"delegator_address"`
	ValidatorAddress string `json:"validator_address"`
	Shares           string `json:"shares"`
	Balance          struct {
		Denom  string `json:"denom"`
		Amount string `json:"amount"`
	} `json:"balance"`
}

func (*Delegation) Value

func (d *Delegation) Value() string

type Delegations

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

type DenomType

type DenomType string

type Event

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

Events

type EventType

type EventType string

type Events

type Events []*Event

func (Events) GetWithdrawRewardValue

func (e Events) GetWithdrawRewardValue() string

type Fee

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

Fee - also references the "amount" struct

type Inflation

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

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

UnmarshalJSON reads different message types

type MessageValueDelegate

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

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

func Init(coin uint, api string) *Platform

func (*Platform) Coin

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

func (*Platform) CurrentBlockNumber

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

func (*Platform) Denom

func (p *Platform) Denom() DenomType

func (*Platform) FilterTxsByDenom added in v1.1.15

func (p *Platform) FilterTxsByDenom(txs []Tx, denom string) []Tx

func (*Platform) GetActiveValidators

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

func (*Platform) GetBlockByNumber

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

func (*Platform) GetDelegations

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

func (*Platform) GetDetails

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

func (*Platform) GetMaxAPR

func (p *Platform) GetMaxAPR() float64

func (*Platform) GetTokenTxsByAddress added in v1.1.15

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

func (*Platform) GetTxsByAddress

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

func (*Platform) GetValidators

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

func (*Platform) Normalize

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

Normalize converts an Cosmos transaction into the generic model

func (*Platform) NormalizeTxs

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

NormalizeTxs converts multiple Cosmos transactions

func (*Platform) UndelegatedBalance

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

type Pool

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

type StakingPool

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

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

type TxType

type TxType string

type UnbondingDelegation

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

type UnbondingDelegationEntry

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

type UnbondingDelegations

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

type Validator

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

type Validators

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