index.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. "use strict";
  2. var __values = (this && this.__values) || function(o) {
  3. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  4. if (m) return m.call(o);
  5. if (o && typeof o.length === "number") return {
  6. next: function () {
  7. if (o && i >= o.length) o = void 0;
  8. return { value: o && o[i++], done: !o };
  9. }
  10. };
  11. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  12. };
  13. var __importDefault = (this && this.__importDefault) || function (mod) {
  14. return (mod && mod.__esModule) ? mod : { "default": mod };
  15. };
  16. Object.defineProperty(exports, "__esModule", { value: true });
  17. exports.chains = exports._getInitializedChains = void 0;
  18. var mainnet_json_1 = __importDefault(require("./mainnet.json"));
  19. var ropsten_json_1 = __importDefault(require("./ropsten.json"));
  20. var rinkeby_json_1 = __importDefault(require("./rinkeby.json"));
  21. var kovan_json_1 = __importDefault(require("./kovan.json"));
  22. var goerli_json_1 = __importDefault(require("./goerli.json"));
  23. /**
  24. * @hidden
  25. */
  26. function _getInitializedChains(customChains) {
  27. var e_1, _a;
  28. var names = {
  29. '1': 'mainnet',
  30. '3': 'ropsten',
  31. '4': 'rinkeby',
  32. '42': 'kovan',
  33. '5': 'goerli',
  34. };
  35. var chains = {
  36. mainnet: mainnet_json_1.default,
  37. ropsten: ropsten_json_1.default,
  38. rinkeby: rinkeby_json_1.default,
  39. kovan: kovan_json_1.default,
  40. goerli: goerli_json_1.default,
  41. };
  42. if (customChains) {
  43. try {
  44. for (var customChains_1 = __values(customChains), customChains_1_1 = customChains_1.next(); !customChains_1_1.done; customChains_1_1 = customChains_1.next()) {
  45. var chain = customChains_1_1.value;
  46. var name_1 = chain.name;
  47. names[chain.chainId.toString()] = name_1;
  48. chains[name_1] = chain;
  49. }
  50. }
  51. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  52. finally {
  53. try {
  54. if (customChains_1_1 && !customChains_1_1.done && (_a = customChains_1.return)) _a.call(customChains_1);
  55. }
  56. finally { if (e_1) throw e_1.error; }
  57. }
  58. }
  59. chains['names'] = names;
  60. return chains;
  61. }
  62. exports._getInitializedChains = _getInitializedChains;
  63. /**
  64. * @deprecated this constant will be internalized (removed)
  65. * on next major version update
  66. */
  67. exports.chains = _getInitializedChains();
  68. //# sourceMappingURL=index.js.map