client

package
v1.1.20 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 19 Imported by: 6

README

Client

Contains code to interact with Chainlink nodes, and other HTTP services.

Documentation

Overview

Package client enables interaction with APIs of test components like the mockserver and Chainlink nodes

Index

Constants

View Source
const (
	QueryMemoryUsage          = `` /* 201-byte string literal not displayed */
	QueryAllCPUBusyPercentage = `100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[%s])) * 100)`
)

Query constants

Variables

View Source
var ErrNotFound = errors.New("unexpected response code, got 404")

ErrNotFound Error for not found

View Source
var ErrUnprocessableEntity = errors.New("unexpected response code, got 422")

ErrUnprocessableEntity Error for and unprocessable entity

View Source
var OneLINK = big.NewFloat(1e18)

OneLINK representation of a single LINK token

Functions

func ObservationSourceKeeperDefault

func ObservationSourceKeeperDefault() string

ObservationSourceKeeperDefault is a basic keeper default that checks and performs upkeep of the contract address

func ObservationSourceSpecBridge

func ObservationSourceSpecBridge(bta BridgeTypeAttributes) string

ObservationSourceSpecBridge creates a bridge task spec for json data

func ObservationSourceSpecHTTP

func ObservationSourceSpecHTTP(url string) string

ObservationSourceSpecHTTP creates a http GET task spec for json data

Types

type AdapterResponse

type AdapterResponse struct {
	Id    string        `json:"id"`
	Data  AdapterResult `json:"data"`
	Error interface{}   `json:"error"`
}

AdapterResponse represents a response from an adapter

type AdapterResult

type AdapterResult struct {
	Result int `json:"result"`
}

AdapterResult represents an int result for an adapter

type BasicHTTPClient

type BasicHTTPClient struct {
	BaseURL    string
	HttpClient *http.Client
	Cookies    []*http.Cookie
	Header     http.Header
}

BasicHTTPClient handles basic http sending logic and cookie handling

func NewBasicHTTPClient

func NewBasicHTTPClient(c *http.Client, baseURL string) *BasicHTTPClient

NewBasicHTTPClient returns new basic http client configured with an base URL

func (*BasicHTTPClient) Do

func (em *BasicHTTPClient) Do(
	method,
	endpoint string,
	body interface{},
	obj interface{},
	expectedStatusCode int,
) (*http.Response, error)

Do executes a method on an endpoint with an optional body and checks that an expected status code is returned

type BlockhashStoreJobSpec

type BlockhashStoreJobSpec struct {
	Name                  string `toml:"name"`
	CoordinatorV2Address  string `toml:"coordinatorV2Address"` // Address of the VRF Coordinator contract
	WaitBlocks            int    `toml:"waitBlocks"`
	LookbackBlocks        int    `toml:"lookbackBlocks"`
	BlockhashStoreAddress string `toml:"blockhashStoreAddress"`
	PollPeriod            string `toml:"pollPeriod"`
	RunTimeout            string `toml:"runTimeout"`
	EVMChainID            string `toml:"evmChainID"`
}

BlockhashStoreJobSpec represents a blockhashstore job

func (*BlockhashStoreJobSpec) String

func (b *BlockhashStoreJobSpec) String() (string, error)

String representation of the job

func (*BlockhashStoreJobSpec) Type

func (b *BlockhashStoreJobSpec) Type() string

Type returns the type of the job

type BridgeType

type BridgeType struct {
	Data BridgeTypeData `json:"data"`
}

BridgeType is the model that represents the bridge when read or created on a Chainlink node

type BridgeTypeAttributes

type BridgeTypeAttributes struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	RequestData string `json:"requestData,omitempty"`
}

BridgeTypeAttributes is the model that represents the bridge when read or created on a Chainlink node

type BridgeTypeData

type BridgeTypeData struct {
	Attributes BridgeTypeAttributes `json:"attributes"`
}

BridgeTypeData is the model that represents the bridge when read or created on a Chainlink node

type CSAKey

type CSAKey struct {
	Data CSAKeyData `json:"data"`
}

CSAKey is the model that represents the created CSA key when created

type CSAKeyAttributes

type CSAKeyAttributes struct {
	PublicKey string `json:"publicKey"`
	Version   int    `json:"version"`
}

CSAKeyAttributes is the model that represents the attributes of a CSA Key

type CSAKeyData

type CSAKeyData struct {
	Type       string           `json:"type"`
	ID         string           `json:"id"`
	Attributes CSAKeyAttributes `json:"attributes"`
}

CSAKeyData is the model that represents the created CSA key when read

type CSAKeys

type CSAKeys struct {
	Data []CSAKeyData `json:"data"`
}

CSAKeys is the model that represents the created CSA keys when read

