2018-10-02 05:33:12 -07:00
|
|
|
import { constants } from "./constants";
|
2018-01-29 10:02:05 -08:00
|
|
|
import helpers from "./helpers";
|
2018-02-13 03:42:17 -08:00
|
|
|
//const local = {
|
2018-10-15 07:52:03 -07:00
|
|
|
// "KEYS_MANAGER_ADDRESS": "0x3ef32bb244016ad9af8c8f45398511e7e551b581"
|
2018-01-29 10:02:05 -08:00
|
|
|
//}
|
2018-01-26 08:26:13 -08:00
|
|
|
|
2018-10-15 07:52:03 -07:00
|
|
|
export default web3Config => {
|
|
|
|
let branch;
|
|
|
|
|
|
|
|
switch (web3Config.netId) {
|
|
|
|
case constants.NETID_DAI_TEST:
|
|
|
|
branch = "dai-test";
|
|
|
|
break;
|
|
|
|
case constants.NETID_SOKOL:
|
|
|
|
branch = "sokol";
|
|
|
|
break;
|
|
|
|
case constants.NETID_DAI:
|
|
|
|
branch = "dai";
|
|
|
|
break;
|
|
|
|
case constants.NETID_CORE:
|
|
|
|
default:
|
|
|
|
branch = "core";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
fetch(helpers.addressesURL(branch))
|
|
|
|
.then(response => {
|
|
|
|
response.json().then(json => {
|
|
|
|
resolve({ addresses: json, web3Config });
|
2018-01-30 18:06:34 -08:00
|
|
|
});
|
2018-10-15 07:52:03 -07:00
|
|
|
})
|
|
|
|
.catch(function(err) {
|
|
|
|
let addr = helpers.addressesURL(branch);
|
|
|
|
helpers.wrongRepoAlert(addr);
|
|
|
|
reject(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|