config

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtcConfirmationCount    = 1
	DevEthConfirmationCount = 2

	// TssTestPrivkey is the private key of the TSS address
	// #nosec G101 - used for testing only
	TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb"
	TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074"

	// Number of blocks to scan per period under normal conditions
	DefaultBlocksPerPeriod = 100

	// MaxLatestIndexedBlockGap defines the maximum allowed gap between the current block
	// and the latest indexed block height on chain. The scanning process will stop when
	// this threshold is exceeded to prevent invalid votes.
	DefaultMaxLatestIndexedBlockGap = uint64(2000)
)
View Source
const (
	DefaultMaxMsgLen uint8 = 13
)

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 GetPath

func GetPath(inputPath string) string

func GetPellConnectorABI

func GetPellConnectorABI() string

func LoadComplianceConfig

func LoadComplianceConfig(cfg Config)

func Save

func Save(config *Config, path string) error

Save saves PellClient config

Types

type BTCConfig

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

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 pellclient config that is used by pellbridge

type ComplianceConfig

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

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"`
	PellCoreHome        string         `json:"PellCoreHome"`
	ChainID             string         `json:"ChainID"`
	PellCoreURL         string         `json:"PellCoreURL"`
	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"`
	PellTxMsgLength uint8               `json:"PellTxMsgLength"`
	// compliance config
	ComplianceConfig ComplianceConfig `json:"ComplianceConfig"`
	// contains filtered or unexported fields
}

Config is the config for PellClient TODO: use snake case for json fields

func Load

func Load(path string) (Config, error)

Load loads PellClient config from a filepath

func New

func New() Config

New constructs Config optionally with default values.

func NewConfig

func NewConfig() Config

func (Config) GetAllEVMConfigs

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

func (Config) GetBTCConfig

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

func (Config) GetEVMConfig

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

func (*Config) GetKeyringBackend

func (c *Config) GetKeyringBackend() KeyringBackend

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

type EVMConfig

type EVMConfig struct {
	Chain            chains.Chain
	Endpoint         string
	ForceStartHeight uint64 // If it is not equal to 0.  scan starts from this height
	// MaxLatestIndexedBlockGap defines the maximum allowed gap between the current block
	// and the latest indexed block height on chain. The scanning process will stop when
	// this threshold is exceeded to prevent invalid votes.
	MaxLatestIndexedBlockGap uint64
}

type KeyringBackend

type KeyringBackend string

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

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

Jump to

Keyboard shortcuts

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