pushcore

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

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

func ExtractHostnameFromURL(grpcURL string) (string, error)

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

func New(urls []string, logger zerolog.Logger) (*Client, error)

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) Close

func (c *Client) Close() error

Close closes all owned connections.

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

func (c *Client) GetCurrentTSSKeyId() (string, error)

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

func (c *Client) GetLatestBlockNum() (uint64, error)

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.

type TxResult

type TxResult struct {
	TxHash     string
	Height     int64
	TxResponse *tx.GetTxResponse
}

TxResult represents a transaction result with its events.

Jump to

Keyboard shortcuts

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