From 102d984018e028aa1c2ec244c71da35085d0fe57 Mon Sep 17 00:00:00 2001 From: michalrozekariane Date: Tue, 19 Mar 2024 14:16:11 +0000 Subject: [PATCH] deploy: 7ec278a0fb73eff2ffbf35cdad36e549e2da8fcb --- assets/{index-C45wNpXZ.js => index-Ca8cwPQR.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-C45wNpXZ.js => index-Ca8cwPQR.js} (99%) diff --git a/assets/index-C45wNpXZ.js b/assets/index-Ca8cwPQR.js similarity index 99% rename from assets/index-C45wNpXZ.js rename to assets/index-Ca8cwPQR.js index 171256c..1211adb 100644 --- a/assets/index-C45wNpXZ.js +++ b/assets/index-Ca8cwPQR.js @@ -43,4 +43,4 @@ Error generating stack: `+i.message+` - less than the value passed to \`max\` (or ${yl} if no \`max\` prop is set) - \`null\` if the progress is indeterminate. -Defaulting to \`null\`.`}const Sy=xy,Dx=Mx,Ey=j.forwardRef(({className:e,value:t,...n},r)=>H.jsx(Sy,{ref:r,className:yn("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:H.jsx(Dx,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ey.displayName=Sy.displayName;const zx=({setTokenId:e,setAccountIds:t,setShouldFetch:n,isFetching:r,fetchedAccountsBalance:s})=>{const[i,o]=j.useState(0),[a,l]=j.useState(0),u=kw({resolver:Tx(Sx),defaultValues:{tokenId:"",accountIds:""}}),c=({tokenId:h,accountIds:g})=>{e(h),o(np(g).length),t(np(g)),n(!0)},p=(h,g)=>h/g*100;return j.useEffect(()=>{l(p(s,i)),!r&&s===i&&l(0)},[i,s,r]),H.jsx(Sw,{...u,children:H.jsxs("form",{onSubmit:u.handleSubmit(c),className:"space-y-8",children:[H.jsxs("div",{className:"mt-10 flex items-start justify-center gap-2",children:[H.jsx("div",{className:"w-full sm:w-1/3",children:H.jsx(Xf,{control:u.control,name:"tokenId",render:({field:h})=>H.jsxs(oc,{children:[H.jsx(ac,{children:dt.tokenId}),H.jsx(lc,{children:H.jsx(Qm,{"data-testid":"tokenId",placeholder:dt.exampleTokenId,...h})}),H.jsx(uc,{})]})})}),H.jsx("div",{className:"w-full sm:w-1/3",children:H.jsx(Xf,{control:u.control,name:"accountIds",render:({field:h})=>H.jsxs(oc,{children:[H.jsx(ac,{children:dt.accountIds}),H.jsx(lc,{children:H.jsx(md,{"data-testid":"accountIds",placeholder:dt.exampleAccountIds,...h})}),H.jsx(uc,{})]})})})]}),H.jsx("div",{className:"flex items-center justify-center",children:H.jsx("div",{className:"w-full sm:w-[68%]",children:r?H.jsx(Ey,{className:"mt-6",value:a}):H.jsx(cd,{"data-testid":"submit",className:"w-full",disabled:r,type:"submit",children:dt.buildList})})})]})})},Wa=e=>`https://${e==="mainnet"?"mainnet-public":e}.mirrornode.hedera.com`,$x=async(e,t,n)=>(await(await fetch(`${Wa(n)}/api/v1/tokens/${t}/balances?account.id=${e}`)).json()).balances.length>0,Vx=async(e,t)=>(await(await fetch(`${Wa(t)}/api/v1/accounts/${e}`)).json()).max_automatic_token_associations,Ux=async(e,t,n)=>{let r=`${Wa(t)}/api/v1/accounts/${e}/tokens?limit=100`,s=0;do{if(s>=n)break;const o=await(await fetch(r)).json();for(const a of o.tokens)a.automatic_association&&s++;r=o.links.next?`${Wa(t)}${o.links.next}`:""}while(r);return s},Bx=async(e,t,n,r)=>{const s=[];for(const[i,o]of e.entries()){if(r&&r(i+1),await $x(o,t,n)){s.push(o);continue}const l=await Vx(o,n);if(!l)continue;const u=await Ux(o,n,l);l>u&&s.push(o)}return s},Zx="mainnet",Qx=()=>{const[e,t]=j.useState(""),[n,r]=j.useState([]),[s,i]=j.useState(!1),[o,a]=j.useState(0),{data:l=[],error:u,isFetching:c,isFetched:p,isSuccess:h}=x1({enabled:s,retry:0,throwOnError:!1,queryKey:["balances"],queryFn:()=>Bx(n,e,Zx,a)}),g=async x=>{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(x),Hl.success(dt.copiedToClipboard);return}else{const _=document.createElement("textarea");_.value=x,_.style.position="absolute",_.style.left="-999999px",document.body.prepend(_),_.select();try{document.execCommand("copy")}catch(C){console.error(C)}finally{_.remove()}}};return j.useEffect(()=>{!c&&h&&Hl.success(dt.successfullyFetchedData)},[h,c]),j.useEffect(()=>{u&&Hl.error(u.toString())},[u]),j.useEffect(()=>{!c&&p&&i(!1)},[p,c]),H.jsxs("div",{className:"container mx-auto",children:[H.jsxs("h1",{className:"mt-20 scroll-m-20 text-center text-4xl font-extrabold tracking-tight lg:text-5xl",children:[dt.title," lorem ipsum"]}),H.jsx("p",{className:"text-center leading-7 [&:not(:first-child)]:mt-6",children:dt.description}),H.jsx("div",{className:"mb-20 mt-5",children:H.jsx(zx,{setTokenId:t,setAccountIds:r,setShouldFetch:i,isFetching:c,fetchedAccountsBalance:o})}),p||c?c?H.jsxs("div",{className:"flex w-full flex-col space-y-3",children:[H.jsx(Ql,{className:"h-5 w-[120px]"}),H.jsx(Ql,{className:"h-[200px] w-full rounded-xl"}),H.jsx(Ql,{className:"!mt-5 h-10 w-full"})]}):H.jsx(H.Fragment,{children:H.jsxs("div",{className:"grid w-full gap-5",children:[H.jsxs(fd,{htmlFor:"holders",children:[l.length," ",dt.outOf," ",n.length," ",dt.textAreaLabel," ",e]}),H.jsx(md,{"data-testid":"response",readOnly:!0,className:"min-h-[200px]",id:"holders",value:l.join(", ")}),H.jsx(cd,{onClick:async()=>{await g(l.join(", "))},children:dt.copyToClipboard})]})}):null]})},Hx=j.createContext(void 0),Wx={setTheme:e=>{},themes:[]},Kx=()=>{var e;return(e=j.useContext(Hx))!==null&&e!==void 0?e:Wx},Gx=({...e})=>{const{theme:t="system"}=Kx();return H.jsx(V1,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},Yx=new n1({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});Xl.createRoot(document.getElementById("root")).render(H.jsx(b.StrictMode,{children:H.jsxs(a1,{client:Yx,children:[H.jsx(Qx,{}),H.jsx(Gx,{})]})})); +Defaulting to \`null\`.`}const Sy=xy,Dx=Mx,Ey=j.forwardRef(({className:e,value:t,...n},r)=>H.jsx(Sy,{ref:r,className:yn("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:H.jsx(Dx,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ey.displayName=Sy.displayName;const zx=({setTokenId:e,setAccountIds:t,setShouldFetch:n,isFetching:r,fetchedAccountsBalance:s})=>{const[i,o]=j.useState(0),[a,l]=j.useState(0),u=kw({resolver:Tx(Sx),defaultValues:{tokenId:"",accountIds:""}}),c=({tokenId:h,accountIds:g})=>{e(h),o(np(g).length),t(np(g)),n(!0)},p=(h,g)=>h/g*100;return j.useEffect(()=>{l(p(s,i)),!r&&s===i&&l(0)},[i,s,r]),H.jsx(Sw,{...u,children:H.jsxs("form",{onSubmit:u.handleSubmit(c),className:"space-y-8",children:[H.jsxs("div",{className:"mt-10 flex items-start justify-center gap-2",children:[H.jsx("div",{className:"w-full sm:w-1/3",children:H.jsx(Xf,{control:u.control,name:"tokenId",render:({field:h})=>H.jsxs(oc,{children:[H.jsx(ac,{children:dt.tokenId}),H.jsx(lc,{children:H.jsx(Qm,{"data-testid":"tokenId",placeholder:dt.exampleTokenId,...h})}),H.jsx(uc,{})]})})}),H.jsx("div",{className:"w-full sm:w-1/3",children:H.jsx(Xf,{control:u.control,name:"accountIds",render:({field:h})=>H.jsxs(oc,{children:[H.jsx(ac,{children:dt.accountIds}),H.jsx(lc,{children:H.jsx(md,{"data-testid":"accountIds",placeholder:dt.exampleAccountIds,...h})}),H.jsx(uc,{})]})})})]}),H.jsx("div",{className:"flex items-center justify-center",children:H.jsx("div",{className:"w-full sm:w-[68%]",children:r?H.jsx(Ey,{className:"mt-6",value:a}):H.jsx(cd,{"data-testid":"submit",className:"w-full",disabled:r,type:"submit",children:dt.buildList})})})]})})},Wa=e=>`https://${e==="mainnet"?"mainnet-public":e}.mirrornode.hedera.com`,$x=async(e,t,n)=>(await(await fetch(`${Wa(n)}/api/v1/tokens/${t}/balances?account.id=${e}`)).json()).balances.length>0,Vx=async(e,t)=>(await(await fetch(`${Wa(t)}/api/v1/accounts/${e}`)).json()).max_automatic_token_associations,Ux=async(e,t,n)=>{let r=`${Wa(t)}/api/v1/accounts/${e}/tokens?limit=100`,s=0;do{if(s>=n)break;const o=await(await fetch(r)).json();for(const a of o.tokens)a.automatic_association&&s++;r=o.links.next?`${Wa(t)}${o.links.next}`:""}while(r);return s},Bx=async(e,t,n,r)=>{const s=[];for(const[i,o]of e.entries()){if(r&&r(i+1),await $x(o,t,n)){s.push(o);continue}const l=await Vx(o,n);if(!l)continue;const u=await Ux(o,n,l);l>u&&s.push(o)}return s},Zx="mainnet",Qx=()=>{const[e,t]=j.useState(""),[n,r]=j.useState([]),[s,i]=j.useState(!1),[o,a]=j.useState(0),{data:l=[],error:u,isFetching:c,isFetched:p,isSuccess:h}=x1({enabled:s,retry:0,throwOnError:!1,queryKey:["balances"],queryFn:()=>Bx(n,e,Zx,a)}),g=async x=>{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(x),Hl.success(dt.copiedToClipboard);return}else{const _=document.createElement("textarea");_.value=x,_.style.position="absolute",_.style.left="-999999px",document.body.prepend(_),_.select();try{document.execCommand("copy")}catch(C){console.error(C)}finally{_.remove()}}};return j.useEffect(()=>{!c&&h&&Hl.success(dt.successfullyFetchedData)},[h,c]),j.useEffect(()=>{u&&Hl.error(u.toString())},[u]),j.useEffect(()=>{!c&&p&&i(!1)},[p,c]),H.jsxs("div",{className:"container mx-auto",children:[H.jsx("h1",{className:"mt-20 scroll-m-20 text-center text-4xl font-extrabold tracking-tight lg:text-5xl",children:dt.title}),H.jsx("p",{className:"text-center leading-7 [&:not(:first-child)]:mt-6",children:dt.description}),H.jsx("div",{className:"mb-20 mt-5",children:H.jsx(zx,{setTokenId:t,setAccountIds:r,setShouldFetch:i,isFetching:c,fetchedAccountsBalance:o})}),p||c?c?H.jsxs("div",{className:"flex w-full flex-col space-y-3",children:[H.jsx(Ql,{className:"h-5 w-[120px]"}),H.jsx(Ql,{className:"h-[200px] w-full rounded-xl"}),H.jsx(Ql,{className:"!mt-5 h-10 w-full"})]}):H.jsx(H.Fragment,{children:H.jsxs("div",{className:"grid w-full gap-5",children:[H.jsxs(fd,{htmlFor:"holders",children:[l.length," ",dt.outOf," ",n.length," ",dt.textAreaLabel," ",e]}),H.jsx(md,{"data-testid":"response",readOnly:!0,className:"min-h-[200px]",id:"holders",value:l.join(", ")}),H.jsx(cd,{onClick:async()=>{await g(l.join(", "))},children:dt.copyToClipboard})]})}):null]})},Hx=j.createContext(void 0),Wx={setTheme:e=>{},themes:[]},Kx=()=>{var e;return(e=j.useContext(Hx))!==null&&e!==void 0?e:Wx},Gx=({...e})=>{const{theme:t="system"}=Kx();return H.jsx(V1,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},Yx=new n1({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});Xl.createRoot(document.getElementById("root")).render(H.jsx(b.StrictMode,{children:H.jsxs(a1,{client:Yx,children:[H.jsx(Qx,{}),H.jsx(Gx,{})]})})); diff --git a/index.html b/index.html index 15540de..7a11504 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Hedera airdrop helper - +