<commit_before>(function () {
    'use strict';

    const ASSET_NAME_MAP = {
        [WavesApp.defaultAssets.ETH]: 'Ethereum',
        [WavesApp.defaultAssets.EUR]: 'Euro',
        [WavesApp.defaultAssets.USD]: 'US Dollar',
        [WavesApp.defaultAssets.BTC]: 'Bitcoin'
    };

    /**
     * @param {BaseNodeComponent} BaseNodeComponent
     * @param {app.utils} utils
     * @param {User} user
     * @param {EventManager} eventManager
     * @param {app.utils.decorators} decorators
     * @return {Assets}
     */
    const factory = function (BaseNodeComponent, utils, user, eventManager, decorators) {

        class Assets extends BaseNodeComponent {

            /**
             * Get Asset info
             * @param {string} assetId
             * @return {Promise<IAssetInfo>}
             */
            @decorators.cachable()
            info(assetId) {
                return fetch(`https://api.wavesplatform.com/assets/${assetId}`)
                    .then(utils.onFetch)
                    .then((info) => {
                        return Waves.Money.fromCoins(String(info.quantity), info.id)
                            .then((money) => ({
                                id: info.id,
                                name: ASSET_NAME_MAP[info.id] || info.name,
                                description: info.id !== WavesApp.defaultAssets.WAVES ? info.description : '',
                                precision: info.decimals,
                                reissuable: info.reissuable,
                                quantity: money,
                                timestamp: info.timestamp,
                                sender: info.sender,
                                height: info.height,
                                ticker: info.ticker || '',
                                sign: info.sign || ''
                            }));
                    });
            }

            /**
             * Get balance by asset id
             * @param {string} assetId
             * @return {Promise<IAssetWithBalance>}
             */
            balance(assetId) {
                return this.balanceList([assetId])
                    .then(([asset]) => asset);
            }

            /**
             * Get balance list by asset id list
             * @param {string[]} assetIdList<commit_msg>CLIENT-144: add catch for expanded asset id info<commit_after>(function () {
    'use strict';

    const ASSET_NAME_MAP = {
        [WavesApp.defaultAssets.ETH]: 'Ethereum',
        [WavesApp.defaultAssets.EUR]: 'Euro',
        [WavesApp.defaultAssets.USD]: 'US Dollar',
        [WavesApp.defaultAssets.BTC]: 'Bitcoin'
    };

    /**
     * @param {BaseNodeComponent} BaseNodeComponent
     * @param {app.utils} utils
     * @param {User} user
     * @param {EventManager} eventManager
     * @param {app.utils.decorators} decorators
     * @return {Assets}
     */
    const factory = function (BaseNodeComponent, utils, user, eventManager, decorators) {

        class Assets extends BaseNodeComponent {

            /**
             * Get Asset info
             * @param {string} assetId
             * @return {Promise<IAssetInfo>}
             */
            @decorators.cachable()
            info(assetId) {
                return fetch(`https://api.wavesplatform.com/assets/${assetId}`)
                    .then(utils.onFetch)
                    .then((info) => {
                        return Waves.Money.fromCoins(String(info.quantity), info.id)
                            .then((money) => ({
                                id: info.id,
                                name: ASSET_NAME_MAP[info.id] || info.name,
                                description: info.id !== WavesApp.defaultAssets.WAVES ? info.description : '',
                                precision: info.decimals,
                                reissuable: info.reissuable,
                                quantity: money,
                                timestamp: info.timestamp,
                                sender: info.sender,
                                height: info.height,
                                ticker: info.ticker || '',
                                sign: info.sign || ''
                            }));
                    })
                    .catch(() => {
                        if (assetId === WavesApp.defaultAssets.WAVES) {
                            return Waves.Money.fromTokens('100000000', assetId).then((quantity) => ({
                                id: WavesApp.defaultAssets.WAVES,
                                name: 'Waves',
                                precision: 8,
                                reissuable: false,
                                timestamp: 1460408400000,
                                quantity,
                                sender: WavesApp.defaultAssets.WAVES,
                                height: 0,
                                ticker: '',
                                sign: ''
                            }));
                        } else {
                            return Waves.API.Node.v2.transactions.get(assetId).then((info) => ({
                                id: info.id,
                                name: info.name,
                                description: info.description,
                                reissuable: info.reissuable,
                                timestamp: info.timestamp,
                                quantity: info.amount,
                                sender: info.sender,
                                height: info.height,
                                ticker: '',
                                sign: ''
                            }));
                        }
                    });
            }

            /**
             * Get balance by asset id
             * @param {string} assetId
             * @return {Promise<IAssetWithBalance>}
             */
            balance(assetId) {
                return this.balanceList([assetId])
                    .then(([asset]) => asset);
            }

            /**
             * Get balance list by asset id list
             * @param {string[]} assetIdList
{'fraction_non_alphanumeric': 0.10241935483870968, 'fraction_numerical': 0.004516129032258065, 'mean_word_length': 0.9887748556767159, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7655568', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1452, 'n_words': 273}