coretypes

package
v1.1.0 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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrZeroOrNegativePerPage  = errors.New("zero or negative per_page")
	ErrPageOutOfRange         = errors.New("page should be within range")
	ErrZeroOrNegativeHeight   = errors.New("height must be greater than zero")
	ErrHeightExceedsChainHead = errors.New("height must be less than or equal to the head of the node's blockchain")
	ErrHeightNotAvailable     = errors.New("height is not available")
	// ErrInvalidRequest is used as a wrapper to cover more specific cases where the user has
	// made an invalid request
	ErrInvalidRequest = errors.New("invalid request")
)

List of standardized errors used across RPC

Functions

This section is empty.

Types

type ApplicationInfo

type ApplicationInfo struct {
	Version string `json:"version"`
}

type EventFilter

type EventFilter struct {
	Query string `json:"query"`
}

An EventFilter specifies which events are selected by an /events request.

type EventItem

type EventItem struct {
	// The cursor of this item.
	Cursor string `json:"cursor"`

	// The event label of this item (for example, "Vote").
	Event string `json:"event,omitempty"`

	// The encoded event data for this item. The content is a JSON object with
	// the following structure:
	//
	//   {
	//      "type":  "type-tag",
	//      "value": <json-encoded-value>
	//   }
	//
	// The known type tags are defined by the tendermint/types package.
	Data json.RawMessage `json:"data"`
}

type Evidence

type Evidence struct {
	Value types.Evidence
}

Evidence is an argument wrapper for a types.Evidence value, that handles encoding and decoding through JSON.

func (Evidence) MarshalJSON

func (e Evidence) MarshalJSON() ([]byte, error)

func (*Evidence) UnmarshalJSON

func (e *Evidence) UnmarshalJSON(data []byte) error

type Int64

type Int64 int64

Int64 is a wrapper for int64 that encodes to JSON as a string and can be decoded from either a string or a number value.

func Int64Ptr

func Int64Ptr(v *int) *Int64

Int64Ptr returns an *Int64 that points to the same value as v, or nil.

func (*Int64) IntPtr

func (z *Int64) IntPtr() *int

IntPtr returns a pointer to the value of *z as an int, or nil if z == nil.

func (Int64) MarshalJSON

func (z Int64) MarshalJSON() ([]byte, error)

func (*Int64) UnmarshalJSON

func (z *Int64) UnmarshalJSON(data []byte) error

type Peer

type Peer struct {
	ID  types.NodeID `json:"node_id"`
	URL string       `json:"url"`
}

A peer

type PeerStateInfo

type PeerStateInfo struct {
	NodeAddress string          `json:"node_address"`
	PeerState   json.RawMessage `json:"peer_state"`
}

UNSTABLE

type RequestABCIQuery

type RequestABCIQuery struct {
	Path   string         `json:"path"`
	Data   bytes.HexBytes `json:"data"`
	Height Int64          `json:"height"`
	Prove  bool           `json:"prove"`
}

type RequestBlockByHash

type RequestBlockByHash struct {
	Hash bytes.HexBytes `json:"hash"`
}

type RequestBlockInfo

type RequestBlockInfo struct {
	Height *Int64 `json:"height"`
}

type RequestBlockSearch

type RequestBlockSearch struct {
	Query   string `json:"query"`
	Page    *Int64 `json:"page"`
	PerPage *Int64 `json:"per_page"`
	OrderBy string `json:"order_by"`
}

type RequestBlockchainInfo

type RequestBlockchainInfo struct {
	MinHeight Int64 `json:"minHeight"`
	MaxHeight Int64 `json:"maxHeight"`
}

type RequestBroadcastEvidence

type RequestBroadcastEvidence struct {
	Evidence types.Evidence
}

func (RequestBroadcastEvidence) MarshalJSON

func (r RequestBroadcastEvidence) MarshalJSON() ([]byte, error)

func (*RequestBroadcastEvidence) UnmarshalJSON

func (r *RequestBroadcastEvidence) UnmarshalJSON(data []byte) error

type RequestBroadcastTx

