Documentation
¶
Index ¶
- func CreateGRPCConnection(endpoint string) (*grpc.ClientConn, error)
- func ExtractHostnameFromURL(grpcURL string) (string, error)
- func QueryGrantsWithRetry(grpcURL, granteeAddr string, cdc *codec.ProtoCodec, log zerolog.Logger) (string, []string, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) GetAllChainConfigs(ctx context.Context) ([]*uregistrytypes.ChainConfig, error)
- func (c *Client) GetBlockByHeight(height int64) (*cmtservice.GetBlockByHeightResponse, error)
- func (c *Client) GetCurrentTSSKeyId() (string, error)
- func (c *Client) GetLatestBlockNum() (uint64, error)
- func (c *Client) GetTxsByEvents(eventQuery string, minHeight, maxHeight uint64, limit uint64) ([]*TxResult, error)
- func (c *Client) GetUniversalValidators() ([]*uvalidatortypes.UniversalValidator, error)
- type TxResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGRPCConnection ¶
func CreateGRPCConnection(endpoint string) (*grpc.ClientConn, error)
CreateGRPCConnection creates a gRPC connection with appropriate transport security. It automatically detects whether to use TLS based on the URL scheme (https:// or http://). The function handles:
- https:// URLs: Uses TLS with default credentials
- http:// or no scheme: Uses insecure connection
- Automatically adds default port 9090 if no port is specified
The endpoint is processed to remove the scheme prefix before dialing.
func ExtractHostnameFromURL ¶
ExtractHostnameFromURL extracts the hostname from a URL string. It handles various URL formats including:
- Full URLs with scheme (https://example.com:443)
- URLs without scheme (example.com:9090)
- Plain hostnames (example.com)
The function returns just the hostname without port or scheme.
func QueryGrantsWithRetry ¶
func QueryGrantsWithRetry(grpcURL, granteeAddr string, cdc *codec.ProtoCodec, log zerolog.Logger) (string, []string, error)
QueryGrantsWithRetry queries AuthZ grants for a grantee with retry logic
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimal fan-out client over multiple gRPC endpoints. Each call tries endpoints in round-robin order and returns the first success.
func New ¶
New dials the provided gRPC URLs (best-effort) and builds a Client. - Uses insecure transport by default. - Skips endpoints that fail to dial; requires at least one success.
func (*Client) GetAllChainConfigs ¶
func (c *Client) GetAllChainConfigs(ctx context.Context) ([]*uregistrytypes.ChainConfig, error)
GetAllChainConfigs tries each endpoint once in round-robin order. If all endpoints fail, returns the last error.
func (*Client) GetBlockByHeight ¶
func (c *Client) GetBlockByHeight(height int64) (*cmtservice.GetBlockByHeightResponse, error)
GetBlockByHeight returns block information for a specific height.
func (*Client) GetCurrentTSSKeyId ¶
GetCurrentTSSKeyId returns the current TSS key ID from Push Chain. It tries each endpoint in round-robin order until one succeeds. Returns empty string if no key exists.
func (*Client) GetLatestBlockNum ¶
GetLatestBlockNum returns the latest block number from Push Chain. It tries each endpoint in round-robin order until one succeeds.
func (*Client) GetTxsByEvents ¶
func (c *Client) GetTxsByEvents(eventQuery string, minHeight, maxHeight uint64, limit uint64) ([]*TxResult, error)
GetTxsByEvents queries transactions matching the given event query. The query should follow Cosmos SDK event query format, e.g., "tss_process_initiated.process_id EXISTS" minHeight and maxHeight can be used to filter by block range (0 means no limit).
func (*Client) GetUniversalValidators ¶
func (c *Client) GetUniversalValidators() ([]*uvalidatortypes.UniversalValidator, error)
GetUniversalValidators returns all universal validators from Push Chain. It tries each endpoint in round-robin order until one succeeds.