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