Documentation
¶
Index ¶
- Constants
- Variables
- func DeletePrivateKey(environment string) error
- func EncodeExecutions(executions []erc7702delegatorV2.Execution) ([]byte, error)
- func EnsureDockerIsRunning(cCtx *cli.Context) error
- func ForceFlagWithUsage(usage string) *cli.BoolFlag
- func FormatAppDisplay(context string, appID common.Address) string
- func FormatETH(weiAmount *big.Int) string
- func GetAddressFromPrivateKey(privateKeyHex string) (string, error)
- func GetAppName(context, appID string) string
- func GetAppRegistryPath(context string) (string, error)
- func GetDefaultEnvironment() (string, 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 GetPrivateKey(environment string) (string, error)
- func IsFirstRun() (bool, error)
- func IsMainnetEnvironment(env string) bool
- func ListApps(context string) (map[string]App, error)
- func LoggerFromContext(cCtx *cli.Context) iface.Logger
- func MarkFirstRunComplete() error
- func Parallel[T1, T2 any](fn1 func() (T1, error), fn2 func() (T2, error)) (T1, T2, error)
- func PeelBoolFromFlags(args []string, longFlag, shortFlag string) bool
- func ProgressTrackerFromContext(ctx context.Context) iface.ProgressTracker
- func ResolveAppID(context, nameOrID string) (string, error)
- func SaveAppRegistry(context string, registry *AppRegistry) error
- func SaveGlobalConfig(config *GlobalConfig) error
- func SaveUserId(userUuid string) error
- func SetAppName(context, appIDOrName, newName string) error
- func SetDefaultEnvironment(environment string) error
- func SetGlobalTelemetryPreference(enabled bool) error
- func ShowTelemetryNotice(logger iface.Logger, opts TelemetryPromptOptions) bool
- func StorePrivateKey(environment, privateKey string) error
- func ValidateAppName(name string) error
- func ValidatePrivateKey(key 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
- type App
- type AppEnvironment
- type AppRegistry
- type AppStatus
- type ChainAddr
- type CommonAddr
- type ContractCaller
- func (cc *ContractCaller) CheckERC7702Delegation(ctx context.Context, account common.Address) (bool, error)
- func (cc *ContractCaller) DeployApp(ctx context.Context, salt [32]byte, ...) (appID common.Address, err error)
- func (cc *ContractCaller) ExecuteBatch(ctx context.Context, executions []erc7702delegatorV2.Execution, ...) error
- func (cc *ContractCaller) SendAndWaitForTransaction(ctx context.Context, txDescription string, callMsg *ethereum.CallMsg, ...) error
- func (cc *ContractCaller) StartApp(ctx context.Context, appAddress common.Address) error
- func (cc *ContractCaller) StopApp(ctx context.Context, appAddress common.Address) error
- func (cc *ContractCaller) TerminateApp(ctx context.Context, appAddress common.Address, force bool) error
- func (cc *ContractCaller) Undelegate(ctx context.Context) error
- func (cc *ContractCaller) UpgradeApp(ctx context.Context, appAddress common.Address, ...) error
- type EnvironmentConfig
- type GlobalConfig
- type KeyringStore
- type OSKeyringStore
- type TelemetryPromptOptions
Constants ¶
const ( AppRegistryVersion = "1.0.0" AppRegistryFile = "apps.yaml" )
const ( // Chain IDs MainnetChainID uint64 = 1 SepoliaChainID uint64 = 11155111 // Fallback environment used if no user-defined default is found FallbackEnvironment = "sepolia" )
const ( BuildSuffix = "-dev" KeyringServiceName = "eigenx-cli-dev" Build = "dev" )
Build-specific constants for dev environment
const ( // L1 is the name of the L1 chain L1 = "l1" // 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" // Docker open timeout DockerOpenTimeoutSeconds = 10 // Docker open retry interval in milliseconds DockerOpenRetryIntervalMilliseconds = 500 // WatchPollIntervalSeconds is the interval between watch loop polls in seconds WatchPollIntervalSeconds = 5 // Environment variable names to filter out MnemonicEnvVar = "MNEMONIC" )
Project structure constants
const ( AppStatusCreated = "Created" AppStatusDeploying = "Deploying" AppStatusUpgrading = "Upgrading" AppStatusResuming = "Resuming" AppStatusRunning = "Running" AppStatusStopping = "Stopping" AppStatusStopped = "Stopped" AppStatusTerminating = "Terminating" AppStatusTerminated = "Terminated" AppStatusFailed = "Failed" AppStatusExited = "Exited" )
App status strings from API
const (
KeyPrefix = "eigenx-"
)
Variables ¶
var ( // Common addresses across all chains CommonAddresses = CommonAddr{ ERC7702Delegator: common.HexToAddress("0x63c0c19a282a1b52b07dd5a65b58948a07dae32b"), } // Addresses specific to each chain ChainAddresses = map[uint64]ChainAddr{ MainnetChainID: { PermissionController: common.HexToAddress("0x25E5F8B1E7aDf44518d35D5B2271f114e081f0E5"), }, SepoliaChainID: { PermissionController: common.HexToAddress("0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37"), }, } // Default environment for each chain ID DefaultEnvironmentForChainID = map[uint64]string{ MainnetChainID: "mainnet-alpha", SepoliaChainID: "sepolia", } )
var ( // The permission to view app logs // bytes4(keccak256("CAN_VIEW_APP_LOGS()")) CanViewAppLogsPermission = [4]byte{0x2f, 0xd3, 0xf2, 0xfe} // The permission to view sensitive app info (including real IPs) // bytes4(keccak256("CAN_VIEW_SENSITIVE_APP_INFO()")) CanViewSensitiveAppInfoPermission = [4]byte{0x0e, 0x67, 0xb2, 0x2f} // The address that is used to allow auth to be bypassed for certain permissions // address(bytes20(keccak256("PermissionController:AnyoneCanCall"))) AnyoneCanCallAddress = ethcommon.HexToAddress("0x493219d9949348178af1f58740655951a8cd110c") // The address that is permissioned onchain for calls // address(bytes20(keccak256("PermissionController:ApiPermissions"))) ApiPermissionsTarget = ethcommon.HexToAddress("0x57ee1fb74c1087e26446abc4fb87fd8f07c43d8d") )
API permissions constants
var ( EnvironmentFlag = &cli.StringFlag{ Name: "environment", Usage: "Deployment environment to use", } RpcUrlFlag = &cli.StringFlag{ Name: "rpc-url", Usage: "RPC URL to connect to blockchain", EnvVars: []string{"RPC_URL"}, } PrivateKeyFlag = &cli.StringFlag{ Name: "private-key", Usage: "Private key for signing transactions", EnvVars: []string{"PRIVATE_KEY"}, } ForceFlag = &cli.BoolFlag{ Name: "force", Usage: "Force operation without confirmation", } EnvFlag = &cli.StringFlag{ Name: "env-file", Usage: "Environment file to use", Value: ".env", } ImageNameFlag = &cli.StringFlag{ Name: "image-name", Usage: "Override app/image name (auto-detected from context if not provided)", } FileFlag = &cli.StringFlag{ Name: "dockerfile", Aliases: []string{"f"}, Usage: "Path to Dockerfile", } TemplateFlag = &cli.StringFlag{ Name: "template", Usage: "Template repository URL", } TemplateVersionFlag = &cli.StringFlag{ Name: "template-version", Usage: "Template version/tag to use", } AllFlag = &cli.BoolFlag{ Name: "all", Usage: "Show all apps including terminated ones", } AddressCountFlag = &cli.IntFlag{ Name: "address-count", Usage: "Number of addresses to fetch", Value: 1, } NameFlag = &cli.StringFlag{ Name: "name", Usage: "Friendly name for the app", } LogVisibilityFlag = &cli.StringFlag{ Name: "log-visibility", Usage: "Log visibility setting: public, private, or off", } WatchFlag = &cli.BoolFlag{ Name: "watch", Aliases: []string{"w"}, Usage: "Continuously fetch and display updates", } )
Common flag definitions
var EnvironmentConfigs = map[string]EnvironmentConfig{ "sepolia": { Name: "sepolia", AppControllerAddress: common.HexToAddress("0xa86DC1C47cb2518327fB4f9A1627F51966c83B92"), PermissionControllerAddress: ChainAddresses[SepoliaChainID].PermissionController, ERC7702DelegatorAddress: CommonAddresses.ERC7702Delegator, KMSServerURL: "http://10.128.0.57:8080", UserApiServerURL: "https://34.49.173.26", DefaultRPCURL: "https://ethereum-sepolia-rpc.publicnode.com", }, }
EnvironmentConfigs contains all environments available in dev builds
var ErrKeyNotFound = errors.New("key not found")
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 DeletePrivateKey ¶
func EncodeExecutions ¶
func EncodeExecutions(executions []erc7702delegatorV2.Execution) ([]byte, error)
func EnsureDockerIsRunning ¶
EnsureDockerIsRunning checks if Docker is running and attempts to launch Docker Desktop if not.
func ForceFlagWithUsage ¶
func FormatAppDisplay ¶
FormatAppDisplay returns a user-friendly display string for an app Returns "name (0x123...)" if name exists, or just "0x123..." if no name
func GetAddressFromPrivateKey ¶
GetAddressFromPrivateKey validates a private key and returns the corresponding address
func GetAppName ¶
GetAppName returns the name for a given app ID, or empty string if not found
func GetAppRegistryPath ¶
GetAppRegistryPath returns the path to the app registry file for a specific context
func GetDefaultEnvironment ¶
GetDefaultEnvironment returns the user's preferred deployment environment
func GetGlobalConfigDir ¶
GetGlobalConfigDir returns the XDG-compliant directory where global eigenx 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 GetPrivateKey ¶
func IsFirstRun ¶
IsFirstRun checks if this is the user's first time running devkit
func IsMainnetEnvironment ¶
IsMainnetEnvironment checks if the given environment is a mainnet environment
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 PeelBoolFromFlags ¶
PeelBoolFromFlags reports whether a boolean CLI flag is set anywhere in args, It supports these forms:
--verbose --verbose=true|false|1|0|yes|no|t|f --verbose true|false|1|0|yes|no|t|f -v -v=true|false|1|0|yes|no|t|f -v true|false|1|0|yes|no|t|f
The last occurrence wins. If a flag is present without an explicit value, it is treated as true.
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 ResolveAppID ¶
ResolveAppID resolves a name or app ID to an app ID
func SaveAppRegistry ¶
func SaveAppRegistry(context string, registry *AppRegistry) error
SaveAppRegistry saves the app registry to disk
func SaveGlobalConfig ¶
func SaveGlobalConfig(config *GlobalConfig) error
SaveGlobalConfig saves the global configuration to disk
func SaveUserId ¶
SaveUserId saves user settings to the global config, but preserves existing UUID if present
func SetAppName ¶
SetAppName sets or updates a name for an app
func SetDefaultEnvironment ¶
SetDefaultEnvironment sets the user's preferred deployment environment
func SetGlobalTelemetryPreference ¶
SetGlobalTelemetryPreference sets the global telemetry preference
func ShowTelemetryNotice ¶
func ShowTelemetryNotice(logger iface.Logger, opts TelemetryPromptOptions) bool
ShowTelemetryNotice displays telemetry information notice without prompting
func StorePrivateKey ¶
func ValidateAppName ¶
ValidateAppName validates that an app name follows Docker image naming restrictions
func ValidatePrivateKey ¶
ValidatePrivateKey validates that a private key is in the correct format
func WithAppEnvironment ¶
func WithLogger ¶
WithLogger stores the logger in the context
func WithProgressTracker ¶
WithProgressTracker stores the progress tracker in the context
Types ¶
type AppEnvironment ¶
func AppEnvironmentFromContext ¶
func AppEnvironmentFromContext(ctx context.Context) (*AppEnvironment, bool)
func NewAppEnvironment ¶
func NewAppEnvironment(os, arch, userUuid string) *AppEnvironment
type AppRegistry ¶
func LoadAppRegistry ¶
func LoadAppRegistry(context string) (*AppRegistry, error)
LoadAppRegistry loads the app registry from disk
type CommonAddr ¶
type ContractCaller ¶
ContractCaller provides a high-level interface for interacting with contracts
func NewContractCaller ¶
func NewContractCaller(privateKeyHex string, chainID *big.Int, environmentConfig EnvironmentConfig, client *ethclient.Client, logger iface.Logger) (*ContractCaller, error)
func (*ContractCaller) CheckERC7702Delegation ¶
func (cc *ContractCaller) CheckERC7702Delegation(ctx context.Context, account common.Address) (bool, error)
CheckERC7702Delegation checks if the given account already delegates to the ERC-7702 delegator
func (*ContractCaller) DeployApp ¶
func (cc *ContractCaller) DeployApp(ctx context.Context, salt [32]byte, release appcontrollerV2.IAppControllerRelease, publicLogs bool, imageRef string) (appID common.Address, err error)
DeployApp creates a new app via AppController contract, accepts admin permissions, and upgrades the app
func (*ContractCaller) ExecuteBatch ¶
func (cc *ContractCaller) ExecuteBatch(ctx context.Context, executions []erc7702delegatorV2.Execution, needsConfirmation bool, confirmationPrompt string, pendingMessage string) error
ExecuteBatch executes a batch of executions. It sets the code of the EOA to the delegator contract if not already set.
func (*ContractCaller) SendAndWaitForTransaction ¶
func (*ContractCaller) TerminateApp ¶
func (cc *ContractCaller) TerminateApp(ctx context.Context, appAddress common.Address, force bool) error
TerminateApp terminates an app permanently via AppController contract
func (*ContractCaller) Undelegate ¶
func (cc *ContractCaller) Undelegate(ctx context.Context) error
func (*ContractCaller) UpgradeApp ¶
func (cc *ContractCaller) UpgradeApp(ctx context.Context, appAddress common.Address, release appcontrollerV2.IAppControllerRelease, publicLogs bool, needsPermissionChange bool, imageRef string) error
UpgradeApp upgrades an app via AppController contract
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Name string
AppControllerAddress common.Address
PermissionControllerAddress common.Address
ERC7702DelegatorAddress common.Address
KMSServerURL string
UserApiServerURL string
DefaultRPCURL string
}
EnvironmentConfig defines the configuration for a specific environment
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"`
// DefaultEnvironment stores the user's preferred deployment environment (sepolia, mainnet-alpha, etc.)
DefaultEnvironment string `yaml:"default_environment,omitempty"`
}
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 KeyringStore ¶
type KeyringStore interface {
StorePrivateKey(environment, privateKey string) error
GetPrivateKey(environment string) (string, error)
DeletePrivateKey(environment string) error
}
var DefaultKeyringStore KeyringStore = &OSKeyringStore{}
type OSKeyringStore ¶
type OSKeyringStore struct{}
func (*OSKeyringStore) DeletePrivateKey ¶
func (o *OSKeyringStore) DeletePrivateKey(environment string) error
func (*OSKeyringStore) GetPrivateKey ¶
func (o *OSKeyringStore) GetPrivateKey(environment string) (string, error)
func (*OSKeyringStore) StorePrivateKey ¶
func (o *OSKeyringStore) StorePrivateKey(environment, privateKey string) error
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