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

networkoptions

package
v1.102.6 Latest Latest
Warning

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

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

Documentation

Overview

Package networkoptions provides network option handling for CLI commands.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultSupportedNetworkOptions are the default network options.
	DefaultSupportedNetworkOptions = []NetworkOption{
		Local,
		Devnet,
		Testnet,
		Mainnet,
	}
	NonLocalSupportedNetworkOptions = []NetworkOption{
		Devnet,
		Testnet,
		Mainnet,
	}
	NonMainnetSupportedNetworkOptions = []NetworkOption{
		Local,
		Devnet,
		Testnet,
	}
	LocalClusterSupportedNetworkOptions = []NetworkOption{
		Local,
		Cluster,
	}
)

Functions

func AddNetworkFlagsToCmd

func AddNetworkFlagsToCmd(cmd *cobra.Command, networkFlags *NetworkFlags, addEndpoint bool, supportedNetworkOptions []NetworkOption)

AddNetworkFlagsToCmd adds network flags to a command.

func GetNetworkFlagsGroup

func GetNetworkFlagsGroup(cmd *cobra.Command, networkFlags *NetworkFlags, addEndpoint bool, supportedNetworkOptions []NetworkOption) flags.GroupedFlags

GetNetworkFlagsGroup returns a grouped set of network flags.

func GetNetworkFromCmdLineFlags

func GetNetworkFromCmdLineFlags(
	app *application.Lux,
	promptStr string,
	networkFlags NetworkFlags,
	requireDevnetEndpointSpecification bool,
	onlyEndpointBasedDevnets bool,
	supportedNetworkOptions []NetworkOption,
	chainName string,
) (models.Network, error)

GetNetworkFromCmdLineFlags returns a network based on command line flags.

Types

type CustomEndpointNetwork

type CustomEndpointNetwork struct {
	models.Network
	Endpoint string
}

CustomEndpointNetwork wraps a Network with a custom endpoint

func (*CustomEndpointNetwork) GetEndpoint

func (c *CustomEndpointNetwork) GetEndpoint() string

GetEndpoint returns the custom endpoint

type NetworkFlags

type NetworkFlags struct {
	UseLocal    bool
	UseDevnet   bool
	UseTestnet  bool
	UseMainnet  bool
	Endpoint    string
	ClusterName string
}

NetworkFlags holds network-related command flags.

type NetworkOption

type NetworkOption int64

NetworkOption represents a network type option.

const (
	Undefined NetworkOption = iota
	Mainnet
	Testnet
	Local
	Devnet
	Cluster
)

Network option constants.

func GetNetworkFromSidecar

func GetNetworkFromSidecar(sc models.Sidecar, defaultOption []NetworkOption) []NetworkOption

GetNetworkFromSidecar returns network options from a sidecar.

func GetSupportedNetworkOptionsForChain added in v1.13.7

func GetSupportedNetworkOptionsForChain(
	app *application.Lux,
	chainName string,
	supportedNetworkOptions []NetworkOption,
) ([]NetworkOption, []string, []string, error)

GetSupportedNetworkOptionsForChain returns supported network options for a chain.

func NetworkOptionFromString

func NetworkOptionFromString(s string) NetworkOption

NetworkOptionFromString converts a string to a NetworkOption.

func (NetworkOption) String

func (n NetworkOption) String() string

Jump to

Keyboard shortcuts

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