types

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthUserKey = "user"
	AuthAppKey  = "app"
	AuthNode    = "node"
)
View Source
const (
	FlagMaxGas                = "max-gas"
	FlagPrometheusPushName    = "prometheus.pushName"
	FlagPrometheusPushGateway = "prometheus.pushGateway"
	FlagPrometheusServer      = "prometheus.prometheusServer"

	FlagInfluxdbServer   = "influxdb.server"
	FlagInfluxdbUser     = "influxdb.user"
	FlagInfluxdbPassword = "influxdb.password"
)
View Source
const (
	UrlPrefixNodes   = "/nodes"
	UrlNodeProxy     = UrlPrefixNodes + "/:nodeName"
	UrlPrefixPlugins = "/plugins"
)
View Source
const (
	//Active 可获得挖矿奖励状态
	Active int8 = iota

	//Inactive
	Inactive
)
View Source
const (
	TokenKey = "QToken"
)

Variables

This section is empty.

Functions

func CheckNodeType added in v0.0.4

func CheckNodeType(nodeType NodeType) bool

func TxCN added in v0.0.4

func TxCN(t string, tx string, address string) string

Types

type AdminAccountStatus

type AdminAccountStatus int
const (
	AdminAccountStatusInit AdminAccountStatus = iota
	AdminAccountStatusChecked
)

func (AdminAccountStatus) String

func (aas AdminAccountStatus) String() string

type AdminNodeType

type AdminNodeType struct {
	Name    string           `json:"name"`
	BaseURL string           `json:"baseUrl"`
	Routers []NodeTypeRouter `json:"routers"`
}

type Block added in v0.0.4

type Block struct {
	Header       BlockHeader
	Txs          [][]byte
	Precommits   []*BlockValidator
	EvidenceList EvidenceList
}

type BlockHeader added in v0.0.4

type BlockHeader struct {
	ID      int64     `json:"-"`
	ChainID string    `json:"chain_id"`
	Height  int64     `json:"height"`
	Time    time.Time `json:"time"`
	NumTxs  int64     `json:"num_txs"`

	// prev block info
	//LastBlockID BlockID `json:"last_block_id"`
	TotalTxs int64 `json:"total_txs"`

	// hashes of block data
	LastCommitHash string `json:"last_commit_hash"` // commit from validators from the last block
	DataHash       string `json:"data_hash"`        // transactions

	// hashes from the app output from the prev block
	ValidatorsHash  string `json:"validators_hash"`   // validators for the current block
	ConsensusHash   string `json:"consensus_hash"`    // consensus params for current block
	AppHash         string `json:"app_hash"`          // state after txs from the previous block
	LastResultsHash string `json:"last_results_hash"` // root hash of all results from the txs from the previous block
	ProposerAddress string `json:"proposer_address"`
	// consensus info
	EvidenceHash string `json:"evidence_hash"` // evidence included in the block

}

type BlockValidator

type BlockValidator struct {
	ChainID          string    `json:"chain_id"`
	Height           int64     `json:"height"`
	ValidatorAddress string    `json:"validator_address"`
	ValidatorIndex   int64     `json:"validator_index"`
	Round            int64     `json:"round"`
	Type             int64     `json:"type"`
	Signature        string    `json:"signature"`
	Timestamp        time.Time `json:"timestamp"`
	VotingPower      int64     `json:"voting_power"` // voting_power
	Accum            int64     `json:"accum"`        // accum
}

type ChainNode added in v0.0.4

type ChainNode struct {
	NodeID int64  `json:"nodeId"`
	Delay  int64  `json:"delay"`
	Remote string `json:"remote"`
}

type Coin added in v0.0.4

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

func ParseCoin added in v0.0.4

func ParseCoin(coinStr string) (coin Coin, err error)

ParseCoin parses a cli input for one coin type, returning errors if invalid. This returns an error on an empty string as well.

type Coins added in v0.0.4

type Coins []Coin

func ParseCoins added in v0.0.4

func ParseCoins(s string) (coins Coins, err error)

func (Coins) String added in v0.0.4

func (c Coins) String() string

type Evidence added in v0.0.4

type Evidence struct {
	Height  int64
	Address string
	Hash    string
	Data    string
	Time    time.Time
}

type EvidenceList added in v0.0.4

type EvidenceList struct {
	Evidences []Evidence
	Time      time.Time
}

type ExplorerRoute

type ExplorerRoute string
const (
	ExplorerRouteBlock    ExplorerRoute = "ResultBlockBase"
	ExplorerRouteValidtor ExplorerRoute = "Validtor"
	ExplorerRouteNode     ExplorerRoute = "Node"
)

func (ExplorerRoute) String

func (er ExplorerRoute) String() string

type LoginType

type LoginType int
const (
	LoginWeb LoginType = iota
)

type Matrix added in v0.0.4

type Matrix struct {
	X string `json:"x"`
	Y string `json:"y"`
}

type NodeType added in v0.0.4

