client

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 35 Imported by: 4

README

Client

Contains code to interact with different blockchains, as well as chainlink nodes.

Documentation

Overview

Package client handles connections between chainlink nodes and different blockchain networks

Index

Constants

View Source
const (
	SimulatedEthNetwork    = "eth_simulated"
	LiveEthTestNetwork     = "eth_testnet"
	NetworkGethPerformance = "ethereum_geth_performance"
)

Commonly used blockchain network types

View Source
const (
	// GWei one giga-wei used for gas calculations
	GWei = 1e9
	// ETH one eth in wei
	ETH = 1e18
)
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 (
	// OneGWei represents 1 GWei
	OneGWei = big.NewFloat(1e9)
	// OneEth represents 1 Ethereum
	OneEth = big.NewFloat(1e18)
)
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 LiveEthTestnetURLs added in v1.0.27

func LiveEthTestnetURLs(e *environment.Environment) ([]*url.URL, error)

LiveEthTestnetURLs indicates that there are no urls to fetch, except from the network config

func ObservationSourceKeeperDefault added in v0.0.32

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

func SimulatedEthereumURLs added in v1.0.27

func SimulatedEthereumURLs(e *environment.Environment) ([]*url.URL, error)

SimulatedEthereumURLs returns the websocket URLs for a simulated geth network

func SimulatedSoakEthereumURLs added in v1.0.53

func SimulatedSoakEthereumURLs(e *environment.Environment) ([]*url.URL, error)

SimulatedEthereumURLs returns the websocket URLs for a simulated geth network

func UnmarshalNetworkConfig added in v0.0.25

func UnmarshalNetworkConfig(config map[string]interface{}, obj interface{}) error

UnmarshalNetworkConfig is a generic function to unmarshal a yaml map into a given object

Types

type AdapterResponse added in v0.0.5

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

AdapterResponse represents a response from an adapter

type AdapterResult added in v0.0.5

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 added in v0.0.44

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 BlockchainClient

type BlockchainClient interface {
	ContractsDeployed() bool
	LoadWallets(ns interface{}) error
	SetWallet(num int) error
	GetDefaultWallet() *EthereumWallet

	EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error)
	EstimateTransactionGasCost() (*big.Int, error)

	Get() interface{}
	GetNetworkName() string
	GetNetworkType() string
	GetChainID() int64
	SwitchNode(node int) error
	GetClients() []BlockchainClient
	HeaderHashByNumber(ctx context.Context, bn *big.Int) (string, error)
	BlockNumber(ctx context.Context) (uint64, error)
	HeaderTimestampByNumber(ctx context.Context, bn *big.Int) (uint64, error)
	Fund(toAddress string, amount *big.Float) error
	GasStats() *GasStats
	ParallelTransactions(enabled bool)
	Close() error

	AddHeaderEventSubscription(key string, subscriber HeaderEventSubscription)
	DeleteHeaderEventSubscription(key string)
	WaitForEvents() error
}

BlockchainClient is the interface that wraps a given client implementation for a blockchain, to allow for switching of network types within the test suite BlockchainClient can be connected to a single or multiple nodes,

func NewEthereumMultiNodeClient added in v0.0.25

func NewEthereumMultiNodeClient(
	_ string,
	networkConfig map[string]interface{},
	urls []*url.URL,
) (BlockchainClient, error)

NewEthereumMultiNodeClient returns an instantiated instance of all Ethereum client connected to all nodes

type BlockchainClientURLFn added in v0.0.25

type BlockchainClientURLFn func(e *environment.Environment) ([]*url.URL, error)

BlockchainClientURLFn are used to be able to return a list of URLs from the environment to connect

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 CCIPBootstrapJobSpec added in v1.1.17

type CCIPBootstrapJobSpec struct {
	Name                    string        `toml:"name"`
	ContractID              string        `toml:"contractID"`
	ChainID                 int           `toml:"chainID"`
	ContractTrackerInterval time.Duration `toml:"contractTrackerInterval"`
}

func (CCIPBootstrapJobSpec) String added in v1.1.17

func (C CCIPBootstrapJobSpec) String() (string, error)

func (CCIPBootstrapJobSpec) Type added in v1.1.17