type RequestBroadcastTx struct {
	Tx types.Tx `json:"tx"`
}

type RequestCheckTx

type RequestCheckTx struct {
	Tx types.Tx `json:"tx"`
}

type RequestConsensusParams

type RequestConsensusParams struct {
	Height *Int64 `json:"height"`
}

type RequestEvents

type RequestEvents struct {
	// Optional filter spec. If nil or empty, all items are eligible.
	Filter *EventFilter `json:"filter"`

	// The maximum number of eligible items to return.
	// If zero or negative, the server will report a default number.
	MaxItems int `json:"maxItems"`

	// Return only items after this cursor. If empty, the limit is just
	// before the the beginning of the event log.
	After string `json:"after"`

	// Return only items before this cursor.  If empty, the limit is just
	// after the head of the event log.
	Before string `json:"before"`

	// Wait for up to this long for events to be available.
	WaitTime time.Duration `json:"waitTime"`
}

RequestEvents is the argument for the "/events" RPC endpoint.

type RequestGenesisChunked

type RequestGenesisChunked struct {
	Chunk Int64 `json:"chunk"`
}

type RequestRemoveTx

type RequestRemoveTx struct {
	TxKey types.TxKey `json:"txkey"`
}

type RequestSubscribe

type RequestSubscribe struct {
	Query string `json:"query"`
}

type RequestTx

type RequestTx struct {
	Hash  bytes.HexBytes `json:"hash"`
	Prove bool           `json:"prove"`
}

type RequestTxSearch

type RequestTxSearch struct {
	Query   string `json:"query"`
	Prove   bool   `json:"prove"`
	Page    *Int64 `json:"page"`
	PerPage *Int64 `json:"per_page"`
	OrderBy string `json:"order_by"`
}

type RequestUnconfirmedTxs

type RequestUnconfirmedTxs struct {
	Page    *Int64 `json:"page"`
	PerPage *Int64 `json:"per_page"`
}

type RequestUnsubscribe

type RequestUnsubscribe struct {
	Query string `json:"query"`
}

type RequestValidators

type RequestValidators struct {
	Height  *Int64 `json:"height"`
	Page    *Int64 `json:"page"`
	PerPage *Int64 `json:"per_page"`

	RequestQuorumInfo *bool `json:"request_quorum_info"`
}

type ResultABCIInfo

type ResultABCIInfo struct {
	Response abci.ResponseInfo `json:"response"`
}

Info abci msg

type ResultABCIQuery

type ResultABCIQuery struct {
	Response abci.ResponseQuery `json:"response"`
}

Query abci msg

type ResultBlock

type ResultBlock struct {
	BlockID types.BlockID `json:"block_id"`
	Block   *types.Block  `json:"block"`
}

Single block (with meta)

type ResultBlockResults

type ResultBlockResults struct {
	Height                int64                    `json:"height,string"`
	TxsResults            []*abci.ExecTxResult     `json:"txs_results"`
	TotalGasUsed          int64                    `json:"total_gas_used,string"`
	FinalizeBlockEvents   []abci.Event             `json:"finalize_block_events"`
	ValidatorSetUpdate    *abci.ValidatorSetUpdate `json:"validator_set_updates"`
	ConsensusParamUpdates *types.ConsensusParams   `json:"consensus_param_updates"`
}

ABCI results from a block

type ResultBlockSearch

type ResultBlockSearch struct {
	Blocks     []*ResultBlock `json:"blocks"`
	TotalCount int            `json:"total_count,string"`
}

ResultBlockSearch defines the RPC response type for a block search by events.

type ResultBlockchainInfo

type ResultBlockchainInfo struct {
	LastHeight int64              `json:"last_height,string"`
	BlockMetas []*types.BlockMeta `json:"block_metas"`
}

List of blocks

type ResultBroadcastEvidence

type ResultBroadcastEvidence struct {
	Hash []byte `json:"hash"`
}

Result of broadcasting evidence

type ResultBroadcastTx

