"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAggUnderlying = exports.useScyUnderlying = void 0;
var useQueries_1 = require("../useQueries");
var common_1 = require("../common");
var useScyUnderlying = function (chain, vault) {
    var _a, _b, _c;
    var _d = (0, useQueries_1.useScyVaultSubgraph)(chain, (vault === null || vault === void 0 ? void 0 : vault.address) || ''), subgraph = _d.data, subgraphFailed = _d.failed;
    var uDec = (0, common_1.useFallbackOnce)(subgraphFailed, (_a = subgraph === null || subgraph === void 0 ? void 0 : subgraph.scyVault) === null || _a === void 0 ? void 0 : _a.underlyingDecimals, vault === null || vault === void 0 ? void 0 : vault.underlyingDecimals).res;
    var uAddress = (0, common_1.useFallbackOnce)(subgraphFailed, (_b = subgraph === null || subgraph === void 0 ? void 0 : subgraph.scyVault) === null || _b === void 0 ? void 0 : _b.underlying, vault === null || vault === void 0 ? void 0 : vault.underlying).res;
    var underlying = (0, common_1.useERC20)(chain, uAddress);
    var uSymbol = (0, common_1.useFallbackOnce)(subgraphFailed, (_c = subgraph === null || subgraph === void 0 ? void 0 : subgraph.scyVault) === null || _c === void 0 ? void 0 : _c.underlyingSymbol, underlying === null || underlying === void 0 ? void 0 : underlying.symbol).res;
    return { uAddress: uAddress, uSymbol: uSymbol, uDec: uDec, underlying: underlying };
};
exports.useScyUnderlying = useScyUnderlying;
var useAggUnderlying = function (chain, vault) {
    var _a, _b, _c;
    var _d = (0, useQueries_1.useAggregatorVaultSubgraph)(chain, (vault === null || vault === void 0 ? void 0 : vault.address) || ''), subgraph = _d.data, subgraphFailed = _d.failed;
    var uDec = (0, common_1.useFallbackOnce)(subgraphFailed, (_a = subgraph === null || subgraph === void 0 ? void 0 : subgraph.aggregatorVault) === null || _a === void 0 ? void 0 : _a.underlyingDecimals, vault === null || vault === void 0 ? void 0 : vault.underlyingDecimals).res;
    var uAddress = (0, common_1.useFallbackOnce)(subgraphFailed, (_b = subgraph === null || subgraph === void 0 ? void 0 : subgraph.aggregatorVault) === null || _b === void 0 ? void 0 : _b.underlying, vault === null || vault === void 0 ? void 0 : vault.underlying).res;
    var underlying = (0, common_1.useERC20)(chain, uAddress);
    var uSymbol = (0, common_1.useFallbackOnce)(subgraphFailed, (_c = subgraph === null || subgraph === void 0 ? void 0 : subgraph.aggregatorVault) === null || _c === void 0 ? void 0 : _c.underlyingSymbol, underlying === null || underlying === void 0 ? void 0 : underlying.symbol).res;
    return { uAddress: uAddress, uSymbol: uSymbol, uDec: uDec, underlying: underlying };
};
exports.useAggUnderlying = useAggUnderlying;
//# sourceMappingURL=useUnderlying.js.map