Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update request keys in examples #1345

Merged
merged 4 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evm/contracts/examples/Consumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract Consumer is ChainlinkClient {

function requestEthereumPrice(string _currency) public {
Chainlink.Request memory req = buildChainlinkRequest(specId, this, this.fulfill.selector);
req.add("url", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
string[] memory path = new string[](1);
path[0] = _currency;
req.addStringArray("path", path);
Expand Down
2 changes: 1 addition & 1 deletion evm/contracts/examples/ServiceAgreementConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract ServiceAgreementConsumer is Chainlinked {

function requestEthereumPrice(string _currency) public {
Chainlink.Request memory req = newRequest(sAId, this, this.fulfill.selector);
req.add("url", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
req.add("path", _currency);
chainlinkRequest(req, ORACLE_PAYMENT);
}
Expand Down
2 changes: 1 addition & 1 deletion evm/test/BasicConsumer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract('BasicConsumer', () => {
const request = h.decodeRunRequest(log)
const expected = {
path: ['USD'],
url:
get:
'https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY'
}

Expand Down
2 changes: 1 addition & 1 deletion evm/test/ServiceAgreementConsumer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract('ServiceAgreementConsumer', () => {
assertBigNum(1, request.dataVersion)
const url =
'https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY'
assert.deepEqual(params, { path: currency, url: url })
assert.deepEqual(params, { path: currency, get: url })
})

it('has a reasonable gas cost', async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/echo_server/broadcast_logs_job.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"_comment": "An ethlog with no address listens to all addresses.",
"initiators": [{ "type": "ethlog" }],
"tasks": [
{ "type": "HttpPost", "params": { "url": "http://localhost:6690" } }
{ "type": "HttpPost", "params": { "post": "http://localhost:6690" } }
]
}
6 changes: 3 additions & 3 deletions examples/testnet/TestnetConsumerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumPrice.selector);
req.add("url", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");
req.add("path", "USD");
req.addInt("times", 100);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
Expand All @@ -45,7 +45,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumChange.selector);
req.add("url", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("path", "RAW.ETH.USD.CHANGEPCTDAY");
req.addInt("times", 1000000000);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
Expand All @@ -56,7 +56,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumLastMarket.selector);
req.add("url", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
Expand Down
6 changes: 3 additions & 3 deletions examples/testnet/contracts/TestnetConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumPrice.selector);
req.add("url", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");
req.add("path", "USD");
req.addInt("times", 100);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
Expand All @@ -1025,7 +1025,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumChange.selector);
req.add("url", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("path", "RAW.ETH.USD.CHANGEPCTDAY");
req.addInt("times", 1000000000);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
Expand All @@ -1036,7 +1036,7 @@ contract ATestnetConsumer is ChainlinkClient, Ownable {
onlyOwner
{
Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), this, this.fulfillEthereumLastMarket.selector);
req.add("url", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
req.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
Expand Down
2 changes: 1 addition & 1 deletion examples/twilio_sms/create_twilio_job_for
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (process.argv.length <= 2) {
const job = {
"_comment": "An ethlog with a specific address only listens to that address.",
"initiators": [{ "type": "ethlog", "address": process.argv[2]}],
"tasks": [{ "type": "HttpPost", "params": { "url": "http://localhost:6691" }}]
"tasks": [{ "type": "HttpPost", "params": { "post": "http://localhost:6691" }}]
};

const request = require("request").defaults({jar: true});
Expand Down
2 changes: 1 addition & 1 deletion examples/uptime_sla/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The ChainLink Job is configured to not take any specific URL or JSON path, so th
```solidity
function updateUptime(string _when) public {
Chainlink.Request memory req = newRequest(jobId, this, "report(uint256,uint256)");
req.add("url", "https://status.heroku.com/api/ui/availabilities");
req.add("get", "https://status.heroku.com/api/ui/availabilities");
string[] memory path = new string[](4);
path[0] = "data";
path[1] = _when; //pick which data point in the array you want to examine
Expand Down
2 changes: 1 addition & 1 deletion examples/uptime_sla/contracts/UptimeSLA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract UptimeSLA is Chainlinked {

function updateUptime(string _when) public {
Chainlink.Request memory req = newRequest(jobId, this, this.report.selector);
req.add("url", "https://status.heroku.com/api/ui/availabilities");
req.add("get", "https://status.heroku.com/api/ui/availabilities");
string[] memory path = new string[](4);
path[0] = "data";
path[1] = _when;
Expand Down
2 changes: 1 addition & 1 deletion examples/uptime_sla/test/UptimeSLA_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ contract('UptimeSLA', accounts => {

const decoded = await h.decodeDietCBOR(events[0].args.data)
assert.deepEqual(decoded, {
url: 'https://status.heroku.com/api/ui/availabilities',
get: 'https://status.heroku.com/api/ui/availabilities',
path: ['data', '0', 'attributes', 'calculation']
})
})
Expand Down