chainlink

package
v1.8.0-beta0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 85 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGeneralConfig added in v1.8.0

func NewGeneralConfig(configToml string, secretsToml string, context *cli.Context) (coreconfig.GeneralConfig, error)

Types

type Application

type Application interface {
	Start(ctx context.Context) error
	Stop() error
	GetLogger() logger.Logger
	GetHealthChecker() services.Checker
	GetSqlxDB() *sqlx.DB
	GetConfig() config.GeneralConfig
	// ConfigDump returns a TOML configuration from the current environment and database configuration.
	ConfigDump(context.Context) (string, error)
	SetLogLevel(lvl zapcore.Level) error
	GetKeyStore() keystore.Master
	GetEventBroadcaster() pg.EventBroadcaster
	WakeSessionReaper()
	GetWebAuthnConfiguration() sessions.WebAuthnConfiguration

	GetExternalInitiatorManager() webhook.ExternalInitiatorManager
	GetChains() Chains

	// V2 Jobs (TOML specified)
	JobSpawner() job.Spawner
	JobORM() job.ORM
	EVMORM() evmtypes.ORM
	PipelineORM() pipeline.ORM
	BridgeORM() bridges.ORM
	SessionORM() sessions.ORM
	TxmORM() txmgr.ORM
	AddJobV2(ctx context.Context, job *job.Job) error
	DeleteJob(ctx context.Context, jobID int32) error
	RunWebhookJobV2(ctx context.Context, jobUUID uuid.UUID, requestBody string, meta pipeline.JSONSerializable) (int64, error)
	ResumeJobV2(ctx context.Context, taskID uuid.UUID, result pipeline.Result) error
	// Testing only
	RunJobV2(ctx context.Context, jobID int32, meta map[string]interface{}) (int64, error)

	// Feeds
	GetFeedsService() feeds.Service

	// ReplayFromBlock replays logs from on or after the given block number. If forceBroadcast is
	// set to true, consumers will reprocess data even if it has already been processed.
	ReplayFromBlock(chainID *big.Int, number uint64, forceBroadcast bool) error

	// ID is unique to this particular application instance
	ID() uuid.UUID

	SecretGenerator() SecretGenerator
}

Application implements the common functions used in the core node.

func NewApplication

func NewApplication(opts ApplicationOpts) (Application, error)

NewApplication initializes a new store if one is not already present at the configured root directory (default: ~/.chainlink), the logger at the same directory and returns the Application to be used by the node. TODO: Inject more dependencies here to save booting up useless stuff in tests

type ApplicationOpts added in v1.1.0

type ApplicationOpts struct {
	Config                   config.GeneralConfig
	EventBroadcaster         pg.EventBroadcaster
	SqlxDB                   *sqlx.DB
	KeyStore                 keystore.Master
	Chains                   Chains
	Logger                   logger.Logger
	CloseLogger              func() error
	ExternalInitiatorManager webhook.ExternalInitiatorManager
	Version                  string
	RestrictedHTTPClient     *http.Client
	UnrestrictedHTTPClient   *http.Client
	SecretGenerator          SecretGenerator
}

type ChainlinkApplication

type ChainlinkApplication struct {
	Chains           Chains
	EventBroadcaster pg.EventBroadcaster

	FeedsService feeds.Service

	Config                   config.GeneralConfig
	KeyStore                 keystore.Master
	ExternalInitiatorManager webhook.ExternalInitiatorManager
	SessionReaper            utils.SleeperTask

	HealthChecker services.Checker
	Nurse         *services.Nurse
	// contains filtered or unexported fields
}

ChainlinkApplication contains fields for the JobSubscriber, Scheduler, and Store. The JobSubscriber and Scheduler are also available in the services package, but the Store has its own package.

func (*ChainlinkApplication) AddJobV2 added in v0.9.3

func (app *ChainlinkApplication) AddJobV2(ctx context.Context, j *job.Job) error

func (*ChainlinkApplication) BridgeORM added in v1.1.0

func (app *ChainlinkApplication) BridgeORM() bridges.ORM

func (*ChainlinkApplication) ConfigDump added in v1.6.0

func (app *ChainlinkApplication) ConfigDump(ctx context.Context) (string, error)

func (*ChainlinkApplication) DeleteJob added in v1.0.0

func (app *ChainlinkApplication) DeleteJob(ctx context.Context, jobID int32) error

func (*ChainlinkApplication) EVMORM added in v1.0.0

func (app *ChainlinkApplication) EVMORM() evmtypes.ORM

