-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctions-request-config.js
51 lines (45 loc) · 1.88 KB
/
Functions-request-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const fs = require("fs")
// Loads environment variables from .env.enc file (if it exists)
require("@chainlink/env-enc").config()
const Location = {
Inline: 0,
Remote: 1,
}
const CodeLanguage = {
JavaScript: 0,
}
const ReturnType = {
uint: "uint256",
uint256: "uint256",
int: "int256",
int256: "int256",
string: "string",
bytes: "Buffer",
Buffer: "Buffer",
}
// Configure the request by setting the fields below
const requestConfig = {
// Location of source code (only Inline is currently supported)
codeLocation: Location.Inline,
// Code language (only JavaScript is currently supported)
codeLanguage: CodeLanguage.JavaScript,
// String containing the source code to be executed
source: fs.readFileSync("./queryLikes.js").toString(),
//source: fs.readFileSync("./calculation-example.js").toString(),
//source: fs.readFileSync('./API-request-example.js').toString(),
// Secrets can be accessed within the source code with `secrets.varName` (ie: secrets.apiKey). The secrets object can only contain string values.
//secrets: { apiKey: process.env.COINMARKETCAP_API_KEY ?? "" },
secrets: { db_conn: process.env.DB_CONN_STRING, db_name: process.env.DB_NAME, db_collection: process.env.DB_COLLECTION },
// Per-node secrets objects assigned to each DON member. When using per-node secrets, nodes can only use secrets which they have been assigned.
perNodeSecrets: [],
// ETH wallet key used to sign secrets so they cannot be accessed by a 3rd party
walletPrivateKey: process.env["PRIVATE_KEY"],
// Args (string only array) can be accessed within the source code with `args[index]` (ie: args[0]).
args:[],
//args: ["1", "bitcoin", "btc-bitcoin", "btc", "1000000", "450"],
// Expected type of the returned value
expectedReturnType: ReturnType.string,
// Redundant URLs which point to encrypted off-chain secrets
secretsURLs: [],
}
module.exports = requestConfig