type NodeType string
const (
	NodeTypeQOS    NodeType = "QOS"
	NodeTypeQSC    NodeType = "QSC"
	NodeTypeCOSMOS NodeType = "COSMOS"
)

func (NodeType) String added in v0.0.4

func (nt NodeType) String() string

type NodeTypeRouter

type NodeTypeRouter struct {
	Route  string `json:"route"`
	Hidden bool   `json:"hidden"`
}

type PriKey

type PriKey struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data,omitempty"`
}

type RPCResponse

type RPCResponse struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      string      `json:"id"`
	Result  interface{} `json:"result,omitempty"`
	Error   *RPCError   `json:"error,omitempty"`
}

func NewRPCErrorResponse

func NewRPCErrorResponse(id string, code int, msg string, data string) RPCResponse

func NewRPCSuccessResponse

func NewRPCSuccessResponse(cdc *amino.Codec, id string, res interface{}) RPCResponse

func RPCForbiddenError

func RPCForbiddenError(id string, err error) RPCResponse

func RPCInternalError

func RPCInternalError(id string, err error) RPCResponse

func RPCInvalidParamsError

func RPCInvalidParamsError(id string, err error) RPCResponse

func RPCInvalidRequestError

func RPCInvalidRequestError(id string, err error) RPCResponse

func RPCMethodNotFoundError

func RPCMethodNotFoundError(id string) RPCResponse

func RPCParseError

func RPCParseError(id string, err error) RPCResponse

func RPCServerError

func RPCServerError(id string, err error) RPCResponse

func RPCUnauthorizedError

func RPCUnauthorizedError(id string, err error) RPCResponse

type ResultAccount

type ResultAccount struct {
	Address string          `json:"address"`
	Nonce   int64           `json:"nonce"`
	Coins   types.BaseCoins `json:"coins"`
}

type ResultBlock

type ResultBlock struct {
	Block      *ResultBlockBase  `json:"block"`
	Txs        []*ResultTx       `json:"txs"`
	Validators []*BlockValidator `json:"validators"`
}

type ResultBlockBase

type ResultBlockBase struct {
	ID             int64      `json:"-"`
	BlockID        string     `json:"block_id"`
	ChainID        string     `json:"chain_id"`
	Height         int64      `json:"height"`
	NumTxs         int64      `json:"num_txs"`
	TotalTxs       int64      `json:"total_txs"`
	Data           string     `json:"data"`
	Time           ResultTime `json:"time"`
	DataHash       string     `json:"data_hash"`
	ValidatorsHash string     `json:"validators_hash"`
	CreatedAt      ResultTime `json:"-"`
}

ResultBlockBase 块信息

type ResultBlockDuration added in v0.0.4

type ResultBlockDuration struct {
	Height   int64 `json:"height"`
	Duration int64
}

type ResultConsensusState

type ResultConsensusState struct {
	ChainID         string `json:"chain_id"`         // chain_id
	Height          string `json:"height"`           // height
	Round           string `json:"round"`            // round
	Step            string `json:"step"`             // step
	PrevotesNum     int64  `json:"prevotes_num"`     // prevotes_num
	PrevotesValue   string `json:"prevotes_value"`   // prevotes_value
	PrecommitsNum   int64  `json:"precommits_num"`   // precommits_num
	PrecommitsValue string `json:"precommits_value"` // precommits_value
	StartTime       string `json:"start_time"`       // start_time
}

type ResultEvidence added in v0.0.4

type ResultEvidence struct {
	Time   string `json:"time"`
	Height int64  `json:"height"`
}

ResultEvidence 双签返回结果

type ResultFee added in v0.0.4

type ResultFee struct {
	Tx        string `json:"tx"`
	Fee       []Coin `json:"fee"`
	GasWanted int64  `json:"gasWanted"`
	GasUsed   int64  `json:"gasUsed"`
}

type ResultMatrix added in v0.0.4

type ResultMatrix struct {
	Title string   `json:"title"`
	List  []Matrix `json:"list"`
}

type ResultMissing added in v0.0.4

type ResultMissing struct {
	Time   string `json:"time"`
	Height int64  `json:"height"`
}

ResultMissing 漏签

type ResultNodeTypes

type ResultNodeTypes struct {
	Nodes []AdminNodeType `json:"nodes"`
}

type ResultPeer

type ResultPeer struct {
	Moniker    string     `json:"moniker"`
	ID         int64      `json:"-"`
	PeerID     string     `json:"id"`
	ListenAddr string     `json:"listen_addr"`
	Network    string     `json:"network"`
	Version    string     `json:"version"`
	Channels   string     `json:"channels"`
	SendStart  ResultTime `json:"send_start"`
	RecvStart  ResultTime `json:"recv_start"`
	CreateAt   ResultTime `json:"create_at"`
}

type ResultPeers

type ResultPeers struct {
	NPeers int64         `json:"n_peers"`
	Peers  []*ResultPeer `json:"peers"`
}

