"use strict";var e=require("react"),r=require("viem"),t=require("./getPublicClient-CFd_sHBk.js"),a=require("./internal-context-CdsQ3LEl.js");exports.useWalletBalance=function({rpcConfig:n,appId:c,address:i,chain:s}){let{chains:l}=a.usePrivyInternal(),[u,o]=e.useState(0n),[d,p]=e.useState(!1),h=e.useMemo((()=>{let e=s||l[0];if(e)return r.createPublicClient({chain:s,transport:r.http(t.getJsonRpcEndpointFromChain(e,n,c))})}),[s,n,c]),f=e.useCallback((async()=>{if(!i||!h)return;p(!0);let e=await h.getBalance({address:i}).catch(console.error);return e?(o(e),p(!1),e):void 0}),[h,i,o]);return e.useEffect((()=>{f().catch(console.error)}),[]),{balance:u,isLoading:d,reloadBalance:f}};
//# sourceMappingURL=useWalletBalance-BvG77-8u.js.map