type Chainlink interface {
	URL() string
	CreateJob(spec JobSpec) (*Job, error)
	CreateJobRaw(spec string) (*Job, error)
	ReadJobs() (*ResponseSlice, error)
	ReadJob(id string) (*Response, error)
	DeleteJob(id string) error

	CreateSpec(spec string) (*Spec, error)
	ReadSpec(id string) (*Response, error)
	DeleteSpec(id string) error

	CreateBridge(bta *BridgeTypeAttributes) error
	ReadBridge(name string) (*BridgeType, error)
	DeleteBridge(name string) error

	ReadRunsByJob(jobID string) (*JobRunsResponse, error)

	CreateOCRKey() (*OCRKey, error)
	ReadOCRKeys() (*OCRKeys, error)
	DeleteOCRKey(id string) error

	CreateOCR2Key(chain string) (*OCR2Key, error)
	ReadOCR2Keys() (*OCR2Keys, error)
	DeleteOCR2Key(id string) error

	CreateP2PKey() (*P2PKey, error)
	ReadP2PKeys() (*P2PKeys, error)
	DeleteP2PKey(id int) error

	ReadETHKeys() (*ETHKeys, error)
	ReadPrimaryETHKey() (*ETHKeyData, error)
	PrimaryEthAddress() (string, error)
	UpdateEthKeyMaxGasPriceGWei(keyId string, gwei int) (*ETHKey, error)

	CreateTxKey(chain string) (*TxKey, error)
	ReadTxKeys(chain string) (*TxKeys, error)
	DeleteTxKey(chain, id string) error

	ReadTransactionAttempts() (*TransactionsData, error)
	ReadTransactions() (*TransactionsData, error)
	SendNativeToken(amount *big.Int, fromAddress, toAddress string) (TransactionData, error)

	CreateVRFKey() (*VRFKey, error)
	ReadVRFKeys() (*VRFKeys, error)

	CreateCSAKey() (*CSAKey, error)
	ReadCSAKeys() (*CSAKeys, error)

	CreateEI(eia *EIAttributes) (*EIKeyCreate, error)
	ReadEIs() (*EIKeys, error)
	DeleteEI(name string) error

	CreateTerraChain(node *TerraChainAttributes) (*TerraChainCreate, error)
	CreateTerraNode(node *TerraNodeAttributes) (*TerraNodeCreate, error)

	CreateSolanaChain(node *SolanaChainAttributes) (*SolanaChainCreate, error)
	CreateSolanaNode(node *SolanaNodeAttributes) (*SolanaNodeCreate, error)

	RemoteIP() string
	SetSessionCookie() error

	SetPageSize(size int)

	// SetClient is used for testing
	SetClient(client *http.Client)
}

Chainlink interface that enables interactions with a chainlink node

func ConnectChainlinkNodes

func ConnectChainlinkNodes(e *environment.Environment) ([]Chainlink, error)

ConnectChainlinkNodes creates new chainlink clients

func ConnectChainlinkNodesByCharts

func ConnectChainlinkNodesByCharts(e *environment.Environment, charts []string) ([]Chainlink, error)

ConnectChainlinkNodesByCharts creates new chainlink clients by charts

func ConnectChainlinkNodesSoak

func ConnectChainlinkNodesSoak(e *environment.Environment) ([]Chainlink, error)

ConnectChainlinkNodesSoak assumes that the tests are being run from an internal soak test runner

func NewChainlink(c *ChainlinkConfig, httpClient *http.Client) (Chainlink, error)

NewChainlink creates a new chainlink model using a provided config

type ChainlinkConfig

type ChainlinkConfig struct {
	URL      string
	Email    string
	Password string
	RemoteIP string
}

ChainlinkConfig represents the variables needed to connect to a Chainlink node

type ContractInfoJSON

type ContractInfoJSON struct {
	ContractAddress string `json:"contractAddress"`
	ContractVersion int    `json:"contractVersion"`
	Path            string `json:"path"`
	Status          string `json:"status"`
}

ContractInfoJSON represents an element of the contracts array used to deliver configs to otpe

type CronJobSpec

type CronJobSpec struct {
	Schedule          string `toml:"schedule"`          // CRON job style schedule string
	ObservationSource string `toml:"observationSource"` // List of commands for the chainlink node
}

CronJobSpec represents a cron job spec

func (*CronJobSpec) String

func (c *CronJobSpec) String() (string, error)

String representation of the job

func (*CronJobSpec) Type

func (c *CronJobSpec) Type() string

Type is cron

type DecodeLogTaskRun

type DecodeLogTaskRun struct {
	Fee       int    `json:"fee"`
	JobID     []int  `json:"jobID"`
	KeyHash   []int  `json:"keyHash"`
	RequestID []byte `json:"requestID"`
	Sender    string `json:"sender"`
}

DecodeLogTaskRun is "ethabidecodelog" task run info, also used for "RequestID" tracing in perf tests

type DirectRequestJobSpec

type DirectRequestJobSpec struct {
	Name              string `toml:"name"`
	ContractAddress   string `toml:"contractAddress"`
	ExternalJobID     string `toml:"externalJobID"`
	ObservationSource string `toml:"observationSource"` // List of commands for the chainlink node
}

DirectRequestJobSpec represents a direct request spec

func (*DirectRequestJobSpec) String

func (d *DirectRequestJobSpec) String() (string, error)

String representation of the pipeline

func (*DirectRequestJobSpec) Type

func (d *DirectRequestJobSpec) Type() string

Type returns the type of the pipeline

type DirectRequestTxPipelineSpec