func (C CCIPBootstrapJobSpec) Type() string

type CCIPExecJobSpec added in v1.1.17

type CCIPExecJobSpec struct {
	Name              string    `toml:"name"`
	ContractID        string    `toml:"contractID"`
	ChainID           int       `toml:"chainID"`
	SourceChainID     int       `toml:"sourceChainID"`
	DestChainID       int       `toml:"destChainID"`
	OnRampID          string    `toml:"onRampID"`
	OffRampID         string    `toml:"offRampID"`
	OCRKeyBundleID    string    `toml:"OCRKeyBundleID"`
	TransmitterID     string    `toml:"TransmitterID"`
	P2PBootstrapPeers []P2PData `toml:"P2PBootstrapPeers"`
}

func (CCIPExecJobSpec) String added in v1.1.17

func (C CCIPExecJobSpec) String() (string, error)

func (CCIPExecJobSpec) Type added in v1.1.17

func (C CCIPExecJobSpec) Type() string

type CCIPRelayJobSpec added in v1.1.17

type CCIPRelayJobSpec struct {
	Name              string    `toml:"name"`
	ContractID        string    `toml:"contractID"`
	ChainID           int       `toml:"chainID"`
	SourceChainID     int       `toml:"sourceChainID"`
	DestChainID       int       `toml:"destChainID"`
	OnRampID          string    `toml:"onRampID"`
	OCRKeyBundleID    string    `toml:"OCRKeyBundleID"`
	TransmitterID     string    `toml:"TransmitterID"`
	P2PBootstrapPeers []P2PData `toml:"P2PBootstrapPeers"`
}

func (CCIPRelayJobSpec) String added in v1.1.17

func (C CCIPRelayJobSpec) String() (string, error)

func (CCIPRelayJobSpec) Type added in v1.1.17

func (C CCIPRelayJobSpec) Type() string

type CSAKey added in v1.0.40

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

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

type CSAKeyAttributes added in v1.0.40

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 added in v1.0.40

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 added in v1.0.40

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

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

type ChainCfg added in v1.1.15