func (*ChainlinkApplication) GetChains added in v1.2.0

func (app *ChainlinkApplication) GetChains() Chains

GetChains returns Chains.

func (*ChainlinkApplication) GetConfig added in v0.10.11

func (app *ChainlinkApplication) GetConfig() config.GeneralConfig

func (*ChainlinkApplication) GetEventBroadcaster added in v1.1.0

func (app *ChainlinkApplication) GetEventBroadcaster() pg.EventBroadcaster

func (*ChainlinkApplication) GetExternalInitiatorManager added in v0.9.10

func (app *ChainlinkApplication) GetExternalInitiatorManager() webhook.ExternalInitiatorManager

func (*ChainlinkApplication) GetFeedsService added in v0.10.8

func (app *ChainlinkApplication) GetFeedsService() feeds.Service

func (*ChainlinkApplication) GetHealthChecker added in v0.10.8

func (app *ChainlinkApplication) GetHealthChecker() services.Checker

func (*ChainlinkApplication) GetKeyStore added in v0.10.8

func (app *ChainlinkApplication) GetKeyStore() keystore.Master

func (*ChainlinkApplication) GetLogger added in v0.10.6

func (app *ChainlinkApplication) GetLogger() logger.Logger

func (*ChainlinkApplication) GetSqlxDB added in v1.1.0

func (app *ChainlinkApplication) GetSqlxDB() *sqlx.DB

func (*ChainlinkApplication) GetWebAuthnConfiguration added in v1.1.0

func (app *ChainlinkApplication) GetWebAuthnConfiguration() sessions.WebAuthnConfiguration

Returns the configuration to use for creating and authenticating new WebAuthn credentials

func (*ChainlinkApplication) ID added in v1.1.0

func (app *ChainlinkApplication) ID() uuid.UUID

func (*ChainlinkApplication) JobORM added in v0.9.9

func (app *ChainlinkApplication) JobORM() job.ORM

func (*ChainlinkApplication) JobSpawner added in v0.10.8

func (app *ChainlinkApplication) JobSpawner() job.Spawner

func (*ChainlinkApplication) PipelineORM added in v0.10.8

func (app *ChainlinkApplication) PipelineORM() pipeline.ORM

func (*ChainlinkApplication) ReplayFromBlock added in v0.10.11

func (app *ChainlinkApplication) ReplayFromBlock(chainID *big.Int, number uint64, forceBroadcast bool) error

ReplayFromBlock implements the Application interface.

func (*ChainlinkApplication) ResumeJobV2 added in v0.10.10

func (app *ChainlinkApplication) ResumeJobV2(
	ctx context.Context,
	taskID uuid.UUID,
	result pipeline.Result,
) error

func (*ChainlinkApplication) RunJobV2 added in v0.9.6

func (app *ChainlinkApplication) RunJobV2(
	ctx context.Context,
	jobID int32,
	meta map[string]interface{},
) (int64, error)

Only used for local testing, not supported by the UI.

func (*ChainlinkApplication) RunWebhookJobV2 added in v0.10.8

func (app *ChainlinkApplication) RunWebhookJobV2(ctx context.Context, jobUUID uuid.UUID, requestBody string, meta pipeline.JSONSerializable) (int64, error)

func (*ChainlinkApplication) SecretGenerator added in v1.7.0

func (app *ChainlinkApplication) SecretGenerator() SecretGenerator

func (*ChainlinkApplication) SessionORM added in v1.1.0

func (app *ChainlinkApplication) SessionORM() sessions.ORM

func (*ChainlinkApplication) SetLogLevel added in v1.1.0

func (app *ChainlinkApplication) SetLogLevel(lvl zapcore.Level) error

func (*ChainlinkApplication) Start

func (app *ChainlinkApplication) Start(ctx context.Context) error

Start all necessary services. If successful, nil will be returned. Start sequence is aborted if the context gets cancelled.

func (*ChainlinkApplication) Stop

func (app *ChainlinkApplication) Stop() error

Stop allows the application to exit by halting schedules, closing logs, and closing the DB connection.

func (*ChainlinkApplication) StopIfStarted added in v0.9.9

func (app *ChainlinkApplication) StopIfStarted() error

func (*ChainlinkApplication) TxmORM added in v1.3.0

func (app *ChainlinkApplication) TxmORM() txmgr.ORM

func (*ChainlinkApplication) WakeSessionReaper

func (app *ChainlinkApplication) WakeSessionReaper()

WakeSessionReaper wakes up the reaper to do its reaping.

type Chains added in v1.2.0

