config

package
v0.0.0-...-313251d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger()

func LoadEnv

func LoadEnv(environment string) error

func ParseJsonArrayConfig

func ParseJsonArrayConfig[T any](content []byte) ([]T, error)

func ParseJsonConfig

func ParseJsonConfig[T any](content []byte) (*T, error)

func ReadJsonArrayConfig

func ReadJsonArrayConfig[T any](filePath string) ([]T, error)

func ReadJsonConfig

func ReadJsonConfig[T any](filePath string) (*T, error)

Types

type ChainFamily

type ChainFamily map[uint64]IChainConfig

type Config

type Config struct {
	ConfigPath        string                 `mapstructure:"config_path"`
	ConnnectionString string                 `mapstructure:"database_url"` // Postgres db connection string
	ScalarMnemonic    string                 `mapstructure:"scalar_mnemonic"`
	EvmPrivateKey     string                 `mapstructure:"evm_private_key"`
	BtcPrivateKey     string                 `mapstructure:"btc_private_key"`
	ChainConfigs      map[string]ChainFamily `mapstructure:"chain_configs"` //Store all valid chain configs
	ActiveChains      map[string]bool        `mapstructure:"active_chains"` //Store all active chains in the scalar network
}
var GlobalConfig Config

func (*Config) AddChainConfig

func (c *Config) AddChainConfig(chainConfig IChainConfig)

func (*Config) GetChainConfigById

func (c *Config) GetChainConfigById(chainFamily string, chainId uint64) (IChainConfig, error)

func (*Config) GetStringIdByChainId

func (c *Config) GetStringIdByChainId(chainFamily string, chainId uint64) (string, error)

type EventBusConfig

type EventBusConfig struct {
}

type IChainConfig

type IChainConfig interface {
	GetId() string      //String identifier for the chain for example ethereum-sepolia
	GetChainId() uint64 //Integer identifier for the chain for example 11155111
	GetFamily() string  //Family of the chain for example evm
	GetName() string    //Name of the chain for example Ethereum Sepolia
}

Jump to

Keyboard shortcuts

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