type ChainCfg struct {
	BlockHistoryEstimatorBlockDelay                null.Int
	BlockHistoryEstimatorBlockHistorySize          null.Int
	BlockHistoryEstimatorEIP1559FeeCapBufferBlocks null.Int
	ChainType                                      null.String
	EthTxReaperThreshold                           *models.Duration
	EthTxResendAfterThreshold                      *models.Duration
	EvmEIP1559DynamicFees                          null.Bool
	EvmFinalityDepth                               null.Int
	EvmGasBumpPercent                              null.Int
	EvmGasBumpTxDepth                              null.Int
	EvmGasBumpWei                                  *utils.Big
	EvmGasFeeCapDefault                            *utils.Big
	EvmGasLimitDefault                             null.Int
	EvmGasLimitMultiplier                          null.Float
	EvmGasPriceDefault                             *utils.Big
	EvmGasTipCapDefault                            *utils.Big
	EvmGasTipCapMinimum                            *utils.Big
	EvmHeadTrackerHistoryDepth                     null.Int
	EvmHeadTrackerMaxBufferSize                    null.Int
	EvmHeadTrackerSamplingInterval                 *models.Duration
	EvmLogBackfillBatchSize                        null.Int
	EvmLogPollInterval                             *models.Duration
	EvmMaxGasPriceWei                              *utils.Big
	EvmNonceAutoSync                               null.Bool
	EvmUseForwarders                               null.Bool
	EvmRPCDefaultBatchSize                         null.Int
	FlagsContractAddress                           null.String
	GasEstimatorMode                               null.String
	KeySpecific                                    map[string]ChainCfg
	LinkContractAddress                            null.String
	MinIncomingConfirmations                       null.Int
	MinRequiredOutgoingConfirmations               null.Int
	MinimumContractPayment                         *assets.Link
	OCRObservationTimeout                          *models.Duration
	NodeNoNewHeadsThreshold                        *models.Duration
}
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)

	CreateTxKey(chain string, chainID int) (*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

	CreateEVMChain(chain CreateEVMChainRequest) error
	UpdateEVMChain(chain UpdateEVMChainRequest) error
	CreateEVMNode(node NewEVMNode) 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 added in v0.0.44

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

ConnectChainlinkNodes creates new chainlink clients

func ConnectChainlinkNodesByCharts added in v0.0.44

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

ConnectChainlinkNodesByCharts creates new chainlink clients by charts

func ConnectChainlinkNodesSoak added in v1.0.53

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 ContractDeployer

type ContractDeployer func(auth *bind.TransactOpts, backend bind.ContractBackend) (
	common.Address,
	*types.Transaction,
	interface{},
	error,
)

ContractDeployer acts as a go-between function for general contract deployment

type ContractInfoJSON added in v0.0.5

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 CreateEVMChainRequest added in v1.1.15

type CreateEVMChainRequest struct {
	ID     utils.Big `json:"chainID"`
	Config ChainCfg  `json:"config"`
}

CreateEVMChainRequest is a JSONAPI request for creating an EVM chain.

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 added in v0.0.7

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 added in v0.0.13

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 EVMNodeAttributes added in v1.1.15

type EVMNodeAttributes struct {
	Name       string `json:"name"`
	EVMChainID string `json:"evmChainId"`
	EVMURL     string `json:"evm_url" db:"evm_url"`
}

EVMNodeAttributes is the model that represents the EVM nodes

type EthereumClient

type EthereumClient struct {
	ID            int
	Client        *ethclient.Client
	NetworkConfig *config.ETHNetwork
	Wallets       []*EthereumWallet
	DefaultWallet *EthereumWallet
	BorrowNonces  bool
	NonceMu       *sync.Mutex
	Nonces        map[string]uint64
	// contains filtered or unexported fields
}

EthereumClient wraps the client and the BlockChain network to interact with an EVM based Blockchain

func NewEthereumClient

func NewEthereumClient(networkSettings *config.ETHNetwork) (*EthereumClient, error)

NewEthereumClient returns an instantiated instance of the Ethereum client that has connected to the server

func (*EthereumClient) AddHeaderEventSubscription

func (e *EthereumClient) AddHeaderEventSubscription(key string, subscriber HeaderEventSubscription)

AddHeaderEventSubscription adds a new header subscriber within the client to receive new headers

func (*EthereumClient) BlockNumber

func (e *EthereumClient) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber gets latest block number

func (*EthereumClient) BorrowedNonces

func (e *EthereumClient) BorrowedNonces(n bool)

BorrowedNonces allows to handle nonces concurrently without requesting them every time

func (*EthereumClient) Close

func (e *EthereumClient) Close() error

Close tears down the current open Ethereum client

func (*EthereumClient) ContractsDeployed added in v1.0.31

func (e *EthereumClient) ContractsDeployed() bool

func (*EthereumClient) DeleteHeaderEventSubscription

func (e *EthereumClient) DeleteHeaderEventSubscription(key string)

DeleteHeaderEventSubscription removes a header subscriber from the map

func (*EthereumClient) DeployContract

func (e *EthereumClient) DeployContract(
	contractName string,
	deployer ContractDeployer,
) (*common.Address, *types.Transaction, interface{}, error)

DeployContract acts as a general contract deployment tool to an ethereum chain

func (*EthereumClient) EstimateCostForChainlinkOperations added in v0.0.25

func (e *EthereumClient) EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error)

EstimateCostForChainlinkOperations calculates required amount of ETH for amountOfOperations Chainlink operations based on the network's suggested gas price and the chainlink gas limit. This is fairly imperfect and should be used as only a rough, upper-end estimate instead of an exact calculation. See https://ethereum.org/en/developers/docs/gas/#post-london for info on how gas calculation works

func (*EthereumClient) EstimateTransactionGasCost added in v1.0.54

func (e *EthereumClient) EstimateTransactionGasCost() (*big.Int, error)

EstimateTransactionGasCost estimates the current total gas cost for a simple transaction

func (*EthereumClient) Fund

func (e *EthereumClient) Fund(
	toAddress string,
	amount *big.Float,
) error

Fund sends some ETH to an address

func (*EthereumClient) GasStats added in v0.0.5

func (e *EthereumClient) GasStats() *GasStats

GasStats gets gas stats instance

func (*EthereumClient) Get

func (e *EthereumClient) Get() interface{}

