var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import React, { useState } from 'react';
import { utils } from 'ethers';
import { Asset } from './Asset';
import './../styles/assetsList.sass';
import './../styles/assetsListDefaults.sass';
import { useAsyncEffect } from '../hooks/useAsyncEffect';
import { getStyleForTopLevelComponent } from '../../core/utils/getStyleForTopLevelComponent';
import { getIconForToken } from '../../core/utils/getIconForToken';
export var Assets = function (_a) {
    var deployedWallet = _a.deployedWallet, className = _a.className;
    var _b = __read(useState([]), 2), tokenDetailsWithBalance = _b[0], setTokenDetailsWithBalance = _b[1];
    useAsyncEffect(function () { return deployedWallet.subscribeToBalances(setTokenDetailsWithBalance); }, []);
    return (React.createElement("div", { className: "universal-login-assets" },
        React.createElement("div", { className: getStyleForTopLevelComponent(className) },
            React.createElement("div", { className: "assets" },
                React.createElement("p", { className: "assets-title" }, "My Assets"),
                React.createElement("div", { className: "assets-list" }, tokenDetailsWithBalance.map(function (_a) {
                    var name = _a.name, symbol = _a.symbol, balance = _a.balance;
                    return (React.createElement(Asset, { key: name + "-" + symbol, sdk: deployedWallet.sdk, name: name, symbol: symbol, balance: utils.formatEther(balance), icon: getIconForToken(symbol), className: className }));
                }))))));
};
//# sourceMappingURL=Assets.js.map