type ResultSequence

type ResultSequence struct {
	Apps []*Sequence `json:"apps"`
}

type ResultStatus

type ResultStatus struct {
	ConsensusState  *ResultConsensusState `json:"consensus_state"`
	TotalValidators int64                 `json:"total_validators"`
	Height          int64                 `json:"height"`
	TotalTxs        int64                 `json:"total_txs"`
	BlockTimeAvg    string                `json:"blockTimeAvg"`
}

type ResultTime added in v0.0.4

type ResultTime time.Time

func (ResultTime) MarshalJSON added in v0.0.4

func (rt ResultTime) MarshalJSON() ([]byte, error)

func (ResultTime) String added in v0.0.4

func (rt ResultTime) String() string

func (ResultTime) Time added in v0.0.4

func (rt ResultTime) Time() time.Time

func (*ResultTime) UnmarshalJSON added in v0.0.4

func (rt *ResultTime) UnmarshalJSON(data []byte) (err error)

type ResultTx

type ResultTx struct {
	ChainID   string                       `json:"chain_id"`
	Hash      string                       `json:"hash"`
	Height    int64                        `json:"height"`
	Index     int64                        `json:"index"`   // index
	TxType    string                       `json:"tx_type"` // tx_type
	TxTypeCN  string                       `json:"tx_type_cn"`
	GasWanted int64                        `json:"gas_wanted"`
	GasUsed   int64                        `json:"gas_used"`
	Fee       string                       `json:"fee"`
	TxStatus  string                       `json:"tx_status"`
	Status    int                          `json:"status"`
	Data      json.RawMessage              `json:"data"` // data
	Time      ResultTime                   `json:"time"` // time
	Log       string                       `json:"log"`
	CreatedAt ResultTime                   `json:"created_at"` // created_at
	TxDetail  map[string][]json.RawMessage `json:"tx_detail"`
}

type ResultTxs

type ResultTxs struct {
	Txs []*ResultTx `json:"txs"`
}

type ResultValidator

type ResultValidator struct {
	Validator *Validator        `json:"validator"`
	Blocks    []*BlockValidator `json:"blocks"`
}

type Sequence

type Sequence struct {
	Name string `json:"name"`
	In   int64  `json:"in"`
	Out  int64  `json:"out"`
}

type Tx added in v0.0.4

type Tx struct {
	Data      []byte   `json:"data"`
	Hash      []byte   `json:"hash"`
	Height    int64    `json:"height"`
	Index     uint32   `json:"index"`
	Code      uint32   `json:"code"`
	TxStatus  TxStatus `json:"txStatus"`
	GasWanted int64    `json:"gasWanted"`
	GasUsed   int64    `json:"gasUsed"`
	Log       string   `json:"log"`
}

type TxByte added in v0.0.4

type TxByte []byte

type TxSendResult added in v0.0.4

type TxSendResult struct {
	Hash string `json:"hash"`
}

type TxStatus added in v0.0.4

type TxStatus int
const (
	TxStatusInit TxStatus = iota
	TxStatusSuccess
	TxStatusFaild
)

func (TxStatus) MarshalJSON added in v0.0.4

func (ts TxStatus) MarshalJSON() ([]byte, error)

func (TxStatus) String added in v0.0.4

func (ts TxStatus) String() string

type Validator

type Validator struct {
	Name             string             `json:"name"`
	Details          string             `json:"details"`
	Identity         string             `json:"identity"`
	Website          string             `json:"website"`
	Owner            string             `json:"owner"`
	ChainID          string             `json:"chain_id"`
	Address          string             `json:"address"`
	ConsPubKey       string             `json:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
	PubKeyType       string             `json:"pub_key_type"`
	PubKeyValue      string             `json:"pub_key_value"`
	VotingPower      int64              `json:"voting_power"`
	Accum            int64              `json:"accum"`
	FirstBlockHeight int64              `json:"first_block_height"`
	FirstBlockTime   time.Time          `json:"first_block_time"`
	CreatedAt        time.Time          `json:"created_at"`
	Status           int8               `json:"status"`
	StatusStr        string             `json:"statusStr"`
	InactiveCode     types.InactiveCode `json:"inactiveCode"`
	InactiveTime     time.Time          `json:"inactiveTime"`
	InactiveHeight   int64              `json:"inactiveHeight"`
	BondHeight       int64              `json:"bondHeight"`
	Percent          string             `json:"percent"`
	PrecommitNum     int64              `json:"precommitNum"`
	Uptime           string             `json:"uptime"`
	UptimeFloat      float64            `json:"-"`
	Commission       string             `json:"commission_rate"`
}

type Validators added in v0.0.4

type Validators []Validator

func (Validators) Len added in v0.0.4

func (vals Validators) Len() int

func (Validators) Less added in v0.0.4

func (vals Validators) Less(i, j int) bool

func (Validators) Swap added in v0.0.4

func (vals Validators) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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