Get returns the underlying client type to be used generically across the framework for switching network types

func (*EthereumClient) GetChainID added in v0.0.31

func (e *EthereumClient) GetChainID() int64

GetChainID retrieves the ChainID of the network that the client interacts with

func (*EthereumClient) GetClients added in v0.0.5

func (e *EthereumClient) GetClients() []BlockchainClient

GetClients not used, only applicable to EthereumMultinodeClient

func (*EthereumClient) GetDefaultWallet added in v1.0.48

func (e *EthereumClient) GetDefaultWallet() *EthereumWallet

DefaultWallet returns the default wallet for the network

func (*EthereumClient) GetHeaderSubscriptions

func (e *EthereumClient) GetHeaderSubscriptions() map[string]HeaderEventSubscription

GetHeaderSubscriptions returns a duplicate map of the queued transactions

func (*EthereumClient) GetNetworkName added in v0.0.7

func (e *EthereumClient) GetNetworkName() string

GetNetworkName retrieves the ID of the network that the client interacts with

func (*EthereumClient) GetNetworkType added in v1.0.27

func (e *EthereumClient) GetNetworkType() string

GetNetworkType retrieves the type of network this is running on

func (*EthereumClient) GetNonce

func (e *EthereumClient) GetNonce(ctx context.Context, addr common.Address) (uint64, error)

GetNonce keep tracking of nonces per address, add last nonce for addr if the map is empty

func (*EthereumClient) HeaderHashByNumber added in v0.0.5

func (e *EthereumClient) HeaderHashByNumber(ctx context.Context, bn *big.Int) (string, error)

HeaderHashByNumber gets header hash by block number

func (*EthereumClient) HeaderTimestampByNumber

func (e *EthereumClient) HeaderTimestampByNumber(ctx context.Context, bn *big.Int) (uint64, error)

HeaderTimestampByNumber gets header timestamp by number

func (*EthereumClient) LoadWallets added in v0.0.25

func (e *EthereumClient) LoadWallets(cfg interface{}) error

LoadWallets loads wallets from config

func (*EthereumClient) ParallelTransactions

func (e *EthereumClient) ParallelTransactions(enabled bool)

ParallelTransactions when enabled, sends the transaction without waiting for transaction confirmations. The hashes are then stored within the client and confirmations can be waited on by calling WaitForEvents. When disabled, the minimum confirmations are waited on when the transaction is sent, so parallelisation is disabled.

func (*EthereumClient) ProcessTransaction

func (e *EthereumClient) ProcessTransaction(tx *types.Transaction) error

ProcessTransaction will queue or wait on a transaction depending on whether parallel transactions are enabled

func (*EthereumClient) SendTransaction

func (e *EthereumClient) SendTransaction(
	from *EthereumWallet,
	to common.Address,
	value *big.Float,
) (common.Hash, error)

SendTransaction sends a specified amount of ETH from a selected wallet to an address

func (*EthereumClient) SetID added in v0.0.5

func (e *EthereumClient) SetID(id int)

SetID sets client id, useful for multi-node networks

func (*EthereumClient) SetWallet added in v0.0.25

func (e *EthereumClient) SetWallet(num int) error

SetWallet sets default wallet

func (*EthereumClient) SwitchNode added in v0.0.25

func (e *EthereumClient) SwitchNode(_ int) error

SwitchNode not used, only applicable to EthereumMultinodeClient

func (*EthereumClient) TransactionOpts

func (e *EthereumClient) TransactionOpts(from *EthereumWallet) (*bind.TransactOpts, error)

TransactionOpts returns the base Tx options for 'transactions' that interact with a smart contract. Since most contract interactions in this framework are designed to happen through abigen calls, it's intentionally quite bare. abigen will handle gas estimation for us on the backend.

func (*EthereumClient) WaitForEvents

func (e *EthereumClient) WaitForEvents() error

WaitForEvents is a blocking function that waits for all event subscriptions that have been queued within the client.

type EthereumMultinodeClient added in v0.0.25

type EthereumMultinodeClient struct {
	DefaultClient *EthereumClient
	Clients       []*EthereumClient
}

EthereumMultinodeClient wraps the client and the BlockChain network to interact with an EVM based Blockchain with multiple nodes

