"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useGetBalance", {
    enumerable: true,
    get: function() {
        return useGetBalance;
    }
});
const _react = require("react");
function useGetBalance(token, fetchBalance) {
    const [balance, setBalance] = (0, _react.useState)("");
    const [loading, setLoading] = (0, _react.useState)(false);
    (0, _react.useEffect)(()=>{
        if (loading) return;
        setLoading(true);
        fetchBalance(token.address, token.decimals).then((balance)=>{
            setBalance(balance);
        }, (error)=>{}).finally(()=>{
            setLoading(false);
        });
    }, [
        token
    ]);
    return {
        balance,
        loading
    };
}

//# sourceMappingURL=useGetBalance.js.map