@cryptoalgebra/alm-sdk
Version:
Algebra ALM SDK
18 lines • 963 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("../graphql/constants");
function getGraphUrls(chainId, dex, isGraphRequired) {
var _a, _b;
var url = (_a = constants_1.graphUrls[chainId][dex]) === null || _a === void 0 ? void 0 : _a.url;
var publishedUrl = (_b = constants_1.graphUrls[chainId][dex]) === null || _b === void 0 ? void 0 : _b.publishedUrl;
// const publishedUrl =
// process.env.SUBGRAPH_API_KEY &&
// graphUrls[chainId]![dex]?.publishedUrl.replace('[api-key]', process.env.SUBGRAPH_API_KEY);
if (!url)
throw new Error("Unsupported DEX ".concat(dex, " on chain ").concat(chainId));
if (url === 'none' && isGraphRequired)
throw new Error("Function not available for DEX ".concat(dex, " on chain ").concat(chainId));
return { url: url, publishedUrl: publishedUrl };
}
exports.default = getGraphUrls;
//# sourceMappingURL=getGraphUrls.js.map