type Chains struct {
	EVM      evm.ChainSet
	Solana   solana.ChainSet   // nil if disabled
	Terra    terra.ChainSet    // nil if disabled
	StarkNet starknet.ChainSet // nil if disabled
}

Chains holds a ChainSet for each type of chain.

type Config added in v1.6.0

type Config struct {
	config.Core

	EVM EVMConfigs `toml:",omitempty"`

	Solana SolanaConfigs `toml:",omitempty"`

	Terra TerraConfigs `toml:",omitempty"`
}

Config is the root type used for TOML configuration.

See docs at /docs/CONFIG.md generated via config.GenerateDocs from /internal/config/docs.toml

When adding a new field:

  • consider including a unit suffix with the field name
  • TOML is limited to int64/float64, so fields requiring greater range/precision must use non-standard types implementing encoding.TextMarshaler/TextUnmarshaler, like utils.Big and decimal.Decimal
  • std lib types that don't implement encoding.TextMarshaler/TextUnmarshaler (time.Duration, url.URL, big.Int) won't work as expected, and require wrapper types. See models.Duration, models.URL, utils.Big.

func (*Config) SetDefaults added in v1.8.0

func (c *Config) SetDefaults()

SetDefaults initializes unset fields with default values.

func (*Config) TOMLString added in v1.6.0

func (c *Config) TOMLString() (string, error)

TOMLString returns a pretty-printed TOML encoded string, with extra line breaks removed.

func (*Config) Validate added in v1.8.0

func (c *Config) Validate() error

type EVMConfig added in v1.6.0

type EVMConfig struct {
	ChainID *utils.Big
	Enabled *bool
	evmcfg.Chain
	Nodes EVMNodes
}

func (*EVMConfig) ValidateConfig added in v1.8.0

func (c *EVMConfig) ValidateConfig() (err error)

type EVMConfigs added in v1.8.0

type EVMConfigs []*EVMConfig

func (EVMConfigs) ValidateConfig added in v1.8.0

func (cs EVMConfigs) ValidateConfig() (err error)

type EVMNodes added in v1.8.0

type EVMNodes []*evmcfg.Node

func (EVMNodes) ValidateConfig added in v1.8.0

func (ns EVMNodes) ValidateConfig() (err error)

type FilePersistedSecretGenerator added in v1.7.0

type FilePersistedSecretGenerator struct{}

func (FilePersistedSecretGenerator) Generate added in v1.7.0

func (f FilePersistedSecretGenerator) Generate(rootDir string) ([]byte, error)

type SecretGenerator added in v1.7.0

type SecretGenerator interface {
	Generate(string) ([]byte, error)
}

SecretGenerator is the interface for objects that generate a secret used to sign or encrypt.

type Secrets added in v1.8.0

type Secrets struct {
	config.Secrets
}

func (*Secrets) SetOverrides added in v1.8.0

func (s *Secrets) SetOverrides(context *cli.Context) error

Use ENV vars or flags to override secrets

func (*Secrets) Validate added in v1.8.0

func (s *Secrets) Validate() error

type SolanaConfig added in v1.6.0

type SolanaConfig struct {
	ChainID *string
	Enabled *bool
	solcfg.Chain
	Nodes SolanaNodes
}

func (*SolanaConfig) ValidateConfig added in v1.8.0

func (c *SolanaConfig) ValidateConfig() (err error)

type SolanaConfigs added in v1.8.0

type SolanaConfigs []*SolanaConfig

func (SolanaConfigs) ValidateConfig added in v1.8.0

func (cs SolanaConfigs) ValidateConfig() (err error)

type SolanaNodes added in v1.8.0

type SolanaNodes []*solcfg.Node

func (SolanaNodes) ValidateConfig added in v1.8.0

func (ns SolanaNodes) ValidateConfig() (err error)

type TerraConfig added in v1.6.0

type TerraConfig struct {
	ChainID *string
	Enabled *bool
	tercfg.Chain
	Nodes TerraNodes
}

func (*TerraConfig) ValidateConfig added in v1.8.0

func (c *TerraConfig) ValidateConfig() (err error)

type TerraConfigs added in v1.8.0

type TerraConfigs []*TerraConfig

func (TerraConfigs) ValidateConfig added in v1.8.0

func (cs TerraConfigs) ValidateConfig() (err error)

type TerraNodes added in v1.8.0

type TerraNodes []*tercfg.Node

func (TerraNodes) ValidateConfig added in v1.8.0

func (ns TerraNodes) ValidateConfig() (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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