"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 _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.walletConnectV2Hooks = exports.walletConnectV2 = void 0;
var core_1 = require("@web3-react/core");
var walletconnect_v2_1 = require("@web3-react/walletconnect-v2");
var constants_1 = require("../constants");
var _b = process.env.PUBLIC_WALLETCONNECT, PUBLIC_WALLETCONNECT = _b === void 0 ? '' : _b;
var rpc = {};
Object.keys(constants_1.RPC_URLS).forEach(function (network) {
    var id = constants_1.CHAIN_IDS[network];
    if (!id)
        return;
    rpc[id] = constants_1.RPC_URLS[network];
});
var chains = constants_1.activeChains.map(function (x) { return Number(constants_1.CHAIN_IDS[x]); });
exports.walletConnectV2 = (_a = __read((0, core_1.initializeConnector)(function (actions) {
    return new walletconnect_v2_1.WalletConnect({
        actions: actions,
        options: {
            projectId: PUBLIC_WALLETCONNECT,
            chains: [1],
            optionalChains: chains,
            showQrModal: true,
            rpcMap: rpc,
        },
    });
}), 2), _a[0]), exports.walletConnectV2Hooks = _a[1];
//# sourceMappingURL=walletconnectv2.js.map