type DirectRequestTxPipelineSpec struct {
	BridgeTypeAttributes BridgeTypeAttributes
	DataPath             string
}

DirectRequestTxPipelineSpec oracle request with tx callback

func (*DirectRequestTxPipelineSpec) String

func (d *DirectRequestTxPipelineSpec) String() (string, error)

String representation of the pipeline

func (*DirectRequestTxPipelineSpec) Type

Type returns the type of the pipeline

type EIAttributes

type EIAttributes struct {
	Name              string `json:"name,omitempty"`
	URL               string `json:"url,omitempty"`
	IncomingAccessKey string `json:"incomingAccessKey,omitempty"`
	AccessKey         string `json:"accessKey,omitempty"`
	Secret            string `json:"incomingSecret,omitempty"`
	OutgoingToken     string `json:"outgoingToken,omitempty"`
	OutgoingSecret    string `json:"outgoingSecret,omitempty"`
}

EIAttributes is the model that represents the EI keys when created and read

type EIKey

type EIKey struct {
	Attributes EIAttributes `json:"attributes"`
}

EIKey is the model that represents the EI configs when read

type EIKeyCreate

type EIKeyCreate struct {
	Data EIKey `json:"data"`
}

EIKeyCreate is the model that represents the EI config when created

type EIKeys

type EIKeys struct {
	Data []EIKey `json:"data"`
}

EIKeys is the model that represents the EI configs when read

type EIServiceConfig

type EIServiceConfig struct {
	URL string
}

EIServiceConfig represents External Initiator service config

type ETHKey

type ETHKey struct {
	Data ETHKeyData `json:"data"`
}

ETHKey is the model that represents the created ETH keys when read

type ETHKeyAttributes

type ETHKeyAttributes struct {
	Address    string `json:"address"`
	ETHBalance string `json:"ethBalance"`
	ChainID    string `json:"evmChainID"`
}

ETHKeyAttributes is the model that represents the created ETH keys when read

type ETHKeyData

type ETHKeyData struct {
	Attributes ETHKeyAttributes `json:"attributes"`
}

ETHKeyData is the model that represents the created ETH keys when read

type ETHKeys

type ETHKeys struct {
	Data []ETHKeyData `json:"data"`
}

ETHKeys is the model that represents the created ETH keys when read

type ExplorerClient

type ExplorerClient struct {
	*BasicHTTPClient
	Config *ExplorerConfig
}

ExplorerClient is used to call Explorer API endpoints

func NewExplorerClient

func NewExplorerClient(cfg *ExplorerConfig) *ExplorerClient

NewExplorerClient creates a new explorer mock client

func (*ExplorerClient) PostAdminNodes

func (em *ExplorerClient) PostAdminNodes(nodeName string) (NodeAccessKeys, error)

PostAdminNodes is used to exercise the POST /api/v1/admin/nodes endpoint This endpoint is used to create access keys for nodes

type ExplorerConfig

type ExplorerConfig struct {
	URL           string
	AdminUsername string
	AdminPassword string
}

ExplorerConfig holds config information for ExplorerClient

type FluxMonitorJobSpec

type FluxMonitorJobSpec struct {
	Name              string        `toml:"name"`
	ContractAddress   string        `toml:"contractAddress"`   // Address of the Flux Monitor script
	Precision         int           `toml:"precision"`         // Optional
	Threshold         float32       `toml:"threshold"`         // Optional
	AbsoluteThreshold float32       `toml:"absoluteThreshold"` // Optional
	IdleTimerPeriod   time.Duration `toml:"idleTimerPeriod"`   // Optional
	IdleTimerDisabled bool          `toml:"idleTimerDisabled"` // Optional
	PollTimerPeriod   time.Duration `toml:"pollTimerPeriod"`   // Optional
	PollTimerDisabled bool          `toml:"pollTimerDisabled"` // Optional
	MaxTaskDuration   time.Duration `toml:"maxTaskDuration"`   // Optional
	ObservationSource string        `toml:"observationSource"` // List of commands for the chainlink node
}

FluxMonitorJobSpec represents a flux monitor spec

func (*FluxMonitorJobSpec) String

func (f *FluxMonitorJobSpec) String() (string, error)

String representation of the job

func (*FluxMonitorJobSpec) Type

func (f *FluxMonitorJobSpec) Type() string

Type returns the type of the job

type HttpInitializer

type HttpInitializer struct {
	Id       string       `json:"id"`
	Request  HttpRequest  `json:"httpRequest"`
	Response HttpResponse `json:"httpResponse"`
}

HttpInitializer represents an element of the initializer array used in the mockserver initializer

type HttpRequest

type HttpRequest struct {
	Path string `json:"path"`
}

HttpRequest represents the httpRequest json object used in the mockserver initializer

type HttpResponse

type HttpResponse struct {
	Body interface{} `json:"body"`
}

HttpResponse represents the httpResponse json object used in the mockserver initializer

type Job

type Job struct {
	Data JobData `json:"data"`
}

Job contains the job data for a given job

type JobData

type JobData struct {
	ID string `json:"id"`
}

JobData contains the ID for a given job

type JobForm

