config

package
v0.1.27-dev-session-ro... Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package config provides a method by which dependencies can be injected into dependency chains, via the use of SupplierFn functions. These functions return functions that can be used in CLI code to chain the dependencies required to start a service into a single depinject.Config.

Index

Constants

View Source
const FlagQueryCaching = "query-caching"

FlagQueryCaching is the flag name to enable or disable query caching.

Variables

This section is empty.

Functions

func GetTxClientGasAndFeesOptionsFromFlags added in v0.1.2

func GetTxClientGasAndFeesOptionsFromFlags(cmd *cobra.Command, gasSettingStr string) ([]client.TxClientOption, error)

GetTxClientGasAndFeesOptionsFromFlags returns a slice of TxClientOptions which are derived from the provided command flags and/or config, using the following precedence:

1. If a fee is specified, it overrides all gas settings, only returns:

  • WithFeeAmount In this case, the fee amount is explicitly set (by the tx author); therefore, while the gas limit will still be respected by the CheckTx ABCI method, the gas limit, adjustment, and prices are NOT used to calculate the fee.

2. Otherwise, the following gas related options are returned:

  • WithGasPrices
  • WithGasAdjustment
  • WithGasSetting In this case, the fee is calculated, given by: `fees = gas_limit * gas_adjustment * gas_prices`.

gasSettingStr is expected to be either "auto", empty string, or a string integer:

  • "auto": The gas limit will be determined by simulating the transaction and multiplying by the gas adjustment.
  • "<integer>": The gas limit will be set to the integer amount represented by the string.
  • "": The gas limit will be set to flags.DefaultGasLimit (200000).

func SupplyConfig

func SupplyConfig(
	ctx context.Context,
	cmd *cobra.Command,
	suppliers []SupplierFn,
) (deps depinject.Config, err error)

SupplyConfig supplies a depinject config by calling each of the supplied supplier functions in order and passing the result of each supplier to the next supplier, chaining them together.

func SupplyMiner added in v0.1.12

func SupplyMiner(
	_ context.Context,
	deps depinject.Config,
	_ *cobra.Command,
) (depinject.Config, error)

SupplyMiner constructs a Miner instance and returns a new depinject.Config with it supplied.

- Supplies Miner to the dependency injection config - Returns updated config and error if any

Parameters:

  • ctx: Context for the function
  • deps: Dependency injection config
  • cmd: Cobra command

Returns:

  • depinject.Config: Updated dependency injection config
  • error: Error if setup fails

func SupplyTxContext added in v0.1.12

func SupplyTxContext(
	_ context.Context,
	deps depinject.Config,
	_ *cobra.Command,
) (depinject.Config, error)

SupplyTxContext constructs a transaction context and returns a new depinject.Config with it supplied.

- Supplies TxContext to the dependency injection config - Returns updated config and error if any

Parameters:

  • ctx: Context for the function
  • deps: Dependency injection config
  • cmd: Cobra command

Returns:

  • depinject.Config: Updated dependency injection config
  • error: Error if setup fails

func SupplyTxFactory added in v0.1.12

func SupplyTxFactory(
	_ context.Context,
	deps depinject.Config,
	cmd *cobra.Command,
) (depinject.Config, error)

SupplyTxFactory constructs a cosmostx.Factory instance and returns a new depinject.Config with it supplied.

- Supplies TxFactory to the dependency injection config - Returns updated config and error if any

Parameters:

  • ctx: Context for the function
  • deps: Dependency injection config
  • cmd: Cobra command

Returns:

  • depinject.Config: Updated dependency injection config
  • error: Error if setup fails

Types

type SupplierFn

type SupplierFn func(
	context.Context,
	depinject.Config,
	*cobra.Command,
) (depinject.Config, error)

SupplierFn is a function that is used to supply a depinject config.

func NewSupplyAccountQuerierFn

func NewSupplyAccountQuerierFn() SupplierFn

NewSupplyAccountQuerierFn supplies a depinject config with an AccountQuerier.

func NewSupplyApplicationQuerierFn

func NewSupplyApplicationQuerierFn() SupplierFn

NewSupplyApplicationQuerierFn supplies a depinject config with an ApplicationQuerier.

func NewSupplyBankQuerierFn added in v0.0.10

func NewSupplyBankQuerierFn() SupplierFn

NewSupplyBankQuerierFn supplies a depinject config with an BankQuerier.

func NewSupplyBlockClientFn

func NewSupplyBlockClientFn(queryNodeRPCURL *url.URL) SupplierFn

NewSupplyBlockClientFn supplies a depinject config with a blockClient.

func NewSupplyCometClientFn added in v0.1.23

func NewSupplyCometClientFn(queryNodeRPCURL *url.URL) SupplierFn

NewSupplyCometClientFn supplies a depinject config with an comet HTTP client from the given queryNodeRPCURL.

func NewSupplyKeyValueCacheFn added in v0.0.14

func NewSupplyKeyValueCacheFn[T any](opts ...querycache.CacheOption[cache.KeyValueCache[T]]) SupplierFn

NewSupplyKeyValueCacheFn returns a function which constructs a KeyValueCache of type T. It take a list of cache options that can be used to configure the cache.

func NewSupplyLoggerFromCtx

func NewSupplyLoggerFromCtx(ctx context.Context) SupplierFn

NewSupplyLoggerFromCtx supplies a depinject config with a polylog.Logger instance populated from the given context.

func NewSupplyParamsCacheFn added in v0.0.14

