Documentation ¶
Overview ¶
Package cmd includes relayer commands Copyright © 2020 Jack Zampolin jack.zampolin@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package cmd includes relayer commands Copyright © 2020 Jack Zampolin jack.zampolin@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package cmd includes relayer commands Copyright © 2020 Jack Zampolin jack.zampolin@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package cmd includes relayer commands Copyright © 2020 Jack Zampolin <jack.zampolin@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func Execute()
- func GetStartOptions(cmd *cobra.Command) (uint64, uint64, error)
- func NewRootCmd(log *zap.Logger) *cobra.Command
- func OverwriteConfigFlag(v *viper.Viper, cmd *cobra.Command) *cobra.Command
- func UnmarshalJSONProviderConfig(data []byte, customTypes map[string]reflect.Type) (any, error)
- func UpdateClientsFromChains(ctx context.Context, src, dst *relayer.Chain, thresholdTime time.Duration) (time.Duration, error)
- type Config
- func (c *Config) AddChain(chain *relayer.Chain) (err error)
- func (c *Config) AddPath(name string, path *relayer.Path) (err error)
- func (c *Config) ChainsFromPath(path string) (map[string]*relayer.Chain, string, string, bool, error)
- func (c *Config) DeleteChain(chain string)
- func (c Config) MustYAML() []byte
- func (c *Config) ValidateClient(ctx context.Context, chain *relayer.Chain, height int64, pe *relayer.PathEnd) error
- func (c *Config) ValidateConnection(ctx context.Context, chain *relayer.Chain, height int64, pe *relayer.PathEnd) error
- func (c *Config) ValidatePath(ctx context.Context, stderr io.Writer, p *relayer.Path) (err error)
- func (c *Config) ValidatePathEnd(ctx context.Context, stderr io.Writer, pe *relayer.PathEnd) error
- func (c *Config) Wrapped() *ConfigOutputWrapper
- type ConfigInputWrapper
- type ConfigOutputWrapper
- type GlobalConfig
- type ProviderConfigWrapper
- type ProviderConfigYAMLWrapper
- type ProviderConfigs
Constants ¶
const ( REPOURL = "https://github.com/defund-labs/relayer" PATHSURL = "https://github.com/defund-labs/relayer/tree/main/interchain" )
const (
MB = 1024 * 1024 // in bytes
)
Variables ¶
var (
// Version defines the application version (defined at compile time)
Version = ""
)
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 GetStartOptions ¶
GetStartOptions sets strategy specific fields.
func NewRootCmd ¶
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 OverwriteConfigFlag ¶
func UnmarshalJSONProviderConfig ¶
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"` Paths relayer.Paths `yaml:"paths" json:"paths"` }
Config represents the config file for the relayer
func (*Config) ChainsFromPath ¶
func (c *Config) ChainsFromPath(path string) (map[string]*relayer.Chain, string, string, bool, error)
ChainsFromPath takes the path name and returns the properly configured chains
func (*Config) DeleteChain ¶
DeleteChain modifies c in-place to remove any chains that have the given name.
func (*Config) ValidateClient ¶
func (c *Config) ValidateClient(ctx context.Context, chain *relayer.Chain, height int64, pe *relayer.PathEnd) error
ValidateClient validates client id in provided pathend
func (*Config) ValidateConnection ¶
func (c *Config) ValidateConnection(ctx context.Context, chain *relayer.Chain, height int64, pe *relayer.PathEnd) error
ValidateConnection validates connection id in provided pathend
func (*Config) ValidatePath ¶
ValidatePath checks that a path is valid
func (*Config) ValidatePathEnd ¶
ValidatePathEnd validates provided pathend and returns error for invalid identifiers
func (*Config) Wrapped ¶
func (c *Config) Wrapped() *ConfigOutputWrapper
Wrapped converts the Config struct into a ConfigOutputWrapper struct
type ConfigInputWrapper ¶
type ConfigInputWrapper struct { Global GlobalConfig `yaml:"global"` ProviderConfigs map[string]*ProviderConfigYAMLWrapper `yaml:"chains"` Paths relayer.Paths `yaml:"paths"` }
ConfigInputWrapper is an intermediary type for parsing the config.yaml file
type ConfigOutputWrapper ¶
type ConfigOutputWrapper struct { Global GlobalConfig `yaml:"global" json:"global"` ProviderConfigs ProviderConfigs `yaml:"chains" json:"chains"` Paths relayer.Paths `yaml:"paths" json:"paths"` }
ConfigOutputWrapper is an intermediary type for writing the config to disk and stdout
type GlobalConfig ¶
type GlobalConfig struct { APIListenPort string `yaml:"api-listen-addr" json:"api-listen-addr"` Timeout string `yaml:"timeout" json:"timeout"` Memo string `yaml:"memo" json:"memo"` LightCacheSize int `yaml:"light-cache-size" json:"light-cache-size"` }
GlobalConfig describes any global relayer settings
type ProviderConfigWrapper ¶
type ProviderConfigWrapper struct { Type string `yaml:"type" json:"type"` Value provider.ProviderConfig `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 ¶
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