type JobForm struct {
	TOML string `json:"toml"`
}

JobForm is the form used when creating a v2 job spec, containing the TOML of the v2 job

type JobRunsResponse

type JobRunsResponse struct {
	Data []RunsResponseData `json:"data"`
	Meta RunsMetaResponse   `json:"meta"`
}

JobRunsResponse job runs

type JobSpec

type JobSpec interface {
	Type() string
	// String Returns TOML representation of the job
	String() (string, error)
}

JobSpec represents the different possible job types that chainlink nodes can handle

type KafkaRestClient

type KafkaRestClient struct {
	*BasicHTTPClient
	Config *KafkaRestConfig
}

KafkaRestClient kafka-rest client

func NewKafkaRestClient

func NewKafkaRestClient(cfg *KafkaRestConfig) *KafkaRestClient

NewKafkaRestClient creates a new KafkaRestClient

func (*KafkaRestClient) GetTopics

func (krc *KafkaRestClient) GetTopics() ([]string, error)

GetTopics Get a list of Kafka topics.

type KafkaRestConfig

type KafkaRestConfig struct {
	URL string
}

KafkaRestConfig holds config information for KafkaRestClient

type KeeperJobSpec

type KeeperJobSpec struct {
	Name                     string `toml:"name"`
	ContractAddress          string `toml:"contractAddress"`
	FromAddress              string `toml:"fromAddress"` // Hex representation of the from address
	MinIncomingConfirmations int    `toml:"minIncomingConfirmations"`
	ObservationSource        string `toml:"observationSource"`
}

KeeperJobSpec represents a V2 keeper spec

func (*KeeperJobSpec) String

func (k *KeeperJobSpec) String() (string, error)

String representation of the job

func (*KeeperJobSpec) Type

func (k *KeeperJobSpec) Type() string

Type returns the type of the job

type MockserverClient

type MockserverClient struct {
	*BasicHTTPClient
	Config *MockserverConfig
}

MockserverClient mockserver client

func ConnectMockServer

func ConnectMockServer(e *environment.Environment) (*MockserverClient, error)

ConnectMockServer creates a connection to a deployed mockserver in the environment

func ConnectMockServerSoak

func ConnectMockServerSoak(e *environment.Environment) (*MockserverClient, error)

ConnectMockServerSoak creates a connection to a deployed mockserver, assuming runner is in a soak test runner

func NewMockserverClient

func NewMockserverClient(cfg *MockserverConfig) *MockserverClient

NewMockserverClient returns a mockserver client

func (*MockserverClient) ClearExpectation

func (em *MockserverClient) ClearExpectation(body interface{}) error

ClearExpectation clears expectations

func (*MockserverClient) PutExpectations

func (em *MockserverClient) PutExpectations(body interface{}) error

PutExpectations sets the expectations (i.e. mocked responses)

func (*MockserverClient) SetValuePath

func (em *MockserverClient) SetValuePath(path string, v int) error

SetValuePath sets an int for a path

type MockserverConfig

type MockserverConfig struct {
	LocalURL   string
	ClusterURL string
}

MockserverConfig holds config information for MockserverClient

type Name

type Name struct {
	Name string `json:"name"`
}

Name is the body of the request

type NodeAccessKeys

type NodeAccessKeys struct {
	ID        string `mapstructure:"id" yaml:"id"`
	AccessKey string `mapstructure:"accessKey" yaml:"accessKey"`
	Secret    string `mapstructure:"secret" yaml:"secret"`
}

NodeAccessKeys is the body of the response

type NodeInfoJSON

type NodeInfoJSON struct {
	ID          string   `json:"id"`
	NodeAddress []string `json:"nodeAddress"`
}

NodeInfoJSON represents an element of the nodes array used to deliver configs to otpe

type OCR2Key

type OCR2Key struct {
	Data OCR2KeyData `json:"data"`
}

OCR2Key is the model that represents the created OCR2 keys when read

type OCR2KeyAttributes

type OCR2KeyAttributes struct {
	ChainType         string `json:"chainType"`
	ConfigPublicKey   string `json:"configPublicKey"`
	OffChainPublicKey string `json:"offchainPublicKey"`
	OnChainPublicKey  string `json:"onchainPublicKey"`
}

OCR2KeyAttributes is the model that represents the created OCR2 keys when read

type OCR2KeyData

type OCR2KeyData struct {
	Type       string            `json:"type"`
	Attributes OCR2KeyAttributes `json:"attributes"`
	ID         string            `json:"id"`
}

OCR2KeyData is the model that represents the created OCR2 keys when read

type OCR2Keys

type OCR2Keys struct {
	Data []OCR2KeyData `json:"data"`
}

OCR2Keys is the model that represents the created OCR2 keys when read

type OCR2TaskJobSpec

