"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAggregatorVault = exports.useScyVault = void 0;
var react_1 = require("react");
var common_1 = require("../common");
var typechain_1 = require("../../typechain");
var useVaultType_1 = require("./useVaultType");
var vaults_1 = require("../../vaults");
function useScyVault(chain, address) {
    var vaultType = (0, useVaultType_1.useVaultType)(chain, address).vaultType;
    var signerOrProvider = (0, common_1.useSignerOrProvider)(chain);
    return (0, react_1.useMemo)(function () {
        if (!address || !signerOrProvider)
            return;
        if (vaultType === vaults_1.VaultType.SCYWEpochVault) {
            return typechain_1.SCYWEpochVault__factory.connect(address, signerOrProvider);
        }
        else {
            return typechain_1.SCYVault__factory.connect(address, signerOrProvider);
        }
    }, [address, signerOrProvider, vaultType]);
}
exports.useScyVault = useScyVault;
function useAggregatorVault(chain, address) {
    var vaultType = (0, useVaultType_1.useVaultType)(chain, address).vaultType;
    var signerOrProvider = (0, common_1.useSignerOrProvider)(chain);
    return (0, react_1.useMemo)(function () {
        if (!address || !signerOrProvider)
            return;
        if (vaultType === vaults_1.VaultType.AggregatorWEpochVault) {
            return typechain_1.AggregatorWEpochVault__factory.connect(address, signerOrProvider);
        }
        else {
            return typechain_1.AggregatorVault__factory.connect(address, signerOrProvider);
        }
    }, [address, signerOrProvider, vaultType]);
}
exports.useAggregatorVault = useAggregatorVault;
//# sourceMappingURL=useVault.js.map