package
2.1.1
Repository: https://github.com/skip-mev/connect.git
Documentation: pkg.go.dev

# README

Oracle Client

Overview

The oracle client is responsible for fetching data from a price oracle that is running externally from the Cosmos SDK application. The client will fetch prices, standardize them according to the preferences of the application and include them in a validator's vote extension.

// OracleClient defines the interface that will be utilized by the application
// to query the oracle service. This interface is meant to be implemented by
// the gRPC client that connects to the oracle service.
type OracleClient interface {
	// Prices defines a method for fetching the latest prices.
	Prices(ctx context.Context, in *QueryPricesRequest, opts ...grpc.CallOption) (*QueryPricesResponse, error)

	// Start starts the oracle client.
	Start() error

	// Stop stops the oracle client.
	Stop() error
}

There are two types of clients that are supported:

  • Vanilla GRPC oracle client - This client is responsible for fetching data from an oracle that is aggregating price data. It implements a GRPC client that connects to the oracle service and fetches the latest prices.
  • Metrics GRPC oracle client - This client implements the same functionality as the vanilla GRPC oracle client, but also exposes metrics that can be scraped by Prometheus.

To enable the metrics GRPC client, please read over the oracle configurations documentation.

# Packages

No description provided by the author

# Functions

NewClient creates a new grpc client of the oracle service with the given address and timeout.
NewClientFromConfig creates a new grpc client of the oracle service with the given app configuration.
NewPriceDaemon creates a new price daemon with the given configuration.
NewPriceDaemonClientFromConfig creates a new grpc client of the oracle service with the given app configuration.
NewThreadSafeResponse creates a new thread-safe response.
WithBlockingDial configures the OracleClient to block on dialing the remote oracle server.

# Structs

GRPCClient defines an implementation of a gRPC oracle client.
NoOpClient is a no-op implementation of the OracleClient interface.
No description provided by the author
ThreadSafeResponse is a thread-safe wrapper around a QueryPricesResponse.

# Interfaces

OracleClient defines the interface that will be utilized by the application to query the oracle service.

# Type aliases

Option enables consumers to configure the behavior of an OracleClient on initialization.