"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.groupCurrenciesByAsset = void 0;
const groupCurrenciesByAsset = (assetsSorted) => {
    const assetMap = new Map();
    if (assetsSorted) {
        for (const item of assetsSorted) {
            const { asset: { id: assetId }, networks = [], } = item;
            if (networks?.length > 0) {
                const mainCurrency = networks.find(c => c.id === assetId) ?? networks[0];
                assetMap.set(assetId, {
                    mainCurrency,
                    currencies: networks,
                });
            }
        }
    }
    return assetMap;
};
exports.groupCurrenciesByAsset = groupCurrenciesByAsset;
//# sourceMappingURL=groupCurrenciesByAsset.js.map