type ResultBroadcastTx struct {
	Code      uint32         `json:"code"`
	Data      bytes.HexBytes `json:"data"`
	Codespace string         `json:"codespace"`
	Hash      bytes.HexBytes `json:"hash"`

	Info string `json:"info"`
}

CheckTx result

type ResultBroadcastTxCommit

type ResultBroadcastTxCommit struct {
	CheckTx  abci.ResponseCheckTx `json:"check_tx"`
	TxResult abci.ExecTxResult    `json:"tx_result"`
	Hash     bytes.HexBytes       `json:"hash"`
	Height   int64                `json:"height,string"`
}

CheckTx and DeliverTx results

type ResultCheckTx

type ResultCheckTx struct {
	abci.ResponseCheckTx
}

ResultCheckTx wraps abci.ResponseCheckTx.

type ResultCommit

type ResultCommit struct {
	types.SignedHeader `json:"signed_header"`
	CanonicalCommit    bool `json:"canonical"`
}

Commit and Header

func NewResultCommit

func NewResultCommit(header *types.Header, commit *types.Commit,
	canonical bool) *ResultCommit

NewResultCommit is a helper to initialize the ResultCommit with the embedded struct

type ResultConsensusParams

type ResultConsensusParams struct {
	BlockHeight     int64                 `json:"block_height,string"`
	ConsensusParams types.ConsensusParams `json:"consensus_params"`
}

ConsensusParams for given height

type ResultConsensusState

type ResultConsensusState struct {
	RoundState json.RawMessage `json:"round_state"`
}

UNSTABLE

type ResultDialPeers

type ResultDialPeers struct {
	Log string `json:"log"`
}

Log from dialing peers

type ResultDialSeeds

type ResultDialSeeds struct {
	Log string `json:"log"`
}

Log from dialing seeds

type ResultDumpConsensusState

type ResultDumpConsensusState struct {
	RoundState json.RawMessage `json:"round_state"`
	Peers      []PeerStateInfo `json:"peers"`
}

Info about the consensus state. UNSTABLE

type ResultEvent

type ResultEvent struct {
	SubscriptionID string
	Query          string
	Data           types.EventData
	Events         []abci.Event
}

Event data from a subscription

func (ResultEvent) MarshalJSON

func (r ResultEvent) MarshalJSON() ([]byte, error)

func (*ResultEvent) UnmarshalJSON

func (r *ResultEvent) UnmarshalJSON(data []byte) error

type ResultEvents

type ResultEvents struct {
	// The items matching the request parameters, from newest
	// to oldest, if any were available within the timeout.
	Items []*EventItem `json:"items"`

	// This is true if there is at least one older matching item
	// available in the log that was not returned.
	More bool `json:"more"`

	// The cursor of the oldest item in the log at the time of this reply,
	// or "" if the log is empty.
	Oldest string `json:"oldest"`

	// The cursor of the newest item in the log at the time of this reply,
	// or "" if the log is empty.
	Newest string `json:"newest"`
}

ResultEvents is the response from the "/events" RPC endpoint.

type ResultGenesis

type ResultGenesis struct {
	Genesis *types.GenesisDoc `json:"genesis"`
}

Genesis file

type ResultGenesisChunk

type ResultGenesisChunk struct {
	ChunkNumber int    `json:"chunk,string"`
	TotalChunks int    `json:"total,string"`
	Data        string `json:"data"`
}

ResultGenesisChunk is the output format for the chunked/paginated interface. These chunks are produced by converting the genesis document to JSON and then splitting the resulting payload into 16 megabyte blocks and then base64 encoding each block.

type ResultHeader

type ResultHeader struct {
	Header *types.Header `json:"header"`
}

ResultHeader represents the response for a Header RPC Client query

type ResultHealth

type ResultHealth struct{}

empty results

type ResultNetInfo

type ResultNetInfo struct {
	Listening bool     `json:"listening"`
	Listeners []string `json:"listeners"`
	NPeers    int      `json:"n_peers,string"`
	Peers     []Peer   `json:"peers"`
}

Info about peer connections

type ResultStatus

