config

package
v0.0.0-...-2da98db Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides functions to load and save ZetaClient config

Index

Constants

View Source
const (
	MaxBlocksPerPeriod = 100
)

Variables

This section is empty.

Functions

func ContainRestrictedAddress

func ContainRestrictedAddress(addrs ...string) bool

ContainRestrictedAddress returns true if any one of the addresses is restricted Note: the addrs can contains both ETH and BTC addresses

func GetConnectorABI

func GetConnectorABI() string

GetConnectorABI returns the ABI of the connector contract

func GetERC20CustodyABI

func GetERC20CustodyABI() string

GetERC20CustodyABI returns the ABI of the erc20 custody contract

func GetPath

func GetPath(inputPath string) string

GetPath returns the absolute path of the input path

func LoadComplianceConfig

func LoadComplianceConfig(cfg Config)

LoadComplianceConfig loads compliance data (restricted addresses) from config

func Save

func Save(config *Config, path string) error

Save saves ZetaClient config

Types

type BTCConfig

type BTCConfig struct {
	// the following are rpcclient ConnConfig fields
	RPCUsername string
	RPCPassword string
	RPCHost     string
	RPCParams   string // "regtest", "mainnet", "testnet3"
}

BTCConfig is the config for Bitcoin chain

type ClientConfiguration

type ClientConfiguration struct {
	ChainHost       string `json:"chain_host"        mapstructure:"chain_host"`
	ChainRPC        string `json:"chain_rpc"         mapstructure:"chain_rpc"`
	ChainHomeFolder string `json:"chain_home_folder" mapstructure:"chain_home_folder"`
	SignerName      string `json:"signer_name"       mapstructure:"signer_name"`
	SignerPasswd    string `json:"signer_passwd"`
	HsmMode         bool   `json:"hsm_mode"`
}

ClientConfiguration is a subset of zetaclient config that is used by zetacore client

type ComplianceConfig

type ComplianceConfig struct {
	LogPath             string   `json:"LogPath"`
	RestrictedAddresses []string `json:"RestrictedAddresses"`
}

ComplianceConfig is the config for compliance

type Config

type Config struct {
	Peer                string         `json:"Peer"`
	PublicIP            string         `json:"PublicIP"`
	LogFormat           string         `json:"LogFormat"`
	LogLevel            int8           `json:"LogLevel"`
	LogSampler          bool           `json:"LogSampler"`
	PreParamsPath       string         `json:"PreParamsPath"`
	ZetaCoreHome        string         `json:"ZetaCoreHome"`
	ChainID             string         `json:"ChainID"`
	ZetaCoreURL         string         `json:"ZetaCoreURL"`
	AuthzGranter        string         `json:"AuthzGranter"`
	AuthzHotkey         string         `json:"AuthzHotkey"`
	P2PDiagnostic       bool           `json:"P2PDiagnostic"`
	ConfigUpdateTicker  uint64         `json:"ConfigUpdateTicker"`
	P2PDiagnosticTicker uint64         `json:"P2PDiagnosticTicker"`
	TssPath             string         `json:"TssPath"`
	TestTssKeysign      bool           `json:"TestTssKeysign"`
	KeyringBackend      KeyringBackend `json:"KeyringBackend"`
	HsmMode             bool           `json:"HsmMode"`
	HsmHotKey           string         `json:"HsmHotKey"`

	EVMChainConfigs map[int64]EVMConfig `json:"EVMChainConfigs"`
	BitcoinConfig   BTCConfig           `json:"BitcoinConfig"`

	// compliance config
	ComplianceConfig ComplianceConfig `json:"ComplianceConfig"`
	// contains filtered or unexported fields
}

Config is the config for ZetaClient TODO: use snake case for json fields https://github.com/zeta-chain/node/issues/1020

func Load

func Load(path string) (Config, error)

Load loads ZetaClient config from a filepath

func New

func New(setDefaults bool) Config

New constructs Config optionally with default values.

func (Config) GetAllEVMConfigs

func (c Config) GetAllEVMConfigs() map[int64]EVMConfig

GetAllEVMConfigs returns a map of all EVM configs

func (Config) GetBTCConfig

func (c Config) GetBTCConfig() (BTCConfig, bool)

GetBTCConfig returns the BTC config

func (Config) GetEVMConfig

func (c Config) GetEVMConfig(chainID int64) (EVMConfig, bool)

GetEVMConfig returns the EVM config for the given chain ID

func (Config) GetKeyringBackend

func (c Config) GetKeyringBackend() KeyringBackend

GetKeyringBackend returns the keyring backend

func (Config) GetRestrictedAddressBook

func (c Config) GetRestrictedAddressBook() map[string]bool

GetRestrictedAddressBook returns a map of restricted addresses Note: the restricted address book contains both ETH and BTC addresses

func (Config) String

func (c Config) String() string

String returns the string representation of the config

type EVMConfig

type EVMConfig struct {
	Chain    chains.Chain
	Endpoint string
}

EVMConfig is the config for EVM chain

type KeyringBackend

type KeyringBackend string

KeyringBackend is the type of keyring backend to use for the hotkey

const (
	// KeyringBackendUndefined is undefined keyring backend
	KeyringBackendUndefined KeyringBackend = ""

	// KeyringBackendTest is the test Cosmos keyring backend
	KeyringBackendTest KeyringBackend = "test"

	// KeyringBackendFile is the file Cosmos keyring backend
	KeyringBackendFile KeyringBackend = "file"
)

Jump to

Keyboard shortcuts

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