config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config allows you to pass in a custom config for which rpcs to hit

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	// RPCS is a list of rpcs to use
	RPCs []string `yaml:"rpcs"`
	// Checks is how many rpcs must return the same result for it to be used. This does not apply to height/status based methods
	Checks uint16 `yaml:"confirmations,omitempty"`
}

ChainConfig is the config for a single chain.

type Config

type Config struct {
	// chainID -> chainConfig
	Chains map[uint32]ChainConfig `yaml:"chains"`
	// Port is the port
	Port uint16 `yaml:"port,omitempty"`
	// RefreshInterval is the refresh interval of rpc latency
	// expressed in seconds
	RefreshInterval int `yaml:"refresh_interval,omitempty"`
	// ClientType is the client type to use
	ClientType string `yaml:"client_type,omitempty"`
}

Config holds the config for the chain.

func GetPublicRPCConfig

func GetPublicRPCConfig() (c Config, err error)

GetPublicRPCConfig gets the rpc map. This should be done at startup time.

func UnmarshallConfig

func UnmarshallConfig(input []byte) (cfg Config, err error)

UnmarshallConfig unmarshalls a config.

func (Config) Marshall

func (c Config) Marshall() ([]byte, error)

Marshall a config to yaml.

Jump to

Keyboard shortcuts

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