config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGitHubClient        = errors.New("GitHub client not provided")
	ErrMissingRPCConfigMsg = "missing RPC config for chain: %s"
)

Functions

This section is empty.

Types

type Account added in v0.7.1

type Account struct {
	Address   string `yaml:"address" validate:"required"`
	Denom     string `yaml:"denom" validate:"required"`
	ChainName string `yaml:"chainName" validate:"required"`
	Balance   math.Int
}

func (*Account) GetBalance added in v0.7.1

func (a *Account) GetBalance(ctx context.Context, rpcs *map[string]RPC) error

type Channel added in v0.13.0

type Channel struct {
	Chain1 struct {
		ChannelID string `json:"channel_id"`
		PortID    string `json:"port_id"`
	} `json:"chain_1"`
	Chain2 struct {
		ChannelID string `json:"channel_id"`
		PortID    string `json:"port_id"`
	} `json:"chain_2"`
	Ordering string `json:"ordering"`
	Version  string `json:"version"`
	Tags     struct {
		Status     string `json:"status"`
		Preferred  bool   `json:"preferred"`
		Dex        string `json:"dex"`
		Properties string `json:"properties"`
	} `json:"tags,omitempty"`
}

type Config

type Config struct {
	Accounts         []Account `yaml:"accounts"`
	GlobalRPCTimeout string    `env:"GLOBAL_RPC_TIMEOUT" envDefault:"5s"`
	RPCs             []RPC     `yaml:"rpc"`
	GitHub           struct {
		Org            string `yaml:"org" validate:"required"`
		Repo           string `yaml:"repo" validate:"required"`
		IBCDir         string `yaml:"dir" validate:"required"`
		TestnetsIBCDir string `yaml:"testnetsDir"`
		Token          string `env:"GITHUB_TOKEN"`
	} `yaml:"github" validate:"required"`
}

func NewConfig

func NewConfig(configPath string) (*Config, error)

func (*Config) GetRPCsMap

func (c *Config) GetRPCsMap(ibcPaths []*IBCData) (*map[string]RPC, error)

GetRPCsMap uses the provided config file to return a map of chain chain_names to RPCs. It uses IBCData already extracted from github IBC registry to validate config for missing RPCs and raises an error if any are missing.

func (*Config) IBCPaths

func (c *Config) IBCPaths(ctx context.Context) ([]*IBCData, error)

func (*Config) Validate added in v0.13.0

func (c *Config) Validate() error

type Discord added in v0.11.0

type Discord struct {
	Handle string `json:"handle"`
	ID     string `json:"id"`
}

type IBCChainMeta added in v0.13.0

type IBCChainMeta struct {
	ChainName    string `json:"chain_name"`
	ClientID     string `json:"client_id"`
	ConnectionID string `json:"connection_id"`
}

type IBCData added in v0.11.0

type IBCData struct {
	Schema    string       `json:"$schema"`
	Chain1    IBCChainMeta `json:"chain_1"`
	Chain2    IBCChainMeta `json:"chain_2"`
	Channels  []Channel    `json:"channels"`
	Operators []Operator   `json:"operators"`
}

type Operator added in v0.11.0

type Operator struct {
	Chain1 struct {
		Address string `json:"address"`
	} `json:"chain_1"`
	Chain2 struct {
		Address string `json:"address"`
	} `json:"chain_2"`
	Memo    string  `json:"memo"`
	Name    string  `json:"name"`
	Discord Discord `json:"discord"`
}

type RPC

type RPC struct {
	ChainName string `yaml:"chainName" validate:"required"`
	ChainID   string `yaml:"chainId" validate:"required"`
	URL       string `yaml:"url" validate:"required,http_url,has_port"`
	Timeout   string `yaml:"timeout"`
}

Jump to

Keyboard shortcuts

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