func (*EthereumMultinodeClient) AddHeaderEventSubscription added in v0.0.25

func (e *EthereumMultinodeClient) AddHeaderEventSubscription(key string, subscriber HeaderEventSubscription)

AddHeaderEventSubscription adds a new header subscriber within the client to receive new headers

func (*EthereumMultinodeClient) BlockNumber added in v0.0.25

func (e *EthereumMultinodeClient) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber gets block number

func (*EthereumMultinodeClient) Close added in v0.0.25

func (e *EthereumMultinodeClient) Close() error

Close tears down the all the clients

func (*EthereumMultinodeClient) ContractsDeployed added in v1.0.31

func (e *EthereumMultinodeClient) ContractsDeployed() bool

func (*EthereumMultinodeClient) DeleteHeaderEventSubscription added in v0.0.25

func (e *EthereumMultinodeClient) DeleteHeaderEventSubscription(key string)

DeleteHeaderEventSubscription removes a header subscriber from the map

func (*EthereumMultinodeClient) EstimateCostForChainlinkOperations added in v0.0.25

func (e *EthereumMultinodeClient) EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error)

EstimateCostForChainlinkOperations calculates TXs cost as a dirty estimation based on transactionLimit for that network

func (*EthereumMultinodeClient) EstimateTransactionGasCost added in v1.0.54

func (e *EthereumMultinodeClient) EstimateTransactionGasCost() (*big.Int, error)

func (*EthereumMultinodeClient) Fund added in v0.0.25

func (e *EthereumMultinodeClient) Fund(toAddress string, nativeAmount *big.Float) error

Fund funds a specified address with LINK token and or ETH from the given wallet

func (*EthereumMultinodeClient) GasStats added in v0.0.25

func (e *EthereumMultinodeClient) GasStats() *GasStats

GasStats gets gas stats instance

func (*EthereumMultinodeClient) Get added in v0.0.25

func (e *EthereumMultinodeClient) Get() interface{}

Get gets default client as an interface{}

func (*EthereumMultinodeClient) GetChainID added in v0.0.31

func (e *EthereumMultinodeClient) GetChainID() int64

GetChainID retrieves the ChainID of the network that the client interacts with

func (*EthereumMultinodeClient) GetClients added in v0.0.25

func (e *EthereumMultinodeClient) GetClients() []BlockchainClient

GetClients gets clients for all nodes connected

func (*EthereumMultinodeClient) GetDefaultWallet added in v1.0.48

func (e *EthereumMultinodeClient) GetDefaultWallet() *EthereumWallet

DefaultWallet returns the default wallet for the network

func (*EthereumMultinodeClient) GetNetworkName added in v0.0.25

func (e *EthereumMultinodeClient) GetNetworkName() string

GetNetworkName gets the ID of the chain that the clients are connected to

func (*EthereumMultinodeClient) GetNetworkType added in v1.0.27

func (e *EthereumMultinodeClient) GetNetworkType() string

GetNetworkType retrieves the type of network this is running on

func (*EthereumMultinodeClient) HeaderHashByNumber added in v0.0.25

func (e *EthereumMultinodeClient) HeaderHashByNumber(ctx context.Context, bn *big.Int) (string, error)

HeaderHashByNumber gets header hash by block number

func (*EthereumMultinodeClient) HeaderTimestampByNumber added in v0.0.25

func (e *EthereumMultinodeClient) HeaderTimestampByNumber(ctx context.Context, bn *big.Int) (uint64, error)

HeaderTimestampByNumber gets header timestamp by number

func (*EthereumMultinodeClient) LoadWallets added in v0.0.25

func (e *EthereumMultinodeClient) LoadWallets(cfg interface{}) error

LoadWallets loads wallets from config

func (*EthereumMultinodeClient) ParallelTransactions added in v0.0.25

func (e *EthereumMultinodeClient) ParallelTransactions(enabled bool)

ParallelTransactions when enabled, sends the transaction without waiting for transaction confirmations. The hashes are then stored within the client and confirmations can be waited on by calling WaitForEvents. When disabled, the minimum confirmations are waited on when the transaction is sent, so parallelisation is disabled.

func (*EthereumMultinodeClient) SetID added in v0.0.25