type OCR2TaskJobSpec struct {
	Name                     string            `toml:"name"`
	JobType                  string            `toml:"type"`
	ContractID               string            `toml:"contractID"`                             // Address of the OCR contract/account(s)
	Relay                    string            `toml:"relay"`                                  // Name of blockchain relay to use
	PluginType               string            `toml:"pluginType"`                             // Type of report plugin to use
	RelayConfig              map[string]string `toml:"relayConfig"`                            // Relay spec object in stringified form
	P2PPeerID                string            `toml:"p2pPeerID"`                              // This node's P2P ID
	P2PBootstrapPeers        []P2PData         `toml:"p2pBootstrapPeers"`                      // P2P ID of the bootstrap node
	OCRKeyBundleID           string            `toml:"ocrKeyBundleID"`                         // ID of this node's OCR key bundle
	MonitoringEndpoint       string            `toml:"monitoringEndpoint"`                     // Typically "chain.link:4321"
	TransmitterID            string            `toml:"transmitterID"`                          // ID of address this node will use to transmit
	BlockChainTimeout        time.Duration     `toml:"blockchainTimeout"`                      // Optional
	TrackerSubscribeInterval time.Duration     `toml:"contractConfigTrackerSubscribeInterval"` // Optional
	TrackerPollInterval      time.Duration     `toml:"contractConfigTrackerPollInterval"`      // Optional
	ContractConfirmations    int               `toml:"contractConfigConfirmations"`            // Optional
	ObservationSource        string            `toml:"observationSource"`                      // List of commands for the chainlink node
	JuelsPerFeeCoinSource    string            `toml:"juelsPerFeeCoinSource"`                  // List of commands to fetch JuelsPerFeeCoin value (used to calculate ocr payments)
}

OCR2TaskJobSpec represents an OCR2 job that is given to other nodes, meant to communicate with the bootstrap node, and provide their answers

func (*OCR2TaskJobSpec) String

func (o *OCR2TaskJobSpec) String() (string, error)

String representation of the job

func (*OCR2TaskJobSpec) Type

func (o *OCR2TaskJobSpec) Type() string

Type returns the type of the job

type OCRBootstrapJobSpec

type OCRBootstrapJobSpec struct {
	Name                     string        `toml:"name"`
	BlockChainTimeout        time.Duration `toml:"blockchainTimeout"`                      // Optional
	ContractConfirmations    int           `toml:"contractConfigConfirmations"`            // Optional
	TrackerPollInterval      time.Duration `toml:"contractConfigTrackerPollInterval"`      // Optional
	TrackerSubscribeInterval time.Duration `toml:"contractConfigTrackerSubscribeInterval"` // Optional
	ContractAddress          string        `toml:"contractAddress"`                        // Address of the OCR contract
	IsBootstrapPeer          bool          `toml:"isBootstrapPeer"`                        // Typically true
	P2PPeerID                string        `toml:"p2pPeerID"`                              // This node's P2P ID
}

OCRBootstrapJobSpec represents the spec for bootstrapping an OCR job, given to one node that then must be linked back to by others by OCRTaskJobSpecs

func (*OCRBootstrapJobSpec) String

func (o *OCRBootstrapJobSpec) String() (string, error)

String representation of the job

func (*OCRBootstrapJobSpec) Type

func (o *OCRBootstrapJobSpec) Type() string

Type returns the type of the job

type OCRKey

type OCRKey struct {
	Data OCRKeyData `json:"data"`
}

OCRKey is the model that represents the created OCR keys when read

type OCRKeyAttributes

type OCRKeyAttributes struct {
	ConfigPublicKey       string `json:"configPublicKey"`
	OffChainPublicKey     string `json:"offChainPublicKey"`
	OnChainSigningAddress string `json:"onChainSigningAddress"`
}

OCRKeyAttributes is the model that represents the created OCR keys when read

type OCRKeyData

type OCRKeyData struct {
	Attributes OCRKeyAttributes `json:"attributes"`
	ID         string           `json:"id"`
}

OCRKeyData is the model that represents the created OCR keys when read

type OCRKeys

type OCRKeys struct {
	Data []OCRKeyData `json:"data"`
}

OCRKeys is the model that represents the created OCR keys when read

type OCRTaskJobSpec

type OCRTaskJobSpec struct {
	Name                     string        `toml:"name"`
	BlockChainTimeout        time.Duration `toml:"blockchainTimeout"`                      // Optional
	ContractConfirmations    int           `toml:"contractConfigConfirmations"`            // Optional
	TrackerPollInterval      time.Duration `toml:"contractConfigTrackerPollInterval"`      // Optional
	TrackerSubscribeInterval time.Duration `toml:"contractConfigTrackerSubscribeInterval"` // Optional
	ContractAddress          string        `toml:"contractAddress"`                        // Address of the OCR contract
	P2PBootstrapPeers        []Chainlink   `toml:"p2pBootstrapPeers"`                      // P2P ID of the bootstrap node
	IsBootstrapPeer          bool          `toml:"isBootstrapPeer"`                        // Typically false
	P2PPeerID                string        `toml:"p2pPeerID"`                              // This node's P2P ID
	KeyBundleID              string        `toml:"keyBundleID"`                            // ID of this node's OCR key bundle
	MonitoringEndpoint       string        `toml:"monitoringEndpoint"`                     // Typically "chain.link:4321"
	TransmitterAddress       string        `toml:"transmitterAddress"`                     // ETH address this node will use to transmit its answer
	ObservationSource        string        `toml:"observationSource"`                      // List of commands for the chainlink node
}