func NewSupplyParamsCacheFn[T any](opts ...querycache.CacheOption[client.ParamsCache[T]]) SupplierFn

NewSupplyParamsCacheFn returns a function which constructs a ParamsCache of type T. It take a list of cache options that can be used to configure the cache.

func NewSupplyProofQueryClientFn added in v0.0.3

func NewSupplyProofQueryClientFn() SupplierFn

NewSupplyProofQueryClientFn returns a function which constructs a ProofQueryClient instance and returns a new depinject.Config which is supplied with the given deps and the new ProofQueryClient.

func NewSupplyQueryClientContextFn

func NewSupplyQueryClientContextFn(queryNodeGRPCURL *url.URL) SupplierFn

NewSupplyQueryClientContextFn supplies a depinject config with a query

ClientContext, a GRPC client connection, and a keyring from the given queryNodeGRPCURL.

func NewSupplyRelayAuthenticatorFn added in v0.1.12

func NewSupplyRelayAuthenticatorFn(
	signingKeyNames []string,
) SupplierFn

NewSupplyRelayAuthenticatorFn returns a function which constructs a RelayAuthenticator and returns a new depinject.Config with it supplied.

- Accepts signingKeyNames for authenticator setup - Returns a SupplierFn for dependency injection

Parameters:

  • signingKeyNames: List of signing key names

Returns:

  • SupplierFn: Supplier function for dependency injection

func NewSupplyRelayerProxyFn added in v0.1.12

func NewSupplyRelayerProxyFn(
	servicesConfigMap map[string]*relayerconfig.RelayMinerServerConfig,
	pingEnabled bool,
) SupplierFn

newSupplyRelayerProxyFn returns a function which constructs a RelayerProxy and returns a new depinject.Config with it supplied.

  • Accepts servicesConfigMap for proxy setup
  • Accepts pingEnabled flag to enable pinging the backend services to ensure they are correctly setup and reachable before starting the relayer proxy.
  • Returns a SupplierFn for dependency injection

Parameters:

  • servicesConfigMap: Map of services configuration
  • pingEnabled: Flag to enable pinging the backend services

Returns:

  • SupplierFn: Supplier function for dependency injection

func NewSupplyRelayerSessionsManagerFn added in v0.1.12

func NewSupplyRelayerSessionsManagerFn(smtStorePath string) SupplierFn

newSupplyRelayerSessionsManagerFn returns a function which constructs a RelayerSessionsManager and returns a new depinject.Config with it supplied.

- Accepts smtStorePath for sessions manager setup - Returns a SupplierFn for dependency injection

Parameters:

  • smtStorePath: Path to the sessions store

Returns:

  • config.SupplierFn: Supplier function for dependency injection

func NewSupplyRingClientFn added in v0.0.14

func NewSupplyRingClientFn() SupplierFn

NewSupplyRingClientFn supplies a depinject config with a RingClient.

func NewSupplyServiceQueryClientFn added in v0.0.8

func NewSupplyServiceQueryClientFn() SupplierFn

NewSupplyServiceQueryClientFn returns a function which constructs a NewSupplyServiceQueryClient instance and returns a new depinject.Config which is supplied with the given deps and the new ServiceQueryClient.

func NewSupplySessionQuerierFn

func NewSupplySessionQuerierFn() SupplierFn

NewSupplySessionQuerierFn supplies a depinject config with a SessionQuerier.

func NewSupplySharedQueryClientFn added in v0.0.3

func NewSupplySharedQueryClientFn() SupplierFn

NewSupplySharedQueryClientFn returns a function which constructs a SharedQueryClient instance and returns a new depinject.Config which is supplied with the given deps and the new SharedQueryClient.

func NewSupplySupplierClientsFn added in v0.0.3

func NewSupplySupplierClientsFn(signingKeyNames []string, gasSettingStr string) SupplierFn

NewSupplySupplierClientsFn returns a function which constructs a SupplierClientMap and returns a new depinject.Config which is supplied with the given deps and the new SupplierClientMap.

  • signingKeyNames is a list of operators signing key name corresponding to the staked suppliers operator addresses.
  • gasSettingStr is the gas setting to use for the tx client. Options are "auto", "<integer>", or "". See: config.GetTxClientGasAndFeesOptionsFromFlags.

func NewSupplySupplierQuerierFn

func NewSupplySupplierQuerierFn() SupplierFn

NewSupplySupplierQuerierFn supplies a depinject config with a SupplierQuerier.

func NewSupplyTxClientContextFn

func NewSupplyTxClientContextFn(
	queryNodeGRPCURL *url.URL,
	txNodeRPCURL *url.URL,
) SupplierFn

NewSupplyTxClientContextFn supplies a depinject config with a TxClientContext from the given txNodeGRPCURL. TODO_TECHDEBT(#256): Remove this function once the as we may no longer need to supply a TxClientContext to the RelayMiner.

func SupplyRelayMeterFn added in v0.1.18

func SupplyRelayMeterFn(
	enableOverServicing bool,
) SupplierFn

SupplyRelayMeterFn returns a function which constructs a RelayMeter instance and returns a new depinject.Config with it supplied.

- Accepts enableOverServicing boolean for proxy setup - Returns a SupplierFn for dependency injection

Parameters:

  • enableOverServicing: Enable over-servicing in the relay meter

Returns:

  • SupplierFn: Supplier function for dependency injection

Jump to

Keyboard shortcuts

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