UNPKG

@cross-nft-marketplace/auction-house-nft-hooks

Version:

Generic react hooks for fetching cross-nft-marketplace auctions, nfts, and data on arbitary 721s. Powers nft-components.

23 lines (22 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCurrenciesInUse = void 0; function getCurrenciesInUse(nftPricing) { var _a, _b, _c, _d, _e, _f, _g; const hasReserve = nftPricing.reserve; if (hasReserve) { const reserveCurrencies = ((_b = (_a = nftPricing.reserve) === null || _a === void 0 ? void 0 : _a.auctionCurrencies) === null || _b === void 0 ? void 0 : _b.map((currency) => currency.id)) || []; const auctionCurrencyId = (_d = (_c = nftPricing.reserve) === null || _c === void 0 ? void 0 : _c.reserveAndBuyNowCurrency) === null || _d === void 0 ? void 0 : _d.id; if (auctionCurrencyId) { reserveCurrencies.push(auctionCurrencyId); } return reserveCurrencies; } const bids = ((_f = (_e = nftPricing.perpetual) === null || _e === void 0 ? void 0 : _e.bids) === null || _f === void 0 ? void 0 : _f.map((bid) => bid.pricing.currency.id)) || []; const ask = (_g = nftPricing.perpetual.ask) === null || _g === void 0 ? void 0 : _g.pricing.currency.id; if (ask) { return [...bids, ask]; } return bids; } exports.getCurrenciesInUse = getCurrenciesInUse;