func (e *EthereumMultinodeClient) SetID(id int)

SetID sets client ID (node)

func (*EthereumMultinodeClient) SetWallet added in v0.0.25

func (e *EthereumMultinodeClient) SetWallet(num int) error

SetWallet sets default wallet

func (*EthereumMultinodeClient) SwitchNode added in v0.0.25

func (e *EthereumMultinodeClient) SwitchNode(clientID int) error

SwitchNode sets default client to perform calls to the network

func (*EthereumMultinodeClient) WaitForEvents added in v0.0.25

func (e *EthereumMultinodeClient) WaitForEvents() error

WaitForEvents is a blocking function that waits for all event subscriptions for all clients

type EthereumWallet

type EthereumWallet struct {
	// contains filtered or unexported fields
}

EthereumWallet is the implementation to allow testing with ETH based wallets

func NewEthereumWallet

func NewEthereumWallet(pk string) (*EthereumWallet, error)

NewEthereumWallet returns the instantiated ETH wallet based on a given private key

func (*EthereumWallet) Address

func (e *EthereumWallet) Address() string

Address returns the ETH address for a given wallet

func (*EthereumWallet) PrivateKey

func (e *EthereumWallet) PrivateKey() string

PrivateKey returns the private key for a given Ethereum wallet

func (*EthereumWallet) RawPrivateKey added in v0.0.11

func (e *EthereumWallet) RawPrivateKey() interface{}

RawPrivateKey returns raw private key if it has some encoding or in bytes

type ExplorerClient

type ExplorerClient struct {
	*BasicHTTPClient
	Config *ExplorerConfig
}

ExplorerClient is used to call Explorer API endpoints

func NewExplorerClient added in v0.0.3

func NewExplorerClient(cfg *ExplorerConfig) *ExplorerClient

NewExplorerClient creates a new explorer mock client

func (*ExplorerClient) PostAdminNodes added in v0.0.3

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 added in v0.0.5

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 GasStats added in v0.0.5

type GasStats struct {
	NodeID       int
	TotalGasUsed int64
	SeenHashes   map[string]bool
	ClientTXs    []TXGasData
}

GasStats helper struct to determine gas metrics across all txs of a test

func NewGasStats added in v0.0.5

func NewGasStats(nodeID int) *GasStats

NewGasStats creates new gas stats collector

func (*GasStats) AddClientTXData added in v0.0.5

func (g *GasStats) AddClientTXData(data TXGasData)

AddClientTXData adds client TX data

func (*GasStats) PrintStats added in v0.0.5

func (g *GasStats) PrintStats()

PrintStats prints gas stats and total TXs cost

type HeaderEventSubscription

type HeaderEventSubscription interface {
	ReceiveBlock(header NodeBlock) error
	Wait() error
}

HeaderEventSubscription is an interface for allowing callbacks when the client receives a new header

type HttpInitializer added in v0.0.5

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 added in v0.0.5

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

HttpRequest represents the httpRequest json object used in the mockserver initializer

type HttpResponse added in v0.0.5

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

HttpResponse represents the httpResponse json object used in the mockserver initializer

type InstantConfirmations

type InstantConfirmations struct{}

InstantConfirmations is a no-op confirmer as all transactions are instantly mined so no confirmations are needed

func (*InstantConfirmations) ReceiveBlock

func (i *InstantConfirmations) ReceiveBlock(block NodeBlock) error

ReceiveBlock is a no-op

func (*InstantConfirmations) Wait

func (i *InstantConfirmations) Wait() error

Wait is a no-op

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 added in v0.0.17

type KafkaRestClient struct {
	*BasicHTTPClient
	Config *KafkaRestConfig
}

KafkaRestClient kafka-rest client

func NewKafkaRestClient added in v0.0.17

func NewKafkaRestClient(cfg *KafkaRestConfig) *KafkaRestClient

NewKafkaRestClient creates a new KafkaRestClient

func (*KafkaRestClient) GetTopics added in v0.0.17

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

GetTopics Get a list of Kafka topics.

type KafkaRestConfig added in v0.0.17

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 added in v0.0.5

type MockserverClient struct {
	*BasicHTTPClient
	Config *MockserverConfig
}

MockserverClient mockserver client

