-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adapters
NOTE: Due to the nature of our development cycle, this page may be out of date. Please see our official Adapters documentation for up the most up to date documentation.
The adapter is in charge of speaking with External Adapters.
-
url
: takes a string containing the location of the external adapter. Bridge can create pending task runs, and resume them viaPUT
requests to/runs/:RUN_ID
.
The adapter walks the copyPath
specified and returns the value found at that result.
-
copyPath
: takes an array of strings, each string being the next key to parse out in the JSON object.
For the JSON object:
{RAW: {ETH: {USD: {LASTMARKET: _someValue}}}}
You would use:
string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
path[2] = "USD";
path[3] = "LASTMARKET";
run.addStringArray("copyPath", path);
The adapter formats its input into a string and then converts it into Solidity's bytes32
format.
None taken.
The adapter formats its input into an integer and then converts it into Solidity's int256
format.
None taken.
The adapter takes the input given and places it into the data field of the transaction. It then signs an Ethereum transaction and broadcasts it to the network. The task is only completed once the transaction's confirmations equal the TX_MIN_CONFIRMATIONS amount.
If the transaction does not confirm by the time ETH_GAS_BUMP_THRESHOLD number of blocks have passed since initially broadcasting, then it bumps the gas price of the transaction by ETH_GAS_BUMP_WEI.
-
address
: the address of the Ethereum account which the transaction will be sent to. -
functionSelector
: (optional) the function selector of the contract which the transaction will invoke.functionSelector
is placed beforedataPrefix
and the adapter's input in the data field of the transaction. -
dataPrefix
: (optional) data which will be prepended before the adapter's input, but after thefunctionSelector
in the transaction's data field.
The adapter formats its input into an integer and then converts it into Solidity's uint256
format.
None taken.
The adapter will report the body of a successful GET
request to the specified url
, or return an error if the response status code is greater than or equal to 400.
-
url
: takes a string containing the URL to make aGET
request to.
run.add("url", "http://example.com");
The adapter will report the body of a successful POST
request to the specified url
, or return an error if the response status code is greater than or equal to 400.
-
url
: takes a string containing the URL to make aPOST
request to.
run.add("url", "http://post.example.com");
The adapter walks the path
specified and returns the value found at that result.
-
path
: takes an array of strings, each string being the next key to parse out in the JSON object.
string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
path[2] = "USD";
path[3] = "LASTMARKET";
run.addStringArray("path", path);
The adapter parses the input into a float and then multiplies it by the times
field.
-
times
: the number to multiply the input by.
run.addInt("times", 100);
The adapter performs no operations, simply passing the input on as output. Commonly used for testing.
None taken.
The adapter performs no operations, and marks its task run pending. Commonly used for testing.
None taken.
The adapter will pause the current task pipeline for the given duration.
-
until
: the UNIX timestamp (in seconds) of when the job should stop sleeping and resume at the next task in the pipeline.
run.addUint("until", now + 1 hours);