cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHomeDirName    = "aerium"
	DefaultWalletsDirName = "wallets"
	DefaultWalletName     = "default_wallet"
)
View Source
const DefaultSnapshotURL = "https://snapshot.aerium.dev"

Variables

This section is empty.

Functions

func AeriumConfigPath

func AeriumConfigPath(home string) string

func AeriumDefaultHomeDir

func AeriumDefaultHomeDir() string

func AeriumDefaultWalletPath

func AeriumDefaultWalletPath(home string) string

func AeriumGenesisPath

func AeriumGenesisPath(home string) string

func AeriumWalletDir

func AeriumWalletDir(home string) string

func CheckTerminalSupported

func CheckTerminalSupported() bool

CheckTerminalSupported returns true if the current terminal supports line editing features.

func CreateNode

func CreateNode(ctx context.Context, numValidators int, chain genesis.ChainType, workingDir string,
	mnemonic string, walletPassword string, recoveryEventFunc func(addr string),
) ([]string, string, error)

func FatalErrorCheck

func FatalErrorCheck(err error)

func MakeConfig

func MakeConfig(workingDir string) (*config.Config, *genesis.Genesis, error)

MakeConfig attempts to load the configuration file and returns an instance of the configuration along with the genesis document. The genesis document is required to determine the chain type, which influences the configuration settings. The function sets various private configurations, such as the "wallets directory" and chain-specific HRP values. If the configuration file cannot be loaded, it tries to recover or restore the configuration.

func MakeRewardAddresses

func MakeRewardAddresses(wlt *wallet.Wallet, valAddrsInfo []vault.AddressInfo,
	confRewardAddrs []string,
) ([]crypto.Address, error)

MakeRewardAddresses generates a list of reward addresses based on wallet and configuration. If no reward addresses are provided in the config, the function attempts to use Ed25519 or BLS addresses from the wallet.

func MakeValidatorKey

func MakeValidatorKey(walletInstance *wallet.Wallet, valAddrsInfo []vault.AddressInfo,
	passwordFetcher func(*wallet.Wallet) (string, bool),
) ([]*bls.ValidatorKey, error)

func PrintErrorMsgf

func PrintErrorMsgf(format string, args ...any)

func PrintInfoMsgBoldf

func PrintInfoMsgBoldf(format string, a ...any)

func PrintInfoMsgf

func PrintInfoMsgf(format string, a ...any)

func PrintJSONData

func PrintJSONData(data []byte)

func PrintJSONObject

func PrintJSONObject(obj any)

func PrintLine

func PrintLine()

func PrintSuccessMsgf

func PrintSuccessMsgf(format string, a ...any)

func PrintWarnMsgf

func PrintWarnMsgf(format string, a ...any)

func PromptConfirm

func PromptConfirm(label string) bool

PromptConfirm prompts user to confirm the operation.

func PromptInput

func PromptInput(label string) string

PromptInput prompts for an input string.

func PromptInputWithRange

func PromptInputWithRange(label string, def, min, max int) int

PromptInputWithRange prompts the user for an input integer within a specified range.

func PromptInputWithSuggestion

func PromptInputWithSuggestion(label, suggestion string) string

PromptInputWithSuggestion prompts the user for an input string with a suggestion.

func PromptPassword

func PromptPassword(label string, confirmation bool) string

PromptPassword prompts the user for a password. Set confirmation to true to require the user to confirm the password.

func PromptSelect

func PromptSelect(label string, items []string) int

PromptSelect prompts create choice menu for select by user.

func RecoverConfig

func RecoverConfig(confPath string, defConf *config.Config, chainType genesis.ChainType) (*config.Config, error)

func StartNode

func StartNode(workingDir string, passwordFetcher func(*wallet.Wallet) (string, bool),
	configModifier func(cfg *config.Config) *config.Config,
) (*node.Node, *wallet.Wallet, error)

StartNode starts the node from the given working directory. The passwordFetcher will be used to fetch the password for the default_wallet if it is encrypted. It returns an error if the genesis doc or default_wallet can't be found inside the working directory. TODO: write test for me.

func TerminalProgressBar

func TerminalProgressBar(totalSize int64, barWidth int) *progressbar.ProgressBar

func TrapSignal

func TrapSignal(cleanupFunc func())

TrapSignal traps SIGINT and SIGTERM and terminates the server correctly.

Types

type Importer

type Importer struct {
	// contains filtered or unexported fields
}

Importer downloads and imports the pruned data from a centralized server.

func NewImporter

func NewImporter(chainType genesis.ChainType, snapshotURL, storeDir string) (*Importer, error)

func (*Importer) Cleanup

func (i *Importer) Cleanup() error

func (*Importer) Download

func (i *Importer) Download(ctx context.Context, metadata *Metadata,
	stateFunc ImporterStateFunc,
) error

func (*Importer) ExtractAndStoreFiles

func (i *Importer) ExtractAndStoreFiles() error

func (*Importer) GetMetadata

func (i *Importer) GetMetadata(ctx context.Context) ([]Metadata, error)

func (*Importer) MoveStore

func (i *Importer) MoveStore() error

type ImporterStateFunc

type ImporterStateFunc func(fileName string) func(stats downloader.Stats)

type Metadata

type Metadata struct {
	Name      string       `json:"name"`
	CreatedAt string       `json:"created_at"`
	Compress  string       `json:"compress"`
	Data      SnapshotData `json:"data"`
}

func (*Metadata) CreatedAtTime

func (md *Metadata) CreatedAtTime() time.Time

type SnapshotData

type SnapshotData struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Sha  string `json:"sha"`
	Size uint64 `json:"size"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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