diff --git a/packages/nextjs/components/tictactoe/CreateChallengeBox.tsx b/packages/nextjs/components/tictactoe/CreateChallengeBox.tsx index 922320f..4ecd0b8 100755 --- a/packages/nextjs/components/tictactoe/CreateChallengeBox.tsx +++ b/packages/nextjs/components/tictactoe/CreateChallengeBox.tsx @@ -1,7 +1,7 @@ import React from "react"; import { useState } from "react"; import { Button, Card, CardBody, Heading, Stack, Text } from "@chakra-ui/react"; -// import { ethers } from "ethers"; +import { ethers } from "ethers"; import { AddressInput, EtherInput } from "~~/components/scaffold-eth"; import { useScaffoldContractWrite } from "~~/hooks/scaffold-eth"; @@ -13,7 +13,7 @@ const CreateChallengeBox = ({}) => { contractName: "TicTacToe", functionName: "createGame", args: [player2Address], - // value: betAmount ? betAmount : undefined, + value: betAmount ? ethers.parseEther(betAmount) : undefined, }); console.log("Bet amount: ", betAmount); diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 18161ff..80fda15 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -2,8 +2,9 @@ import { useEffect, useState } from "react"; // import Link from "next/link"; import { NewGameProps } from "../types/TicTacToeTypes"; import { Card, CardBody, Flex, Heading } from "@chakra-ui/react"; -// import { ethers } from "ethers"; +import { ethers } from "ethers"; import type { NextPage } from "next"; +// import { parseEther } from "viem"; // import { BugAntIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { MetaHeader } from "~~/components/MetaHeader"; import { Address } from "~~/components/scaffold-eth"; @@ -51,7 +52,7 @@ const Home: NextPage = () => { }); const gameCards = gameHistory?.map(game => { - // This is where all events relevant to a single game will be stored and sorted which is a palindrome + // This is where all events relevant to a single game will be stored return game; }); @@ -103,7 +104,7 @@ const Home: NextPage = () => {

Player 2:

-

Bet: {bet.toString()} ETH

+

Bet: {parseFloat(ethers.formatEther(bet.toString())).toFixed(4)} ETH

------------------------