@dojoengine/sdk
Version:
Dojo SDK: Build onchain and provable apps faster
2 lines • 598 B
JavaScript
import{useQuery as i}from"@tanstack/react-query";async function p(r,e,n){try{let t=await fetch(`${r}/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:e});if(!t.ok)throw new Error("Failed to fetch data");return n(await t.json())}catch(t){throw console.error("Error fetching data:",t),t}}function y(r,e,n,t){let{data:o,error:u,isPending:a,isRefetching:s}=i({queryKey:[r],queryFn:async()=>await p(t??"http://127.0.0.1:8080",r,e),placeholderData:n??[]});return{data:o,error:u,isPending:a,isRefetching:s}}export{p as queryTorii,y as useToriiSQLQuery};
//# sourceMappingURL=sql.js.map