"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getURL = void 0;
var constants_1 = require("../constants");
var MAINNET_CHAIN_IDs = Object.values(constants_1.MAINNET_CHAIN_IDs);
var endpoints = (_a = {},
    _a[constants_1.CHAIN_IDs.ARBITRUM] = "arb",
    _a[constants_1.CHAIN_IDs.ARBITRUM_SEPOLIA] = "arb-sepolia",
    _a[constants_1.CHAIN_IDs.MAINNET] = "eth",
    _a[constants_1.CHAIN_IDs.SEPOLIA] = "eth-sepolia",
    _a[constants_1.CHAIN_IDs.OPTIMISM] = "opt",
    _a[constants_1.CHAIN_IDs.OPTIMISM_SEPOLIA] = "opt-sepolia",
    _a[constants_1.CHAIN_IDs.WORLD_CHAIN] = "worldchain",
    _a[constants_1.CHAIN_IDs.BSC] = "bnb",
    _a);
function getURL(chainId, apiKey, transport) {
    var _a, _b;
    var chain = (_a = endpoints[chainId]) !== null && _a !== void 0 ? _a : (_b = constants_1.PUBLIC_NETWORKS[chainId]) === null || _b === void 0 ? void 0 : _b.name;
    if (!chain) {
        throw new Error("No known Alchemy provider for chainId ".concat(chainId));
    }
    if (MAINNET_CHAIN_IDs.includes(chainId)) {
        chain = "".concat(chain, "-mainnet");
    }
    chain = chain.toLowerCase().replace(" ", "-");
    return "".concat(transport, "://").concat(chain, ".g.alchemy.com/v2/").concat(apiKey);
}
exports.getURL = getURL;
//# sourceMappingURL=alchemy.js.map