node

package
v0.0.0-...-c77c525 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DepositPeriodProposalStatus = "PROPOSAL_STATUS_DEPOSIT_PERIOD"
	VotingPeriodProposalStatus  = "PROPOSAL_STATUS_VOTING_PERIOD"
	PassedProposalStatus        = "PROPOSAL_STATUS_PASSED"
	RejectedProposalStatus      = "PROPOSAL_STATUS_REJECTED"
	FailedProposalStatus        = "PROPOSAL_STATUS_FAILED"

	MainUnit = "uatom"
)

Variables

View Source
var PrecisionDiv = decimal.New(1, precision)

Functions

func Precision

func Precision(amount decimal.Decimal) decimal.Decimal

Types

type API

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

func NewAPI

func NewAPI(cfg config.Config) *API

func (API) GetBalance

func (api API) GetBalance(address string) (amount decimal.Decimal, err error)

func (API) GetBalances

func (api API) GetBalances(address string) (result AmountResult, err error)

func (API) GetBlock

func (api API) GetBlock(id uint64) (result Block, err error)

func (API) GetCommunityPoolAmount

func (api API) GetCommunityPoolAmount() (amount decimal.Decimal, err error)

func (API) GetDelegatorValidatorStake

func (api API) GetDelegatorValidatorStake(delegator string, validator string) (amount decimal.Decimal, err error)

func (API) GetInflation

func (api API) GetInflation() (amount decimal.Decimal, err error)

func (API) GetProposals

func (api API) GetProposals() (proposals ProposalsResult, err error)

func (API) GetStake

func (api API) GetStake(address string) (amount decimal.Decimal, err error)

func (API) GetStakeRewards

func (api API) GetStakeRewards(address string) (amount decimal.Decimal, err error)

func (API) GetStakingPool

func (api API) GetStakingPool() (sp StakingPool, err error)

func (API) GetTotalSupply

func (api API) GetTotalSupply() (amount decimal.Decimal, err error)

func (API) GetTransaction

func (api API) GetTransaction(hash string) (result TxResult, err error)

func (API) GetUnbonding

func (api API) GetUnbonding(address string) (amount decimal.Decimal, err error)

func (API) GetValidators

func (api API) GetValidators() (items []Validator, err error)

func (API) ProposalTallyResult

func (api API) ProposalTallyResult(id uint64) (result ProposalTallyResult, err error)

type Amount

type Amount struct {
	Denom  string          `json:"denom"`
	Amount decimal.Decimal `json:"amount"`
}

type AmountResult

type AmountResult struct {
	Balances []struct {
		Denom  string          `json:"denom"`
		Amount decimal.Decimal `json:"amount"`
	} `json:"balances"`
}

type Block

type Block struct {
	BlockID struct {
		Hash          string `json:"hash"`
		PartSetHeader struct {
			Total int    `json:"total"`
			Hash  string `json:"hash"`
		} `json:"part_set_header"`
	} `json:"block_id"`
	Block struct {
		Header struct {
			Version struct {
				Block string `json:"block"`
				App   string `json:"app"`
			} `json:"version"`
			ChainID     string    `json:"chain_id"`
			Height      uint64    `json:"height,string"`
			Time        time.Time `json:"time"`
			LastBlockID struct {
				Hash          string `json:"hash"`
				PartSetHeader struct {
					Total int    `json:"total"`
					Hash  string `json:"hash"`
				} `json:"part_set_header"`
			} `json:"last_block_id"`
			LastCommitHash     string `json:"last_commit_hash"`
			DataHash           string `json:"data_hash"`
			ValidatorsHash     string `json:"validators_hash"`
			NextValidatorsHash string `json:"next_validators_hash"`
			ConsensusHash      string `json:"consensus_hash"`
			AppHash            string `json:"app_hash"`
			LastResultsHash    string `json:"last_results_hash"`
			EvidenceHash       string `json:"evidence_hash"`
			ProposerAddress    string `json:"proposer_address"`
		} `json:"header"`
		Data struct {
			Txs []string `json:"txs"`
		} `json:"data"`
	} `json:"block"`
}

