-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgob.config.js
100 lines (87 loc) · 3.44 KB
/
algob.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// NOTE: below we provide some example accounts.
// DON'T this account in any working environment because everyone can check it and use
// the private keys (this accounts are visible to everyone).
// NOTE: to be able to execute transactions, you need to use an active account with
// a sufficient ALGO balance.
/**
Check our /docs/algob-config.md documentation (https://github.com/scale-it/algo-builder/blob/master/docs/guide/algob-config.md) for more configuration options and ways how to
load a private keys:
+ using mnemonic
+ using binary secret key
+ using KMD daemon
+ loading from a file
+ loading from an environment variable
+ ...
*/
// ## ACCOUNTS USING mnemonic ##
const { mkAccounts, algodCredentialsFromEnv } = require("@algo-builder/algob");
let accounts = mkAccounts([
{
// This account is created using `make setup-master-account` command from our
// `/infrastructure` directory. It already has many ALGOs
name: "master",
addr: "WWYNX3TKQYVEREVSW6QQP3SXSFOCE3SKUSEIVJ7YAGUPEACNI5UGI4DZCE",
mnemonic:
"enforce drive foster uniform cradle tired win arrow wasp melt cattle chronic sport dinosaur announce shell correct shed amused dismiss mother jazz task above hospital",
},
]);
// ## ACCOUNTS loaded from a FILE ##
// const { loadAccountsFromFileSync } = require("@algo-builder/algob");
// const accFromFile = loadAccountsFromFileSync("assets/accounts_generated.yaml");
// accounts = accounts.concat(accFromFile);
/// ## Enabling KMD access
/// Please check https://github.com/scale-it/algo-builder/blob/master/docs/guide/algob-config.md#credentials for more details and more methods.
// process.env.$KMD_DATA = "/path_to/KMD_DATA";
// let kmdCred = KMDCredentialsFromEnv();
// ## Algod Credentials
// You can set the credentials directly in this file:
// ## config for indexer running on local
// const indexerCfg = {
// host: "http://localhost",
// port: 8980,
// token: ""
// };
let defaultCfg = {
host: "http://localhost",
port: 4001,
// Below is a token created through our script in `/infrastructure`
// If you use other setup, update it accordignly (eg content of algorand-node-data/algod.token)
token: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
// you can also pass token as an object
// token: {
// "X-Algo-API-Token": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
// },
accounts: accounts,
// if you want to load accounts from KMD, you need to add the kmdCfg object. Please read
// algob-config.md documentation for details.
// kmdCfg: kmdCfg,
// you can pass config of indexer (ideally it should be attached to this network's algod node)
// indexerCfg: indexerCfg
};
// purestake testnet config
let purestakeTestNetCfg = {
host: "https://testnet-algorand.api.purestake.io/ps2",
port: "",
token: {
"X-API-Key": "Xhkn7v7h972hj7Egx3fGr9RFbfXeGuoD6wSLKDyG",
},
};
// You can also use Environment variables to get Algod credentials
// Please check https://github.com/scale-it/algo-builder/blob/master/docs/algob-config.md#credentials for more details and more methods.
// Method 1
process.env.ALGOD_ADDR = "127.0.0.1:4001";
process.env.ALGOD_TOKEN = "algod_token";
let algodCred = algodCredentialsFromEnv();
let envCfg = {
host: algodCred.host,
port: algodCred.port,
token: algodCred.token,
accounts: accounts,
};
module.exports = {
networks: {
default: defaultCfg,
prod: envCfg,
purestake: purestakeTestNetCfg,
},
};