context

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Environment variable to set the system path for unit tests
	TestSystemDirEnvVar string = "HYPERDRIVE_TEST_SYSTEM_DIR"

	// System dir path for Linux
	LinuxSystemDir string = "/usr/share/hyperdrive"

	// Subfolders under the system dir
	ScriptsDir        string = "scripts"
	TemplatesDir      string = "templates"
	OverrideSourceDir string = "override"
	NetworksDir       string = "networks"
)

Variables

This section is empty.

Functions

func SetHyperdriveContext

func SetHyperdriveContext(c *cli.Context, hd *HyperdriveContext)

Add the Hyperdrive context into a CLI context

Types

type HyperdriveContext

type HyperdriveContext struct {
	*InstallationInfo

	// The path to the Hyperdrive user directory
	UserDirPath string

	// The max fee for transactions
	MaxFee float64

	// The max priority fee for transactions
	MaxPriorityFee float64

	// The nonce for the first transaction, if set
	Nonce *big.Int

	// True if debug mode is enabled
	DebugEnabled bool

	// True if this is a secure session
	SecureSession bool

	// The address and URL of the API server
	ApiUrl *url.URL

	// The HTTP trace file if tracing is enabled
	HttpTraceFile *os.File

	// The list of networks options and corresponding settings for Hyperdrive itself
	HyperdriveNetworkSettings []*hdconfig.HyperdriveSettings

	// The list of networks options and corresponding settings for the StakeWise module
	StakeWiseNetworkSettings []*swconfig.StakeWiseSettings

	// The list of networks options and corresponding settings for the Constellation module
	ConstellationNetworkSettings []*csconfig.ConstellationSettings
}

Context for global settings

func GetHyperdriveContext

func GetHyperdriveContext(c *cli.Context) *HyperdriveContext

Get the Hyperdrive context from a CLI context

func NewHyperdriveContext added in v1.1.0

func NewHyperdriveContext(userDirPath string, installationInfo *InstallationInfo) *HyperdriveContext

Creates a new Hyperdrive context. If installationInfo is nil, a new one will be created using the system configuration.

func (*HyperdriveContext) LoadNetworkSettings added in v1.1.0

func (c *HyperdriveContext) LoadNetworkSettings() error

Load the network settings

type InstallationInfo added in v1.1.0

type InstallationInfo struct {
	// The system path for Hyperdrive scripts used in the Docker containers
	ScriptsDir string

	// The system path for Hyperdrive templates
	TemplatesDir string

	// The system path for the source files to put in the user's override directory
	OverrideSourceDir string

	// The system path for built-in network settings and resource definitions
	NetworksDir string
}

Holds information about Hyperdrive's installation on the system

func NewInstallationInfo added in v1.1.0

func NewInstallationInfo() *InstallationInfo

Creates a new installation info instance

func NewInstallationInfoForSystemDir added in v1.1.1

func NewInstallationInfoForSystemDir(systemDir string) *InstallationInfo

Creates a new installation info instance with the given system directory

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