Documentation
¶
Index ¶
- Constants
- Variables
- func CallTemplateScript(cmdCtx context.Context, logger iface.Logger, dir string, scriptPath string, ...) (map[string]interface{}, error)
- func CleanYAML(v interface{}) interface{}
- func CloneNode(n *yaml.Node) *yaml.Node
- func DeepMerge(dst, src *yaml.Node) *yaml.Node
- func EnsureDockerIsRunning(ctx *cli.Context) error
- func FindProjectRoot() (string, error)
- func GetChildByKey(node *yaml.Node, key string) *yaml.Node
- func GetEffectiveTelemetryPreference() (bool, error)
- func GetGlobalConfigDir() (string, error)
- func GetGlobalConfigPath() (string, error)
- func GetGlobalTelemetryPreference() (*bool, error)
- func GetLogger(verbose bool) (iface.Logger, iface.ProgressTracker)
- func GetLoggerFromCLIContext(cCtx *cli.Context) (iface.Logger, iface.ProgressTracker)
- func GetProjectUUID() string
- func HandleFirstRunTelemetryPrompt(logger iface.Logger) (bool, bool, error)
- func HandleFirstRunTelemetryPromptWithOptions(logger iface.Logger, opts TelemetryPromptOptions) (bool, bool, error)
- func InterfaceToNode(v interface{}) (*yaml.Node, error)
- func IsFirstRun() (bool, error)
- func IsTelemetryEnabled() bool
- func IsValidABI(v interface{}) error
- func IsVerboseEnabled(cCtx *cli.Context, cfg *ConfigWithContextConfig) bool
- func ListYaml(filePath string, logger iface.Logger) error
- func LoadBaseConfig() (map[string]interface{}, error)
- func LoadContextConfig(ctxName string) (map[string]interface{}, error)
- func LoadMap(path string) (map[string]interface{}, error)
- func LoadRawContext(yamlPath string) ([]byte, error)
- func LoadYAML(path string) (*yaml.Node, error)
- func LoggerFromContext(ctx context.Context) iface.Logger
- func MarkFirstRunComplete() error
- func NodeToInterface(node *yaml.Node) (interface{}, error)
- func Normalize(i interface{}) interface{}
- func ProgressTrackerFromContext(ctx context.Context) iface.ProgressTracker
- func RequireNonZero(s interface{}) error
- func SaveGlobalConfig(config *GlobalConfig) error
- func SaveProjectIdAndTelemetryToggle(projectDir string, projectUuid string, telemetryEnabled bool) error
- func SaveUserId(userUuid string) error
- func SetGlobalTelemetryPreference(enabled bool) error
- func SetMappingValue(mapNode, keyNode, valNode *yaml.Node)
- func SetProjectTelemetry(enabled bool) error
- func TelemetryPromptWithOptions(logger iface.Logger, opts TelemetryPromptOptions) (bool, error)
- func UpdateContextWithZeusAddresses(logger iface.Logger, ctx *yaml.Node, contextName string) error
- func WithAppEnvironment(ctx *cli.Context)
- func WithLogger(ctx context.Context, logger iface.Logger) context.Context
- func WithProgressTracker(ctx context.Context, tracker iface.ProgressTracker) context.Context
- func WithShutdown(ctx context.Context) context.Context
- func WriteMap(path string, m map[string]interface{}) error
- func WriteToPath(root *yaml.Node, path []string, val string) (*yaml.Node, error)
- func WriteYAML(path string, node *yaml.Node) error
- func YamlToMap(b []byte) (map[string]interface{}, error)
- type AppEnvironment
- type AvsConfig
- type ChainConfig
- type ChainContextConfig
- type Config
- type ConfigBlock
- type ConfigWithContextConfig
- type ContextConfig
- type ContractCaller
- func (cc *ContractCaller) CreateOperatorSets(ctx context.Context, avsAddress common.Address, ...) error
- func (cc *ContractCaller) RegisterAsOperator(ctx context.Context, operatorAddress common.Address, allocationDelay uint32, ...) error
- func (cc *ContractCaller) RegisterForOperatorSets(ctx context.Context, operatorAddress, avsAddress common.Address, ...) error
- func (cc *ContractCaller) SendAndWaitForTransaction(ctx context.Context, txDescription string, ...) error
- func (cc *ContractCaller) SetAVSRegistrar(ctx context.Context, avsAddress, registrarAddress common.Address) error
- func (cc *ContractCaller) UpdateAVSMetadata(ctx context.Context, avsAddress common.Address, metadataURI string) error
- type DeployedContract
- type EigenLayerConfig
- type ForkConfig
- type GlobalConfig
- type HandlerFunc
- type OperatorRegistration
- type OperatorSet
- type OperatorSpec
- type ProjectConfig
- type ProjectSettings
- type ResponseExpectation
- type Strategy
- type TelemetryPromptOptions
- type ZeusAddressData
Constants ¶
const ( // ContractsDir is the subdirectory name for contract components ContractsDir = "contracts" // Makefile is the name of the makefile used for root level operations Makefile = "Makefile" // ContractsMakefile is the name of the makefile used for contract level operations ContractsMakefile = "Makefile" // GlobalConfigFile is the name of the global YAML used to store global config details (eg, user_id) GlobalConfigFile = "config.yaml" // Filename for devkit project config BaseConfig = "config.yaml" // Filename for zeus config ZeusConfig = ".zeus" // Docker open timeout DockerOpenTimeoutSeconds = 10 // Docker open retry interval in milliseconds DockerOpenRetryIntervalMilliseconds = 500 // Default chainId for Anvil DefaultAnvilChainId = 31337 )
Project structure constants
const DefaultConfigWithContextConfigPath = "config"
Variables ¶
var GlobalFlags = []cli.Flag{ &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Usage: "Enable verbose logging", }, &cli.BoolFlag{ Name: "enable-telemetry", Usage: "Enable telemetry collection on first run without prompting", }, &cli.BoolFlag{ Name: "disable-telemetry", Usage: "Disable telemetry collection on first run without prompting", }, }
GlobalFlags defines flags that apply to the entire application (global flags).
Functions ¶
func CallTemplateScript ¶
func DeepMerge ¶
DeepMerge merges two *yaml.Node trees recursively
- If both nodes are MappingNodes, their keys are merged:
- Matching keys: recurse if both values are maps, else src replaces dst
- New keys in src are appended to dst
- For non-mapping nodes, src replaces dst - All merged values are deep-cloned to avoid shared references
func EnsureDockerIsRunning ¶
EnsureDockerIsRunning checks if Docker is running and attempts to launch Docker Desktop if not.
func FindProjectRoot ¶
FindProjectRoot searches upward from current directory to find config/config.yaml
func GetChildByKey ¶
GetChildByKey returns the value node associated with the given key from a MappingNode
func GetEffectiveTelemetryPreference ¶
GetEffectiveTelemetryPreference returns the effective telemetry preference Project setting takes precedence over global setting
func GetGlobalConfigDir ¶
GetGlobalConfigDir returns the XDG-compliant directory where global devkit config should be stored
func GetGlobalConfigPath ¶
GetGlobalConfigPath returns the full path to the global config file
func GetGlobalTelemetryPreference ¶
GetGlobalTelemetryPreference returns the global telemetry preference
func GetLogger ¶
func GetLogger(verbose bool) (iface.Logger, iface.ProgressTracker)
Get logger for the env we're in
func GetLoggerFromCLIContext ¶
GetLoggerFromCLIContext creates a logger based on the CLI context It checks the verbose flag and returns the appropriate logger
func GetProjectUUID ¶
func GetProjectUUID() string
GetProjectUUID returns the project UUID from config.yaml or empty string if not found
func HandleFirstRunTelemetryPrompt ¶
HandleFirstRunTelemetryPrompt checks if this is a first run and prompts for telemetry Returns the telemetry preference (true/false) and whether this was a first run
func HandleFirstRunTelemetryPromptWithOptions ¶
func HandleFirstRunTelemetryPromptWithOptions(logger iface.Logger, opts TelemetryPromptOptions) (bool, bool, error)
HandleFirstRunTelemetryPromptWithOptions handles first run with configurable options
func InterfaceToNode ¶
InterfaceToNode converts a Go value (typically map[string]interface{}) into a *yaml.Node
func IsFirstRun ¶
IsFirstRun checks if this is the user's first time running devkit
func IsTelemetryEnabled ¶
func IsTelemetryEnabled() bool
IsTelemetryEnabled returns whether telemetry is enabled for the project It checks both global and project-level preferences, with project taking precedence
func IsValidABI ¶
func IsValidABI(v interface{}) error
func IsVerboseEnabled ¶
func IsVerboseEnabled(cCtx *cli.Context, cfg *ConfigWithContextConfig) bool
IsVerboseEnabled checks if either the CLI --verbose flag is set, or config.yaml has log level = "debug"
func ListYaml ¶
ListYaml prints the contents of a YAML file to stdout, preserving order and comments. It rejects non-.yaml/.yml extensions and surfaces precise errors.
func LoadBaseConfig ¶
func LoadContextConfig ¶
func LoadRawContext ¶
func LoggerFromContext ¶
LoggerFromContext retrieves the logger from the context If no logger is found, it returns a non-verbose logger as fallback
func MarkFirstRunComplete ¶
func MarkFirstRunComplete() error
MarkFirstRunComplete marks that the first run has been completed
func NodeToInterface ¶
NodeToInterface converts a *yaml.Node back into a Go interface{}
func Normalize ¶
func Normalize(i interface{}) interface{}
Normalize will walk any nested map[interface{}]interface{} -> map[string]interface{}, and also recurse into []interface{}
func ProgressTrackerFromContext ¶
func ProgressTrackerFromContext(ctx context.Context) iface.ProgressTracker
ProgressTrackerFromContext retrieves the progress tracker from the context If no tracker is found, it returns a non-verbose tracker as fallback
func RequireNonZero ¶
func RequireNonZero(s interface{}) error
func SaveGlobalConfig ¶
func SaveGlobalConfig(config *GlobalConfig) error
SaveGlobalConfig saves the global configuration to disk
func SaveProjectIdAndTelemetryToggle ¶
func SaveProjectIdAndTelemetryToggle(projectDir string, projectUuid string, telemetryEnabled bool) error
SaveProjectIdAndTelemetryToggle saves project settings to config.yaml
func SaveUserId ¶
SaveUserId saves user settings to the global config, but preserves existing UUID if present
func SetGlobalTelemetryPreference ¶
SetGlobalTelemetryPreference sets the global telemetry preference
func SetMappingValue ¶
SetMappingValue sets mapNode[keyNode.Value] = valNode, replacing existing or appending if missing.
func SetProjectTelemetry ¶
SetProjectTelemetry sets telemetry preference for the current project only
func TelemetryPromptWithOptions ¶
func TelemetryPromptWithOptions(logger iface.Logger, opts TelemetryPromptOptions) (bool, error)
TelemetryPromptWithOptions presents the telemetry opt-in dialog with configurable behavior
func UpdateContextWithZeusAddresses ¶
UpdateContextWithZeusAddresses updates the context configuration with addresses from Zeus
func WithAppEnvironment ¶
func WithLogger ¶
WithLogger stores the logger in the context
func WithProgressTracker ¶
WithProgressTracker stores the progress tracker in the context
func WithShutdown ¶
WithShutdown creates a new context that will be cancelled on SIGTERM/SIGINT
func WriteToPath ¶
WriteToPath sets or overwrites a value in the YAML tree given a dot-delimited path.
Types ¶
type AppEnvironment ¶
type AppEnvironment struct {
CLIVersion string
OS string
Arch string
ProjectUUID string
UserUUID string
}
func AppEnvironmentFromContext ¶
func AppEnvironmentFromContext(ctx context.Context) (*AppEnvironment, bool)
func NewAppEnvironment ¶
func NewAppEnvironment(os, arch, projectUuid, userUuid string) *AppEnvironment
type ChainConfig ¶
type ChainConfig struct {
ChainID int `json:"chain_id" yaml:"chain_id"`
RPCURL string `json:"rpc_url" yaml:"rpc_url"`
Fork *ForkConfig `json:"fork" yaml:"fork"`
}
type ChainContextConfig ¶
type ChainContextConfig struct {
Name string `json:"name" yaml:"name"`
Chains map[string]ChainConfig `json:"chains" yaml:"chains"`
DeployerPrivateKey string `json:"deployer_private_key" yaml:"deployer_private_key"`
AppDeployerPrivateKey string `json:"app_private_key" yaml:"app_private_key"`
Operators []OperatorSpec `json:"operators" yaml:"operators"`
Avs AvsConfig `json:"avs" yaml:"avs"`
EigenLayer *EigenLayerConfig `json:"eigenlayer" yaml:"eigenlayer"`
DeployedContracts []DeployedContract `json:"deployed_contracts,omitempty" yaml:"deployed_contracts,omitempty"`
OperatorSets []OperatorSet `json:"operator_sets" yaml:"operator_sets"`
OperatorRegistrations []OperatorRegistration `json:"operator_registrations" yaml:"operator_registrations"`
}
type Config ¶
type Config struct {
Version string `json:"version" yaml:"version"`
Config ConfigBlock `json:"config" yaml:"config"`
}
func LoadBaseConfigYaml ¶
type ConfigBlock ¶
type ConfigBlock struct {
Project ProjectConfig `json:"project" yaml:"project"`
}
type ConfigWithContextConfig ¶
type ConfigWithContextConfig struct {
Config ConfigBlock `json:"config" yaml:"config"`
Context map[string]ChainContextConfig `json:"context" yaml:"context"`
}
func LoadConfigWithContextConfig ¶
func LoadConfigWithContextConfig(ctxName string) (*ConfigWithContextConfig, error)
type ContextConfig ¶
type ContextConfig struct {
Version string `json:"version" yaml:"version"`
Context ChainContextConfig `json:"context" yaml:"context"`
}
type ContractCaller ¶
type ContractCaller struct {
// contains filtered or unexported fields
}
TODO: Should we break this out into it's own package?
func NewContractCaller ¶
func (*ContractCaller) CreateOperatorSets ¶
func (cc *ContractCaller) CreateOperatorSets(ctx context.Context, avsAddress common.Address, sets []allocationmanager.IAllocationManagerTypesCreateSetParams) error
CreateOperatorSets creates operator sets for an AVS
func (*ContractCaller) RegisterAsOperator ¶
func (*ContractCaller) RegisterForOperatorSets ¶
func (*ContractCaller) SendAndWaitForTransaction ¶
func (cc *ContractCaller) SendAndWaitForTransaction( ctx context.Context, txDescription string, fn func() (*types.Transaction, error), ) error
func (*ContractCaller) SetAVSRegistrar ¶
func (cc *ContractCaller) SetAVSRegistrar(ctx context.Context, avsAddress, registrarAddress common.Address) error
SetAVSRegistrar sets the registrar address for an AVS
func (*ContractCaller) UpdateAVSMetadata ¶
type DeployedContract ¶
type EigenLayerConfig ¶
type ForkConfig ¶
type GlobalConfig ¶
type GlobalConfig struct {
// FirstRun tracks if this is the user's first time running devkit
FirstRun bool `yaml:"first_run"`
// TelemetryEnabled stores the user's global telemetry preference
TelemetryEnabled *bool `yaml:"telemetry_enabled,omitempty"`
// The users uuid to identify user across projects
UserUUID string `yaml:"user_uuid"`
}
GlobalConfig contains user-level configuration that persists across all devkit usage
func LoadGlobalConfig ¶
func LoadGlobalConfig() (*GlobalConfig, error)
LoadGlobalConfig loads the global configuration, creating defaults if needed
type HandlerFunc ¶
HandlerFunc defines operations on a YAML node
type OperatorRegistration ¶
type OperatorSet ¶
type OperatorSpec ¶
type OperatorSpec struct {
Address string `json:"address" yaml:"address"`
ECDSAKey string `json:"ecdsa_key" yaml:"ecdsa_key"`
BlsKeystorePath string `json:"bls_keystore_path" yaml:"bls_keystore_path"`
BlsKeystorePassword string `json:"bls_keystore_password" yaml:"bls_keystore_password"`
Stake string `json:"stake" yaml:"stake"`
}
type ProjectConfig ¶
type ProjectConfig struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Context string `json:"context" yaml:"context"`
ProjectUUID string `json:"project_uuid,omitempty" yaml:"project_uuid,omitempty"`
TelemetryEnabled bool `json:"telemetry_enabled" yaml:"telemetry_enabled"`
TemplateBaseURL string `json:"templateBaseUrl,omitempty" yaml:"templateBaseUrl,omitempty"`
TemplateVersion string `json:"templateVersion,omitempty" yaml:"templateVersion,omitempty"`
}
type ProjectSettings ¶
type ProjectSettings struct {
ProjectUUID string `yaml:"project_uuid"`
TelemetryEnabled bool `yaml:"telemetry_enabled"`
}
ProjectSettings contains the project-level configuration
func LoadProjectSettings ¶
func LoadProjectSettings() (*ProjectSettings, error)
LoadProjectSettings loads project settings from config.yaml
type ResponseExpectation ¶
type ResponseExpectation int
const ( ExpectNonJSONResponse ResponseExpectation = iota ExpectJSONResponse )
type TelemetryPromptOptions ¶
type TelemetryPromptOptions struct {
// EnableTelemetry automatically enables telemetry without prompting (for --enable-telemetry flag)
EnableTelemetry bool
// DisableTelemetry automatically disables telemetry without prompting (for --disable-telemetry flag)
DisableTelemetry bool
// SkipPromptInCI skips the prompt in CI environments (defaults to disabled)
SkipPromptInCI bool
}
TelemetryPromptOptions controls how the telemetry prompt behaves
type ZeusAddressData ¶
type ZeusAddressData struct {
AllocationManager string `json:"allocationManager"`
DelegationManager string `json:"delegationManager"`
}
ZeusAddressData represents the addresses returned by zeus list command
func GetZeusAddresses ¶
func GetZeusAddresses(logger iface.Logger) (*ZeusAddressData, error)
GetZeusAddresses runs the zeus env show mainnet command and extracts core EigenLayer addresses