cmd

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TempDir = os.TempDir()
View Source
var (
	Version = "v1.1.0"
)

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewRootCmd

func NewRootCmd(log *zap.Logger) *cobra.Command

NewRootCmd returns the root command for relayer. If log is nil, a new zap.Logger is set on the app state based on the command line flags regarding logging.

func UnmarshalJSONProviderConfig

func UnmarshalJSONProviderConfig(data []byte, customTypes map[string]reflect.Type) (any, error)

UnmarshalJSONProviderConfig contains the custom unmarshalling logic for ProviderConfig structs

Types

type Config

type Config struct {
	Global *GlobalConfig  `yaml:"global" json:"global"`
	Chains relayer.Chains `yaml:"chains" json:"chains"`
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) AddChain

func (c *Config) AddChain(chain *relayer.Chain) error

AddChain adds an additional chain to the config

func (*Config) DeleteChain

func (c *Config) DeleteChain(chain string)

func (Config) MustYAML

func (c Config) MustYAML() []byte

func (*Config) Save

func (c *Config) Save(cfgPath string) error

func (*Config) Wrapped

func (c *Config) Wrapped() *ConfigOutputWrapper

Note: chainId and chainName is basically the same Wrapped converts the Config struct into a ConfigOutputWrapper struct

type ConfigInputWrapper

type ConfigInputWrapper struct {
	Global          *GlobalConfig                         `yaml:"global"`
	ProviderConfigs map[string]*ProviderConfigYAMLWrapper `yaml:"chains"`
}

ConfigInputWrapper is an intermediary type for parsing the config.yaml file

func (*ConfigInputWrapper) RuntimeConfig

func (c *ConfigInputWrapper) RuntimeConfig(ctx context.Context, a *appState) (*Config, error)

RuntimeConfig converts the input disk config into the relayer runtime config.

type ConfigOutputWrapper

type ConfigOutputWrapper struct {
	Global          *GlobalConfig   `yaml:"global" json:"global"`
	ProviderConfigs ProviderConfigs `yaml:"chains" json:"chains"`
}

ConfigOutputWrapper is an intermediary type for writing the config to disk and stdout

type GlobalConfig

type GlobalConfig struct {
	Timeout  string `yaml:"timeout" json:"timeout"`
	KMSKeyID string `yaml:"kms-key-id" json:"kms-key-id"`
}

GlobalConfig describes any global relayer settings

type ProviderConfigWrapper

type ProviderConfigWrapper struct {
	Type  string          `yaml:"type"  json:"type"`
	Value provider.Config `yaml:"value" json:"value"`
}

ProviderConfigWrapper is an intermediary type for parsing arbitrary ProviderConfigs from json files and writing to json/yaml files

func (*ProviderConfigWrapper) UnmarshalJSON

func (pcw *ProviderConfigWrapper) UnmarshalJSON(data []byte) error

UnmarshalJSON adds support for unmarshalling data from an arbitrary ProviderConfig NOTE: Add new ProviderConfig types in the map here with the key set equal to the type of ChainProvider (e.g. cosmos, substrate, etc.)

type ProviderConfigYAMLWrapper

type ProviderConfigYAMLWrapper struct {
	Type  string `yaml:"type"`
	Value any    `yaml:"-"`
}

ProviderConfigYAMLWrapper is an intermediary type for parsing arbitrary ProviderConfigs from yaml files

func (*ProviderConfigYAMLWrapper) UnmarshalYAML

func (iw *ProviderConfigYAMLWrapper) UnmarshalYAML(n *yaml.Node) error

UnmarshalYAML adds support for unmarshalling data from arbitrary ProviderConfig entries found in the config file NOTE: Add logic for new ProviderConfig types in a switch case here

type ProviderConfigs

type ProviderConfigs map[string]*ProviderConfigWrapper

Jump to

Keyboard shortcuts

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