Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultEndpoint = fmt.Sprintf("http://localhost:%d", seiconfig.PortRPC)
DefaultEndpoint is the local CometBFT RPC address.
Functions ¶
This section is empty.
Types ¶
type Block ¶ added in v0.0.31
type Block struct {
Header BlockHeader `json:"header"`
}
Block holds the subset of block fields we need.
type BlockHeader ¶ added in v0.0.31
type BlockHeader struct {
AppHash string `json:"app_hash"`
LastResultsHash string `json:"last_results_hash"`
}
BlockHeader holds consensus-critical header fields for comparison.
type BlockID ¶ added in v0.0.31
type BlockID struct {
Hash string `json:"hash"`
}
BlockID identifies a block by hash.
type BlockResult ¶ added in v0.0.31
BlockResult is the inner "result" of the CometBFT /block response.
type BlockResultsResult ¶ added in v0.0.31
type BlockResultsResult struct {
TxsResults []TxResult `json:"txs_results"`
}
BlockResultsResult is the inner "result" of the CometBFT /block_results response.
type Client ¶ added in v0.0.31
type Client struct {
// contains filtered or unexported fields
}
Client performs HTTP GET requests against a CometBFT RPC endpoint and handles the JSON-RPC envelope unwrapping.
func NewClient ¶ added in v0.0.31
NewClient creates a CometBFT RPC client. Pass "" for endpoint to use the default localhost address. Pass nil for httpClient to use http.DefaultClient with no custom timeout.
func (*Client) Get ¶ added in v0.0.31
Get performs an HTTP GET to endpoint+path and returns the inner result as raw JSON. It handles both response formats:
- JSON-RPC envelope (standard CometBFT): {"jsonrpc":"2.0","result":{...}} → returns the unwrapped "result" value
- Flat JSON (seid): {"node_info":{...},"sync_info":{...}} → returns the body as-is
This dual-format support is necessary because seid's CometBFT fork returns flat responses while standard CometBFT uses JSON-RPC envelopes.
func (*Client) GetRaw ¶ added in v0.0.31
GetRaw performs an HTTP GET and returns the entire response body without envelope unwrapping. Use for archival paths that store the verbatim JSON-RPC response (e.g., S3 export).
func (*Client) SetTimeout ¶ added in v0.0.31
SetTimeout overrides the per-request context timeout.
type NodeInfo ¶ added in v0.0.31
type NodeInfo struct {
ID string `json:"id"`
}
NodeInfo identifies a CometBFT node.
type NodeStatus ¶
NodeStatus holds the fields we care about from CometBFT /status.
type StatusClient ¶
type StatusClient struct {
// contains filtered or unexported fields
}
StatusClient queries a CometBFT node's /status endpoint.
func NewStatusClient ¶
func NewStatusClient(endpoint string, httpClient HTTPDoer) *StatusClient
NewStatusClient creates a client targeting the given RPC endpoint. Pass "" for the default localhost endpoint. Pass nil for the default HTTP client.
func (*StatusClient) Endpoint ¶
func (c *StatusClient) Endpoint() string
Endpoint returns the configured RPC endpoint.
func (*StatusClient) LatestHeight ¶
func (c *StatusClient) LatestHeight(ctx context.Context) (int64, error)
LatestHeight is a convenience wrapper returning just the height.
func (*StatusClient) Status ¶
func (c *StatusClient) Status(ctx context.Context) (*NodeStatus, error)
Status queries the node and returns the parsed status.
type StatusResult ¶ added in v0.0.31
type StatusResult struct {
NodeInfo NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
}
StatusResult is the inner "result" of the CometBFT /status response, after the JSON-RPC envelope has been stripped by Client.Get.