func ConnectMockServer added in v0.0.44

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

ConnectMockServer creates a connection to a deployed mockserver in the environment

func ConnectMockServerSoak added in v1.0.53

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 added in v0.0.5

func NewMockserverClient(cfg *MockserverConfig) *MockserverClient

NewMockserverClient returns a mockserver client

func (*MockserverClient) ClearExpectation added in v0.0.5

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

ClearExpectation clears expectations

func (*MockserverClient) PutExpectations added in v0.0.5

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

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

func (*MockserverClient) SetValuePath added in v0.0.25

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

SetValuePath sets an int for a path

type MockserverConfig added in v0.0.5

type MockserverConfig struct {
	LocalURL   string
	ClusterURL string
}

MockserverConfig holds config information for MockserverClient

type Name added in v0.0.3

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

Name is the body of the request

type NetworkRegistry added in v0.0.25

type NetworkRegistry struct {
	// contains filtered or unexported fields
}

NetworkRegistry holds all the registered network types that can be initialized, allowing external libraries to register alternative network types to use

func NewDefaultNetworkRegistry added in v1.0.53

func NewDefaultNetworkRegistry() *NetworkRegistry

NewDefaultNetworkRegistry returns an instance of the network registry with the default supported networks registered

func NewSoakNetworkRegistry added in v1.0.53

func NewSoakNetworkRegistry() *NetworkRegistry

NewSoakNetworkRegistry retrieves a network registry for use in soak tests

func (*NetworkRegistry) GetNetworks added in v0.0.25

func (n *NetworkRegistry) GetNetworks(env *environment.Environment) (*Networks, error)

GetNetworks returns a networks object with all the BlockchainClient(s) initialized

func (*NetworkRegistry) RegisterNetwork added in v0.0.25

func (n *NetworkRegistry) RegisterNetwork(networkType string, fn NewBlockchainClientFn, urlFn BlockchainClientURLFn)

RegisterNetwork registers a new type of network within the registry

type Networks added in v0.0.25

type Networks struct {
	Default BlockchainClient
	// contains filtered or unexported fields
}

Networks is a thin wrapper that just selects client connected to some network if there is only one client it is chosen as Default if there is multiple you just get clients you need in test

func (*Networks) AllNetworks added in v1.0.54

func (b *Networks) AllNetworks() []BlockchainClient

AllNetworks returns all the network clients

func (*Networks) Get added in v0.0.25

func (b *Networks) Get(index int) (BlockchainClient, error)

Get gets blockchain network (client) by name

func (*Networks) SetDefault added in v0.0.25

func (b *Networks) SetDefault(index int) error

SetDefault chooses default client

func (*Networks) Teardown added in v0.0.25

func (b *Networks) Teardown() error

Teardown all clients

type NewBlockchainClientFn added in v0.0.25

type NewBlockchainClientFn func(
	networkName string,
	networkConfig map[string]interface{},
	urls []*url.URL,
) (BlockchainClient, error)

NewBlockchainClientFn external client implementation function networkName must match a key in "networks" in networks.yaml config networkConfig is just an arbitrary config you provide in "networks" for your key

type NewEVMNode added in v1.1.15

type NewEVMNode struct {
	Name       string      `json:"name"`
	EVMChainID utils.Big   `json:"evmChainId"`
	WSURL      null.String `json:"wsURL" db:"ws_url"`
	HTTPURL    null.String `json:"httpURL" db:"http_url"`
	SendOnly   bool        `json:"sendOnly"`
}

type NodeAccessKeys added in v0.0.3

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 NodeBlock added in v0.0.5

type NodeBlock struct {
	NodeID int
	*types.Block
}

NodeBlock block with a node ID which mined it

type NodeInfoJSON added in v0.0.5

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 added in v0.0.37

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

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

type OCR2KeyAttributes added in v0.0.37

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 added in v0.0.37

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 added in v0.0.37

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

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

type OCR2TaskJobSpec added in v0.0.37

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 added in v0.0.37

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

String representation of the job

func (*OCR2TaskJobSpec) Type added in v0.0.37

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 added in v0.0.5

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 added in v1.0.45

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

PostgresConfig postgres config for connection string

type PostgresConnector added in v1.0.45

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

