"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.routerMethod = exports.fallbackRpcs = exports.fallbackPublic = exports.RPC_URLS = exports.UniContracts = exports.getRelevantChains = exports.prodChains = exports.activeChains = exports.PERCENT = exports.GAS_MARGIN = exports.CHAIN_IDS = exports.chainIdToNetwork = exports.DEFAULT_HARVEST_MAX_DELTA = exports.MAX_PRICE_MISMATCH = exports.DEFAULT_GAS_LIMIT = exports.NATIVE_DEC = exports.isNode = exports.isBrowser = exports.PUBLIC_ALCHEMY_ARB = exports.PUBLIC_ALCHEMY_OP = exports.POKT_API_KEY = exports.INFURA_API_KEY = exports.PUBLIC_INFURA_API_KEY = exports.ALCHEMY_OP = exports.ALCHEMY_ARB = exports.ONFINALITY_MOVR_API_KEY = exports.BLAST_MOVR_API_KEY = exports.QUICKNODE_OP = exports.QUICKNODE_ARB = exports.REACT_APP_GAS_STATION_KEY = exports.NODE_ENV = exports.BigNumber = void 0;
var ethers_1 = require("ethers");
Object.defineProperty(exports, "BigNumber", { enumerable: true, get: function () { return ethers_1.BigNumber; } });
var bn_1 = require("./bn");
exports.NODE_ENV = (_a = process.env, _a.NODE_ENV), exports.REACT_APP_GAS_STATION_KEY = _a.REACT_APP_GAS_STATION_KEY, exports.QUICKNODE_ARB = _a.QUICKNODE_ARB, exports.QUICKNODE_OP = _a.QUICKNODE_OP, exports.BLAST_MOVR_API_KEY = _a.BLAST_MOVR_API_KEY, exports.ONFINALITY_MOVR_API_KEY = _a.ONFINALITY_MOVR_API_KEY, exports.ALCHEMY_ARB = _a.ALCHEMY_ARB, exports.ALCHEMY_OP = _a.ALCHEMY_OP, exports.PUBLIC_INFURA_API_KEY = _a.PUBLIC_INFURA_API_KEY, exports.INFURA_API_KEY = _a.INFURA_API_KEY, exports.POKT_API_KEY = _a.POKT_API_KEY, exports.PUBLIC_ALCHEMY_OP = _a.PUBLIC_ALCHEMY_OP, exports.PUBLIC_ALCHEMY_ARB = _a.PUBLIC_ALCHEMY_ARB;
exports.isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
exports.isNode = new Function('try {return this===global;}catch(e){return false;}');
exports.NATIVE_DEC = 18;
// usually we fall under 2000000;
exports.DEFAULT_GAS_LIMIT = 6000000;
exports.MAX_PRICE_MISMATCH = 0; // will fall back to defaultPriceMismatch.
exports.DEFAULT_HARVEST_MAX_DELTA = 1000; // .1%
exports.chainIdToNetwork = {
    1: 'mainnet',
    3: 'ropsten',
    4: 'rinkeby',
    42: 'kovan',
    56: 'bsc',
    137: 'polygon',
    250: 'fantom',
    1337: 'localhost',
    43114: 'avalanche',
    1285: 'moonriver',
    1284: 'moonbeam',
    10: 'optimism',
    42161: 'arbitrum',
};
exports.CHAIN_IDS = {
    mainnet: 1,
    localhost: 1337,
    hardhat: 1337,
    rinkeby: 4,
    ropsten: 3,
    bsc: 56,
    polygon: 137,
    avalanche: 43114,
    fantom: 250,
    moonriver: 1285,
    moonbeam: 1284,
    optimism: 10,
    arbitrum: 42161,
};
exports.GAS_MARGIN = (0, bn_1.toBN)(1000); // 10% in basis
exports.PERCENT = (0, bn_1.toBN)(10000); // 100% in basis
exports.activeChains = [
    'moonriver',
    'optimism',
    'arbitrum',
    'mainnet',
];
exports.prodChains = [
    'moonriver',
    'optimism',
    'arbitrum',
    'mainnet',
];
function getRelevantChains(chain) {
    if (chain && chain !== 'ALL')
        return [chain];
    if (exports.NODE_ENV === 'development')
        return __spreadArray(['ALL', 'localhost'], __read(exports.activeChains), false);
    return __spreadArray(['ALL'], __read(exports.prodChains), false);
}
exports.getRelevantChains = getRelevantChains;
exports.UniContracts = ['UNISWAP_FACTORY', 'UNISWAP_ROUTER'];
exports.RPC_URLS = {
    mainnet: 'https://mainnet.infura.io/v3/' + exports.PUBLIC_INFURA_API_KEY,
    optimism: (0, exports.isBrowser)()
        ? 'https://rpc.ankr.com/optimism/' // just in case, don't use public provider on backend
        : 'https://opt-mainnet.g.alchemy.com/v2/' + exports.PUBLIC_ALCHEMY_OP,
    arbitrum: (0, exports.isBrowser)()
        ? 'https://rpc.ankr.com/arbitrum/' //  public provider fails on static calls
        : 'https://arb-mainnet.g.alchemy.com/v2/' + exports.PUBLIC_ALCHEMY_ARB,
    avalanche: 'https://api.avax.network/ext/bc/C/rpc',
    fantom: 'https://rpc.ftm.tools/',
    moonriver: 'https://rpc.api.moonriver.moonbeam.network',
    moonbeam: 'https://rpc.api.moonbeam.network',
    hardhat: 'http://localhost:8545',
    localhost: 'http://127.0.0.1:8545/',
    ALL: '',
};
exports.fallbackPublic = {
    mainnet: [
        'https://eth.llamarpc.com',
        'https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7',
        'https://eth.rpc.blxrbdn.com',
        'https://virginia.rpc.blxrbdn.com',
        'https://ethereum.blockpi.network/v1/rpc/public',
        'https://rpc.ankr.com/eth',
        'https://ethereum.publicnode.com',
        'https://rpc.flashbots.net',
    ],
    arbitrum: ['https://arbitrum.public-rpc.com'],
};
exports.fallbackRpcs = {
    mainnet: ['https://mainnet.infura.io/v3/' + exports.PUBLIC_INFURA_API_KEY],
    arbitrum: [
        "https://arb-mainnet.g.alchemy.com/v2/".concat(exports.ALCHEMY_ARB),
        exports.QUICKNODE_ARB,
    ],
    optimism: [
        'https://rpc.ankr.com/optimism/',
        "https://opt-mainnet.g.alchemy.com/v2/".concat(exports.ALCHEMY_OP),
        exports.QUICKNODE_OP,
    ],
    fantom: [
        // 'https://fantom-mainnet.blastapi.io/e5671d53-d034-4f56-96d5-2ea8cc16759c',
        'https://rpcapi.fantom.network/',
        'https://rpc.ankr.com/fantom/',
        // 'wss://fantom-mainnet.blastapi.io/02c6997f-72bc-4e25-b903-cd733694dad0',
    ],
    moonriver: [
        "https://moonriver.api.onfinality.io/rpc?apikey=".concat(exports.ONFINALITY_MOVR_API_KEY),
        'https://moonriver.blastapi.io/' + exports.BLAST_MOVR_API_KEY,
        "https://moonriver-mainnet.gateway.pokt.network/v1/lb/".concat(exports.POKT_API_KEY),
    ],
    avalanche: [
        'https://ava-api-c-chain.bwarelabs.com/9d5eca2f-12bf-4b9a-9382-81aa641f5959',
        'https://rpc.ankr.com/avalanche',
    ],
    moonbeam: [
        'https://moonbeam.blastapi.io/adaf1bc9-23d5-4455-b777-7afa6c14c0f8',
        'https://moonbeam.api.onfinality.io/rpc?apikey=cd5a0801-2eb3-414f-8735-c93b709d30df',
    ],
    localhost: [],
};
var routerMethod = function (method, swap) {
    switch (swap) {
        case 'pangolin':
        case 'traderJoe':
            return method.replace('ETH', 'AVAX');
        case 'solidly':
            return method.replace('ETH', 'FTM');
        default:
            return method;
    }
};
exports.routerMethod = routerMethod;
//# sourceMappingURL=constants.js.map