Documentation
¶
Index ¶
- Constants
- Variables
- func AddRawTxFlag(cmd *cobra.Command)
- func AddSkipConfirmation(cmd *cobra.Command)
- func AddTxnTypeFlags(cmd *cobra.Command)
- func BindEnv(v *viper.Viper) error
- func FindOrCreateProjectSettings(startDir string, replacements map[string]string) error
- func GenerateFileFromTemplate(outputPath string, templateContent string, replacements map[string]string) error
- func GenerateGitIgnoreFile(workingDirectory string) (string, error)
- func GenerateProjectEnvFile(workingDirectory string, stdin io.Reader) (string, error)
- func GenerateProjectSettingsFile(workingDirectory string, stdin io.Reader) (string, bool, error)
- func GenerateWorkflowSettingsFile(workingDirectory string, workflowName string, workflowPath string) (string, error)
- func GetChainNameByChainSelector(chainSelector uint64) (string, error)
- func GetChainSelectorByChainName(name string) (uint64, error)
- func GetDefaultReplacements() map[string]string
- func GetEnvironmentVariable(filePath, key string) (string, error)
- func GetRpcUrlSettings(v *viper.Viper, chainName string) (string, error)
- func GetTarget(v *viper.Viper) (string, error)
- func GetWorkflowOwner(v *viper.Viper) (ownerAddress string, ownerType string, err error)
- func IsValidChainName(name string) error
- func LoadEnv(envPath string) error
- func LoadSettingsIntoViper(v *viper.Viper, cmd *cobra.Command) error
- func NormalizeHexKey(k string) string
- func ShouldSkipGetOwner(cmd *cobra.Command) bool
- type CREStorageSettings
- type Contract
- type ContractGroups
- type Flag
- type ProjectEnv
- type RpcEndpoint
- type Settings
- type UserSettings
- type WorkflowSettings
- type WorkflowStorageSettings
Constants ¶
View Source
const ( EthPrivateKeyEnvVar = "CRE_ETH_PRIVATE_KEY" CreTargetEnvVar = "CRE_TARGET" )
sensitive information (not in configuration file)
View Source
const ( WorkflowOwnerSettingName = "account.workflow-owner-address" WorkflowNameSettingName = "user-workflow.workflow-name" WorkflowPathSettingName = "workflow-artifacts.workflow-path" ConfigPathSettingName = "workflow-artifacts.config-path" SecretsPathSettingName = "workflow-artifacts.secrets-path" SethConfigPathSettingName = "logging.seth-config-path" RegistriesSettingName = "contracts.registries" KeystoneSettingName = "contracts.keystone" RpcsSettingName = "rpcs" )
Config names (YAML field paths)
Variables ¶
View Source
var Flags = flagNames{ Owner: Flag{"owner", "o"}, ProjectRoot: Flag{"project-root", "R"}, CliEnvFile: Flag{"env", "e"}, Verbose: Flag{"verbose", "v"}, Target: Flag{"target", "T"}, OverridePreviousRoot: Flag{"override-previous-root", "O"}, RawTxFlag: Flag{"unsigned", ""}, Ledger: Flag{"ledger", ""}, LedgerDerivationPath: Flag{"ledger-derivation-path", ""}, NonInteractive: Flag{"non-interactive", ""}, SkipConfirmation: Flag{"yes", "y"}, }
View Source
var ProjectEnvironmentTemplateContent string
View Source
var ProjectSettingsTemplateContent string
Functions ¶
func AddRawTxFlag ¶
func AddSkipConfirmation ¶
func AddTxnTypeFlags ¶
func GenerateGitIgnoreFile ¶
func GenerateProjectEnvFile ¶
func GetDefaultReplacements ¶
func GetEnvironmentVariable ¶
func GetWorkflowOwner ¶
func IsValidChainName ¶
func LoadSettingsIntoViper ¶
Loads the configuration file (if found) and sets the configuration values via Viper
func NormalizeHexKey ¶
func ShouldSkipGetOwner ¶
For commands that don't need the private key, we skip getting the owner address. ShouldSkipGetOwner returns true if the command is `simulate` and `--broadcast` is false or not set. `cre help` should skip as well.
Types ¶
type CREStorageSettings ¶
type ContractGroups ¶
type ProjectEnv ¶
type RpcEndpoint ¶
type RpcEndpoint struct {
ChainName string `mapstructure:"chain-name" yaml:"chain-name"`
// TODO: in the future, we can have a distinction between "public URL" and "private URL", with only one of them present at the time
// "public URL" would be URL hidden behind the VPN or URL from ChainList, something that doesn't contain sensitive API tokens, e.g.
// url_public: https://rpcs.cldev.sh/ethereum/sepolia
// "private URL" can be feeded to the settings file by specifying the env var name where the real URL is kept, e.g.
// url_private: RPC_URL_ETH_SEPOLIA
Url string `mapstructure:"url" yaml:"url"`
}
type Settings ¶
type Settings struct {
Workflow WorkflowSettings
User UserSettings
StorageSettings WorkflowStorageSettings
}
Settings holds user, project, and workflow configurations.
type UserSettings ¶
UserSettings stores user-specific configurations.
type WorkflowSettings ¶
type WorkflowSettings struct {
UserWorkflowSettings struct {
WorkflowOwnerAddress string `mapstructure:"workflow-owner-address" yaml:"workflow-owner-address"`
WorkflowOwnerType string `mapstructure:"workflow-owner-type" yaml:"workflow-owner-type"`
WorkflowName string `mapstructure:"workflow-name" yaml:"workflow-name"`
} `mapstructure:"user-workflow" yaml:"user-workflow"`
WorkflowArtifactSettings struct {
WorkflowPath string `mapstructure:"workflow-path" yaml:"workflow-path"`
ConfigPath string `mapstructure:"config-path" yaml:"config-path"`
SecretsPath string `mapstructure:"secrets-path" yaml:"secrets-path"`
} `mapstructure:"workflow-artifacts" yaml:"workflow-artifacts"`
LoggingSettings struct {
SethConfigPath string `mapstructure:"seth-config-path" yaml:"seth-config-path"`
} `mapstructure:"logging" yaml:"logging"`
RPCs []RpcEndpoint `mapstructure:"rpcs" yaml:"rpcs"`
}
type WorkflowStorageSettings ¶
type WorkflowStorageSettings struct {
CREStorage CREStorageSettings `mapstructure:"cre_storage"`
}
func LoadWorkflowStorageSettings ¶
func LoadWorkflowStorageSettings(logger *zerolog.Logger, v *viper.Viper) WorkflowStorageSettings
Click to show internal directories.
Click to hide internal directories.