PostgresConnector sqlx postgres connector

func ConnectChainlinkDBByCharts added in v1.0.47

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

ConnectChainlinkDBByCharts creates new chainlink DBs clients by charts

func ConnectChainlinkDBs added in v1.0.47

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

func NewPostgresConnector added in v1.0.45

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 added in v0.0.5

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

GetAlerts returns all firing alerts

func (*Prometheus) GetQuery added in v0.0.5

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 added in v1.0.48

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 added in v1.0.54

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

type SolanaChain added in v1.0.53

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

SolanaChain is the model that represents the solana chain when read

type SolanaChainAttributes added in v1.0.53

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

SolanaChainAttributes is the model that represents the solana chain

type SolanaChainConfig added in v1.0.53

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 added in v1.0.53

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

SolanaChainCreate is the model that represents the solana chain when created

type SolanaNode added in v1.0.53

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

SolanaNode is the model that represents the solana node when read

type SolanaNodeAttributes added in v1.0.53

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 added in v1.0.53

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 TXGasData added in v0.0.5

type TXGasData struct {
	TXHash            string
	Value             uint64
	GasLimit          uint64
	GasUsed           uint64
	GasPrice          uint64
	CumulativeGasUsed uint64
}

TXGasData transaction gas data

type TaskRun added in v0.0.7

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 added in v1.0.36

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

TerraChain is the model that represents the terra chain when read

type TerraChainAttributes added in v1.0.36

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 added in v1.0.36

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

type TerraChainCreate added in v1.0.36

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

TerraChainCreate is the model that represents the terra chain when created

type TerraNode added in v1.0.29

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

TerraNode is the model that represents the terra node when read

type TerraNodeAttributes added in v1.0.29

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 added in v1.0.29

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

TerraNodeCreate is the model that represents the terra node when created

type TransactionAttributes added in v1.0.48

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 TransactionConfirmer

type TransactionConfirmer struct {
	// contains filtered or unexported fields
}

TransactionConfirmer is an implementation of HeaderEventSubscription that checks whether tx are confirmed

func NewTransactionConfirmer

func NewTransactionConfirmer(eth *EthereumClient, tx *types.Transaction, minConfirmations int) *TransactionConfirmer

NewTransactionConfirmer returns a new instance of the transaction confirmer that waits for on-chain minimum confirmations

func (*TransactionConfirmer) ReceiveBlock

func (t *TransactionConfirmer) ReceiveBlock(block NodeBlock) error

ReceiveBlock the implementation of the HeaderEventSubscription that receives each block and checks tx confirmation

func (*TransactionConfirmer) Wait

func (t *TransactionConfirmer) Wait() error

Wait is a blocking function that waits until the transaction is complete

type TransactionData added in v1.0.48

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

type TransactionsData added in v1.0.48

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

type TransactionsMetaData added in v1.0.48

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

type TxKey added in v0.0.37

type TxKey struct {
	Address   string    `json:"address"`
	IsFunding bool      `json:"isFunding"`
	Data      TxKeyData `json:"data"`
}

TxKey is the model that represents the created keys when read

type TxKeyAttributes added in v0.0.37

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

TxKeyAttributes is the model that represents the created keys when read

type TxKeyData added in v0.0.37

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 added in v0.0.37

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

TxKeys is the model that represents the created keys when read

type UpdateEVMChainRequest added in v1.1.15

type UpdateEVMChainRequest struct {
	ID      string   `json:"chainID"`
	Config  ChainCfg `json:"config"`
	Enabled bool     `json:"enabled"`
}

UpdateEVMChainRequest is a JSONAPI request for updating an EVM chain.

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 added in v0.0.24

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 added in v1.1.3

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 added in v1.1.3

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

String representation of the job

func (*VRFV2JobSpec) Type added in v1.1.3

func (v *VRFV2JobSpec) Type() string

Type returns the type of the job

type VRFV2TxPipelineSpec added in v1.0.54

type VRFV2TxPipelineSpec struct {
	Address string
}

VRFV2TxPipelineSpec VRFv2 request with tx callback

func (*VRFV2TxPipelineSpec) String added in v1.0.54

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

String representation of the pipeline

func (*VRFV2TxPipelineSpec) Type added in v1.0.54

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