-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathFunctions-request-config.js
45 lines (39 loc) · 1.47 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
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("./source-code.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.API_KEY ?? "", biscuit1: process.env.BISCUIT1 ?? "" },
// 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"],
// Expected type of the returned value
expectedReturnType: ReturnType.uint256,
// Redundant URLs which point to encrypted off-chain secrets
secretsURLs: [],
}
module.exports = requestConfig