From 46d9ffa76e727facd14eaa9c6fdcec47cd22834e Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Thu, 29 Aug 2024 14:47:29 -0400 Subject: [PATCH] - complete the claiming process per nftOwner - add fetching of all images when a user goes straight to claimed through controller --- src/App.tsx | 9 +- src/components/Icons.tsx | 131 +++++---------------- src/containers/Claim.tsx | 221 ++++++++++++++++++++++++----------- src/containers/Claimed.tsx | 117 +++++++++++-------- src/hooks/graphql/queries.ts | 75 +++++++++--- src/hooks/useSyscalls.ts | 15 ++- src/hooks/useUIStore.ts | 8 ++ src/lib/constants.ts | 53 +++++---- src/lib/networkConfig.ts | 2 +- src/lib/types.ts | 6 + vite.config.ts | 8 +- 11 files changed, 371 insertions(+), 274 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 60fb392..539222f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,23 +23,24 @@ const App = () => { setUsername, fetchingMetadata, setFetchingMetadata, + freeGamesData, } = useUIStore(); const { connector } = useConnect(); const network: Network = import.meta.env.VITE_NETWORK; - console.log(claimedData); + // console.log(claimedData); useEffect(() => { if ( - claimedData.length > 0 && + freeGamesData.length > 0 && fetchingMetadata && connector?.id.includes("cartridge") ) { const fetchImages = async () => { const adventurersMetadata = await Promise.all( - claimedData.map((claimed) => + freeGamesData.map((claimed) => fetchAdventurerMetadata( networkConfig[network!].gameAddress, claimed.adventurerId, @@ -57,8 +58,6 @@ const App = () => { } }, [claimedData, fetchingMetadata, connector]); - console.log(claimed); - useEffect(() => { if (connector?.id.includes("cartridge")) { const init = async () => { diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx index 357e605..5806c8f 100644 --- a/src/components/Icons.tsx +++ b/src/components/Icons.tsx @@ -14,109 +14,34 @@ export const CompleteIcon: React.FC = () => ( ); export const TwitterIcon: React.FC = () => ( - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + ); diff --git a/src/containers/Claim.tsx b/src/containers/Claim.tsx index 875c868..4f046d5 100644 --- a/src/containers/Claim.tsx +++ b/src/containers/Claim.tsx @@ -1,23 +1,27 @@ -import { useCallback, useEffect, useState } from "react"; +import { useCallback, useEffect, useState, useMemo } from "react"; import { Button } from "../components/Button"; import { useUiSounds, soundSelector } from "../hooks/useUISound"; import { useAccount, useConnect, useDisconnect } from "@starknet-react/core"; import { getCartridgeConnector, getWalletConnectors } from "../lib/connectors"; import { CartridgeIcon, CompleteIcon } from "../components/Icons"; -import { collectionsData } from "../lib/constants"; +import { collectionsData, GAMES_PER_TOKEN } from "../lib/constants"; import { displayAddress, padAddress } from "../lib/utils"; import useSyscalls from "../hooks/useSyscalls"; import { useUIStore } from "../hooks/useUIStore"; import { Network } from "../lib/types"; import { networkConfig } from "../lib/networkConfig"; import { useQuery } from "@apollo/client"; -import { getGamesByNftOwner } from "../hooks/graphql/queries"; +import { + getTokensByNftOwner, + getGamesByTokens, +} from "../hooks/graphql/queries"; const Claim = () => { const [nftWallet, setNftWallet] = useState(""); const [controllerAccount, setControllerAccount] = useState(""); const [claimedGames, setClaimedGames] = useState([]); const [selectSkip, setSelectSkip] = useState(false); + const [hashList, setHashList] = useState([]); const { play: clickPlay } = useUiSounds(soundSelector.click); const { setClaiming, @@ -27,6 +31,10 @@ const Claim = () => { setClaimedData, setPreparingClaim, setFetchingMetadata, + alreadyClaimed, + setAlreadyClaimed, + freeGamesData, + setFreeGamesData, } = useUIStore(); const { connectors, connect, connector } = useConnect(); @@ -37,42 +45,100 @@ const Claim = () => { const walletConnectors = getWalletConnectors(connectors); - const freeGamesAvailable = claimedData.filter( - (token: any) => !token.freeGameUsed - ); - const tokenByOwnerVariables = { ownerAddress: address ? address : "0x0", }; - const { refetch } = useQuery(getGamesByNftOwner, { + const { refetch: refetchNftOwner } = useQuery(getTokensByNftOwner, { variables: tokenByOwnerVariables, skip: !address, fetchPolicy: "network-only", }); - const fetchData = useCallback(async () => { + const gamesByTokensVariables = { + hashList: hashList, + }; + + const { refetch: refetchGameOwner } = useQuery(getGamesByTokens, { + variables: gamesByTokensVariables, + skip: hashList.length === 0, + fetchPolicy: "network-only", + }); + + const fetchNftData = useCallback(async () => { if (connector?.id !== "cartridge") { - const data: any = await refetch({ + const data: any = await refetchNftOwner({ ownerAddress: address ? address : "0x0", }); - const tokensData = data ? data.data.tokensWithFreeGameStatus : []; + const tokensData = data ? data.data.tokens : []; setClaimedData(tokensData); + setHashList(tokensData.map((token: any) => token.hash)); } }, [address, connector]); + const fetchGameData = useCallback(async () => { + if (connector?.id !== "cartridge") { + const data: any = await refetchGameOwner({ + hashList: hashList, + }); + const tokensData = data ? data.data.claimedFreeGames : []; + setFreeGamesData(tokensData); + } + }, [address, connector, hashList]); + useEffect(() => { - if (address) { - fetchData(); + if (address && freeGamesData.length === 0) { + fetchNftData(); + fetchGameData(); } - }, [address]); + }, [address, hashList]); + + const mergeGameData = useCallback(() => { + // Create a map to store the count of free games for each hash + const freeGameCountMap: { [hash: string]: number } = {}; + freeGamesData.forEach((freeGame: any) => { + freeGameCountMap[freeGame.hash] = + (freeGameCountMap[freeGame.hash] || 0) + 1; + }); + + const mergedData = claimedData.map((claimedItem: any) => { + const freeGamesUsed = freeGameCountMap[claimedItem.hash] || 0; + const freeGamesAvailable = + GAMES_PER_TOKEN[padAddress(claimedItem.token)] || 1; + + return { + ...claimedItem, + freeGamesUsed, + freeGamesAvailable: Math.max(0, freeGamesAvailable - freeGamesUsed), + allFreeGamesUsed: freeGamesUsed >= freeGamesAvailable, + }; + }); + + return mergedData; + }, [claimedData, freeGamesData]); + + const { freeGamesAvailable, totalFreeGamesAvailable } = useMemo(() => { + const mergedData = mergeGameData(); + const availableTokens = mergedData.filter( + (token: any) => token.freeGamesAvailable > 0 + ); + const totalAvailable = mergedData.reduce( + (sum, token) => sum + token.freeGamesAvailable, + 0 + ); + return { + freeGamesAvailable: availableTokens, + totalFreeGamesAvailable: totalAvailable, + }; + }, [mergeGameData]); useEffect(() => { if (account && claimedData.length > 0 && freeGamesAvailable.length === 0) { - console.log("CLAIMED NOW"); - setClaimed(true); + setAlreadyClaimed(true); } - }, [freeGamesAvailable]); + }, [account, claimedData]); + + console.log(freeGamesAvailable); const handleCartridgeOnboarding = async () => { clickPlay(); @@ -87,8 +153,6 @@ const Claim = () => { } }; - console.log(account); - const executeClaimProcess = async () => { try { // setDelegateAccount(address!); @@ -136,8 +200,6 @@ const Claim = () => { } }, [connector, account]); - console.log(controllerAccount); - useEffect(() => { if (connector?.id !== "cartridge" && account) { if (controllerAccount && !claimed) { @@ -150,19 +212,19 @@ const Claim = () => { } }, [connector, account]); - const getCollectionFreeGames = (tokens: string[]) => { - return freeGamesAvailable.filter((item: any) => - tokens.includes(padAddress(item.token)) - ); + const getCollectionFreeGames = (token: string) => { + return freeGamesAvailable + .filter((game) => padAddress(game.token) === token) + .reduce((sum, token) => sum + token.freeGamesAvailable, 0); }; const renderCollection = ( - tokens: string[], + token: string, image: string, alt: string, index: number ) => { - const freeGames = getCollectionFreeGames(tokens); + const freeGames = getCollectionFreeGames(token); return (
{ {address && ( <> - {freeGames.length > 0 && ( + {freeGames > 0 && ( @@ -185,10 +247,10 @@ const Claim = () => { className="w-full h-full" /> - {address && freeGames.length > 0 && ( + {address && freeGames > 0 && ( - {`${freeGames.length} - Game${freeGames.length > 1 ? "s" : ""} + {`${freeGames} + Game${freeGames > 1 ? "s" : ""} `} )} @@ -196,11 +258,9 @@ const Claim = () => { ); }; - console.log(claimedData); - return (
-
+

Mainnet Tournament Claim

@@ -218,6 +278,7 @@ const Claim = () => { onClick={() => { disconnect(); clickPlay(); + setAlreadyClaimed(false); }} className="h-8" > @@ -229,7 +290,7 @@ const Claim = () => {
{collectionsData.map((collection, index) => renderCollection( - collection.tokens, + collection.token, collection.image, collection.alt, index @@ -237,31 +298,34 @@ const Claim = () => { )}
- {!address ? ( + {!address || alreadyClaimed ? ( <>

Check Eligibility

-
- {walletConnectors.map((connector, index) => ( - - ))} -
+ {!alreadyClaimed ? ( +
+ {walletConnectors.map((connector, index) => ( + + ))} +
+ ) : ( +

ALREADY CLAIMED

+ )}

Already Claimed?

+ ) : ( + + - + )}
)}
diff --git a/src/containers/Claimed.tsx b/src/containers/Claimed.tsx index b699eb6..74081a2 100644 --- a/src/containers/Claimed.tsx +++ b/src/containers/Claimed.tsx @@ -14,18 +14,23 @@ import RevealAll from "../components/animations/RevealAll"; import TwitterShareButton from "../components/TwitterShareButton"; import { useQuery } from "@apollo/client"; import { getGamesByGameOwner } from "../hooks/graphql/queries"; +import { fetchAdventurerMetadata } from "../api/fetchMetadata"; +import TokenLoader from "../components/animations/TokenLoader"; const Claimed = () => { const { address } = useAccount(); const { disconnect } = useDisconnect(); const { adventurersMetadata, - claimedData, - setClaimedData, username, isRevealingAll, setIsRevealingAll, setPreparingReveal, + setClaimed, + freeGamesData, + setFreeGamesData, + setAdventurersMetadata, + setAlreadyClaimed, } = useUIStore(); const pageSize = 5; const [currentPage, setCurrentPage] = useState(0); @@ -33,16 +38,17 @@ const Claimed = () => { const filteredAdventurers = hideRevealed ? adventurersMetadata.filter((meta) => !statsRevealed(meta)) : adventurersMetadata; - const filteredClaimedData = hideRevealed - ? claimedData.filter( - (_, index) => !statsRevealed(adventurersMetadata[index]) - ) - : claimedData; + const filteredFreeGamesData = hideRevealed + ? freeGamesData.filter((_, index) => !freeGamesData[index].revealed) + : freeGamesData; const totalPages = Math.ceil(filteredAdventurers.length / pageSize); const startIndex = currentPage * pageSize; const endIndex = startIndex + pageSize; const currentAdventurers = filteredAdventurers.slice(startIndex, endIndex); - const currentClaimedData = filteredClaimedData.slice(startIndex, endIndex); + const currentFreeGamesData = filteredFreeGamesData.slice( + startIndex, + endIndex + ); const finalPage = currentPage === totalPages - 1; const network: Network = import.meta.env.VITE_NETWORK; @@ -57,16 +63,12 @@ const Claimed = () => { const { executeRevealAll } = useSyscalls(); - const unrevealedGames = claimedData.filter( - (token: any) => !token.freeGameRevealed - ); + const unrevealedGames = freeGamesData.filter((token: any) => !token.revealed); - const revealedGamesCount = claimedData.filter( - (token: any) => token.freeGameRevealed + const revealedGamesCount = freeGamesData.filter( + (token: any) => token.revealed ).length; - console.log(isRevealingAll); - const tokenByOwnerVariables = { ownerAddress: address ? address : "0x0", }; @@ -81,8 +83,8 @@ const Claimed = () => { const data: any = await refetch({ ownerAddress: address ? address : "0x0", }); - const tokensData = data ? data.data.tokensWithFreeGameStatus : []; - setClaimedData(tokensData); + const tokensData = data ? data.data.claimedFreeGames : []; + setFreeGamesData(tokensData); }, [address]); useEffect(() => { @@ -91,10 +93,28 @@ const Claimed = () => { } }, [address]); + useEffect(() => { + // if (adventurersMetadata.length === 0 && freeGamesData.length > 0) { + const fetchImages = async () => { + const adventurersMetadata = await Promise.all( + freeGamesData.map((freeGame) => + fetchAdventurerMetadata( + networkConfig[network!].gameAddress, + freeGame.adventurerId, + networkConfig[network!].rpcUrl + ) + ) + ); + setAdventurersMetadata(adventurersMetadata); + }; + fetchImages(); + // } + }, [freeGamesData]); + return (
- +

{username}

{!isRevealingAll ? ( -
- {currentPage > 0 && ( - handleClick(currentPage - 1)} - > - - - )} - {currentAdventurers.map((meta: any, index: any) => ( - - ))} - {!finalPage && ( - handleClick(currentPage + 1)} - > - - - )} -
+ adventurersMetadata.length > 0 ? ( +
+ {currentPage > 0 && ( + handleClick(currentPage - 1)} + > + + + )} + {freeGamesData.length > 0 && + currentAdventurers.map((meta: any, index: any) => ( + + ))} + {!finalPage && ( + handleClick(currentPage + 1)} + > + + + )} +
+ ) : ( + + ) ) : ( )} diff --git a/src/hooks/graphql/queries.ts b/src/hooks/graphql/queries.ts index 4186c74..c7c8b3d 100644 --- a/src/hooks/graphql/queries.ts +++ b/src/hooks/graphql/queries.ts @@ -1,43 +1,84 @@ import { gql } from "@apollo/client"; +// const TOKEN_FIELDS = ` +// adventurerId +// freeGameRevealed +// freeGameUsed +// gameOwnerAddress +// nftOwnerAddress +// token +// tokenId +// `; + const TOKEN_FIELDS = ` + nftOwnerAddress + timestamp + token + tokenId + hash +`; + +const FREE_GAME_FIELDS = ` adventurerId - freeGameRevealed - freeGameUsed gameOwnerAddress - nftOwnerAddress - token + revealed tokenId + token + hash `; const TOKENS_FRAGMENT = ` - fragment TokenFields on TokenWithFreeGameStatus { - ${TOKEN_FIELDS} + fragment TokenFields on Token { + ${TOKEN_FIELDS} + } +`; + +const FREE_GAME_FRAGMENT = ` + fragment FreeGameFields on ClaimedFreeGame { + ${FREE_GAME_FIELDS} } `; -const getGamesByNftOwner = gql` +// const getGamesByNftOwner = gql` +// ${TOKENS_FRAGMENT} +// query get_tokens_by_owner($ownerAddress: HexValue) { +// tokensWithFreeGameStatus( +// where: { nftOwnerAddress: { eq: $ownerAddress } } +// limit: 100000 +// ) { +// ...TokenFields +// } +// } +// `; + +const getTokensByNftOwner = gql` ${TOKENS_FRAGMENT} query get_tokens_by_owner($ownerAddress: HexValue) { - tokensWithFreeGameStatus( - where: { nftOwnerAddress: { eq: $ownerAddress } } - limit: 100000 - ) { + tokens(where: { nftOwnerAddress: { eq: $ownerAddress } }, limit: 100000) { ...TokenFields } } `; +const getGamesByTokens = gql` + ${FREE_GAME_FRAGMENT} + query get_games_by_owner($hashList: [String!]) { + claimedFreeGames(where: { hash: { In: $hashList } }, limit: 100000) { + ...FreeGameFields + } + } +`; + const getGamesByGameOwner = gql` - ${TOKENS_FRAGMENT} - query get_tokens_by_owner($ownerAddress: HexValue) { - tokensWithFreeGameStatus( - where: { gameOwnerAddress: { eq: $ownerAddress } } + ${FREE_GAME_FRAGMENT} + query get_games_by_owner($ownerAddress: HexValue) { + claimedFreeGames( + where: { gameOwnerAddress: { eq: $ownerAddress }, token: { gt: "0x0" } } limit: 100000 ) { - ...TokenFields + ...FreeGameFields } } `; -export { getGamesByNftOwner, getGamesByGameOwner }; +export { getTokensByNftOwner, getGamesByTokens, getGamesByGameOwner }; diff --git a/src/hooks/useSyscalls.ts b/src/hooks/useSyscalls.ts index b0b3a24..d275951 100644 --- a/src/hooks/useSyscalls.ts +++ b/src/hooks/useSyscalls.ts @@ -15,7 +15,8 @@ const useSyscalls = () => { const { account } = useAccount(); const { connector } = useConnect(); const { provider } = useProvider(); - const { setPreparingClaim, setClaiming } = useUIStore(); + const { setPreparingClaim, setClaiming, freeGamesData, setFreeGamesData } = + useUIStore(); const executeSetDelegate = async (delegateAddress: string) => { if (!account) { @@ -76,7 +77,17 @@ const useSyscalls = () => { "ClaimedFreeGame" ); - console.log(claimedFreeGameEvents); + const updatedFreeGamesData = [ + ...freeGamesData, + ...claimedFreeGameEvents.map((event) => ({ + token: event.data.collectionAddress, + tokenId: event.data.tokenId, + adventurerId: event.data.adventurerId, + revealed: false, + })), + ]; + + setFreeGamesData(updatedFreeGamesData); }; const executeReveal = async (gameAddress: string, adventurerId: number) => { diff --git a/src/hooks/useUIStore.ts b/src/hooks/useUIStore.ts index c18163a..77e4b64 100644 --- a/src/hooks/useUIStore.ts +++ b/src/hooks/useUIStore.ts @@ -18,10 +18,14 @@ type State = { setAdventurersMetadata: (metadata: AdventurerMetadata[]) => void; claimedData: any[]; setClaimedData: (claimedData: any[]) => void; + freeGamesData: any[]; + setFreeGamesData: (freeGamesData: any[]) => void; username: string; setUsername: (username: string) => void; isRevealingAll: boolean; setIsRevealingAll: (isRevealingAll: boolean) => void; + alreadyClaimed: boolean; + setAlreadyClaimed: (alreadyClaimed: boolean) => void; }; export const useUIStore = create((set) => ({ @@ -41,8 +45,12 @@ export const useUIStore = create((set) => ({ setAdventurersMetadata: (metadata) => set({ adventurersMetadata: metadata }), claimedData: [], setClaimedData: (claimedData) => set({ claimedData }), + freeGamesData: [], + setFreeGamesData: (freeGamesData) => set({ freeGamesData }), username: "", setUsername: (username) => set({ username }), isRevealingAll: false, setIsRevealingAll: (isRevealingAll) => set({ isRevealingAll }), + alreadyClaimed: false, + setAlreadyClaimed: (alreadyClaimed) => set({ alreadyClaimed }), })); diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 87e293a..ead2e1a 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,19 +1,16 @@ import { hash } from "starknet"; +import { CollectionData } from "./types"; export const COLLECTION_TOKENS_MAP = { Blobert: "0x04a79a62dc260f2e9e4b208181b2014c14f3ff44fe7d0e6452a759ed91a106d1", - DefiSpring: - "0x000aa84534f0e0510618ad6a16f24e9a64fe0277b1f1ca799f0bddfec300d870", DucksEverywhere: "0x07c006181ea9cc7dd1b09c29e9ff23112be30ecfef73b760fabe5bc7ae6ecb44", - DuckFrens: - "0x0433a83c97c083470a1e2f47e24cbc53c4a225f69ffc045580a7279e7f077c79", Everai: "0x04efe851716110abeee81b7f22f7964845355ffa32e6833fc3a557a1881721ac", FocusTree: "0x0377c2d65debb3978ea81904e7d59740da1f07412e30d01c5ded1c5d6f1ddc43", InfluenceCrew: "0x07280a807c8b79379bec87919433b7b836b93a92e6d71b24ee99f4ffe33dd337", - OpenDivision: "0x1", + TheSyndicate: "0x1", PixelBanners: "0x02d66679de61a5c6d57afd21e005a8c96118bd60315fd79a4521d68f5e5430d1", Realms: "0x07ae27a31bb6526e3de9cf02f081f6ce0615ac12a6d7b85ee58b8ad7947a2809", @@ -21,71 +18,73 @@ export const COLLECTION_TOKENS_MAP = { export const COLLECTION_WEAPON_MAP = { Blobert: "76", - DefiSpring: "12", DucksEverywhere: "76", DuckFrens: "76", Everai: "46", FocusTree: "16", InfluenceCrew: "16", - OpenDivision: "12", + TheSyndicate: "12", PixelBanners: "46", Realms: "46", }; -export const collectionsData = [ +export const collectionsData: CollectionData[] = [ { - tokens: [COLLECTION_TOKENS_MAP["Blobert"]], + token: COLLECTION_TOKENS_MAP["Blobert"], alt: "Blobert", image: "Blobert.png", }, { - tokens: [COLLECTION_TOKENS_MAP["DefiSpring"]], - alt: "Defi Spring", - image: "Defi-Spring.png", - }, - { - tokens: [ - COLLECTION_TOKENS_MAP["DucksEverywhere"], - COLLECTION_TOKENS_MAP["DuckFrens"], - ], + token: COLLECTION_TOKENS_MAP["DucksEverywhere"], alt: "Duck", image: "Ducks-Everywhere.png", }, { - tokens: [COLLECTION_TOKENS_MAP["Everai"]], + token: COLLECTION_TOKENS_MAP["Everai"], alt: "Everai", image: "Everai.png", }, { - tokens: [COLLECTION_TOKENS_MAP["FocusTree"]], + token: COLLECTION_TOKENS_MAP["FocusTree"], alt: "Focus Tree", image: "Focus-Tree.png", }, { - tokens: [COLLECTION_TOKENS_MAP["InfluenceCrew"]], + token: COLLECTION_TOKENS_MAP["InfluenceCrew"], alt: "Influence Crew", image: "Influence.png", }, { - tokens: [COLLECTION_TOKENS_MAP["Open Division"]], - alt: "Open Division", + token: COLLECTION_TOKENS_MAP["The Syndicate"], + alt: "The Syndicate", image: "Open-Division.png", }, { - tokens: [COLLECTION_TOKENS_MAP["Pixel Banners"]], + token: [COLLECTION_TOKENS_MAP["Pixel Banners"]], alt: "Pixel Banners", image: "Pixel-Banners.png", }, { - tokens: [COLLECTION_TOKENS_MAP["Realms"]], + token: [COLLECTION_TOKENS_MAP["Realms"]], alt: "Realms", image: "Realms.png", }, ]; +export const GAMES_PER_TOKEN = { + "0x04a79a62dc260f2e9e4b208181b2014c14f3ff44fe7d0e6452a759ed91a106d1": 1, + "0x07c006181ea9cc7dd1b09c29e9ff23112be30ecfef73b760fabe5bc7ae6ecb44": 1, + "0x04efe851716110abeee81b7f22f7964845355ffa32e6833fc3a557a1881721ac": 1, + "0x0377c2d65debb3978ea81904e7d59740da1f07412e30d01c5ded1c5d6f1ddc43": 1, + "0x07280a807c8b79379bec87919433b7b836b93a92e6d71b24ee99f4ffe33dd337": 1, + "0x1": 1, + "0x02d66679de61a5c6d57afd21e005a8c96118bd60315fd79a4521d68f5e5430d1": 1, + "0x07ae27a31bb6526e3de9cf02f081f6ce0615ac12a6d7b85ee58b8ad7947a2809": 1, +}; + export const getCollectionAlt = (token: string) => { - const collection = collectionsData.find((collection) => - collection.tokens.includes(token) + const collection = collectionsData.find( + (collection) => collection.token === token ); return collection?.alt; }; diff --git a/src/lib/networkConfig.ts b/src/lib/networkConfig.ts index 13c8b16..e954417 100644 --- a/src/lib/networkConfig.ts +++ b/src/lib/networkConfig.ts @@ -2,7 +2,7 @@ export const networkConfig = { sepolia: { rpcUrl: "https://starknet-sepolia.blastapi.io/5ef61753-e7c1-4593-bc62-97fdf96f8de5", - lsGQLURL: "https://ls-indexer-sepolia.provable.games/graphql", + lsGQLURL: "http://localhost:8080/graphql", ethAddress: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", gameAddress: diff --git a/src/lib/types.ts b/src/lib/types.ts index 85100c4..5539356 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -5,3 +5,9 @@ export type AdventurerMetadata = { name: string; description: string; }; + +export type CollectionData = { + token: string; + alt: string; + image: string; +}; diff --git a/vite.config.ts b/vite.config.ts index 8be1414..52737c3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,17 +1,13 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; -// import mkcert from "vite-plugin-mkcert"; +import mkcert from "vite-plugin-mkcert"; // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react()], + plugins: [react(), mkcert()], resolve: { alias: { buffer: "buffer", }, }, - // // Add this if you want to use HTTPS - // server: { - // https: true, - // }, });