diff --git a/packages/client/src/components/Map/index.tsx b/packages/client/src/components/Map/index.tsx index b53c8e0a..7193b0a2 100644 --- a/packages/client/src/components/Map/index.tsx +++ b/packages/client/src/components/Map/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useRef } from 'react'; +import React, { useMemo, useRef } from 'react'; import { IPlayer } from '../Player'; import MapCell, { ICellClassCache, ICoordinate } from '../MapCell'; import './styles.scss'; @@ -44,9 +44,8 @@ const Map = (props: IProps) => { const onMoveTo = (coordinate) => { const { x, y} = players.find((player) => player.id === curId); - const paths = bfs(simpleMapData, { x, y }, coordinate); + const paths = bfs(simpleMapData, { x, y }, coordinate).slice(1); onPlayerMove(paths, formatMovePath(paths)); - console.log(paths, { x, y }, coordinate); } diff --git a/packages/client/src/pages/game/index.tsx b/packages/client/src/pages/game/index.tsx index ebdf2375..264285c5 100644 --- a/packages/client/src/pages/game/index.tsx +++ b/packages/client/src/pages/game/index.tsx @@ -59,8 +59,7 @@ const Game = () => { clearInterval(interval); } }, 300); - console.log(merkelData); - uploadUserMove(players[curPlayerIndex].x, players[curPlayerIndex].y, merkelData); + uploadUserMove(merkelData); } useEffect(() => { diff --git a/packages/client/src/service/user.ts b/packages/client/src/service/user.ts index 0807c6c4..d96f0fec 100644 --- a/packages/client/src/service/user.ts +++ b/packages/client/src/service/user.ts @@ -1,7 +1,7 @@ import { ethers } from 'ethers'; import Mississippi from '../../abi/Mississippi.json'; -export const uploadUserMove = async (x, y, steps) => { +export const uploadUserMove = async (steps) => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const provider = new ethers.providers.Web3Provider(window.ethereum) @@ -11,8 +11,8 @@ export const uploadUserMove = async (x, y, steps) => { const miss = new ethers.Contract('0xc86c785620e9d9a14374ea203b34b6312bce6d03', Mississippi, signer); - const transaction = await miss.connect(signer).move([x, y, steps]); - const tx = await transaction.wait(1); + const transaction = await miss.connect(signer).move(steps); + const tx = await transaction.wait(); console.log(tx.events)