Documentation
¶
Index ¶
- func BuildFullMethodName(methodDescriptor protoreflect.MethodDescriptor) string
- func ExtractGRPCField[T any](gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, ...) (T, error)
- func GetBech32PrefixWithRetry(gRPCClient *client.GRPCClient, maxRetries uint) (string, error)
- func GetEarliestBlockHeight(gRPCClient *client.GRPCClient, maxRetries uint) (uint64, error)
- func GetGRPCResponse(gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, ...) ([]byte, error)
- func GetLatestBlockHeightWithRetry(gRPCClient *client.GRPCClient, maxRetries uint) (uint64, error)
- func ParseLowestHeightFromError(errMsg string) uint64
- func ParseMethodFullName(methodFullName string) (string, string, error)
- func RetryGRPCCall[T any](gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, ...) (T, error)
- type GRPCResponseFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFullMethodName ¶
func BuildFullMethodName(methodDescriptor protoreflect.MethodDescriptor) string
BuildFullMethodName constructs the full method name from the method descriptor
func ExtractGRPCField ¶
func ExtractGRPCField[T any]( gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, fieldName string, converter func(string) (T, error), ) (T, error)
ExtractGRPCField calls a gRPC method and extracts a specific field from the response
func GetBech32PrefixWithRetry ¶
func GetBech32PrefixWithRetry(gRPCClient *client.GRPCClient, maxRetries uint) (string, error)
GetBech32PrefixWithRetry retrieves the Bech32 prefix from the gRPC server with retry logic.
func GetEarliestBlockHeight ¶ added in v0.11.0
func GetEarliestBlockHeight(gRPCClient *client.GRPCClient, maxRetries uint) (uint64, error)
GetEarliestBlockHeight determines the earliest available block on a node. It probes block 1 to check if the node is an archive node or pruned. For archive nodes, returns 1. For pruned nodes, parses the error message to extract the lowest available height.
func GetGRPCResponse ¶
func GetGRPCResponse( gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, inputParams []byte, ) ([]byte, error)
GetGRPCResponse calls a gRPC method and returns the response as JSON
func GetLatestBlockHeightWithRetry ¶
func GetLatestBlockHeightWithRetry(gRPCClient *client.GRPCClient, maxRetries uint) (uint64, error)
GetLatestBlockHeightWithRetry retrieves the latest block height from the gRPC server with retry logic.
func ParseLowestHeightFromError ¶ added in v0.11.0
ParseLowestHeightFromError extracts lowest height from pruned node errors. CosmosSDK nodes return errors like "height 1 is not available, lowest height is 28566001".
func ParseMethodFullName ¶
ParseMethodFullName parses a gRPC method full name into service name and method name
func RetryGRPCCall ¶
func RetryGRPCCall[T any]( gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, callFunc func(string, protoreflect.MethodDescriptor) (T, error), ) (T, error)
RetryGRPCCall retries a gRPC call with exponential backoff
Types ¶
type GRPCResponseFunc ¶ added in v0.11.0
type GRPCResponseFunc func(gRPCClient *client.GRPCClient, methodFullName string, maxRetries uint, inputParams []byte) ([]byte, error)
GRPCResponseFunc is a function type for getting gRPC responses, allowing dependency injection for testing.