OCRTaskJobSpec represents an OCR job that is given to other nodes, meant to communicate with the bootstrap node, and provide their answers

func (*OCRTaskJobSpec) String

func (o *OCRTaskJobSpec) String() (string, error)

String representation of the job

func (*OCRTaskJobSpec) Type

func (o *OCRTaskJobSpec) Type() string

Type returns the type of the job

type P2PData

type P2PData struct {
	RemoteIP   string
	RemotePort string
	PeerID     string
}

P2PData holds the remote ip and the peer id and port

type P2PKey

type P2PKey struct {
	Data P2PKeyData `json:"data"`
}

P2PKey is the model that represents the created P2P keys when read

type P2PKeyAttributes

type P2PKeyAttributes struct {
	ID        int    `json:"id"`
	PeerID    string `json:"peerId"`
	PublicKey string `json:"publicKey"`
}

P2PKeyAttributes is the model that represents the created P2P keys when read

type P2PKeyData

type P2PKeyData struct {
	Attributes P2PKeyAttributes `json:"attributes"`
}

P2PKeyData is the model that represents the created P2P keys when read

type P2PKeys

type P2PKeys struct {
	Data []P2PKeyData `json:"data"`
}

P2PKeys is the model that represents the created P2P keys when read

type PathSelector

type PathSelector struct {
	Path string `json:"path"`
}

PathSelector represents the json object used to find expectations by path

type PipelineSpec

type PipelineSpec struct {
	BridgeTypeAttributes BridgeTypeAttributes
	DataPath             string
}

PipelineSpec common API call pipeline

func (*PipelineSpec) String

func (d *PipelineSpec) String() (string, error)

String representation of the pipeline

func (*PipelineSpec) Type

func (d *PipelineSpec) Type() string

Type is common_pipeline

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
}

PostgresConfig postgres config for connection string

type PostgresConnector

type PostgresConnector struct {
	*sqlx.DB
	Cfg *PostgresConfig
}

PostgresConnector sqlx postgres connector

func ConnectChainlinkDBByCharts

func ConnectChainlinkDBByCharts(e *environment.Environment, charts []string) ([]*PostgresConnector, error)

ConnectChainlinkDBByCharts creates new chainlink DBs clients by charts

func ConnectChainlinkDBs

func ConnectChainlinkDBs(e *environment.Environment) ([]*PostgresConnector, error)

func NewPostgresConnector

func NewPostgresConnector(cfg *PostgresConfig) (*PostgresConnector, error)

NewPostgresConnector creates new sqlx postgres connector

type Prometheus

type Prometheus struct {
	v1.API
}

Prometheus ease of use for v1.API

func NewPrometheusClient

func NewPrometheusClient(url string) (*Prometheus, error)

NewPrometheusClient returns a prometheus client

func (*Prometheus) CPUBusyPercentage

func (p *Prometheus) CPUBusyPercentage() (float64, error)

CPUBusyPercentage host CPU busy percentage

func (*Prometheus) GetAlerts

func (p *Prometheus) GetAlerts() (v1.AlertsResult, error)

GetAlerts returns all firing alerts

func (*Prometheus) GetQuery

func (p *Prometheus) GetQuery(query string) (model.Value, error)

GetQuery returns the result of applying a PromQL query

func (*Prometheus) MemoryUsage

func (p *Prometheus) MemoryUsage() (float64, error)

MemoryUsage total memory used by interval

func (*Prometheus) ResourcesSummary

func (p *Prometheus) ResourcesSummary() (float64, float64, error)

ResourcesSummary returns a summary of memory and cpu used

type ResourcesSummary

type ResourcesSummary struct {
	MemoryUsage   float64
	CPUPercentage float64
}

ResourcesSummary Data for memory and cpu usage

type Response

type Response struct {
	Data map[string]interface{}
}

Response is the generic model that can be used for all Chainlink API responses

type ResponseSlice

type ResponseSlice struct {
	Data []map[string]interface{}
}

ResponseSlice is the generic model that can be used for all Chainlink API responses that are an slice

type RunInputs

type RunInputs struct {
	Parse int `json:"parse"`
}

RunInputs run inputs (value)

type RunsAttributesResponse

type RunsAttributesResponse struct {
	Meta       interface{}   `json:"meta"`
	Errors     []interface{} `json:"errors"`
	Inputs     RunInputs     `json:"inputs"`
	TaskRuns   []TaskRun     `json:"taskRuns"`
	CreatedAt  time.Time     `json:"createdAt"`
	FinishedAt time.Time     `json:"finishedAt"`
}

RunsAttributesResponse runs attributes

type RunsMetaResponse

type RunsMetaResponse struct {
	Count int `json:"count"`
}

RunsMetaResponse runs meta

type RunsResponseData

type RunsResponseData struct {
	Type       string                 `json:"type"`
	ID         string                 `json:"id"`
	Attributes RunsAttributesResponse `json:"attributes"`
}

RunsResponseData runs response data

type SendEtherRequest

type SendEtherRequest struct {
	DestinationAddress string `json:"address"`
	FromAddress        string `json:"from"`
	Amount             string `json:"amount"`
	EVMChainID         int    `json:"evmChainID,omitempty"`
	AllowHigherAmounts bool   `json:"allowHigherAmounts"`
}

