config

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config provides configuration loading, validation, and persistence for the Push Universal Validator.

Directory layout:

<NodeHome>/                        (default: ~/.puniversal)
├── config/
│   └── pushuv_config.json
├── databases/
│   ├── eip155_1.db
│   └── eip155_97.db
└── relayer/
    └── <namespace>.json

Index

Constants

View Source
const (
	NodeDir         = ".puniversal"
	ConfigSubdir    = "config"
	ConfigFileName  = "pushuv_config.json"
	DatabasesSubdir = "databases"
	RelayerSubdir   = "relayer"
)

Variables

This section is empty.

Functions

func DefaultNodeHome added in v0.0.23

func DefaultNodeHome() string

DefaultNodeHome returns the default node home directory (~/.puniversal).

func Save

func Save(cfg *Config, basePath string) error

Save validates the config and writes it to <basePath>/config/pushuv_config.json.

Types

type ChainSpecificConfig

type ChainSpecificConfig struct {
	RPCURLs                     []string          `json:"rpc_urls,omitempty"`
	CleanupIntervalSeconds      *int              `json:"cleanup_interval_seconds,omitempty"`
	RetentionPeriodSeconds      *int              `json:"retention_period_seconds,omitempty"`
	EventPollingIntervalSeconds *int              `json:"event_polling_interval_seconds,omitempty"`
	EventStartFrom              *int64            `json:"event_start_from,omitempty"`
	GasPriceIntervalSeconds     *int              `json:"gas_price_interval_seconds,omitempty"`
	GasPriceMarkupPercent       *int              `json:"gas_price_markup_percent,omitempty"` // % markup on fetched gas price to handle spikes
	ProtocolALT                 string            `json:"protocol_alt,omitempty"`             // Protocol ALT address (base58) for V0 transactions
	TokenALTs                   map[string]string `json:"token_alts,omitempty"`               // mint address → token ALT address (base58)
}

ChainSpecificConfig holds per-chain configuration.

type Config

type Config struct {
	// Logging
	LogLevel   int    `json:"log_level"`
	LogFormat  string `json:"log_format"`
	LogSampler bool   `json:"log_sampler"`

	// Node
	NodeHome string `json:"node_home"`

	// Push Chain
	PushChainID                  string   `json:"push_chain_id"`
	PushChainGRPCURLs            []string `json:"push_chain_grpc_urls"`
	PushValoperAddress           string   `json:"push_valoper_address"`
	ConfigRefreshIntervalSeconds int      `json:"config_refresh_interval_seconds"`
	MaxRetries                   int      `json:"max_retries"`

	// Query Server
	QueryServerPort int `json:"query_server_port"`

	// Keyring
	KeyringBackend  KeyringBackend `json:"keyring_backend"`
	KeyringPassword string         `json:"keyring_password"`

	// Per-chain settings (keyed by CAIP-2 chain ID)
	ChainConfigs map[string]ChainSpecificConfig `json:"chain_configs"`

	// TSS
	TSSP2PPrivateKeyHex string `json:"tss_p2p_private_key_hex"`
	TSSP2PListen        string `json:"tss_p2p_listen"`
	TSSPassword         string `json:"tss_password"`
	TSSHomeDir          string `json:"tss_home_dir"`
}

Config holds all configuration for the Universal Validator.

func Load

func Load(basePath string) (Config, error)

Load reads the config from <basePath>/config/pushuv_config.json, applies defaults for any missing fields, and validates.

func LoadDefaultConfig

func LoadDefaultConfig() (Config, error)

LoadDefaultConfig loads the embedded default configuration.

func (*Config) GetChainCleanupSettings

func (c *Config) GetChainCleanupSettings(chainID string) (cleanupInterval, retentionPeriod int, err error)

GetChainCleanupSettings returns cleanup settings for a specific chain.

func (*Config) GetChainConfig

func (c *Config) GetChainConfig(chainID string) *ChainSpecificConfig

GetChainConfig returns the configuration for a specific chain, or an empty config if not found.

type KeyringBackend

type KeyringBackend string

KeyringBackend represents the type of keyring backend to use.

const (
	KeyringBackendTest KeyringBackend = "test"
	KeyringBackendFile KeyringBackend = "file"
)

Jump to

Keyboard shortcuts

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