import{useState as r,useMemo as a,useCallback as e,useEffect as t}from"react";import{createPublicClient as n,http as o}from"viem";import{a as i}from"./getPublicClient-D4yNgeGy.mjs";import{u as c}from"./internal-context-dfitw7Ot.mjs";function s({rpcConfig:s,appId:l,address:m,chain:d}){let{chains:p}=c(),[f,u]=r(0n),[h,g]=r(!1),b=a((()=>{let r=d||p[0];if(r)return n({chain:d,transport:o(i(r,s,l))})}),[d,s,l]),j=e((async()=>{if(!m||!b)return;g(!0);let r=await b.getBalance({address:m}).catch(console.error);return r?(u(r),g(!1),r):void 0}),[b,m,u]);return t((()=>{j().catch(console.error)}),[]),{balance:f,isLoading:h,reloadBalance:j}}export{s as u};
//# sourceMappingURL=useWalletBalance-Bnyl87EB.mjs.map
