config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeholderConfig

type BeholderConfig struct {
	InsecureConnection       bool    `toml:"insecure_connection"`
	CACertFile               string  `toml:"ca_cert_file"`
	OtelExporterGRPCEndpoint string  `toml:"otel_exporter_grpc_endpoint"`
	OtelExporterHTTPEndpoint string  `toml:"otel_exporter_http_endpoint"`
	LogStreamingEnabled      bool    `toml:"log_streaming_enabled"`
	MetricReaderInterval     int64   `toml:"metric_reader_interval"`
	TraceSampleRatio         float64 `toml:"trace_sample_ratio"`
	TraceBatchTimeout        int64   `toml:"trace_batch_timeout"`
}

type CCIPAPIConfig

type CCIPAPIConfig struct {
	Enabled bool `toml:"enabled"`

	PerPartyRouterFactory ContractIdentifier `toml:"per_party_router_factory" validate:"required_if=Enabled true,omitempty"`
	OnRamp                ContractIdentifier `toml:"on_ramp" validate:"required_if=Enabled true,omitempty"`
	OffRamp               ContractIdentifier `toml:"off_ramp" validate:"required_if=Enabled true,omitempty"`
	GlobalConfig          ContractIdentifier `toml:"global_config" validate:"required_if=Enabled true,omitempty"`
	TokenAdminRegistry    ContractIdentifier `toml:"token_admin_registry" validate:"required_if=Enabled true,omitempty"`
	RMNRemote             ContractIdentifier `toml:"rmn_remote" validate:"required_if=Enabled true,omitempty"`
	FeeQuoter             ContractIdentifier `toml:"fee_quoter" validate:"required_if=Enabled true,omitempty"`
}

type CCV

type CCV struct {
	ContractIdentifier
}

type CCVAPIConfig

type CCVAPIConfig struct {
	Enabled bool  `toml:"enabled"`
	CCVs    []CCV `toml:"ccvs" validate:"required_if=Enabled true,dive"`
}

type Config

type Config struct {
	ChainSelector string           `toml:"chain_selector" validate:"required"`
	Server        ServerConfig     `toml:"server" validate:"required"`
	Node          NodeConfig       `toml:"node" validate:"required"`
	Monitoring    MonitoringConfig `toml:"monitoring"`

	// API Configs
	GlobalAPIConfig        GlobalAPIConfig        `toml:"global_api"`
	CCIPAPIConfig          CCIPAPIConfig          `toml:"ccip_api"`
	CCVAPIConfig           CCVAPIConfig           `toml:"ccv_api"`
	ExecutorAPIConfig      ExecutorAPIConfig      `toml:"executor_api"`
	TokenPoolAPIConfig     TokenPoolAPIConfig     `toml:"token_pool_api"`
	TokenStandardAPIConfig TokenStandardAPIConfig `toml:"token_standard_api"`
	RegistryAPIConfig      RegistryAPIConfig      `toml:"registry_api"`
}

func DefaultConfig

func DefaultConfig() *Config

func Read

func Read(configData io.Reader) (*Config, error)

func ReadAndMerge

func ReadAndMerge(configDatas ...io.Reader) (*Config, error)

ReadAndMerge merges multiple configs in low->high preceding order. Later passed readers will take precedence over earlier ones.

func (*Config) Merge

func (cfg *Config) Merge(in *Config) (*Config, error)

Merge merges the in config into cfg and returns cfg. Any unexported/unset/zero-value field will be ignored. If in is nil, no merge will be performed and cfg will be returned as-is.

Token pool entries are merged separately by contract-address key: mergo cannot merge struct values inside maps correctly, so token_pool_api.token_pools uses a manual per-key merge.

func (*Config) Validate

func (cfg *Config) Validate() error

type ContractIdentifier

type ContractIdentifier struct {
	PartyID         string                    `toml:"party_id" validate:"required"`
	InstanceAddress contracts.InstanceAddress `toml:"instance_address" validate:"required"`
}

ContractIdentifier uniquely identifies a contract using an InstanceAddress. It also contains a PartyID of a party that must be a stakeholder on the contract. This party will be used to retrieve contracts from the Active Contract Set, it can be the same party that owns the contract, but does not have to be.

type Executor

type Executor struct {
	ContractIdentifier
}

type ExecutorAPIConfig

type ExecutorAPIConfig struct {
	Enabled   bool       `toml:"enabled"`
	Executors []Executor `toml:"executors" validate:"required_if=Enabled true,dive"`
}

type Factory

