Internal API Hooks
Every single API call made can be found here, such as Koii SDK
📦api
┣ 📂hooks /* react-query hooks */
┃ ┣ 📜useArtist.ts /* Get the artist details */
┃ ┣ 📜useNft.ts /* Get the NFT details */
┃ ┣ 📜useNfts.ts /* Get all NFTs based on the timeframe, 24 hours, 1 week, 1 month, 1 year & even all of them */
┃ ┗ 📜useNsfw.ts /* Get NFTs marked as nsfw */
┃
┣ 📜finnie.ts /* Api calls to interact with finnie wallet */
┣ 📜index.ts /* Generic api calls */
┣ 📜sdk.ts /* Koii sdk api calls */
┗ 📜upload.ts /* Api related to upload to Koii network */
React-query Queries
Example
import { useQuery } from "react-query";
import axios from "services/axios";
interface Props {
id: string;
}
const fetchNft = async (id: string) => {
try {
if (!id) return undefined;
const { data } = await axios.get(`/attention/nft?id=${id}`);
return data;
} catch (error) {
return undefined;
}
};
export function useNft({ id }: Props) {
return useQuery(`nft-${id}`, () => fetchNft(id), {
staleTime: 60 * 1000 * 60, // 1hr cache, since the nft details does not change.
refetchOnWindowFocus: undefined
});
}Finnie & SDK
Last updated