"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useUserVaultBalanceSubgraph = exports.useUserBalancesSubgraph = void 0;
var utils_1 = require("../../../utils");
var types_1 = require("../../../gql/types");
var client_1 = require("@apollo/client");
var getUserBalancesQuery_1 = require("../../../gql/subgraphQueries/getUserBalancesQuery");
var useError_1 = require("../../useError");
var useUserBalancesSubgraph = function (chain, account) {
    var query = (0, client_1.useQuery)(getUserBalancesQuery_1.USER_BALANCES_QUERY, {
        context: { chain: chain },
        variables: { account: account, network: (0, utils_1.fixChainId)(chain) || '' },
        pollInterval: 20000,
    });
    var error = query.error;
    (0, useError_1.useError)(error);
    return query;
};
exports.useUserBalancesSubgraph = useUserBalancesSubgraph;
var useUserVaultBalanceSubgraph = function (chain, account, vaultAddress) {
    var vaultId = (0, utils_1.getSgId)(vaultAddress, chain);
    var query = (0, types_1.useUserVaultBalanceQuery)({
        context: { chain: chain },
        variables: {
            account: account === null || account === void 0 ? void 0 : account.toLowerCase(),
            vaultId: vaultId,
            network: (0, utils_1.fixChainId)(chain) || '',
        },
        pollInterval: 20000,
    });
    var error = query.error;
    (0, useError_1.useError)(error);
    return query;
};
exports.useUserVaultBalanceSubgraph = useUserVaultBalanceSubgraph;
//# sourceMappingURL=useUserBalancesSubgraph.js.map