type Factory struct {
	Type FactoryType `toml:"type" validate:"oneof='' address url urlRequests"`

	TemplateId      *string                    `toml:"template_id" validate:"required_if=Type address"`
	Party           *string                    `toml:"party" validate:"required_if=Type address"`
	InstanceAddress *contracts.InstanceAddress `toml:"instance_address" validate:"required_if=Type address"`

	TokenStandardURL        *string                `` /* 156-byte string literal not displayed */
	TokenStandardAuthConfig *authConfig.AuthConfig `toml:"token_standard_auth" validate:"excluded_unless=Type url|excluded_unless=Type urlRequests"`
}

type FactoryType

type FactoryType string
const (
	FactoryTypeDisabled    FactoryType = ""
	FactoryTypeAddress     FactoryType = "address"
	FactoryTypeURL         FactoryType = "url"
	FactoryTypeURLRequests FactoryType = "urlRequests"
)

type GlobalAPIConfig

type GlobalAPIConfig struct {
	// The maximum number of disclosures that can be requested in a single batch request.
	MaxBatchSize int `toml:"max_batch_size" validate:"required"`
}

type MonitoringConfig

type MonitoringConfig struct {
	Enabled  bool           `toml:"enabled"`
	Beholder BeholderConfig `toml:"beholder" validate:"required_if=Enabled true"`
}

type NodeConfig

type NodeConfig struct {
	URL        string                `toml:"url" validate:"required,url"`
	AuthConfig authConfig.AuthConfig `toml:"auth" validate:"required"`
	MaxRetries int                   `toml:"max_retries"`
}

type Registry

type Registry struct {
	ContractIdentifier
	TokenType   TokenType `toml:"token_type" validate:"required,oneof=LINK"`
	TokenId     string    `toml:"token_id" validate:"required"`
	TokenName   string    `toml:"token_name"`
	TokenSymbol string    `toml:"token_symbol"`
}

type RegistryAPIConfig

type RegistryAPIConfig struct {
	Enabled bool   `toml:"enabled"`
	PartyID string `toml:"party_id" validate:"required_if=Enabled true"`
	// TokenStandardURL is the base URL of the token-standard (DA registry) backend used to
	// resolve burn-mint/transfer factories for discovered pools (URL factory mode — resolved
	// over HTTP at serve time, so EDS needs no ledger visibility into the factory contract).
	// Required when enabled: without it, discovered pools get no factory and send/execute
	// aborts on-ledger (the pool requires the factory CID in the choice context).
	TokenStandardURL string `toml:"token_standard_url" validate:"required_if=Enabled true,omitempty,url"`
}

RegistryAPIConfig configures EDS's registry observer party, used to detect Registry-deployed token pools that name it as an observer. PartyID is EDS's own party - it is never a pool's owner party, which is a separate, per-pool party EDS has no rights over.

type ServerConfig

type ServerConfig struct {
	Host                string `toml:"host" validate:"required"`
	Port                uint16 `toml:"port" validate:"required,port"`
	MaxRequestSizeBytes int64  `toml:"max_request_size_bytes" validate:"required"`
}

type TokenPool

type TokenPool struct {
	ContractIdentifier
	Type TokenPoolType `toml:"type" validate:"required,oneof=lockRelease burnMint"`

	// The owner party of the token pool.
	PoolOwner string `toml:"pool_owner" validate:"required"`

	Factory             *Factory             `toml:"factory" validate:"omitnil"`
	TransferPreapproval *TransferPreapproval `toml:"transfer_preapproval" validate:"omitnil"`
}

type TokenPoolAPIConfig

type TokenPoolAPIConfig struct {
	Enabled bool `toml:"enabled"`
	// TokenPools is keyed by instance_address (contracts.InstanceAddress.Hex()) so layered configs merge per pool.
	// Not required_if=Enabled true: an instance running purely on registry-discovered pools may start with none.
	TokenPools map[string]TokenPool `toml:"token_pools" validate:"dive"`
}

type TokenPoolType

type TokenPoolType string
const (
	TokenPoolTypeLockRelease TokenPoolType = "lockRelease"
	TokenPoolTypeBurnMint    TokenPoolType = "burnMint"
)

type TokenStandardAPIConfig

type TokenStandardAPIConfig struct {
	Enabled bool `toml:"enabled"`
	// The duration for which to cache a token's totalSupply.
	// Defaults to 10 seconds if not specified.
	SupplyCacheTTL time.Duration       `toml:"supply_cache_ttl"`
	Admin          string              `toml:"admin" validate:"required_if=Enabled true"`
	Registries     map[string]Registry `toml:"registries" validate:"required_if=Enabled true,dive"`
}

type TokenType

type TokenType string
const (
	TokenTypeLINK TokenType = "LINK"
)

type TransferPreapproval

type TransferPreapproval struct {
	ContextKey string `toml:"context_key" validate:"required"`
	TemplateId string `toml:"template_id" validate:"required"`
}

Jump to

Keyboard shortcuts

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