"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryBase__factory = void 0;
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var constants_1 = require("@across-protocol/constants");
var contracts_1 = require("@across-protocol/contracts");
var sdk_1 = require("@eth-optimism/sdk");
var constants_2 = require("../../constants");
var utils_1 = require("../../utils");
var baseQuery_1 = require("./baseQuery");
var relayFeeCalculator_1 = require("../relayFeeCalculator");
var customGasToken_1 = require("./customGasToken");
var svmQuery_1 = require("./svmQuery");
var fixedGasPrice = (_a = {},
    _a[constants_1.CHAIN_IDs.BOBA] = 1e9,
    _a);
var QueryBase__factory = (function () {
    function QueryBase__factory() {
    }
    QueryBase__factory.create = function (chainId, provider, symbolMapping, spokePoolAddress, relayerAddress, coingeckoProApiKey, logger, coingeckoBaseCurrency) {
        if (symbolMapping === void 0) { symbolMapping = constants_1.TOKEN_SYMBOLS_MAP; }
        if (spokePoolAddress === void 0) { spokePoolAddress = (0, contracts_1.getDeployedAddress)("SpokePool", chainId); }
        if (relayerAddress === void 0) { relayerAddress = (0, relayFeeCalculator_1.getDefaultRelayer)(chainId); }
        if (logger === void 0) { logger = relayFeeCalculator_1.DEFAULT_LOGGER; }
        if (coingeckoBaseCurrency === void 0) { coingeckoBaseCurrency = "eth"; }
        (0, assert_1.default)((0, utils_1.isDefined)(spokePoolAddress));
        var customGasTokenSymbol = constants_2.CUSTOM_GAS_TOKENS[chainId];
        if (customGasTokenSymbol) {
            (0, assert_1.default)(relayerAddress.isEVM());
            return new customGasToken_1.CustomGasTokenQueries({
                queryBaseArgs: [
                    provider,
                    symbolMapping,
                    spokePoolAddress,
                    relayerAddress,
                    logger,
                    coingeckoProApiKey,
                    fixedGasPrice[chainId],
                    "usd",
                ],
                customGasTokenSymbol: customGasTokenSymbol,
            });
        }
        if ((0, utils_1.chainIsSvm)(chainId)) {
            (0, assert_1.default)(relayerAddress.isSVM());
            return new svmQuery_1.SvmQuery(provider, symbolMapping, utils_1.SvmAddress.from(spokePoolAddress), relayerAddress, logger, coingeckoProApiKey, fixedGasPrice[chainId], coingeckoBaseCurrency);
        }
        provider = (0, utils_1.chainIsOPStack)(chainId)
            ? (0, sdk_1.asL2Provider)(provider)
            : provider;
        (0, assert_1.default)(relayerAddress.isEVM());
        return new baseQuery_1.QueryBase(provider, symbolMapping, spokePoolAddress, relayerAddress, logger, coingeckoProApiKey, fixedGasPrice[chainId], coingeckoBaseCurrency);
    };
    return QueryBase__factory;
}());
exports.QueryBase__factory = QueryBase__factory;
//# sourceMappingURL=factory.js.map