Help us shape the future of Go! Take the 2026 Go Developer Survey

application

package
v1.102.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package application provides the core application context and utilities for the CLI.

Index

Constants

View Source
const (
	WriteReadReadPerms = 0o644
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveAccountInfo added in v1.13.7

type ActiveAccountInfo struct {
	Index         int    `json:"index"`
	PChainAddress string `json:"pChainAddress"`
	XChainAddress string `json:"xChainAddress"`
	CChainAddress string `json:"cChainAddress"`
}

ActiveAccountInfo represents the currently active account for network operations

type Downloader

type Downloader interface {
	Download(url string) ([]byte, error)
	DownloadWithTee(url string, filePath string) ([]byte, error)
	GetLatestReleaseVersion(releaseURL string) (string, error)
	GetLatestPreReleaseVersion(releaseURL string) (string, error)
	GetAllReleasesForRepo(org, repo string) ([]string, error)
}

This is a generic interface for performing highly testable downloads. All methods here involve external http requests. To write tests using these functions, provide a mocked version of this interface to your application object.

func NewDownloader

func NewDownloader() Downloader

type LastActions

type LastActions struct {
	LastSkipCheck time.Time
	LastUpdated   time.Time
}

type Lux

type Lux struct {
	*sdkapp.Lux                  // Embed SDK's Lux type
	CliPrompt   prompts.Prompter // CLI-specific prompter
	Conf        *config.Config   // CLI-specific config
}

Lux extends the SDK's application.Lux type with CLI-specific functionality

func New

func New() *Lux

func (*Lux) CheckCertInSSHDir

func (app *Lux) CheckCertInSSHDir(certName string) bool

CheckCertInSSHDir checks if a certificate exists in the SSH directory

func (*Lux) ClearNetworkState added in v1.13.7

func (app *Lux) ClearNetworkState() error

ClearNetworkState removes the default network state file For network-specific state, use ClearNetworkStateForType

func (*Lux) ClearNetworkStateForType added in v1.13.7

func (app *Lux) ClearNetworkStateForType(networkType string) error

ClearNetworkStateForType removes the network-specific state file

func (*Lux) ClusterExists

func (app *Lux) ClusterExists(clusterName string) (bool, error)

ClusterExists checks if a cluster exists

func (*Lux) ConfigFileExists

func (app *Lux) ConfigFileExists() bool

func (*Lux) CreateNodeCloudConfigFile

func (app *Lux) CreateNodeCloudConfigFile(clusterName string, nodeConfig interface{}) error

func (*Lux) GetAggregatorLogDir

func (app *Lux) GetAggregatorLogDir(clusterName string) string

GetAggregatorLogDir returns the signature aggregator log directory

func (*Lux) GetAllRunningNetworks added in v1.13.7

func (app *Lux) GetAllRunningNetworks() []string

GetAllRunningNetworks returns all currently running network types

func (*Lux) GetBasePath

func (app *Lux) GetBasePath() string

GetBasePath returns the base directory path for the CLI

func (*Lux) GetClusterConfig

func (app *Lux) GetClusterConfig(clusterName string) (map[string]interface{}, error)

GetClusterConfig loads cluster configuration from disk

func (*Lux) GetClusterYAMLFilePath

func (app *Lux) GetClusterYAMLFilePath(clusterName string) string

GetClusterYAMLFilePath returns the path to a cluster's YAML config file

func (*Lux) GetClustersConfig

func (app *Lux) GetClustersConfig() (map[string]interface{}, error)

func (*Lux) GetConfigPath added in v1.7.9

func (app *Lux) GetConfigPath() string

GetConfigPath returns the CLI config file path (~/.lux/cli.json) This overrides the SDK's GetConfigPath which returns ~/.lux/config

func (*Lux) GetEVMBinDir

func (app *Lux) GetEVMBinDir() string

func (*Lux) GetLoadTestInventoryDir

func (app *Lux) GetLoadTestInventoryDir(clusterName string) string

GetLoadTestInventoryDir returns the load test inventory directory

func (*Lux) GetLuxBinDir

func (app *Lux) GetLuxBinDir() string

func (*Lux) GetLuxCompatibilityURL

func (*Lux) GetLuxCompatibilityURL() string

func (*Lux) GetLuxNodeBinDir added in v1.13.7

func (app *Lux) GetLuxNodeBinDir() string

func (*Lux) GetLuxgoBinDir

func (app *Lux) GetLuxgoBinDir() string

GetLuxgoBinDir is deprecated, use GetLuxNodeBinDir instead

func (*Lux) GetMonitoringDashboardDir

func (app *Lux) GetMonitoringDashboardDir() string

func (*Lux) GetNetworkStateFile added in v1.13.7

func (app *Lux) GetNetworkStateFile() string

GetNetworkStateFile returns the path to the default network state file For network-specific state files, use GetNetworkStateFileForType

func (*Lux) GetNetworkStateFileForType added in v1.13.7

func (app *Lux) GetNetworkStateFileForType(networkType string) string

GetNetworkStateFileForType returns the path to the network state file for a specific network type Each network type has its own state file to allow multiple networks to run concurrently: - mainnet_network_state.json - testnet_network_state.json - devnet_network_state.json - custom_network_state.json

func (*Lux) GetNodeConfigPath

func (app *Lux) GetNodeConfigPath(nodeName string) string

GetNodeConfigPath returns the path to a node's config file

func (*Lux) GetNodeInstanceDirPath

func (app *Lux) GetNodeInstanceDirPath(nodeName string) string

func (*Lux) GetNodeStakingDir

func (app *Lux) GetNodeStakingDir(nodeName string) string

GetNodeStakingDir returns the staking directory for a node

func (*Lux) GetReposDir

func (app *Lux) GetReposDir() string

func (*Lux) GetRunFileForNetwork added in v1.13.7

func (app *Lux) GetRunFileForNetwork(networkType string) string

GetRunFileForNetwork returns the path to the run file for a specific network type. Each network type (mainnet, testnet, local) has its own run file to allow running multiple networks simultaneously.

func (*Lux) GetRunningNetworkEndpoint added in v1.13.7

func (app *Lux) GetRunningNetworkEndpoint() string

GetRunningNetworkEndpoint returns the API endpoint of the running network Returns the default LocalAPIEndpoint if no network state is found

func (*Lux) GetRunningNetworkType added in v1.13.7

func (app *Lux) GetRunningNetworkType() string

GetRunningNetworkType returns the type of the running network Returns "" if no network is running

func (*Lux) GetSDKApp

func (app *Lux) GetSDKApp() *sdkapp.Lux

GetSDKApp returns the embedded SDK application for compatibility with SDK-based functions

func (*Lux) GetSSHCertFilePath

func (app *Lux) GetSSHCertFilePath(certName string) (string, error)

func (*Lux) GetUpgradeBytesFilepath

func (app *Lux) GetUpgradeBytesFilepath(chainName string) string

func (*Lux) GetWarpRelayerBinDir

func (app *Lux) GetWarpRelayerBinDir() string

func (*Lux) GetWarpRelayerServiceConfigPath

func (app *Lux) GetWarpRelayerServiceConfigPath(blockchainName string) string

GetWarpRelayerServiceConfigPath returns the path to the warp relayer service config

func (*Lux) GetWarpRelayerServiceStorageDir added in v1.9.4

func (app *Lux) GetWarpRelayerServiceStorageDir() string

func (*Lux) HasEVMGenesis added in v1.13.7

func (app *Lux) HasEVMGenesis(blockchainName string) (bool, string, error)

HasEVMGenesis checks if the blockchain has a EVM genesis

func (*Lux) IsNetworkRunning added in v1.13.7

func (app *Lux) IsNetworkRunning() bool

IsNetworkRunning checks if a network is currently running (uses default state file)

func (*Lux) IsNetworkTypeRunning added in v1.13.7

func (app *Lux) IsNetworkTypeRunning(networkType string) bool

IsNetworkTypeRunning checks if a specific network type is currently running

func (*Lux) LoadClusterNodeConfig

func (app *Lux) LoadClusterNodeConfig(clusterName string, nodeName string) (map[string]interface{}, error)

LoadClusterNodeConfig loads node configuration for a cluster

func (*Lux) LoadConfig

func (app *Lux) LoadConfig() (types.Config, error)

func (*Lux) LoadEvmGenesis

func (app *Lux) LoadEvmGenesis(blockchainName string) (*types.EvmGenesis, error)

LoadEvmGenesis loads EVM genesis for a blockchain

func (*Lux) LoadNetworkState added in v1.13.7

func (app *Lux) LoadNetworkState() (*NetworkState, error)

LoadNetworkState loads the network state from the default state file For network-specific state, use LoadNetworkStateForType

func (*Lux) LoadNetworkStateForType added in v1.13.7

func (app *Lux) LoadNetworkStateForType(networkType string) (*NetworkState, error)

LoadNetworkStateForType loads the network state from the network-specific state file

func (*Lux) ReadLastActionsFile

func (app *Lux) ReadLastActionsFile() (*LastActions, error)

func (*Lux) SaveClustersConfig

func (app *Lux) SaveClustersConfig(config map[string]interface{}) error

SaveClustersConfig saves the clusters configuration

func (*Lux) SaveNetworkState added in v1.13.7

func (app *Lux) SaveNetworkState(state *NetworkState) error

SaveNetworkState saves the current network state to disk Uses the network-specific state file based on state.NetworkType

func (*Lux) SaveNetworkStateForType added in v1.13.7

func (app *Lux) SaveNetworkStateForType(networkType string, state *NetworkState) error

SaveNetworkStateForType saves network state to the network-specific state file

func (*Lux) SetClusterConfig

func (app *Lux) SetClusterConfig(clusterName string, config map[string]interface{}) error

SetClusterConfig saves cluster configuration to disk

func (*Lux) Setup

func (app *Lux) Setup(baseDir string, log luxlog.Logger, conf *config.Config, prompt prompts.Prompter, downloader Downloader)

func (*Lux) SetupMonitoringEnv

func (app *Lux) SetupMonitoringEnv(clusterName string) error

SetupMonitoringEnv sets up monitoring environment

func (*Lux) WriteConfigFile

func (app *Lux) WriteConfigFile(data []byte) error

CLI-specific config methods

func (*Lux) WriteLastActionsFile

func (app *Lux) WriteLastActionsFile(acts *LastActions)

type NetworkState added in v1.13.7

type NetworkState struct {
	NetworkType   string             `json:"network_type"` // "local", "testnet", "mainnet"
	NetworkID     uint32             `json:"network_id"`
	PortBase      int                `json:"port_base"`
	GRPCPort      int                `json:"grpc_port"`    // gRPC server port for this network
	GatewayPort   int                `json:"gateway_port"` // gRPC gateway port for this network
	APIEndpoint   string             `json:"api_endpoint"`
	Running       bool               `json:"running"`
	Validators    []ValidatorInfo    `json:"validators,omitempty"`     // Validator addresses
	ActiveAccount *ActiveAccountInfo `json:"active_account,omitempty"` // Currently active account
}

NetworkState tracks the state of a running local network

func CreateNetworkState added in v1.13.7

func CreateNetworkState(netType string, networkID uint32, portBase int) *NetworkState

CreateNetworkState creates a new network state for the given parameters

func CreateNetworkStateWithGRPC added in v1.13.7

func CreateNetworkStateWithGRPC(netType string, networkID uint32, portBase, grpcPort, gatewayPort int) *NetworkState

CreateNetworkStateWithGRPC creates a new network state with gRPC port configuration

func (*NetworkState) GetGRPCEndpoint added in v1.13.7

func (s *NetworkState) GetGRPCEndpoint() string

GetGRPCEndpoint returns the gRPC endpoint for connecting to this network's server

type ValidatorInfo added in v1.13.7

type ValidatorInfo struct {
	Index         int    `json:"index"`
	NodeID        string `json:"nodeID"`
	PChainAddress string `json:"pChainAddress"`
	XChainAddress string `json:"xChainAddress"`
	CChainAddress string `json:"cChainAddress"` // 0x format
}

ValidatorInfo contains validator addresses and optional balance info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL