thorchainV1.go


Overview

The [thorchainV1.go](/projects/291/69226) file provides Go client functionality to interact with the Thorchain blockchain's RPC endpoints, specifically to retrieve block results at a given block height. It wraps and extends Tendermint's RPC client response types to provide easy access to blockchain events emitted during block processing.

This file primarily defines:

This layer abstracts the complexity of Tendermint RPC calls and JSON unmarshaling, providing a clean interface for higher-level application components to consume blockchain event data.


Detailed Documentation

Package: thorchainV1

This package contains client-side types and methods to interact with Thorchain blockchain nodes, focusing on fetching block results.


Types

HTTPClient

type HTTPClient struct {
	*cosmos.HTTPClient
}

ResultBlockResults

type ResultBlockResults struct {
	*coretypes.ResultBlockResults
}

Functions

NewHTTPClient

func NewHTTPClient(httpClient *cosmos.HTTPClient) *HTTPClient

(*HTTPClient) BlockResults

func (c *HTTPClient) BlockResults(height int) (cosmos.BlockResults, error)

Important Implementation Details


Interaction with Other System Components


Visual Diagram

classDiagram
    class HTTPClient {
        +BlockResults(height int) (cosmos.BlockResults, error)
    }
    HTTPClient o-- cosmos.HTTPClient : embeds

    class ResultBlockResults {
        +GetBlockEvents() []cosmos.ABCIEvent
    }
    ResultBlockResults o-- coretypes.ResultBlockResults : wraps

    HTTPClient --> ResultBlockResults : returns

Summary

The [thorchainV1.go](/projects/291/69226) file is a specialized client module designed for fetching and processing block results from Thorchain nodes using Tendermint RPC. It provides a clean abstraction to obtain block events, handling the nuances of RPC communication, JSON unmarshaling, and event attribute conversion. This file plays a key role in enabling higher-level Thorchain applications to consume blockchain event data reliably and efficiently.