Documentation
¶
Overview ¶
Package client handles connections between chainlink nodes and different blockchain networks
Index ¶
- Constants
- Variables
- func EthereumMultiNodeURLs(e *environment.Environment) ([]*url.URL, error)
- func ObservationSourceSpecBridge(bta BridgeTypeAttributes) string
- func ObservationSourceSpecHTTP(url string) string
- func UnmarshalNetworkConfig(config map[string]interface{}, obj interface{}) error
- type AdapterResponse
- type AdapterResult
- type BasicHTTPClient
- type BlockchainClient
- type BlockchainClientURLFn
- type BridgeType
- type BridgeTypeAttributes
- type BridgeTypeData
- type Chainlink
- type ChainlinkConfig
- type ContractDeployer
- type ContractInfoJSON
- type CronJobSpec
- type DecodeLogTaskRun
- type DirectRequestJobSpec
- type DirectRequestTxPipelineSpec
- type EIAttributes
- type EIKey
- type EIKeyCreate
- type EIKeys
- type EIServiceConfig
- type ETHKey
- type ETHKeyAttributes
- type ETHKeyData
- type ETHKeys
- type EthereumClient
- func (e *EthereumClient) AddHeaderEventSubscription(key string, subscriber HeaderEventSubscription)
- func (e *EthereumClient) BlockNumber(ctx context.Context) (uint64, error)
- func (e *EthereumClient) BorrowedNonces(n bool)
- func (e *EthereumClient) Close() error
- func (e *EthereumClient) DeleteHeaderEventSubscription(key string)
- func (e *EthereumClient) DeployContract(contractName string, deployer ContractDeployer) (*common.Address, *types.Transaction, interface{}, error)
- func (e *EthereumClient) EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error)
- func (e *EthereumClient) Fund(toAddress string, amount *big.Float) error
- func (e *EthereumClient) GasStats() *GasStats
- func (e *EthereumClient) Get() interface{}
- func (e *EthereumClient) GetClients() []BlockchainClient
- func (e *EthereumClient) GetHeaderSubscriptions() map[string]HeaderEventSubscription
- func (e *EthereumClient) GetNetworkName() string
- func (e *EthereumClient) GetNonce(ctx context.Context, addr common.Address) (uint64, error)
- func (e *EthereumClient) HeaderHashByNumber(ctx context.Context, bn *big.Int) (string, error)
- func (e *EthereumClient) HeaderTimestampByNumber(ctx context.Context, bn *big.Int) (uint64, error)
- func (e *EthereumClient) LoadWallets(cfg interface{}) error
- func (e *EthereumClient) ParallelTransactions(enabled bool)
- func (e *EthereumClient) ProcessTransaction(tx *types.Transaction) error
- func (e *EthereumClient) SendTransaction(from *EthereumWallet, to common.Address, value *big.Float) (common.Hash, error)
- func (e *EthereumClient) SetID(id int)
- func (e *EthereumClient) SetWallet(num int) error
- func (e *EthereumClient) SwitchNode(_ int) error
- func (e *EthereumClient) TransactionOpts(from *EthereumWallet) (*bind.TransactOpts, error)
- func (e *EthereumClient) WaitForEvents() error
- type EthereumMultinodeClient
- func (e *EthereumMultinodeClient) AddHeaderEventSubscription(key string, subscriber HeaderEventSubscription)
- func (e *EthereumMultinodeClient) BlockNumber(ctx context.Context) (uint64, error)
- func (e *EthereumMultinodeClient) Close() error
- func (e *EthereumMultinodeClient) DeleteHeaderEventSubscription(key string)
- func (e *EthereumMultinodeClient) EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error)
- func (e *EthereumMultinodeClient) Fund(toAddress string, nativeAmount *big.Float) error
- func (e *EthereumMultinodeClient) GasStats() *GasStats
- func (e *EthereumMultinodeClient) Get() interface{}
- func (e *EthereumMultinodeClient) GetClients() []BlockchainClient
- func (e *EthereumMultinodeClient) GetNetworkName() string
- func (e *EthereumMultinodeClient) HeaderHashByNumber(ctx context.Context, bn *big.Int) (string, error)
- func (e *EthereumMultinodeClient) HeaderTimestampByNumber(ctx context.Context, bn *big.Int) (uint64, error)
- func (e *EthereumMultinodeClient) LoadWallets(cfg interface{}) error
- func (e *EthereumMultinodeClient) ParallelTransactions(enabled bool)
- func (e *EthereumMultinodeClient) SetID(id int)
- func (e *EthereumMultinodeClient) SetWallet(num int) error
- func (e *EthereumMultinodeClient) SwitchNode(clientID int) error
- func (e *EthereumMultinodeClient) WaitForEvents() error
- type EthereumWallet
- type ExplorerClient
- type ExplorerConfig
- type FluxMonitorJobSpec
- type GasStats
- type HeaderEventSubscription
- type HttpInitializer
- type HttpRequest
- type HttpResponse
- type InstantConfirmations
- type Job
- type JobData
- type JobForm
- type JobRunsResponse
- type JobSpec
- type KafkaRestClient
- type KafkaRestConfig
- type KeeperJobSpec
- type MockserverClient
- type MockserverConfig
- type Name
- type NetworkRegistry
- type Networks
- type NewBlockchainClientFn
- type NodeAccessKeys
- type NodeBlock
- type NodeInfoJSON
- type OCRBootstrapJobSpec
- type OCRKey
- type OCRKeyAttributes
- type OCRKeyData
- type OCRKeys
- type OCRTaskJobSpec
- type P2PData
- type P2PKey
- type P2PKeyAttributes
- type P2PKeyData
- type P2PKeys
- type PathSelector
- type PipelineSpec
- type Prometheus
- type ResourcesSummary
- type Response
- type ResponseSlice
- type RunInputs
- type RunsAttributesResponse
- type RunsMetaResponse
- type RunsResponseData
- type Session
- type Spec
- type SpecData
- type SpecForm
- type TXGasData
- type TaskRun
- type TransactionConfirmer
- type VRFJobSpec
- type VRFKey
- type VRFKeyAttributes
- type VRFKeyData
- type VRFKeys
- type VRFTxPipelineSpec
- type WebhookJobSpec
Constants ¶
const ( ETHNetworkType = "eth_multinode" NetworkGethPerformance = "ethereum_geth_performance" )
Commonly used blockchain network types
const ( // GWei one giga-wei used for gas calculations GWei = 1e9 // ETH one eth in wei ETH = 1e18 )
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 ¶
var ( // OneGWei represents 1 GWei OneGWei = big.NewFloat(1e9) // OneEth represents 1 Ethereum OneEth = big.NewFloat(1e18) )
var ErrNotFound = errors.New("unexpected response code, got 404")
ErrNotFound Error for not found
var ErrUnprocessableEntity = errors.New("unexpected response code, got 422")
ErrUnprocessableEntity Error for and unprocessable entity
var OneLINK = big.NewFloat(1e18)
OneLINK representation of a single LINK token
Functions ¶
func EthereumMultiNodeURLs ¶ added in v0.0.25
func EthereumMultiNodeURLs(e *environment.Environment) ([]*url.URL, error)
EthereumMultiNodeURLs returns the websocket URLs for a deployed Ethereum multi-node setup
func ObservationSourceSpecBridge ¶
func ObservationSourceSpecBridge(bta BridgeTypeAttributes) string
ObservationSourceSpecBridge creates a bridge task spec for json data
func ObservationSourceSpecHTTP ¶
ObservationSourceSpecHTTP creates a http GET task spec for json data
func UnmarshalNetworkConfig ¶ added in v0.0.25
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
type BlockchainClient ¶
type BlockchainClient interface { LoadWallets(ns interface{}) error SetWallet(num int) error EstimateCostForChainlinkOperations(amountOfOperations int) (*big.Float, error) Get() interface{} GetNetworkName() string 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 Chainlink ¶
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 CreateP2PKey() (*P2PKey, error) ReadP2PKeys() (*P2PKeys, error) DeleteP2PKey(id int) error ReadETHKeys() (*ETHKeys, error) PrimaryEthAddress() (string, error) CreateVRFKey() (*VRFKey, error) ReadVRFKeys() (*VRFKeys, error) CreateEI(eia *EIAttributes) (*EIKeyCreate, error) ReadEIs() (*EIKeys, error) DeleteEI(name string) 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 NewChainlink ¶
func NewChainlink(c *ChainlinkConfig, httpClient *http.Client) (Chainlink, error)
NewChainlink creates a new chainlink model using a provided config
func NewChainlinkClients ¶ added in v0.0.25
func NewChainlinkClients(e *environment.Environment) ([]Chainlink, error)
NewChainlinkClients creates new chainlink clients
func NewChainlinkClientsByCharts ¶ added in v0.0.25
func NewChainlinkClientsByCharts(e *environment.Environment, charts []string) ([]Chainlink, error)
NewChainlinkClientsByCharts creates new chainlink clients by charts
type ChainlinkConfig ¶
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 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
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 ¶
func (d *DirectRequestTxPipelineSpec) Type() string
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"`
}
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 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) 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) 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) GetClients ¶ added in v0.0.5
func (e *EthereumClient) GetClients() []BlockchainClient
GetClients not used, only applicable to EthereumMultinodeClient
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) GetNonce ¶
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
HeaderHashByNumber gets header hash by block number
func (*EthereumClient) HeaderTimestampByNumber ¶
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) 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) 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) GetClients ¶ added in v0.0.25
func (e *EthereumMultinodeClient) GetClients() []BlockchainClient
GetClients gets clients for all nodes connected
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) 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
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
NewGasStats creates new gas stats collector
func (*GasStats) AddClientTXData ¶ added in v0.0.5
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 ¶
HeaderEventSubscription is an interface for allowing callbacks when the client receives a new header
type HttpInitializer ¶ added in v0.0.5
type HttpInitializer struct { 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
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 }
KeeperJobSpec represents a keeper spec
func (*KeeperJobSpec) String ¶
func (k *KeeperJobSpec) String() (string, error)
String representation of the job
type MockserverClient ¶ added in v0.0.5
type MockserverClient struct { *BasicHTTPClient Config *MockserverConfig }
MockserverClient mockserver client
func NewMockServerClientFromEnv ¶ added in v0.0.25
func NewMockServerClientFromEnv(e *environment.Environment) (*MockserverClient, error)
NewMockServerClientFromEnv creates new mockserver from env
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
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 NewNetworkRegistry ¶ added in v0.0.25
func NewNetworkRegistry() *NetworkRegistry
NewNetworkRegistry returns an instance of the network registry with the default supported networks registered
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) 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
SetDefault chooses default client
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 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 NodeInfoJSON ¶ added in v0.0.5
NodeInfoJSON represents an element of the nodes array used to deliver configs to otpe
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 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
type Prometheus ¶
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 ¶
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 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 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 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 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 Confirmations int `toml:"confirmations"` // Number of block confirmations to wait for ExternalJobID string `toml:"externalJobID"` ObservationSource string `toml:"observationSource"` // List of commands for the chainlink node }
VRFJobSpec represents a VRF job
func (*VRFJobSpec) String ¶
func (v *VRFJobSpec) String() (string, error)
String representation 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 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
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package chaos handles the setup necessary to run chaos tests across chainlnk nodes and blockchains
|
Package chaos handles the setup necessary to run chaos tests across chainlnk nodes and blockchains |