type ResultStatus struct {
	NodeInfo        types.NodeInfo        `json:"node_info"`
	ApplicationInfo ApplicationInfo       `json:"application_info,omitempty"`
	SyncInfo        SyncInfo              `json:"sync_info"`
	ValidatorInfo   ValidatorInfo         `json:"validator_info"`
	LightClientInfo types.LightClientInfo `json:"light_client_info,omitempty"`
}

Node Status

func (*ResultStatus) TxIndexEnabled

func (s *ResultStatus) TxIndexEnabled() bool

Is TxIndexing enabled

type ResultSubscribe

type ResultSubscribe struct{}

empty results

type ResultTx

type ResultTx struct {
	Hash     bytes.HexBytes    `json:"hash"`
	Height   int64             `json:"height,string"`
	Index    uint32            `json:"index"`
	TxResult abci.ExecTxResult `json:"tx_result"`
	Tx       types.Tx          `json:"tx"`
	Proof    types.TxProof     `json:"proof,omitempty"`
}

Result of querying for a tx

type ResultTxSearch

type ResultTxSearch struct {
	Txs        []*ResultTx `json:"txs"`
	TotalCount int         `json:"total_count,string"`
}

Result of searching for txs

type ResultUnconfirmedTxs

type ResultUnconfirmedTxs struct {
	Count      int        `json:"n_txs,string"`
	Total      int        `json:"total,string"`
	TotalBytes int64      `json:"total_bytes,string"`
	Txs        []types.Tx `json:"txs"`
}

List of mempool txs

type ResultUnsafeFlushMempool

type ResultUnsafeFlushMempool struct{}

empty results

type ResultUnsafeProfile

type ResultUnsafeProfile struct{}

empty results

type ResultUnsubscribe

type ResultUnsubscribe struct{}

empty results

type ResultValidators

type ResultValidators struct {
	BlockHeight int64
	Validators  []*types.Validator

	Count int // Count of actual validators in this result
	Total int // Total number of validators

	// dash fields
	ThresholdPublicKey *crypto.PubKey
	QuorumType         btcjson.LLMQType
	QuorumHash         *crypto.QuorumHash
}

ResultValidators for a height.

func (ResultValidators) MarshalJSON

func (r ResultValidators) MarshalJSON() ([]byte, error)

func (*ResultValidators) UnmarshalJSON

func (r *ResultValidators) UnmarshalJSON(data []byte) error

type SyncInfo

type SyncInfo struct {
	LatestBlockHash   bytes.HexBytes `json:"latest_block_hash"`
	LatestAppHash     bytes.HexBytes `json:"latest_app_hash"`
	LatestBlockHeight int64          `json:"latest_block_height,string"`
	LatestBlockTime   time.Time      `json:"latest_block_time"`

	EarliestBlockHash   bytes.HexBytes `json:"earliest_block_hash"`
	EarliestAppHash     bytes.HexBytes `json:"earliest_app_hash"`
	EarliestBlockHeight int64          `json:"earliest_block_height,string"`
	EarliestBlockTime   time.Time      `json:"earliest_block_time"`

	MaxPeerBlockHeight int64 `json:"max_peer_block_height,string"`

	CatchingUp bool `json:"catching_up"`

	TotalSyncedTime time.Duration `json:"total_synced_time,string"`
	RemainingTime   time.Duration `json:"remaining_time,string"`

	TotalSnapshots      int64         `json:"total_snapshots,string"`
	ChunkProcessAvgTime time.Duration `json:"chunk_process_avg_time,string"`
	SnapshotHeight      int64         `json:"snapshot_height,string"`
	SnapshotChunksCount int64         `json:"snapshot_chunks_count,string"`
	BackFilledBlocks    int64         `json:"backfilled_blocks,string"`
	BackFillBlocksTotal int64         `json:"backfill_blocks_total,string"`
}

Info about the node's syncing state

type ValidatorInfo

type ValidatorInfo struct {
	ProTxHash   crypto.ProTxHash `json:"pro_tx_hash"`
	VotingPower int64            `json:"voting_power"`
}

Info about the node's validator

Jump to

Keyboard shortcuts

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