From 0b3572a663b8fc84de0e14bd7c8c101c2ac49583 Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Wed, 10 Jan 2024 17:47:29 +0000 Subject: [PATCH] fix build --- ui/src/app/components/intro/ArcadeIntro.tsx | 8 ++------ ui/src/app/components/intro/WalletSelect.tsx | 2 -- ui/src/app/components/start/CreateAdventurer.tsx | 4 ++++ ui/src/app/components/start/Spawn.tsx | 9 ++++++--- ui/src/app/containers/AdventurerScreen.tsx | 3 +++ ui/src/app/containers/Onboarding.tsx | 6 ++---- ui/src/app/page.tsx | 4 +++- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ui/src/app/components/intro/ArcadeIntro.tsx b/ui/src/app/components/intro/ArcadeIntro.tsx index ddb5b4585..d882aa0e9 100644 --- a/ui/src/app/components/intro/ArcadeIntro.tsx +++ b/ui/src/app/components/intro/ArcadeIntro.tsx @@ -2,11 +2,7 @@ import { useEffect, useState } from "react"; import { MdClose } from "react-icons/md"; import { Contract } from "starknet"; import { useAccount, useConnect, useDisconnect } from "@starknet-react/core"; -import { - ETH_PREFUND_AMOUNT, - LORDS_PREFUND_AMOUNT, - useBurner, -} from "@/app/lib/burner"; +import { ETH_PREFUND_AMOUNT, useBurner } from "@/app/lib/burner"; import { Button } from "@/app/components/buttons/Button"; import useUIStore from "@/app/hooks/useUIStore"; import { getWalletConnectors } from "@/app/lib/connectors"; @@ -66,7 +62,7 @@ export const ArcadeIntro = ({ const eth = Number(ethBalance); const checkNotEnoughPrefundEth = eth < parseInt(ETH_PREFUND_AMOUNT); - const checkNotEnoughPrefundLords = lords < parseInt(LORDS_PREFUND_AMOUNT); + const checkNotEnoughPrefundLords = lords < parseInt("1000000000000"); useEffect(() => { if ( diff --git a/ui/src/app/components/intro/WalletSelect.tsx b/ui/src/app/components/intro/WalletSelect.tsx index f7608846c..40ce9b9e2 100644 --- a/ui/src/app/components/intro/WalletSelect.tsx +++ b/ui/src/app/components/intro/WalletSelect.tsx @@ -2,7 +2,6 @@ import { useState } from "react"; import Image from "next/image"; import { Button } from "@/app/components/buttons/Button"; import { useConnect } from "@starknet-react/core"; -import useUIStore from "@/app/hooks/useUIStore"; import { WalletTutorial } from "@/app/components/intro/WalletTutorial"; import Storage from "@/app/lib/storage"; import { BurnerStorage } from "@/app/types"; @@ -12,7 +11,6 @@ interface WalletSelectProps {} const WalletSelect = ({}: WalletSelectProps) => { const { connectors, connect } = useConnect(); - const setDisconnected = useUIStore((state) => state.setDisconnected); const [screen, setScreen] = useState("wallet"); if (!connectors) return
; diff --git a/ui/src/app/components/start/CreateAdventurer.tsx b/ui/src/app/components/start/CreateAdventurer.tsx index 4ecab46b6..f0d3b74ff 100644 --- a/ui/src/app/components/start/CreateAdventurer.tsx +++ b/ui/src/app/components/start/CreateAdventurer.tsx @@ -14,6 +14,7 @@ export interface CreateAdventurerProps { gameContract: Contract; getBalances: () => Promise; mintLords: () => Promise; + costToPlay: bigint; } export const CreateAdventurer = ({ @@ -25,6 +26,7 @@ export const CreateAdventurer = ({ gameContract, getBalances, mintLords, + costToPlay, }: CreateAdventurerProps) => { const [formData, setFormData] = useState({ startingWeapon: "", @@ -120,6 +122,7 @@ export const CreateAdventurer = ({ gameContract={gameContract} getBalances={getBalances} mintLords={mintLords} + costToPlay={costToPlay} />
@@ -144,6 +147,7 @@ export const CreateAdventurer = ({ gameContract={gameContract} getBalances={getBalances} mintLords={mintLords} + costToPlay={costToPlay} />
)} diff --git a/ui/src/app/components/start/Spawn.tsx b/ui/src/app/components/start/Spawn.tsx index d1d9efb9d..b359e01f4 100644 --- a/ui/src/app/components/start/Spawn.tsx +++ b/ui/src/app/components/start/Spawn.tsx @@ -32,6 +32,7 @@ export interface SpawnProps { gameContract: Contract; getBalances: () => Promise; mintLords: () => Promise; + costToPlay: bigint; } export const Spawn = ({ @@ -43,6 +44,7 @@ export const Spawn = ({ gameContract, getBalances, mintLords, + costToPlay, }: SpawnProps) => { const [showWalletTutorial, setShowWalletTutorial] = useState(false); const [formFilled, setFormFilled] = useState(false); @@ -72,15 +74,17 @@ export const Spawn = ({ setShowWalletTutorial(true); }; + const lordsGameCost = Number(costToPlay); + const handleSubmitLords = async () => { resetNotification(); - await spawn(formData, "0", costToPlay!); + await spawn(formData, "0", lordsGameCost); await getBalances(); }; const handleSubmitGoldenToken = async () => { resetNotification(); - await spawn(formData, usableToken, costToPlay); + await spawn(formData, usableToken, lordsGameCost); await getBalances(); }; @@ -133,7 +137,6 @@ export const Spawn = ({ useEffect(() => { getUsableGoldenToken(goldenTokens ?? []); - getCostToPlay(); }, []); return ( diff --git a/ui/src/app/containers/AdventurerScreen.tsx b/ui/src/app/containers/AdventurerScreen.tsx index 0c42056d9..57f578c28 100644 --- a/ui/src/app/containers/AdventurerScreen.tsx +++ b/ui/src/app/containers/AdventurerScreen.tsx @@ -16,6 +16,7 @@ interface AdventurerScreenProps { goldenTokenData: any; getBalances: () => Promise; mintLords: () => Promise; + costToPlay: bigint; } /** @@ -30,6 +31,7 @@ export default function AdventurerScreen({ goldenTokenData, getBalances, mintLords, + costToPlay, }: AdventurerScreenProps) { const [activeMenu, setActiveMenu] = useState(0); const setAdventurer = useAdventurerStore((state) => state.setAdventurer); @@ -93,6 +95,7 @@ export default function AdventurerScreen({ gameContract={gameContract} getBalances={getBalances} mintLords={mintLords} + costToPlay={costToPlay} /> )} diff --git a/ui/src/app/containers/Onboarding.tsx b/ui/src/app/containers/Onboarding.tsx index df0bc0613..a91645893 100644 --- a/ui/src/app/containers/Onboarding.tsx +++ b/ui/src/app/containers/Onboarding.tsx @@ -1,11 +1,9 @@ import { useState, useEffect } from "react"; -import Image from "next/image"; import { MdClose } from "react-icons/md"; import { CompleteIcon, InfoIcon } from "@/app/components/icons/Icons"; import { Button } from "@/app/components/buttons/Button"; import { getWalletConnectors } from "@/app/lib/connectors"; import { useAccount, useConnect, useDisconnect } from "@starknet-react/core"; -import useUIStore from "@/app/hooks/useUIStore"; import { ETH_PREFUND_AMOUNT } from "../lib/burner"; import Eth from "public/icons/eth-2.svg"; import Lords from "public/icons/lords.svg"; @@ -130,7 +128,7 @@ const Onboarding = ({ costToPlay, mintLords, }: OnboardingProps) => { - const { account, address, connector } = useAccount(); + const { account, address } = useAccount(); const { connect, connectors } = useConnect(); const { disconnect } = useDisconnect(); const walletConnectors = getWalletConnectors(connectors); @@ -139,7 +137,7 @@ const Onboarding = ({ const [step, setStep] = useState(1); - const setScreen = useUIStore((state) => state.setScreen); + // const setScreen = useUIStore((state) => state.setScreen); const eth = Number(ethBalance); const lords = Number(lordsBalance); diff --git a/ui/src/app/page.tsx b/ui/src/app/page.tsx index 342ab5a2b..76902b8f2 100644 --- a/ui/src/app/page.tsx +++ b/ui/src/app/page.tsx @@ -56,7 +56,7 @@ import Game from "@/app/abi/Game.json"; import Lords from "@/app/abi/Lords.json"; import EthBalanceFragment from "@/app/abi/EthBalanceFragment.json"; import Beasts from "@/app/abi/Beasts.json"; -import { ArcadeIntro } from "@/app/components/intro/ArcadeIntro"; +// import { ArcadeIntro } from "@/app/components/intro/ArcadeIntro"; import ScreenMenu from "@/app/components/menu/ScreenMenu"; import { getArcadeConnectors, @@ -526,6 +526,7 @@ function Home({ updateConnectors }: HomeProps) { ethBalance={ethBalance} lordsBalance={lordsBalance} costToPlay={costToPlay!} + mintLords={mintLords} /> ) : ( <> @@ -608,6 +609,7 @@ function Home({ updateConnectors }: HomeProps) { goldenTokenData={goldenTokenData} getBalances={getBalances} mintLords={mintLords} + costToPlay={costToPlay!} /> )} {screen === "play" && (