type Session

type Session struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

Session is the form structure used for authenticating

type SingleTransactionDataWrapper

type SingleTransactionDataWrapper struct {
	Data TransactionData `json:"data"`
}

type SolanaChain

type SolanaChain struct {
	Attributes SolanaChainAttributes `json:"attributes"`
}

SolanaChain is the model that represents the solana chain when read

type SolanaChainAttributes

type SolanaChainAttributes struct {
	ChainID string            `json:"chainID"`
	Config  SolanaChainConfig `json:"config"`
}

SolanaChainAttributes is the model that represents the solana chain

type SolanaChainConfig

type SolanaChainConfig struct {
	BlockRate           null.String
	ConfirmPollPeriod   null.String
	OCR2CachePollPeriod null.String
	OCR2CacheTTL        null.String
	TxTimeout           null.String
	SkipPreflight       null.Bool
	Commitment          null.String
}

type SolanaChainCreate

type SolanaChainCreate struct {
	Data SolanaChain `json:"data"`
}

SolanaChainCreate is the model that represents the solana chain when created

type SolanaNode

type SolanaNode struct {
	Attributes SolanaNodeAttributes `json:"attributes"`
}

SolanaNode is the model that represents the solana node when read

type SolanaNodeAttributes

type SolanaNodeAttributes struct {
	Name          string `json:"name"`
	SolanaChainID string `json:"solanaChainId" db:"solana_chain_id"`
	SolanaURL     string `json:"solanaURL" db:"solana_url"`
}

SolanaNodeAttributes is the model that represents the solana noded

type SolanaNodeCreate

type SolanaNodeCreate struct {
	Data SolanaNode `json:"data"`
}

SolanaNodeCreate is the model that represents the solana node when created

type Spec

type Spec struct {
	Data SpecData `json:"data"`
}

Spec represents a job specification that contains information about the job spec

type SpecData

type SpecData struct {
	ID string `json:"id"`
}

SpecData contains the ID of the job spec

type SpecForm

type SpecForm struct {
	TOML string `json:"toml"`
}

SpecForm is the form used when creating a v2 job spec, containing the TOML of the v2 job

type TaskRun

type TaskRun struct {
	Type       string      `json:"type"`
	CreatedAt  time.Time   `json:"createdAt"`
	FinishedAt time.Time   `json:"finishedAt"`
	Output     string      `json:"output"`
	Error      interface{} `json:"error"`
	DotID      string      `json:"dotId"`
}

TaskRun is pipeline task run info

type TerraChain

type TerraChain struct {
	Attributes TerraChainAttributes `json:"attributes"`
}

TerraChain is the model that represents the terra chain when read

type TerraChainAttributes

type TerraChainAttributes struct {
	ChainID string           `json:"chainID"`
	Config  TerraChainConfig `json:"config"`
	FCDURL  string           `json:"fcdURL" db:"fcd_url"`
}

TerraChainAttributes is the model that represents the terra chain

type TerraChainConfig

type TerraChainConfig struct {
	BlockRate             null.String
	BlocksUntilTxTimeout  null.Int
	ConfirmPollPeriod     null.String
	FallbackGasPriceULuna null.String
	GasLimitMultiplier    null.Float
	MaxMsgsPerBatch       null.Int
}

type TerraChainCreate

type TerraChainCreate struct {
	Data TerraChain `json:"data"`
}

TerraChainCreate is the model that represents the terra chain when created

type TerraNode

type TerraNode struct {
	Attributes TerraNodeAttributes `json:"attributes"`
}

TerraNode is the model that represents the terra node when read

type TerraNodeAttributes

type TerraNodeAttributes struct {
	Name          string `json:"name"`
	TerraChainID  string `json:"terraChainId"`
	TendermintURL string `json:"tendermintURL" db:"tendermint_url"`
}

TerraNodeAttributes is the model that represents the terra noded

type TerraNodeCreate

type TerraNodeCreate struct {
	Data TerraNode `json:"data"`
}

TerraNodeCreate is the model that represents the terra node when created

type TransactionAttributes

type TransactionAttributes struct {
	State    string `json:"state"`
	Data     string `json:"data"`
	From     string `json:"from"`
	To       string `json:"to"`
	Value    string `json:"value"`
	ChainID  string `json:"evmChainID"`
	GasLimit string `json:"gasLimit"`
	GasPrice string `json:"gasPrice"`
	Hash     string `json:"hash"`
	RawHex   string `json:"rawHex"`
	Nonce    string `json:"nonce"`
	SentAt   string `json:"sentAt"`
}

type TransactionData

type TransactionData struct {
	Type       string                `json:"type"`
	ID         string                `json:"id"`
	Attributes TransactionAttributes `json:"attributes"`
}

type TransactionsData

type TransactionsData struct {
	Data []TransactionData    `json:"data"`
	Meta TransactionsMetaData `json:"meta"`
}

type TransactionsMetaData

type TransactionsMetaData struct {
	Count int `json:"count"`
}

type TxKey

