"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useTokensMarketPrice = void 0;
var react_1 = require("react");
var async_1 = require("../async");
var utils_1 = require("../../utils");
function useTokensMarketPrice(_a) {
    var base = _a.base, quote = _a.quote;
    var basePrice = (0, async_1.useAsync)(utils_1.getPriceById, [(base === null || base === void 0 ? void 0 : base.symbol) || ''], {
        condition: !!(base === null || base === void 0 ? void 0 : base.symbol),
        deps: [base === null || base === void 0 ? void 0 : base.symbol],
    }).res;
    var quotePrice = (0, async_1.useAsync)(utils_1.getPriceById, [(quote === null || quote === void 0 ? void 0 : quote.symbol) || ''], {
        condition: !!(quote === null || quote === void 0 ? void 0 : quote.symbol),
        deps: [quote === null || quote === void 0 ? void 0 : quote.symbol],
    }).res;
    var marketPrice = (0, react_1.useMemo)(function () {
        if (!basePrice || !quotePrice)
            return;
        return basePrice / quotePrice;
    }, [basePrice, quotePrice]);
    return { basePrice: basePrice, quotePrice: quotePrice, marketPrice: marketPrice };
}
exports.useTokensMarketPrice = useTokensMarketPrice;
//# sourceMappingURL=useTokensMarketPrice.js.map