"use strict";
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./factories"));
const originalWindow = Object.assign({}, window);
function mockEthereumBrowser({ support = 'modern', options = {
    networkId: 1,
    loaded: true,
}, }) {
    const { networkId, loaded } = options;
    if (support === 'modern') {
        window = Object.assign(window, {
            ethereum: {
                networkVersion: loaded ? `${networkId}` : undefined,
            },
        });
    }
    if (support === 'legacy') {
        window = Object.assign(window, {
            web3: {
                version: networkId,
            },
        });
    }
    return {
        restore: () => {
            window = originalWindow;
        },
        load: () => {
            if (support === 'modern') {
                window.ethereum.networkVersion = `${networkId}`;
            }
            if (support === 'legacy') {
                window.web3.version = `${networkId}`;
            }
        },
    };
}
exports.mockEthereumBrowser = mockEthereumBrowser;
//# sourceMappingURL=index.js.map