type TxKey struct {
	Data TxKeyData `json:"data"`
}

TxKey is the model that represents the created keys when read

type TxKeyAttributes

type TxKeyAttributes struct {
	PublicKey string `json:"publicKey"`
}

TxKeyAttributes is the model that represents the created keys when read

type TxKeyData

type TxKeyData struct {
	Type       string          `json:"type"`
	ID         string          `json:"id"`
	Attributes TxKeyAttributes `json:"attributes"`
}

TxKeyData is the model that represents the created keys when read

type TxKeys

type TxKeys struct {
	Data []TxKeyData `json:"data"`
}

TxKeys is the model that represents the created keys when read

type VRFJobSpec

type VRFJobSpec struct {
	Name                     string `toml:"name"`
	CoordinatorAddress       string `toml:"coordinatorAddress"` // Address of the VRF Coordinator contract
	PublicKey                string `toml:"publicKey"`          // Public key of the proving key
	ExternalJobID            string `toml:"externalJobID"`
	ObservationSource        string `toml:"observationSource"` // List of commands for the chainlink node
	MinIncomingConfirmations int    `toml:"minIncomingConfirmations"`
}

VRFJobSpec represents a VRF job

func (*VRFJobSpec) String

func (v *VRFJobSpec) String() (string, error)

String representation of the job

func (*VRFJobSpec) Type

func (v *VRFJobSpec) Type() string

Type returns the type of the job

type VRFKey

type VRFKey struct {
	Data VRFKeyData `json:"data"`
}

VRFKey is the model that represents the created VRF key when read

type VRFKeyAttributes

type VRFKeyAttributes struct {
	Compressed   string      `json:"compressed"`
	Uncompressed string      `json:"uncompressed"`
	Hash         string      `json:"hash"`
	CreatedAt    time.Time   `json:"createdAt"`
	UpdatedAt    time.Time   `json:"updatedAt"`
	DeletedAt    interface{} `json:"deletedAt"`
}

VRFKeyAttributes is the model that represents the created VRF key attributes when read

type VRFKeyData

type VRFKeyData struct {
	Type       string           `json:"type"`
	ID         string           `json:"id"`
	Attributes VRFKeyAttributes `json:"attributes"`
}

VRFKeyData is the model that represents the created VRF key's data when read

type VRFKeys

type VRFKeys struct {
	Data []VRFKey `json:"data"`
}

VRFKeys is the model that represents the created VRF keys when read

type VRFTxPipelineSpec

type VRFTxPipelineSpec struct {
	Address string
}

VRFTxPipelineSpec VRF request with tx callback

func (*VRFTxPipelineSpec) String

func (d *VRFTxPipelineSpec) String() (string, error)

String representation of the pipeline

func (*VRFTxPipelineSpec) Type

func (d *VRFTxPipelineSpec) Type() string

Type returns the type of the pipeline

type VRFV2JobSpec

type VRFV2JobSpec struct {
	Name                     string        `toml:"name"`
	CoordinatorAddress       string        `toml:"coordinatorAddress"` // Address of the VRF Coordinator contract
	PublicKey                string        `toml:"publicKey"`          // Public key of the proving key
	ExternalJobID            string        `toml:"externalJobID"`
	ObservationSource        string        `toml:"observationSource"` // List of commands for the chainlink node
	MinIncomingConfirmations int           `toml:"minIncomingConfirmations"`
	FromAddress              string        `toml:"fromAddress"`
	EVMChainID               string        `toml:"evmChainID"`
	BatchFulfillmentEnabled  bool          `toml:"batchFulfillmentEnabled"`
	BackOffInitialDelay      time.Duration `toml:"backOffInitialDelay"`
	BackOffMaxDelay          time.Duration `toml:"backOffMaxDelay"`
}

VRFV2JobSpec represents a VRFV2 job

func (*VRFV2JobSpec) String

func (v *VRFV2JobSpec) String() (string, error)

String representation of the job

func (*VRFV2JobSpec) Type

func (v *VRFV2JobSpec) Type() string

Type returns the type of the job

type VRFV2TxPipelineSpec

type VRFV2TxPipelineSpec struct {
	Address string
}

VRFV2TxPipelineSpec VRFv2 request with tx callback

func (*VRFV2TxPipelineSpec) String

func (d *VRFV2TxPipelineSpec) String() (string, error)

String representation of the pipeline

func (*VRFV2TxPipelineSpec) Type

func (d *VRFV2TxPipelineSpec) Type() string

Type returns the type of the pipeline

type WebhookJobSpec

type WebhookJobSpec struct {
	Name              string `toml:"name"`
	Initiator         string `toml:"initiator"`         // External initiator name
	InitiatorSpec     string `toml:"initiatorSpec"`     // External initiator spec object in stringified form
	ObservationSource string `toml:"observationSource"` // List of commands for the chainlink node
}

WebhookJobSpec reprsents a webhook job

func (*WebhookJobSpec) String

func (w *WebhookJobSpec) String() (string, error)

String representation of the job

func (*WebhookJobSpec) Type

func (w *WebhookJobSpec) Type() string

Type returns the type of the job

Jump to

Keyboard shortcuts

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