type CommunityPool

type CommunityPool struct {
	Pool []struct {
		Denom  string          `json:"denom"`
		Amount decimal.Decimal `json:"amount"`
	} `json:"pool"`
}

type DelegatorRewards

type DelegatorRewards struct {
	Rewards []struct {
		ValidatorAddress string   `json:"validator_address"`
		Reward           []Amount `json:"reward"`
	} `json:"rewards"`
	Total []Amount `json:"total"`
}

type DelegatorValidatorStakeResult

type DelegatorValidatorStakeResult struct {
	DelegationResponse struct {
		Delegation struct {
			DelegatorAddress string          `json:"delegator_address"`
			ValidatorAddress string          `json:"validator_address"`
			Shares           decimal.Decimal `json:"shares"`
		} `json:"delegation"`
		Balance struct {
			Denom  string          `json:"denom"`
			Amount decimal.Decimal `json:"amount"`
		} `json:"balance"`
	} `json:"delegation_response"`
}

type Inflation

type Inflation struct {
	Inflation decimal.Decimal `json:"inflation"`
}

type ProposalProposer

type ProposalProposer struct {
	Proposal struct {
		ProposalID uint64 `json:"proposal_id,string"`
		Proposer   string `json:"proposer"`
	} `json:"proposal"`
}

type ProposalTallyResult

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

type ProposalVotersResult

type ProposalVotersResult struct {
	Result []struct {
		ProposalID uint64 `json:"proposal_id,string"`
		Voter      string `json:"voter"`
		Option     string `json:"option"`
	} `json:"result"`
}

type ProposalsResult

type ProposalsResult struct {
	Proposals []struct {
		Content struct {
			Type        string `json:"@type"`
			Title       string `json:"title"`
			Description string `json:"description"`
		} `json:"content"`
		ProposalID       uint64 `json:"proposal_id,string"`
		Status           string `json:"status"`
		FinalTallyResult struct {
			Yes        int64 `json:"yes,string"`
			Abstain    int64 `json:"abstain,string"`
			No         int64 `json:"no,string"`
			NoWithVeto int64 `json:"no_with_veto,string"`
		} `json:"final_tally_result"`
		SubmitTime     time.Time `json:"submit_time"`
		DepositEndTime time.Time `json:"deposit_end_time"`
		TotalDeposit   []struct {
			Amount decimal.Decimal `json:"amount"`
		} `json:"total_deposit"`
		VotingStartTime time.Time `json:"voting_start_time"`
		VotingEndTime   time.Time `json:"voting_end_time"`
	} `json:"proposals"`
}

type StakeResult

type StakeResult struct {
	DelegationResponses []struct {
		Delegation struct {
			DelegatorAddress string          `json:"delegator_address"`
			ValidatorAddress string          `json:"validator_address"`
			Shares           decimal.Decimal `json:"shares"`
		} `json:"delegation"`
	} `json:"delegation_responses"`
}

type StakingPool

type StakingPool struct {
	Pool struct {
		NotBondedTokens decimal.Decimal `json:"not_bonded_tokens"`
		BondedTokens    decimal.Decimal `json:"bonded_tokens"`
	} `json:"pool"`
}

type Supply

type Supply struct {
	Amount struct {
		Denom  string          `json:"denom"`
		Amount decimal.Decimal `json:"amount"`
	} `json:"amount"`
}

type TxResult

