Documentation ¶
Overview ¶
Package adapters contain the core adapters used by the Chainlink node.
HTTPGet ¶
The HTTPGet adapter is used to grab the JSON data from the given URL.
{ "type": "HTTPGet", "url": "https://some-api-example.net/api" }
HTTPPost ¶
Sends a POST request to the specified URL and will return the response.
{ "type": "HTTPPost", "url": "https://weiwatchers.com/api" }
JSONParse ¶
The JSONParse adapter will obtain the value(s) for the given field(s).
{ "type": "JSONParse", "path": ["someField"] }
EthBytes32 ¶
The EthBytes32 adapter will take the given values and format them for the Ethereum blockhain.
{ "type": "EthBytes32" }
EthInt256 ¶
The EthInt256 adapter will take a given signed 256 bit integer and format it to hex for the Ethereum blockchain.
{ "type": "EthInt256" }
EthUint256 ¶
The EthUint256 adapter will take a given 256 bit integer and format it in hex for the Ethereum blockchain.
{ "type": "EthUint256" }
EthTx ¶
The EthTx adapter will write the data to the given address and functionSelector.
{ "type": "EthTx", "address": "0x0000000000000000000000000000000000000000", "functionSelector": "0xffffffff" }
Multiplier ¶
The Multiplier adapter multiplies the given input value times another specified value.
{ "type": "Multiply", "times": 100 }
Bridge ¶
The Bridge adapter is used to send and receive data to and from external adapters. The adapter will POST to the target adapter URL with an "id" field for the TaskRunID and a "data" field. For example:
{"id":"b8004e2989e24e1d8e4449afad2eb480","data":{}}
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // TaskTypeCopy is the identifier for the Copy adapter. TaskTypeCopy = models.MustNewTaskType("copy") // TaskTypeEthBytes32 is the identifier for the EthBytes32 adapter. TaskTypeEthBytes32 = models.MustNewTaskType("ethbytes32") // TaskTypeEthInt256 is the identifier for the EthInt256 adapter. TaskTypeEthInt256 = models.MustNewTaskType("ethint256") // TaskTypeEthUint256 is the identifier for the EthUint256 adapter. TaskTypeEthUint256 = models.MustNewTaskType("ethuint256") // TaskTypeEthTx is the identifier for the EthTx adapter. TaskTypeEthTx = models.MustNewTaskType("ethtx") // TaskTypeHTTPGet is the identifier for the HTTPGet adapter. TaskTypeHTTPGet = models.MustNewTaskType("httpget") // TaskTypeHTTPPost is the identifier for the HTTPPost adapter. TaskTypeHTTPPost = models.MustNewTaskType("httppost") // TaskTypeJSONParse is the identifier for the JSONParse adapter. TaskTypeJSONParse = models.MustNewTaskType("jsonparse") // TaskTypeMultiply is the identifier for the Multiply adapter. TaskTypeMultiply = models.MustNewTaskType("multiply") // TaskTypeNoOp is the identifier for the NoOp adapter. TaskTypeNoOp = models.MustNewTaskType("noop") // TaskTypeNoOpPend is the identifier for the NoOpPend adapter. TaskTypeNoOpPend = models.MustNewTaskType("nooppend") // TaskTypeSleep is the identifier for the Sleep adapter. TaskTypeSleep = models.MustNewTaskType("sleep") // TaskTypeWasm is the wasm interpereter adapter TaskTypeWasm = models.MustNewTaskType("wasm") )
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
Adapter interface applies to all core adapters. Each implementation must return a RunResult.
type AdapterWithMinConfs ¶
AdapterWithMinConfs is the interface required for an adapter to be run in the job pipeline. In addition to the Adapter interface, implementers must specify the number of confirmations required before the Adapter can be run.
type Bridge ¶
type Bridge struct { models.BridgeType Params *models.JSON }
Bridge adapter is responsible for connecting the task pipeline to external adapters, allowing for custom computations to be executed and included in runs.
func (*Bridge) MinConfs ¶
MinConfs specifies the number of block confirmations needed for the Bridge to run. This method enables the Bridge to meet the adapters.AdapterWithMinConfs interface.
func (*Bridge) Perform ¶
Perform sends a POST request containing the JSON of the input RunResult to the external adapter specified in the BridgeType. It records the RunResult returned to it, and optionally marks the RunResult pending.
If the Perform is resumed with a pending RunResult, the RunResult is marked not pending and the RunResult is returned.
type Copy ¶
type Copy struct {
CopyPath []string `json:"copyPath"`
}
Copy obj keys refers to which value to copy inside `data`, each obj value refers to where to copy the value to inside `data`
type EthBytes32 ¶
type EthBytes32 struct{}
EthBytes32 holds no fields.
func (*EthBytes32) Perform ¶
Perform returns the hex value of the first 32 bytes of a string so that it is in the proper format to be written to the blockchain.
For example, after converting the string "16800.01" to hex encoded Ethereum ABI, it would be: "0x31363830302e3031000000000000000000000000000000000000000000000000"
type EthInt256 ¶
type EthInt256 struct{}
EthInt256 holds no fields
func (*EthInt256) Perform ¶
Perform returns the hex value of a given string so that it is in the proper format to be written to the blockchain.
For example, after converting the string "-123.99" to hex encoded Ethereum ABI, it would be: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85"
type EthTx ¶
type EthTx struct { Address common.Address `json:"address"` FunctionSelector models.FunctionSelector `json:"functionSelector"` DataPrefix hexutil.Bytes `json:"dataPrefix"` }
EthTx holds the Address to send the result to and the FunctionSelector to execute.
type EthUint256 ¶
type EthUint256 struct{}
EthUint256 holds no fields.
func (*EthUint256) Perform ¶
Perform returns the hex value of a given string so that it is in the proper format to be written to the blockchain.
For example, after converting the string "123.99" to hex encoded Ethereum ABI, it would be: "0x000000000000000000000000000000000000000000000000000000000000007b"
type HTTPPost ¶
HTTPPost requires a URL which is used for a POST request when the adapter is called.
type JSONParse ¶
type JSONParse struct {
Path []string `json:"path"`
}
JSONParse holds a path to the desired field in a JSON object, made up of an array of strings.
type MinConfsWrappedAdapter ¶
MinConfsWrappedAdapter allows for an adapter to be wrapped so that it meets the AdapterWithMinConfsInterface.
func (MinConfsWrappedAdapter) MinConfs ¶
func (wa MinConfsWrappedAdapter) MinConfs() uint64
MinConfs specifies the number of block confirmations needed to run the adapter.
type Multiplier ¶
type Multiplier float64
Multiplier represents the number to multiply by in Multiply adapter.
func (*Multiplier) UnmarshalJSON ¶
func (m *Multiplier) UnmarshalJSON(input []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Multiply ¶
type Multiply struct {
Times Multiplier `json:"times"`
}
Multiply holds the a number to multiply the given value by.