cmd

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CreateNode added in v0.10.0

func CreateNode(ctx context.Context, numValidators int, chain genesis.ChainType, workingDir string,
	mnemonic string, walletPassword string,
) (*wallet.Wallet, string, error)

func MakeConfig added in v1.0.0

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 added in v1.1.0

func MakeRewardAddresses(wlt *wallet.Wallet, valList []types.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 added in v1.1.0

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

func PactusConfigPath

func PactusConfigPath(home string) string

func PactusDaemonName added in v1.10.0

func PactusDaemonName() string

func PactusDefaultHomeDir added in v0.18.2

func PactusDefaultHomeDir() string

func PactusDefaultWalletPath

func PactusDefaultWalletPath(home string) string

func PactusGenesisPath

func PactusGenesisPath(home string) string

func PactusLockFilePath added in v1.10.0

func PactusLockFilePath(home string) string

func PactusWalletDir added in v1.0.0

func PactusWalletDir(home string) string

func RecoverConfig added in v1.1.0

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

func RecoverWalletAddresses added in v1.10.0

func RecoverWalletAddresses(wlt *wallet.Wallet, password string)

func ShortAddress added in v1.11.0

func ShortAddress(addr string) string

func ShortHash added in v1.11.0

func ShortHash(id string) string

func StartNode added in v0.11.0

func StartNode(workingDir string, passwordFetcher func() (string, bool),
	configModifier func(cfg *config.Config) *config.Config,
) (*node.Node, 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.

Types

type Importer added in v1.4.0

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

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

func NewImporter added in v1.4.0

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

func (*Importer) Cleanup added in v1.4.0

func (i *Importer) Cleanup() error

func (*Importer) Download added in v1.4.0

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

func (*Importer) ExtractAndStoreFiles added in v1.4.0

func (i *Importer) ExtractAndStoreFiles() error

func (*Importer) GetMetadata added in v1.4.0

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

func (*Importer) MoveStore added in v1.4.0

func (i *Importer) MoveStore() error

type ImporterStateFunc added in v1.4.0

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

type Metadata added in v1.4.0

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

func (*Metadata) CreatedAtTime added in v1.4.0

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

type SnapshotData added in v1.4.0

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