type TxResult struct {
	Tx struct {
		Type string `json:"@type"`
		Body struct {
			Messages         []json.RawMessage `json:"messages"`
			Memo             string            `json:"memo"`
			TimeoutHeight    string            `json:"timeout_height"`
			ExtensionOptions []struct {
				TypeURL string `json:"type_url"`
				Value   string `json:"value"`
			} `json:"extension_options"`
			NonCriticalExtensionOptions []struct {
				TypeURL string `json:"type_url"`
				Value   string `json:"value"`
			} `json:"non_critical_extension_options"`
		} `json:"body"`
		AuthInfo struct {
			SignerInfos []struct {
				PublicKey struct {
					TypeURL string `json:"type_url"`
					Value   string `json:"value"`
				} `json:"public_key"`
				ModeInfo struct {
					Single struct {
						Mode string `json:"mode"`
					} `json:"single"`
					Multi struct {
						Bitarray struct {
							ExtraBitsStored int    `json:"extra_bits_stored"`
							Elems           string `json:"elems"`
						} `json:"bitarray"`
						ModeInfos []interface{} `json:"mode_infos"`
					} `json:"multi"`
				} `json:"mode_info"`
				Sequence string `json:"sequence"`
			} `json:"signer_infos"`
			Fee struct {
				Amount []struct {
					Denom  string          `json:"denom"`
					Amount decimal.Decimal `json:"amount"`
				} `json:"amount"`
				GasLimit decimal.Decimal `json:"gas_limit"`
				Payer    string          `json:"payer"`
				Granter  string          `json:"granter"`
			} `json:"fee"`
		} `json:"auth_info"`
		Signatures []string `json:"signatures"`
	} `json:"tx"`
	TxResponse struct {
		Height    uint64 `json:"height,string"`
		Txhash    string `json:"txhash"`
		Codespace string `json:"codespace"`
		Code      int    `json:"code"`
		Data      string `json:"data"`
		RawLog    string `json:"raw_log"`
		Logs      []struct {
			MsgIndex int    `json:"msg_index"`
			Log      string `json:"log"`
			Events   []struct {
				Type       string `json:"type"`
				Attributes []struct {
					Key   string `json:"key"`
					Value string `json:"value"`
				} `json:"attributes"`
			} `json:"events"`
		} `json:"logs"`
		Info      string `json:"info"`
		GasWanted uint64 `json:"gas_wanted,string"`
		GasUsed   uint64 `json:"gas_used,string"`
		Tx        struct {
			TypeURL string `json:"type_url"`
			Value   string `json:"value"`
		} `json:"tx"`
		Timestamp time.Time `json:"timestamp"`
	} `json:"tx_response"`
}

type UnbondingResult

type UnbondingResult struct {
	UnbondingResponses []struct {
		DelegatorAddress string `json:"delegator_address"`
		ValidatorAddress string `json:"validator_address"`
		Entries          []struct {
			Balance decimal.Decimal `json:"balance"`
		} `json:"entries"`
	} `json:"unbonding_responses"`
}

type Validator

type Validator struct {
	OperatorAddress string `json:"operator_address"`
	ConsensusPubkey struct {
		Type string `json:"@type"`
		Key  string `json:"key"`
	} `json:"consensus_pubkey"`
	Tokens          uint64          `json:"tokens,string"`
	DelegatorShares decimal.Decimal `json:"delegator_shares"`
	Description     struct {
		Moniker  string `json:"moniker"`
		Identity string `json:"identity"`
		Website  string `json:"website"`
		Details  string `json:"details"`
	} `json:"description"`
	UnbondingHeight uint64    `json:"unbonding_height,string"`
	UnbondingTime   time.Time `json:"unbonding_time"`
	Commission      struct {
		CommissionRates struct {
			Rate          decimal.Decimal `json:"rate"`
			MaxRate       decimal.Decimal `json:"max_rate"`
			MaxChangeRate decimal.Decimal `json:"max_change_rate"`
		} `json:"commission_rates"`
	} `json:"commission"`
	MaxChangeRate decimal.Decimal `json:"max_change_rate"`
}

type Validators

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

Jump to

Keyboard shortcuts

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