Documentation ¶
Index ¶
- Variables
- func CheckVersion(configFile io.Reader) error
- func ComposablesPath(conf *Config) string
- func FaucetHost(cfg *Config) string
- func HooksPath(conf *Config) string
- func LocateDefault(root string) (path string, err error)
- func MigrateLatest(current io.Reader, latest io.Writer) error
- func ReadConfigVersion(configFile io.Reader) (version.Version, error)
- func Save(c Config, path string) error
- func TSClientPath(conf Config) string
- func VuexPath(conf *Config) string
- type Config
- func ConvertLatest(c version.Converter) (_ *Config, err error)
- func DefaultChainConfig() *Config
- func Parse(configFile io.Reader) (*Config, error)
- func ParseFile(path string) (*Config, error)
- func ParseNetwork(configFile io.Reader) (*Config, error)
- func ParseNetworkFile(path string) (*Config, error)
- type UnsupportedVersionError
- type ValidationError
- type Validator
- type VersionError
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigFilenames is a list of recognized names as Spellshape's chain config file. ConfigFilenames = []string{"config.yml", "config.yaml"} // DefaultTSClientPath defines the default relative path to use when generating the TS client. // The path is relative to the app's directory. DefaultTSClientPath = "ts-client" // DefaultVuePath defines the default relative path to use when scaffolding a Vue app. // The path is relative to the app's directory. DefaultVuePath = "vue" // DefaultReactPath defines the default relative path to use when scaffolding a React app. // The path is relative to the app's directory. DefaultReactPath = "react" // DefaultVuexPath defines the default relative path to use when generating Vuex stores for a Vue app. // The path is relative to the app's directory. DefaultVuexPath = "vue/src/store" // DefaultComposablesPath defines the default relative path to use when generating useQuery composables for a Vue app. // The path is relative to the app's directory. DefaultComposablesPath = "vue/src/composables" // DefaultHooksPath defines the default relative path to use when generating useQuery hooks for a React app. // The path is relative to the app's directory. DefaultHooksPath = "react/src/hooks" // DefaultOpenAPIPath defines the default relative path to use when generating an OpenAPI schema. // The path is relative to the app's directory. DefaultOpenAPIPath = "docs/static/openapi.yml" // LatestVersion defines the latest version of the config. LatestVersion version.Version = 1 // Versions holds config types for the supported versions. Versions = map[version.Version]version.Converter{ 0: &v0.Config{}, 1: &v1.Config{}, } )
var ErrConfigNotFound = errors.New("could not locate a config.yml in your chain")
ErrConfigNotFound indicates that the config.yml can't be found.
Functions ¶
func CheckVersion ¶
CheckVersion checks that the config version is the latest and if not a VersionError is returned.
func ComposablesPath ¶
ComposablesPath returns the relative path to the Vue useQuery composables directory. Path is relative to the app's directory.
func HooksPath ¶
HooksPath returns the relative path to the React useQuery hooks directory. Path is relative to the app's directory.
func LocateDefault ¶
LocateDefault locates the default path for the config file. Returns ErrConfigNotFound when no config file found.
func MigrateLatest ¶
MigrateLatest migrates a config file to the latest version.
func ReadConfigVersion ¶
ReadConfigVersion reads the config version.
func TSClientPath ¶
TSClientPath returns the relative path to the Typescript client directory. Path is relative to the app's directory.
Types ¶
type Config ¶
Config defines the latest chain config.
func ConvertLatest ¶
ConvertLatest converts a config to the latest version.
func DefaultChainConfig ¶
func DefaultChainConfig() *Config
DefaultChainConfig returns a config for the latest version initialized with default values.
func Parse ¶
Parse reads a config file. When the version of the file being read is not the latest it is automatically migrated to the latest version.
func ParseNetwork ¶
ParseNetwork reads a config file for Spellshape Network genesis. When the version of the file being read is not the latest it is automatically migrated to the latest version.
func ParseNetworkFile ¶
ParseNetworkFile parses a config for Spellshape Network genesis from a file path.
type UnsupportedVersionError ¶
UnsupportedVersionError is returned when the version of the config is not supported.
func (UnsupportedVersionError) Error ¶
func (e UnsupportedVersionError) Error() string
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError is returned when a configuration is invalid.
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type Validator ¶
Validator defines the latest validator settings.
func FirstValidator ¶
FirstValidator returns the first validator from the validators list. An error is returned when there are no validators defined in the config.
type VersionError ¶
VersionError is returned when config version doesn't match with the version CLI supports.
func (VersionError) Error ¶
func (e VersionError) Error() string