diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index e83d25c..6b95079 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -4,7 +4,7 @@ _Detailed description of proposed changes_
## Related Issue(s)
-_Closes #_
+Closes #
## Checklist:
- [ ] Read the [contributing docs](../CONTRIBUTING.md) (if this is your first contribution)
@@ -16,4 +16,4 @@ _Closes #_
- [ ] Documented the changes in code (API docs will be generated automatically)
-
\ No newline at end of file
+
diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs
index 6885d76..6adba53 100644
--- a/client/.eslintrc.cjs
+++ b/client/.eslintrc.cjs
@@ -1,14 +1,15 @@
module.exports = {
- env: { browser: true, es2020: true },
- extends: [
- "eslint:recommended",
- "plugin:@typescript-eslint/recommended",
- "plugin:react-hooks/recommended",
- ],
- parser: "@typescript-eslint/parser",
- parserOptions: { ecmaVersion: "latest", sourceType: "module" },
- plugins: ["react-refresh"],
- rules: {
- "react-refresh/only-export-components": "warn",
- },
+ env: { browser: true, es2020: true },
+ extends: [
+ "eslint:recommended",
+ "plugin:@typescript-eslint/recommended",
+ "plugin:react-hooks/recommended",
+ ],
+ parser: "@typescript-eslint/parser",
+ parserOptions: { ecmaVersion: "latest", sourceType: "module" },
+ plugins: ["react-refresh"],
+ rules: {
+ "react-refresh/only-export-components": "warn",
+ },
+ ignorePatterns: ["src/dojo/typescript/models.gen.ts"],
};
diff --git a/client/package.json b/client/package.json
index c116d8b..1cf4dd7 100644
--- a/client/package.json
+++ b/client/package.json
@@ -13,13 +13,13 @@
},
"dependencies": {
"@apollo/client": "^3.11.8",
- "@dojoengine/core": "1.0.0-alpha.5",
- "@dojoengine/create-burner": "1.0.0-alpha.5",
- "@dojoengine/react": "1.0.0-alpha.5",
+ "@dojoengine/core": "1.0.0-alpha.14",
+ "@dojoengine/create-burner": "1.0.0-alpha.14",
+ "@dojoengine/react": "1.0.0-alpha.14",
"@dojoengine/recs": "2.0.13",
- "@dojoengine/state": "1.0.0-alpha.5",
- "@dojoengine/torii-client": "1.0.0-alpha.5",
- "@dojoengine/utils": "1.0.0-alpha.5",
+ "@dojoengine/state": "1.0.0-alpha.14",
+ "@dojoengine/torii-client": "1.0.0-alpha.14",
+ "@dojoengine/utils": "1.0.0-alpha.14",
"@latticexyz/react": "^2.0.12",
"@latticexyz/utils": "^2.0.12",
"@starknet-react/chains": "^0.1.7",
@@ -57,4 +57,4 @@
"typescript": "^5.5.4",
"vite": "^4.3.9"
}
-}
+}
\ No newline at end of file
diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml
index 64600b4..75dee8d 100644
--- a/client/pnpm-lock.yaml
+++ b/client/pnpm-lock.yaml
@@ -9,26 +9,26 @@ dependencies:
specifier: ^3.11.8
version: 3.11.8(@types/react@18.3.8)(graphql@16.9.0)(react-dom@18.3.1)(react@18.3.1)
'@dojoengine/core':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2)
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2)
'@dojoengine/create-burner':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5(react-dom@18.3.1)(react@18.3.1)(starknet@6.11.0)(typescript@5.6.2)
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14(react-dom@18.3.1)(react@18.3.1)(starknet@6.11.0)(typescript@5.6.2)
'@dojoengine/react':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(type-fest@2.19.0)(typescript@5.6.2)
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(type-fest@2.19.0)(typescript@5.6.2)
'@dojoengine/recs':
specifier: 2.0.13
version: 2.0.13(typescript@5.6.2)(zod@3.23.8)
'@dojoengine/state':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2)
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2)
'@dojoengine/torii-client':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14
'@dojoengine/utils':
- specifier: 1.0.0-alpha.5
- version: 1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2)
+ specifier: 1.0.0-alpha.14
+ version: 1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2)
'@latticexyz/react':
specifier: ^2.0.12
version: 2.2.7(typescript@5.6.2)
@@ -1903,8 +1903,8 @@ packages:
postcss-selector-parser: 6.1.2
dev: false
- /@dojoengine/core@1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2):
- resolution: {integrity: sha512-X+MDXFYoV3rDVFCZlOc5RXQUviuWnsaMvAqjhNNI683w6qWNYqt2e2FUauHgJI67Vi1/9/WuIetkM5hxU9QHFQ==}
+ /@dojoengine/core@1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2):
+ resolution: {integrity: sha512-wWleoZ3v9V72t5m2u8rfTc1a4B1xoFMXvfwEy3rDanuIph392Buo5huYnskbmzs1qInNPygl/5zX8wyctprmyw==}
hasBin: true
peerDependencies:
starknet: 6.11.0
@@ -1918,14 +1918,14 @@ packages:
- utf-8-validate
dev: false
- /@dojoengine/create-burner@1.0.0-alpha.5(react-dom@18.3.1)(react@18.3.1)(starknet@6.11.0)(typescript@5.6.2):
- resolution: {integrity: sha512-HcfwPGGzWrqgS0+xJIC/kAFc7aFwLIlT7bjnCCFUrwhvypg2qbb9csHekRWVsP98d2syTzNTMOYnGSJUocR62g==}
+ /@dojoengine/create-burner@1.0.0-alpha.14(react-dom@18.3.1)(react@18.3.1)(starknet@6.11.0)(typescript@5.6.2):
+ resolution: {integrity: sha512-gOgvGNXweYAs1HyaX/ARD9oog9p5JvmeqqAIEXmOBrPv/R7/cY4dLVRS0ZG02Bcb2P6CLCoTWiMTz9t7n004Lg==}
peerDependencies:
react: ^18.2.0
react-dom: ^18.2.0
starknet: 6.11.0
dependencies:
- '@dojoengine/core': 1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2)
+ '@dojoengine/core': 1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2)
'@scure/bip32': 1.5.0
'@starknet-react/core': 2.3.0(get-starknet-core@3.3.3)(react@18.3.1)(starknet@6.11.0)
encoding: 0.1.13
@@ -1940,17 +1940,17 @@ packages:
- utf-8-validate
dev: false
- /@dojoengine/react@1.0.0-alpha.5(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(type-fest@2.19.0)(typescript@5.6.2):
- resolution: {integrity: sha512-urM9fAurroGerpRvBqefa1JzP6p8AqTedrpiQWP+ORoHa2jHpy4BqrOluzB6kNA0cINYHnD11gVkcesl28EwFw==}
+ /@dojoengine/react@1.0.0-alpha.14(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(type-fest@2.19.0)(typescript@5.6.2):
+ resolution: {integrity: sha512-oV2QE5VLJsIDyBLqtfH3LDdfGu1DORxEcvrO0UvHyIT6AvA0Gk61O+oOQ+bQ6ry/O4mGOvOX5Txno8jeA4Znew==}
peerDependencies:
react: ^18.2.0
starknet: 6.11.0
type-fest: ^2.14.0
dependencies:
'@dojoengine/recs': 2.0.13(typescript@5.6.2)(zod@3.23.8)
- '@dojoengine/state': 1.0.0-alpha.5(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2)
- '@dojoengine/torii-client': 1.0.0-alpha.5
- '@dojoengine/utils': 1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2)
+ '@dojoengine/state': 1.0.0-alpha.14(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2)
+ '@dojoengine/torii-client': 1.0.0-alpha.14
+ '@dojoengine/utils': 1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2)
'@latticexyz/utils': 2.2.7
encoding: 0.1.13
fast-deep-equal: 3.1.3
@@ -1998,13 +1998,13 @@ packages:
- zod
dev: false
- /@dojoengine/state@1.0.0-alpha.5(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2):
- resolution: {integrity: sha512-a5RG9OWJuCSjoQMqL4Uyysai1d5AVZbRfxfdPdNT2Ykwvw/KAVOhDWItpA36PpBmnnokJWglNXMKeDWDEtL9sQ==}
+ /@dojoengine/state@1.0.0-alpha.14(@types/node@20.16.5)(@types/react@18.3.8)(react@18.3.1)(sass@1.79.3)(starknet@6.11.0)(typescript@5.6.2):
+ resolution: {integrity: sha512-4scuHGt05efeQ9JCP7fYyLwJBN/QIyQZ/NW5ObTNpHzjTQKY1G678o4LP7lhEmPJ8h6gJZTHLrRg380AJDCrlQ==}
peerDependencies:
starknet: 6.11.0
dependencies:
'@dojoengine/recs': 2.0.13(typescript@5.6.2)(zod@3.23.8)
- '@dojoengine/torii-client': 1.0.0-alpha.5
+ '@dojoengine/torii-client': 1.0.0-alpha.14
'@latticexyz/utils': 2.2.7
starknet: 6.11.0
vitest: 1.6.0(@types/node@20.16.5)(sass@1.79.3)
@@ -2033,19 +2033,19 @@ packages:
- zod
dev: false
- /@dojoengine/torii-client@1.0.0-alpha.5:
- resolution: {integrity: sha512-H+6bwEOaUA1UXq9PniM3D6dJVV2g514RaTkuW6/4TV+SPs7GHa123W2kpifg4AdXwauS42Ej/h2+xRhg1W1G3g==}
+ /@dojoengine/torii-client@1.0.0-alpha.14:
+ resolution: {integrity: sha512-2tc5Phn6yI7dR5oHe9Jf3k88MCXO/K5KYoz+UUvk5Paf2dm5yHC2rKE3kqKwLBpBVuzg3GVzRTLnc55miVVXSQ==}
dependencies:
- '@dojoengine/torii-wasm': 1.0.0-alpha.5
+ '@dojoengine/torii-wasm': 1.0.0-alpha.14
typescript: 5.6.2
dev: false
- /@dojoengine/torii-wasm@1.0.0-alpha.5:
- resolution: {integrity: sha512-5SlvWimnrhEnRJIMDy8Lew8jBv6FAVk2tBwHhgOEQNs2p3/zqROc1ejn0SaETzSyiq3E9RMprIo04yxVAtr14A==}
+ /@dojoengine/torii-wasm@1.0.0-alpha.14:
+ resolution: {integrity: sha512-FABJsR/cIPLX+4vbR4rs2idwukwHgMV5xA55Gj6xX3IcaYj8wv1SokJGvV9vr+I8lc9qQ1JXpOAAGNQDOuu7pQ==}
dev: false
- /@dojoengine/utils@1.0.0-alpha.5(starknet@6.11.0)(typescript@5.6.2):
- resolution: {integrity: sha512-39Z0XNIvEBc+YDuderPiJ+T1DXtAo8DEUGoxna1B5O2pBCi0jXlze5Puke4D98ZX6GfMD+XbflW0H5ccmguwVw==}
+ /@dojoengine/utils@1.0.0-alpha.14(starknet@6.11.0)(typescript@5.6.2):
+ resolution: {integrity: sha512-JrJXmMX4fwmNmesWW0aQgZBazQTobR/z43ik/nTDQorSSWZLC0Y+L8XEVz+U6tlB6QHjP/usfVU/CSLe9zg8Gg==}
peerDependencies:
starknet: 6.11.0
dependencies:
diff --git a/client/scripts/gen.sh b/client/scripts/gen.sh
new file mode 100644
index 0000000..28c3252
--- /dev/null
+++ b/client/scripts/gen.sh
@@ -0,0 +1 @@
+DOJO_MANIFEST_PATH=../onchain/scarb.toml sozo build --typescript --bindings-output=./src/dojo
\ No newline at end of file
diff --git a/client/scripts/gen_cc.sh b/client/scripts/gen_cc.sh
new file mode 100644
index 0000000..e710180
--- /dev/null
+++ b/client/scripts/gen_cc.sh
@@ -0,0 +1 @@
+npx @dojoengine/core ../onchain/manifests/dev/deployment/manifest.json ./_dojo http://localhost:5050 0x4e4a8cb96198772361acc30c71d81768bccc6c29501f211b0f0ca7045b194a4
\ No newline at end of file
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 14ea8aa..0e79b74 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -63,7 +63,7 @@ const App = () => {
setActiveCategory(category);
};
- const setGameData = useCallback((game: any) => {
+ const setGameData = useCallback((game: object) => {
setGameState(game);
}, []);
diff --git a/client/src/components/Control.tsx b/client/src/components/Control.tsx
index 23ef96f..04bbd98 100644
--- a/client/src/components/Control.tsx
+++ b/client/src/components/Control.tsx
@@ -66,6 +66,7 @@ const Control = ({
}: {
toggleActiveWindow: (window: string) => void;
}) => {
+ /* eslint-disable @typescript-eslint/no-unused-vars */
const [windows, setWindows] = useState(
WINDOW_CONFIGS.map((config) => ({ ...config, show: false, zIndex: 0 }))
);
diff --git a/client/src/components/ControlWindows/ControlWindowLayout.tsx b/client/src/components/ControlWindows/ControlWindowLayout.tsx
index 49225b6..eb6cbe4 100644
--- a/client/src/components/ControlWindows/ControlWindowLayout.tsx
+++ b/client/src/components/ControlWindows/ControlWindowLayout.tsx
@@ -1,5 +1,4 @@
import React from "react";
-import Draggable from "react-draggable";
import { FiXSquare } from "react-icons/fi";
import "../../styles/ControlWindowLayout.scss";
diff --git a/client/src/components/ControlWindows/GameAccount.tsx b/client/src/components/ControlWindows/GameAccount.tsx
index 582d407..80e4656 100644
--- a/client/src/components/ControlWindows/GameAccount.tsx
+++ b/client/src/components/ControlWindows/GameAccount.tsx
@@ -1,4 +1,3 @@
-import React, { useEffect, useState } from "react";
import {
useAccount,
useConnect,
@@ -6,14 +5,14 @@ import {
useNetwork,
useStarkProfile,
} from "@starknet-react/core";
-import { useMemo } from "react";
+import { useEffect, useMemo, useState } from "react";
+import { FaArrowAltCircleRight } from "react-icons/fa";
+import { useDojo } from "../../dojo/useDojo";
import "../../styles/GameAccount.scss";
import {
convertHexToText,
- createGameProfile,
- getGameProfilesFromAddress,
+ getGameProfilesFromAddress
} from "../../utils/helpers";
-import { FaArrowAltCircleRight } from "react-icons/fa";
const ConnectWallet = () => {
const { connectors, connect } = useConnect();
@@ -38,6 +37,7 @@ const ConnectWallet = () => {
);
};
+/* eslint-disable @typescript-eslint/no-unused-vars */
const ProfilePage = () => {
return
Profile page
;
};
@@ -63,6 +63,8 @@ const GameAccount = () => {
disconnect();
};
+ const { system } = useDojo();
+
const addGameProfile = async () => {
if (newProfileName === undefined || newProfileName?.length < 2) {
alert("profile name must be greater than 2");
@@ -74,8 +76,9 @@ const GameAccount = () => {
return;
}
- await createGameProfile(newProfileName, account);
- setNewProfileName("");
+ // await createGameProfile(newProfileName, account);
+ await system.createUsername(account, newProfileName);
+ await setNewProfileName("");
await getGameProfilesFromAddress(address, setGameProfiles);
};
@@ -85,7 +88,7 @@ const GameAccount = () => {
getGameProfilesFromAddress(address, setGameProfiles);
}
- return () => {};
+ return () => undefined;
}, [address]);
const enum pagesName {
@@ -93,7 +96,7 @@ const GameAccount = () => {
PROFILE_PAGE = "PROFILE_PAGE",
}
- let mainPage = {
+ const mainPage = {
name: pagesName.MAIN_PAGE,
content: (
@@ -166,22 +169,62 @@ const GameAccount = () => {
+
+
+
Game Profiles
+
+ {gameProfiles !== undefined ? (
+
+ {gameProfiles?.length > 0 ? (
+
+ {gameProfiles.map((gameProfile) => (
+
+ {convertHexToText(gameProfile)}
+
+
+
+ ))}
+
+ ) : (
+
--no profile found--
+ )}
+
+ ) : (
+
+ Loading...
+
+ )}
+
+
+ setNewProfileName(e.target.value)}
+ />
+
+
+
)}
),
};
- let profilePage = {
+ const profilePage = {
name: pagesName.PROFILE_PAGE,
content: Profile
,
};
- let pages = [mainPage, profilePage];
+ const pages = [mainPage, profilePage];
const resolvePageToReturn = () => {
// Get last page name
- let lastPage =
+ const lastPage =
pagesStack[pagesStack.length - 1 > 0 ? pagesStack.length - 1 : 0];
let pageToReturn;
diff --git a/client/src/components/Dice.tsx b/client/src/components/Dice.tsx
index 5cfc490..422591d 100644
--- a/client/src/components/Dice.tsx
+++ b/client/src/components/Dice.tsx
@@ -1,4 +1,4 @@
-import React, { useState, useContext,useRef } from "react";
+import React, { useState, useContext, useRef } from "react";
import { useGame } from "../hooks/game-hook";
import { Row, Col } from "react-simple-flex-grid";
import "../styles/Dice.scss";
@@ -53,13 +53,12 @@ const Dice = () => {
// The is the argument for the rollDie function
const randomRollAmount = () => {
- let rollAmount = Math.floor(Math.random() * 30 + 15);
- return rollAmount;
+ return Math.floor(Math.random() * 30 + 15);
};
// The end result is simply a random number picked between 1 and 6
const randomRollResult = async () => {
- let rollResult: number = 6;
+ let rollResult = 6;
rollResult = Math.floor(Math.random() * 6 + 1);
@@ -77,7 +76,7 @@ const Dice = () => {
if (counter >= numberOfRolls) {
clearInterval(rolling);
// The result on die
- let x = await randomRollResult();
+ const x = await randomRollResult();
makeDots(x);
stopDiceSound();
moveValidator(x); // Validate move after rolling
diff --git a/client/src/components/OptionCard.tsx b/client/src/components/OptionCard.tsx
index 57912ad..64a819d 100644
--- a/client/src/components/OptionCard.tsx
+++ b/client/src/components/OptionCard.tsx
@@ -8,7 +8,7 @@ export default function OptionCard({
}: {
active?: boolean;
onSelect?: () => void;
- option?: any;
+ option?: { name: string };
}) {
return (
);
diff --git a/client/src/components/RestartGame.tsx b/client/src/components/RestartGame.tsx
index acc279c..f9c67df 100644
--- a/client/src/components/RestartGame.tsx
+++ b/client/src/components/RestartGame.tsx
@@ -11,16 +11,16 @@ const RestartGame: React.FC = () => {
const [restart, setRestart] = useState(false);
function handleRestartGame() {
- setRestart(true);
+ setRestart(true);
}
function handleConfirm() {
- restartGame();
- setRestart(false);
+ restartGame();
+ setRestart(false);
}
function handleCancle() {
- setRestart(false);
+ setRestart(false);
}
return (
@@ -32,7 +32,13 @@ const RestartGame: React.FC = () => {
)}
- {restart && }
+ {restart && (
+
+ )}
);
};
diff --git a/client/src/context/board-context.tsx b/client/src/context/board-context.tsx
index 84de5cb..282b674 100644
--- a/client/src/context/board-context.tsx
+++ b/client/src/context/board-context.tsx
@@ -9,5 +9,5 @@ interface BoardContextType {
export const BoardContext = createContext({
board: "",
- toggleBoard: () => {},
+ toggleBoard: () => undefined,
});
diff --git a/client/src/context/game-context.tsx b/client/src/context/game-context.tsx
index 723bd2b..3ff7ade 100644
--- a/client/src/context/game-context.tsx
+++ b/client/src/context/game-context.tsx
@@ -2,13 +2,15 @@ import { createContext } from "react";
import { OptionsProps } from "../types";
export const GameContext = createContext<{
+ /* eslint-disable @typescript-eslint/no-explicit-any */
gameState: { [key: string]: string | any };
setGameData: (game: { [key: string]: string }) => void;
options: OptionsProps;
- setGameOptions: (newOption: {}) => void;
+ setGameOptions: (newOption: object) => void;
}>({
gameState: {},
- setGameData: (game) => {},
+ /* eslint-disable @typescript-eslint/no-unused-vars */
+ setGameData: (game) => undefined,
options: {
gameIsOngoing: false,
playersLength: 0,
@@ -18,5 +20,5 @@ export const GameContext = createContext<{
winners: [],
gameCondition: [],
},
- setGameOptions: (newOption) => {},
+ setGameOptions: (newOption) => undefined,
});
diff --git a/client/src/dojo/DojoContext.tsx b/client/src/dojo/DojoContext.tsx
index cebee9d..7121402 100644
--- a/client/src/dojo/DojoContext.tsx
+++ b/client/src/dojo/DojoContext.tsx
@@ -1,83 +1,79 @@
+import { createContext, ReactNode, useContext, useMemo } from "react";
import { BurnerAccount, useBurnerManager } from "@dojoengine/create-burner";
-import { ReactNode, createContext, useContext, useMemo } from "react";
import { Account } from "starknet";
-import { SetupResult } from "./generated/setup";
+
+import { SetupResult } from "./setup";
interface DojoContextType extends SetupResult {
- masterAccount: Account;
- account: BurnerAccount;
+ masterAccount: Account;
+ account: BurnerAccount;
}
export const DojoContext = createContext(null);
export const DojoProvider = ({
- children,
- value,
+ children,
+ value,
}: {
- children: ReactNode;
- value: SetupResult;
+ children: ReactNode;
+ value: SetupResult;
}) => {
- const currentValue = useContext(DojoContext);
- if (currentValue) throw new Error("DojoProvider can only be used once");
+ const currentValue = useContext(DojoContext);
+ if (currentValue) throw new Error("DojoProvider can only be used once");
- const {
- config: { masterAddress, masterPrivateKey },
- burnerManager,
- dojoProvider,
- } = value;
+ const {
+ config: { masterAddress, masterPrivateKey },
+ burnerManager,
+ dojoProvider,
+ } = value;
- const masterAccount = useMemo(
- () =>
- new Account(
- dojoProvider.provider,
- masterAddress,
- masterPrivateKey,
- "1"
- ),
- [masterAddress, masterPrivateKey, dojoProvider.provider]
- );
+ const masterAccount = useMemo(
+ () =>
+ new Account(dojoProvider.provider, masterAddress, masterPrivateKey, "1"),
+ [masterAddress, masterPrivateKey, dojoProvider.provider]
+ );
- const {
- create,
- list,
- get,
- select,
- deselect,
- remove,
- clear,
- account,
- isDeploying,
- count,
- copyToClipboard,
- applyFromClipboard,
- checkIsDeployed,
- } = useBurnerManager({
- burnerManager,
- });
+ const {
+ create,
+ list,
+ get,
+ select,
+ deselect,
+ remove,
+ clear,
+ account,
+ isDeploying,
+ count,
+ copyToClipboard,
+ applyFromClipboard,
+ checkIsDeployed,
+ } = useBurnerManager({
+ burnerManager,
+ });
- return (
-
- {children}
-
- );
+ return (
+
+ {children}
+
+ );
};
diff --git a/client/src/dojo/createClientComponents.ts b/client/src/dojo/createClientComponents.ts
index 70814af..419c4e5 100644
--- a/client/src/dojo/createClientComponents.ts
+++ b/client/src/dojo/createClientComponents.ts
@@ -1,5 +1,4 @@
-import { overridableComponent } from "@dojoengine/recs";
-import { ContractComponents } from "./generated/contractComponents";
+import { ContractComponents } from "./typescript/models.gen";
export type ClientComponents = ReturnType;
@@ -10,7 +9,5 @@ export function createClientComponents({
}) {
return {
...contractComponents,
- Position: overridableComponent(contractComponents.Position),
- Moves: overridableComponent(contractComponents.Moves),
};
}
diff --git a/client/src/dojo/createSystemCalls.ts b/client/src/dojo/createSystemCalls.ts
index c3d0f06..d0b0a20 100644
--- a/client/src/dojo/createSystemCalls.ts
+++ b/client/src/dojo/createSystemCalls.ts
@@ -1,131 +1,33 @@
+import { getEvents } from "@dojoengine/utils";
import { AccountInterface } from "starknet";
-import {
- Entity,
- Has,
- HasValue,
- World,
- defineSystem,
- getComponentValue,
-} from "@dojoengine/recs";
-import { uuid } from "@latticexyz/utils";
import { ClientComponents } from "./createClientComponents";
-import { Direction, updatePositionWithDirection } from "../utils";
-import { getEntityIdFromKeys } from "@dojoengine/utils";
-import type { IWorld } from "./generated/generated";
+
+import type { IWorld } from "./typescript/contracts.gen";
export type SystemCalls = ReturnType;
export function createSystemCalls(
{ client }: { client: IWorld },
- { Position, Moves }: ClientComponents,
- world: World,
+ /* eslint-disable @typescript-eslint/no-unused-vars */
+ contractComponents: ClientComponents
) {
- const spawn = async (account: AccountInterface) => {
- const entityId = getEntityIdFromKeys([BigInt(account.address)]) as Entity;
-
- const movesId = uuid();
- Moves.addOverride(movesId, {
- entity: entityId,
- value: {
- player: BigInt(entityId),
- remaining: (getComponentValue(Moves, entityId)?.remaining || 0) + 100,
- },
- });
-
- const positionId = uuid();
- Position.addOverride(positionId, {
- entity: entityId,
- value: {
- player: BigInt(entityId),
- vec: {
- x: 10 + (getComponentValue(Position, entityId)?.vec.x || 0),
- y: 10 + (getComponentValue(Position, entityId)?.vec.y || 0),
- },
- },
- });
-
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ const createUsername = async (account: AccountInterface, username: any) => {
try {
- await client.actions.spawn({
+ const { transaction_hash } = await client.PlayerActions.create({
account,
+ username,
});
-
- // Wait for the indexer to update the entity
- // By doing this we keep the optimistic UI in sync with the actual state
- await new Promise((resolve) => {
- defineSystem(
- world,
- [Has(Moves), HasValue(Moves, { player: BigInt(account.address) })],
- () => {
- resolve();
- },
- );
- });
- } catch (e) {
- console.log(e);
- Position.removeOverride(positionId);
- Moves.removeOverride(movesId);
- } finally {
- Position.removeOverride(positionId);
- Moves.removeOverride(movesId);
- }
- };
-
- const move = async (account: AccountInterface, direction: Direction) => {
- const entityId = getEntityIdFromKeys([BigInt(account.address)]) as Entity;
-
- // Update the state before the transaction
- // const positionId = uuid();
- // Position.addOverride(positionId, {
- // entity: entityId,
- // value: {
- // player: BigInt(entityId),
- // vec: updatePositionWithDirection(
- // direction,
- // getComponentValue(Position, entityId) as any
- // ).vec,
- // },
- // });
-
- // // Update the state before the transaction
- // const movesId = uuid();
- // Moves.addOverride(movesId, {
- // entity: entityId,
- // value: {
- // player: BigInt(entityId),
- // remaining:
- // (getComponentValue(Moves, entityId)?.remaining || 0) - 1,
- // },
- // });
-
- try {
- await client.actions.move({
- account,
- direction,
+ const transaction = await account.waitForTransaction(transaction_hash, {
+ retryInterval: 100,
});
- // Wait for the indexer to update the entity
- // By doing this we keep the optimistic UI in sync with the actual state
- await new Promise((resolve) => {
- defineSystem(
- world,
- [Has(Moves), HasValue(Moves, { player: BigInt(account.address) })],
- () => {
- resolve();
- },
- );
- });
- } catch (e) {
- console.log(e);
- // Position.removeOverride(positionId);
- // Moves.removeOverride(movesId);
- } finally {
- // Position.removeOverride(positionId);
- // Moves.removeOverride(movesId);
+ const events = getEvents(transaction);
+ console.log("events: ", events);
+ } catch (error) {
+ console.log(error);
}
};
- return {
- spawn,
- move,
- };
+ return { createUsername };
}
diff --git a/client/src/dojo/generated/contractComponents.ts b/client/src/dojo/generated/contractComponents.ts
deleted file mode 100644
index d4197ee..0000000
--- a/client/src/dojo/generated/contractComponents.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Autogenerated file. Do not edit manually.
- * Generated using @dojoengine/core
- * Command: npx @dojoengine/core
- */
-
-import { defineComponent, Type as RecsType, World } from "@dojoengine/recs";
-
-export type ContractComponents = Awaited<
- ReturnType
->;
-
-export function defineContractComponents(world: World) {
- return {
- DirectionsAvailable: (() => {
- return defineComponent(
- world,
- { player: RecsType.BigInt, directions: RecsType.StringArray },
- {
- metadata: {
- name: "dojo_starter-DirectionsAvailable",
- types: ["contractaddress"],
- customTypes: ["Direction"],
- },
- },
- );
- })(),
- Moves: (() => {
- return defineComponent(
- world,
- {
- player: RecsType.BigInt,
- remaining: RecsType.Number,
- last_direction: RecsType.Number,
- can_move: RecsType.Boolean,
- },
- {
- metadata: {
- name: "dojo_starter-Moves",
- types: ["contractaddress", "u8", "enum", "bool"],
- customTypes: ["Direction"],
- },
- },
- );
- })(),
- Position: (() => {
- return defineComponent(
- world,
- {
- player: RecsType.BigInt,
- vec: { x: RecsType.Number, y: RecsType.Number },
- },
- {
- metadata: {
- name: "dojo_starter-Position",
- types: ["contractaddress", "u32", "u32"],
- customTypes: ["Vec2"],
- },
- },
- );
- })(),
- };
-}
diff --git a/client/src/dojo/generated/generated.ts b/client/src/dojo/generated/generated.ts
deleted file mode 100644
index bbd1c73..0000000
--- a/client/src/dojo/generated/generated.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { Account, AccountInterface } from "starknet";
-import { DojoProvider } from "@dojoengine/core";
-import { Direction } from "../../utils";
-
-const NAMESPACE = "dojo_starter";
-
-export interface IWorld {
- actions: {
- spawn: (props: { account: AccountInterface }) => Promise;
- move: (props: MoveProps) => Promise;
- };
-}
-
-export interface MoveProps {
- account: Account | AccountInterface;
- direction: Direction;
-}
-
-const handleError = (action: string, error: unknown) => {
- console.error(`Error executing ${action}:`, error);
- throw error;
-};
-
-export const setupWorld = async (provider: DojoProvider): Promise => {
- const actions = () => ({
- spawn: async ({ account }: { account: AccountInterface }) => {
- try {
- return await provider.execute(
- account,
- {
- contractName: "actions",
- entrypoint: "spawn",
- calldata: [],
- },
- NAMESPACE,
- );
- } catch (error) {
- handleError("spawn", error);
- }
- },
-
- move: async ({ account, direction }: MoveProps) => {
- try {
- return await provider.execute(
- account,
- {
- contractName: "actions",
- entrypoint: "move",
- calldata: [direction],
- },
- NAMESPACE,
- );
- } catch (error) {
- handleError("move", error);
- }
- },
- });
-
- return { actions: actions() };
-};
diff --git a/client/src/dojo/generated/setup.ts b/client/src/dojo/setup.ts
similarity index 74%
rename from client/src/dojo/generated/setup.ts
rename to client/src/dojo/setup.ts
index 386810d..771d748 100644
--- a/client/src/dojo/generated/setup.ts
+++ b/client/src/dojo/setup.ts
@@ -1,17 +1,18 @@
import { DojoConfig, DojoProvider } from "@dojoengine/core";
+import { BurnerManager } from "@dojoengine/create-burner";
+import { getSyncEvents } from "@dojoengine/state";
import * as torii from "@dojoengine/torii-client";
-import { createClientComponents } from "../createClientComponents";
-import { createSystemCalls } from "../createSystemCalls";
-import { defineContractComponents } from "./contractComponents";
-import { world } from "./world";
-import { setupWorld } from "./generated";
import { Account, ArraySignatureType } from "starknet";
-import { BurnerManager } from "@dojoengine/create-burner";
+
+import { createClientComponents } from "./createClientComponents";
+import { createSystemCalls } from "./createSystemCalls";
+import { setupWorld } from "./typescript/contracts.gen";
+import { defineContractComponents } from "./typescript/models.gen";
+import { world } from "./world";
export type SetupResult = Awaited>;
export async function setup({ ...config }: DojoConfig) {
- console.log(torii.poseidonHash(["1"]));
// torii client
const toriiClient = await torii.createClient({
rpcUrl: config.rpcUrl,
@@ -29,6 +30,14 @@ export async function setup({ ...config }: DojoConfig) {
// create dojo provider
const dojoProvider = new DojoProvider(config.manifest, config.rpcUrl);
+ const eventSync = getSyncEvents(
+ toriiClient,
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ contractComponents as any,
+ undefined,
+ []
+ );
+
// setup world
const client = await setupWorld(dojoProvider);
@@ -39,7 +48,7 @@ export async function setup({ ...config }: DojoConfig) {
nodeUrl: config.rpcUrl,
},
config.masterAddress,
- config.masterPrivateKey,
+ config.masterPrivateKey
),
accountClassHash: config.accountClassHash,
rpcProvider: dojoProvider.provider,
@@ -59,7 +68,7 @@ export async function setup({ ...config }: DojoConfig) {
client,
clientComponents,
contractComponents,
- systemCalls: createSystemCalls({ client }, clientComponents, world),
+ systemCalls: createSystemCalls({ client }, clientComponents),
publish: (typedData: string, signature: ArraySignatureType) => {
toriiClient.publishMessage(typedData, signature);
},
@@ -67,5 +76,6 @@ export async function setup({ ...config }: DojoConfig) {
dojoProvider,
burnerManager,
toriiClient,
+ eventSync,
};
}
diff --git a/client/src/dojo/typescript/contracts.gen.ts b/client/src/dojo/typescript/contracts.gen.ts
new file mode 100644
index 0000000..6a65dbf
--- /dev/null
+++ b/client/src/dojo/typescript/contracts.gen.ts
@@ -0,0 +1,235 @@
+// Generated by dojo-bindgen on Mon, 30 Sep 2024 04:07:50 +0000. Do not modify this file manually.
+// Import the necessary types from the recs SDK
+// generate again with `sozo build --typescript`
+import { DojoProvider } from "@dojoengine/core";
+import { Account, AccountInterface } from "starknet";
+import * as models from "./models.gen";
+
+export type IWorld = Awaited>;
+
+export async function setupWorld(provider: DojoProvider) {
+ // System definitions for `starkludo-GameActions` contract
+ function GameActions() {
+ const contract_name = "GameActions";
+
+ // Call the `create` system with the specified Account and calldata
+ const create = async (props: {
+ account: Account;
+ created_by: bigint;
+ game_mode: models.GameMode;
+ player_green: bigint;
+ player_yellow: bigint;
+ player_blue: bigint;
+ player_red: bigint;
+ number_of_players: number;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "create",
+ calldata: [
+ props.created_by,
+ ["SinglePlayer", "MultiPlayer"].indexOf(props.game_mode.type),
+ props.player_green,
+ props.player_yellow,
+ props.player_blue,
+ props.player_red,
+ props.number_of_players,
+ ],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing create:", error);
+ throw error;
+ }
+ };
+
+ // Call the `restart` system with the specified Account and calldata
+ const restart = async (props: { account: Account; game_id: number }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "restart",
+ calldata: [props.game_id],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing restart:", error);
+ throw error;
+ }
+ };
+
+ // Call the `terminate_game` system with the specified Account and calldata
+ const terminate_game = async (props: {
+ account: Account;
+ game_id: number;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "terminate_game",
+ calldata: [props.game_id],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing terminate_game:", error);
+ throw error;
+ }
+ };
+
+ // Call the `world` system with the specified Account and calldata
+ const world = async (props: { account: Account }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "world",
+ calldata: [],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing world:", error);
+ throw error;
+ }
+ };
+
+ return {
+ create,
+ restart,
+ terminate_game,
+ world,
+ };
+ }
+
+ // System definitions for `starkludo-PlayerActions` contract
+ function PlayerActions() {
+ const contract_name = "PlayerActions";
+
+ // Call the `create` system with the specified Account and calldata
+ const create = async (props: {
+ account: Account | AccountInterface;
+ username: bigint;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "create",
+ calldata: [props.username],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing create:", error);
+ throw error;
+ }
+ };
+
+ // Call the `get_address_from_username` system with the specified Account and calldata
+ const get_address_from_username = async (props: {
+ account: Account;
+ username: bigint;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "get_address_from_username",
+ calldata: [props.username],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing get_address_from_username:", error);
+ throw error;
+ }
+ };
+
+ // Call the `get_player_stats` system with the specified Account and calldata
+ const get_player_stats = async (props: {
+ account: Account;
+ username: bigint;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "get_player_stats",
+ calldata: [props.username],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing get_player_stats:", error);
+ throw error;
+ }
+ };
+
+ // Call the `update_username` system with the specified Account and calldata
+ const update_username = async (props: {
+ account: Account;
+ new_username: bigint;
+ old_username: bigint;
+ }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "update_username",
+ calldata: [props.new_username, props.old_username],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing update_username:", error);
+ throw error;
+ }
+ };
+
+ // Call the `world` system with the specified Account and calldata
+ const world = async (props: { account: Account }) => {
+ try {
+ return await provider.execute(
+ props.account,
+ {
+ contractName: contract_name,
+ entrypoint: "world",
+ calldata: [],
+ },
+ "starkludo"
+ );
+ } catch (error) {
+ console.error("Error executing world:", error);
+ throw error;
+ }
+ };
+
+ return {
+ create,
+ get_address_from_username,
+ get_player_stats,
+ update_username,
+ world,
+ };
+ }
+
+ return {
+ GameActions: GameActions(),
+ PlayerActions: PlayerActions(),
+ };
+}
diff --git a/client/src/dojo/typescript/models.gen.ts b/client/src/dojo/typescript/models.gen.ts
new file mode 100644
index 0000000..ccd3856
--- /dev/null
+++ b/client/src/dojo/typescript/models.gen.ts
@@ -0,0 +1,271 @@
+// Generated by dojo-bindgen on Mon, 30 Sep 2024 04:07:50 +0000. Do not modify this file manually.
+// Import the necessary types from the recs SDK
+// generate again with `sozo build --typescript`
+import { defineComponent, Type as RecsType, World } from "@dojoengine/recs";
+
+export type ContractComponents = Awaited<
+ ReturnType
+>;
+
+// Type definition for `starkludo::models::game::GameMode` enum
+export type GameMode = { type: "SinglePlayer" } | { type: "MultiPlayer" };
+
+export const GameModeDefinition = {
+ type: RecsType.String,
+ value: RecsType.String,
+};
+
+// Type definition for `starkludo::models::game::GameStatus` enum
+export type GameStatus =
+ | { type: "Ongoing" }
+ | { type: "Waiting" }
+ | { type: "Ended" };
+
+export const GameStatusDefinition = {
+ type: RecsType.String,
+ value: RecsType.String,
+};
+
+// Type definition for `dojo::model::layout::Layout` enum
+export type Layout =
+ | { type: "Fixed"; value: RecsType.NumberArray }
+ | { type: "Struct"; value: RecsType.StringArray }
+ | { type: "Tuple"; value: RecsType.StringArray }
+ | { type: "Array"; value: RecsType.StringArray }
+ | { type: "ByteArray" }
+ | { type: "Enum"; value: RecsType.StringArray };
+
+export const LayoutDefinition = {
+ type: RecsType.String,
+ value: RecsType.String,
+};
+
+// Type definition for `core::byte_array::ByteArray` struct
+export interface ByteArray {
+ data: String[];
+ pending_word: BigInt;
+ pending_word_len: Number;
+}
+export const ByteArrayDefinition = {
+ data: RecsType.StringArray,
+ pending_word: RecsType.BigInt,
+ pending_word_len: RecsType.Number,
+};
+
+// Type definition for `dojo::model::layout::FieldLayout` struct
+export interface FieldLayout {
+ selector: BigInt;
+ layout: Layout;
+}
+export const FieldLayoutDefinition = {
+ selector: RecsType.BigInt,
+ layout: LayoutDefinition,
+};
+
+export const U256Definition = {
+ low: RecsType.BigInt,
+ high: RecsType.BigInt,
+};
+
+// Type definition for `starkludo::models::game::Game` struct
+export interface Game {
+ id: Number;
+ created_by: BigInt;
+ game_status: GameStatus;
+ game_mode: GameMode;
+ player_green: BigInt;
+ player_yellow: BigInt;
+ player_blue: BigInt;
+ player_red: BigInt;
+ winner_1: BigInt;
+ winner_2: BigInt;
+ winner_3: BigInt;
+ next_player: BigInt;
+ number_of_players: Number;
+ rolls_count: U256;
+ rolls_times: U256;
+ dice_face: Number;
+ player_chance: BigInt;
+ has_thrown_dice: Boolean;
+ b0: BigInt;
+ b1: BigInt;
+ b2: BigInt;
+ b3: BigInt;
+ g0: BigInt;
+ g1: BigInt;
+ g2: BigInt;
+ g3: BigInt;
+ r0: BigInt;
+ r1: BigInt;
+ r2: BigInt;
+ r3: BigInt;
+ y0: BigInt;
+ y1: BigInt;
+ y2: BigInt;
+ y3: BigInt;
+}
+export const GameDefinition = {
+ id: RecsType.Number,
+ created_by: RecsType.BigInt,
+ game_status: GameStatusDefinition,
+ game_mode: GameModeDefinition,
+ player_green: RecsType.BigInt,
+ player_yellow: RecsType.BigInt,
+ player_blue: RecsType.BigInt,
+ player_red: RecsType.BigInt,
+ winner_1: RecsType.BigInt,
+ winner_2: RecsType.BigInt,
+ winner_3: RecsType.BigInt,
+ next_player: RecsType.BigInt,
+ number_of_players: RecsType.Number,
+ rolls_count: U256Definition,
+ rolls_times: U256Definition,
+ dice_face: RecsType.Number,
+ player_chance: RecsType.BigInt,
+ has_thrown_dice: RecsType.Boolean,
+ b0: RecsType.BigInt,
+ b1: RecsType.BigInt,
+ b2: RecsType.BigInt,
+ b3: RecsType.BigInt,
+ g0: RecsType.BigInt,
+ g1: RecsType.BigInt,
+ g2: RecsType.BigInt,
+ g3: RecsType.BigInt,
+ r0: RecsType.BigInt,
+ r1: RecsType.BigInt,
+ r2: RecsType.BigInt,
+ r3: RecsType.BigInt,
+ y0: RecsType.BigInt,
+ y1: RecsType.BigInt,
+ y2: RecsType.BigInt,
+ y3: RecsType.BigInt,
+};
+
+// Type definition for `core::integer::u256` struct
+export interface U256 {
+ low: BigInt;
+ high: BigInt;
+}
+
+// Type definition for `starkludo::models::player::Player` struct
+export interface Player {
+ username: BigInt;
+ owner: BigInt;
+ total_games_played: U256;
+ total_games_won: U256;
+}
+export const PlayerDefinition = {
+ username: RecsType.BigInt,
+ owner: RecsType.BigInt,
+ total_games_played: U256Definition,
+ total_games_won: U256Definition,
+};
+
+export function defineContractComponents(world: World) {
+ return {
+ // Model definition for `starkludo::models::game::Game` model
+ Game: (() => {
+ return defineComponent(
+ world,
+ {
+ id: RecsType.Number,
+ created_by: RecsType.BigInt,
+ game_status: RecsType.String,
+ game_mode: RecsType.String,
+ player_green: RecsType.BigInt,
+ player_yellow: RecsType.BigInt,
+ player_blue: RecsType.BigInt,
+ player_red: RecsType.BigInt,
+ winner_1: RecsType.BigInt,
+ winner_2: RecsType.BigInt,
+ winner_3: RecsType.BigInt,
+ next_player: RecsType.BigInt,
+ number_of_players: RecsType.Number,
+ rolls_count: U256Definition,
+ rolls_times: U256Definition,
+ dice_face: RecsType.Number,
+ player_chance: RecsType.BigInt,
+ has_thrown_dice: RecsType.Boolean,
+ b0: RecsType.BigInt,
+ b1: RecsType.BigInt,
+ b2: RecsType.BigInt,
+ b3: RecsType.BigInt,
+ g0: RecsType.BigInt,
+ g1: RecsType.BigInt,
+ g2: RecsType.BigInt,
+ g3: RecsType.BigInt,
+ r0: RecsType.BigInt,
+ r1: RecsType.BigInt,
+ r2: RecsType.BigInt,
+ r3: RecsType.BigInt,
+ y0: RecsType.BigInt,
+ y1: RecsType.BigInt,
+ y2: RecsType.BigInt,
+ y3: RecsType.BigInt,
+ },
+ {
+ metadata: {
+ namespace: "starkludo",
+ name: "Game",
+ types: [
+ "u64",
+ "ContractAddress",
+ "GameStatus",
+ "GameMode",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "u8",
+ "u8",
+ "ContractAddress",
+ "bool",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ "felt252",
+ ],
+ customTypes: ["U256", "U256"],
+ },
+ }
+ );
+ })(),
+
+ // Model definition for `starkludo::models::player::Player` model
+ Player: (() => {
+ return defineComponent(
+ world,
+ {
+ username: RecsType.BigInt,
+ owner: RecsType.BigInt,
+ total_games_played: U256Definition,
+ total_games_won: U256Definition,
+ },
+ {
+ metadata: {
+ namespace: "starkludo",
+ name: "Player",
+ types: ["felt252", "ContractAddress"],
+ customTypes: ["U256", "U256"],
+ },
+ }
+ );
+ })(),
+ };
+}
diff --git a/client/src/dojo/useDojo.tsx b/client/src/dojo/useDojo.tsx
index 9a77177..74ee27a 100644
--- a/client/src/dojo/useDojo.tsx
+++ b/client/src/dojo/useDojo.tsx
@@ -2,14 +2,13 @@ import { useContext } from "react";
import { DojoContext } from "./DojoContext";
export const useDojo = () => {
- const context = useContext(DojoContext);
- if (!context)
- throw new Error(
- "The `useDojo` hook must be used within a `DojoProvider`"
- );
+ const context = useContext(DojoContext);
+ if (!context)
+ throw new Error("The `useDojo` hook must be used within a `DojoProvider`");
- return {
- setup: context,
- account: context.account,
- };
+ return {
+ setup: context,
+ account: context.account,
+ system: context.systemCalls,
+ };
};
diff --git a/client/src/dojo/generated/world.ts b/client/src/dojo/world.ts
similarity index 100%
rename from client/src/dojo/generated/world.ts
rename to client/src/dojo/world.ts
diff --git a/client/src/hooks/game-hook.tsx b/client/src/hooks/game-hook.tsx
index 4ec3844..3726c1b 100644
--- a/client/src/hooks/game-hook.tsx
+++ b/client/src/hooks/game-hook.tsx
@@ -1,18 +1,16 @@
import { useCallback, useContext } from "react";
import { GameContext } from "../context/game-context";
-import { GameOptions, WinnerList } from "../types";
+import { GameOptions } from "../types";
import {
- capColors,
- posReducer,
BoardToPos,
PosToBoard,
+ capColors,
+ coloredBlocks,
markers,
+ posReducer,
safePos,
startState,
- coloredBlocks,
} from "./utils";
-import { toast } from "react-toastify";
-import { num } from "starknet";
export const useGame = () => {
const { gameState, setGameData, options, setGameOptions } =
@@ -20,7 +18,7 @@ export const useGame = () => {
const startGame = useCallback(
async (playersLength: number) => {
- let newGame: { [key: string]: string } = {};
+ const newGame: { [key: string]: string } = {};
Object.entries(startState)
.slice(0, playersLength * 4)
.map((entry) => {
@@ -35,7 +33,7 @@ export const useGame = () => {
gameCondition: new Array(16).fill(0),
});
},
- [setGameData, options, setGameOptions, alert]
+ [setGameData, setGameOptions]
);
const incrementChance = useCallback(
@@ -72,7 +70,7 @@ export const useGame = () => {
const moveValidator = useCallback(
(diceThrow: number) => {
setGameOptions({ diceFace: diceThrow });
- let color = options.playerChance;
+ const color = options.playerChance;
const sp = Object.values(startState);
const colorState = Object.values(gameState).slice(
color * 4,
@@ -82,7 +80,7 @@ export const useGame = () => {
if (sp.includes(c) && diceThrow !== 6) {
return 0;
} else if (coloredBlocks.includes(c)) {
- let x = parseInt(c.charAt(1));
+ const x = parseInt(c.charAt(1));
if (x === 6 || x + diceThrow > 6) return 0;
}
return 1;
@@ -113,7 +111,7 @@ export const useGame = () => {
ischance = true;
isthrown = true;
} else {
- let testVal = val + diceThrow;
+ const testVal = val + diceThrow;
if (testVal > 57) {
newVal = val;
ischance = true;
@@ -129,20 +127,20 @@ export const useGame = () => {
const moveMarker = useCallback(
async (pos: string, color: number) => {
- let diceThrow = options.diceFace;
+ const diceThrow = options.diceFace;
- let j = markers.indexOf(pos);
+ const j = markers.indexOf(pos);
// Fetch Current Game Condition
- let gameCondition = options.gameCondition;
+ const gameCondition = options.gameCondition;
let currentGame: number[] = new Array(16).fill(0);
- let isChance: boolean = false;
- let isThrown: boolean = false;
+ let isChance = false;
+ let isThrown = false;
currentGame = BoardToPos(gameCondition);
let val = currentGame[j];
- let { newVal, ischance, isthrown } = moveDeducer(val, diceThrow);
+ const { newVal, ischance, isthrown } = moveDeducer(val, diceThrow);
isChance = ischance;
isThrown = isthrown;
currentGame[j] = newVal;
@@ -165,7 +163,7 @@ export const useGame = () => {
// -- XX --
setGameOptions({ gameCondition: currentGame });
- let newGameState = posReducer(currentGame, options.playersLength);
+ const newGameState = posReducer(currentGame, options.playersLength);
const colorState = Object.values(newGameState).slice(
color * 4,
color * 4 + 4
diff --git a/client/src/hooks/size-hook.tsx b/client/src/hooks/size-hook.tsx
index 679729f..7a4d5ea 100644
--- a/client/src/hooks/size-hook.tsx
+++ b/client/src/hooks/size-hook.tsx
@@ -99,7 +99,7 @@ export interface TileNode {
export const useSize = () => {
const [size, setSize] = useState(() => {
// if (window.innerWidth > 600) {
- return 500;
+ return 500;
// } else if (window.innerWidth > 460) {
// return 400;
// } else {
@@ -109,7 +109,7 @@ export const useSize = () => {
const [tileMap, setTileMap] = useState(() => {
// if (window.innerWidth > 600) {
- return TM500;
+ return TM500;
// } else if (window.innerWidth > 460) {
// return TM400;
// } else {
@@ -120,8 +120,8 @@ export const useSize = () => {
useEffect(() => {
function handleResize() {
// if (window.innerWidth > 600) {
- setSize(500);
- setTileMap(TM500);
+ setSize(500);
+ setTileMap(TM500);
// } else if (window.innerWidth > 460) {
// setSize(400);
// setTileMap(TM400);
@@ -141,6 +141,7 @@ export const useSize = () => {
return { size, tileMap };
};
+/* eslint-disable react-refresh/only-export-components */
const TM500 = {
"1": [0.4, 0.82],
"2": [0.4, 0.76],
@@ -236,6 +237,7 @@ const TM500 = {
B04: [0.84, 0.8],
};
+/* eslint-disable @typescript-eslint/no-unused-vars */
const TM400 = {
"1": [0.395, 0.81],
"2": [0.395, 0.74],
@@ -331,6 +333,7 @@ const TM400 = {
B04: [0.83, 0.79],
};
+/* eslint-disable @typescript-eslint/no-unused-vars */
const TM300 = {
"1": [0.45, 0.92],
"2": [0.45, 0.84],
diff --git a/client/src/hooks/utils.ts b/client/src/hooks/utils.ts
index 31827b0..3e9fcc6 100644
--- a/client/src/hooks/utils.ts
+++ b/client/src/hooks/utils.ts
@@ -1,7 +1,7 @@
export const capColors: string[] = ["R", "G", "Y", "B"];
export const posReducer = (data: number[], playersLength: number) => {
- let game: { [key: string]: string } = {};
+ const game: { [key: string]: string } = {};
data.map((d, i) => {
if (i < playersLength * 4) {
if (d === 0) {
@@ -21,7 +21,7 @@ const startPoints: number[] = [0, 13, 26, 39];
export const BoardToPos = (arr: number[]) => {
const newArr: number[] = arr?.map((val, i) => {
- let color: number = Math.floor(i / 4);
+ const color: number = Math.floor(i / 4);
if (val > 52) {
return 51 + (val % 1000);
} else if (val === 0) {
@@ -37,13 +37,13 @@ export const BoardToPos = (arr: number[]) => {
export const PosToBoard = (arr: number[]) => {
const newArr: number[] = arr?.map((val, i) => {
- let color: number = Math.floor(i / 4);
+ const color: number = Math.floor(i / 4);
if (val > 51) {
return (color + 1) * 1000 + (val % 50) - 1;
} else if (val === 0) {
return 0;
} else {
- let a = (startPoints[color] + val) % 52;
+ const a = (startPoints[color] + val) % 52;
return a === 0 ? 52 : a;
}
});
@@ -95,36 +95,35 @@ export const safePos: number[] = [
export const animateCustomEase = (
duration: number,
+ /* eslint-disable @typescript-eslint/no-explicit-any */
easing: any,
element: HTMLSpanElement,
+ /* eslint-disable @typescript-eslint/no-explicit-any */
property: any,
currentValue: number,
- toValue: number,
+ toValue: number
) => {
- let d = duration,
+ const d = duration,
ea = easing,
e = element,
// eslint-disable-next-line
p = property,
fromV = currentValue,
- toV = toValue,
- lastStart: number | any = null,
- animate = function (timestamp: number) {
- debug++;
- // check if this is a new animation
- if (!lastStart) {
- lastStart = timestamp;
- }
- // check still in animation range
- if (timestamp - lastStart <= d) {
- // do animation
- e.style[property] = ea(timestamp - lastStart, 0, d, fromV, toV);
- // call next frame
- window.requestAnimationFrame(animate);
- }
- },
- // eslint-disable-next-line
- debug = 0;
+ toV = toValue;
+ let lastStart: number | null = null;
+ const animate = function (timestamp: number) {
+ // check if this is a new animation
+ if (!lastStart) {
+ lastStart = timestamp;
+ }
+ // check still in animation range
+ if (timestamp - lastStart <= d) {
+ // do animation
+ e.style[property] = ea(timestamp - lastStart, 0, d, fromV, toV);
+ // call next frame
+ window.requestAnimationFrame(animate);
+ }
+ };
return animate;
};
@@ -134,7 +133,7 @@ const Utils: {
fromMin: number,
fromMax: number,
toMin: number,
- toMax: number,
+ toMax: number
) => number;
} = {
modulate: (val, fromMin, fromMax, toMin, toMax) => {
@@ -147,16 +146,22 @@ export const flicker = (
durationLow: number,
durationHigh: number,
valLow: number,
- valHigh: number,
+ valHigh: number
) => {
// get normalized progress value from 0 - 1
- let n = Utils.modulate(progress, durationLow, durationHigh, valLow, valHigh);
- let upperCap = (Math.random() * 7) / 10;
+ const n = Utils.modulate(
+ progress,
+ durationLow,
+ durationHigh,
+ valLow,
+ valHigh
+ );
+ const upperCap = (Math.random() * 7) / 10;
if (Boolean(n) === !!n || n > upperCap) {
return n;
}
- let result: number = Math.abs(
- n * Math.sin((n - 0.13) * ((0.2 * Math.PI) / 0.4)),
+ const result: number = Math.abs(
+ n * Math.sin((n - 0.13) * ((0.2 * Math.PI) / 0.4))
);
return result > 0 ? result : result * -1;
};
diff --git a/client/src/main.tsx b/client/src/main.tsx
index 027295f..90eebe0 100644
--- a/client/src/main.tsx
+++ b/client/src/main.tsx
@@ -2,7 +2,7 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./index.css";
-import { setup } from "./dojo/generated/setup.ts";
+import { setup } from "./dojo/setup.ts";
import { DojoProvider } from "./dojo/DojoContext.tsx";
import { dojoConfig } from "../dojoConfig.ts";
import { ApolloProvider } from "@apollo/client";
diff --git a/client/src/types/react-simple-flex-grid.d.ts b/client/src/types/react-simple-flex-grid.d.ts
index aa53988..a52e869 100644
--- a/client/src/types/react-simple-flex-grid.d.ts
+++ b/client/src/types/react-simple-flex-grid.d.ts
@@ -1,4 +1,42 @@
declare module "react-simple-flex-grid" {
- export const Row: React.ComponentType;
- export const Col: React.ComponentType;
+ import { HTMLProps, PureComponent } from "react";
+
+ type JustifyContent =
+ | "start"
+ | "end"
+ | "center"
+ | "space-around"
+ | "space-between";
+
+ type AlignItems = "top " | "middle " | "bottom";
+
+ type Breakpoint = {
+ span?: number;
+ offset?: number;
+ };
+
+ export interface IRowProps {
+ gutter?: number;
+ justify?: JustifyContent;
+ align?: AlignItems;
+ }
+
+ interface IColProps {
+ span?: number;
+ offset?: number;
+ order?: number;
+ xs?: number | Breakpoint;
+ sm?: number | Breakpoint;
+ md?: number | Breakpoint;
+ lg?: number | Breakpoint;
+ xl?: number | Breakpoint;
+ }
+
+ export class Row extends PureComponent<
+ IRowProps & HTMLProps
+ > {}
+
+ export class Col extends PureComponent<
+ IColProps & HTMLProps
+ > {}
}
diff --git a/client/src/utils/constants/constants.ts b/client/src/utils/constants/constants.ts
index fc2626a..08a5b03 100644
--- a/client/src/utils/constants/constants.ts
+++ b/client/src/utils/constants/constants.ts
@@ -19,7 +19,7 @@ export const getERC721Contract = (account?: AccountInterface): Contract => {
// throw new Error("no ERC721 abi");
// }
- let contract = new Contract(ERC721_ABI, ERC721_ADDRESS, RPC_PROVIDER);
+ const contract = new Contract(ERC721_ABI, ERC721_ADDRESS, RPC_PROVIDER);
if (account) {
contract.connect(account);
@@ -39,7 +39,7 @@ export const getNftNameResolverContract = (
// if (NFT_NAME_RESOLVER_ABI === undefined) {
// throw new Error("no NFT_NAME_RESOLVER abi");
// }
- let contract = new Contract(
+ const contract = new Contract(
NFT_NAME_RESOLVER_ABI,
NFT_NAME_RESOLVER_ADDRESS,
RPC_PROVIDER
diff --git a/client/src/utils/helpers.tsx b/client/src/utils/helpers.tsx
index 73d5383..908e6df 100644
--- a/client/src/utils/helpers.tsx
+++ b/client/src/utils/helpers.tsx
@@ -7,7 +7,7 @@ import {
} from "./constants/constants";
export const convertHexToText = (hexValue: string) => {
- let stripHex = hexValue[0].slice(2);
+ const stripHex = hexValue[0].slice(2);
if (!stripHex) {
return "--Error--";
@@ -22,22 +22,22 @@ export const convertHexToText = (hexValue: string) => {
export const getGameProfilesFromAddress = async (
address: string,
- setGameProfiles: any
+ setGameProfiles: (args: string[]) => void
) => {
try {
// Get all NFT Ids belonging to address
- let ids: any[] =
+ let ids: string[] =
await getERC721Contract().get_token_ids_of_address(address);
// Convert Ids to string
ids = ids.map((id) => new BigNumber(id).toString());
- let names: string[] = [];
+ const names: string[] = [];
// Loop through Ids and get the corresponding name associated with the Id
// Reverse the list
for (let i = ids.length; i > 0; i--) {
- let name = await getNftNameResolverContract().get_name_of_id(ids[i - 1], {
+ const name = await getNftNameResolverContract().get_name_of_id(ids[i - 1], {
parseResponse: false,
});
@@ -55,7 +55,7 @@ export const createGameProfile = async (
account: AccountInterface
) => {
try {
- let addProfileTxn =
+ const addProfileTxn =
await getNftNameResolverContract(account).create_nft_name(profileName);
await RPC_PROVIDER.waitForTransaction(addProfileTxn.transaction_hash);
diff --git a/onchain/dojo_dev.toml b/onchain/dojo_dev.toml
index 81b292f..7e7d497 100644
--- a/onchain/dojo_dev.toml
+++ b/onchain/dojo_dev.toml
@@ -20,4 +20,4 @@ rpc_url = "http://localhost:5050/"
# Default account for katana with seed = 0
account_address = "0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca"
private_key = "0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a"
-# world_address = "0x403b5f047b8c4797139e30801e310473d99ca6877d19e0f27506f353f8f70f7"
+world_address = "0x4e4a8cb96198772361acc30c71d81768bccc6c29501f211b0f0ca7045b194a4"
diff --git a/onchain/manifests/dev/base/abis/contracts/starkludo-GameActions-72b46dc4.json b/onchain/manifests/dev/base/abis/contracts/starkludo-GameActions-72b46dc4.json
index 3f673b3..953e1bb 100644
--- a/onchain/manifests/dev/base/abis/contracts/starkludo-GameActions-72b46dc4.json
+++ b/onchain/manifests/dev/base/abis/contracts/starkludo-GameActions-72b46dc4.json
@@ -153,6 +153,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
diff --git a/onchain/manifests/dev/base/abis/models/starkludo-Game-5286f583.json b/onchain/manifests/dev/base/abis/models/starkludo-Game-5286f583.json
index 47c12a4..12123d4 100644
--- a/onchain/manifests/dev/base/abis/models/starkludo-Game-5286f583.json
+++ b/onchain/manifests/dev/base/abis/models/starkludo-Game-5286f583.json
@@ -374,6 +374,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
diff --git a/onchain/manifests/dev/base/contracts/starkludo-GameActions-72b46dc4.toml b/onchain/manifests/dev/base/contracts/starkludo-GameActions-72b46dc4.toml
index edc7884..436863b 100644
--- a/onchain/manifests/dev/base/contracts/starkludo-GameActions-72b46dc4.toml
+++ b/onchain/manifests/dev/base/contracts/starkludo-GameActions-72b46dc4.toml
@@ -1,6 +1,6 @@
kind = "DojoContract"
-class_hash = "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b"
-original_class_hash = "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b"
+class_hash = "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5"
+original_class_hash = "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5"
base_class_hash = "0x0"
abi = "manifests/dev/base/abis/contracts/starkludo-GameActions-72b46dc4.json"
reads = []
diff --git a/onchain/manifests/dev/base/contracts/starkludo-PlayerActions-20dad3ac.toml b/onchain/manifests/dev/base/contracts/starkludo-PlayerActions-20dad3ac.toml
index 57e8b61..e3304d2 100644
--- a/onchain/manifests/dev/base/contracts/starkludo-PlayerActions-20dad3ac.toml
+++ b/onchain/manifests/dev/base/contracts/starkludo-PlayerActions-20dad3ac.toml
@@ -1,6 +1,6 @@
kind = "DojoContract"
-class_hash = "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c"
-original_class_hash = "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c"
+class_hash = "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65"
+original_class_hash = "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65"
base_class_hash = "0x0"
abi = "manifests/dev/base/abis/contracts/starkludo-PlayerActions-20dad3ac.json"
reads = []
diff --git a/onchain/manifests/dev/base/models/starkludo-Game-5286f583.toml b/onchain/manifests/dev/base/models/starkludo-Game-5286f583.toml
index 74a1cde..94b732a 100644
--- a/onchain/manifests/dev/base/models/starkludo-Game-5286f583.toml
+++ b/onchain/manifests/dev/base/models/starkludo-Game-5286f583.toml
@@ -1,6 +1,6 @@
kind = "DojoModel"
-class_hash = "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446"
-original_class_hash = "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446"
+class_hash = "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939"
+original_class_hash = "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939"
abi = "manifests/dev/base/abis/models/starkludo-Game-5286f583.json"
tag = "starkludo-Game"
qualified_path = "starkludo::models::game::game"
diff --git a/onchain/manifests/dev/deployment/abis/contracts/starkludo-GameActions-72b46dc4.json b/onchain/manifests/dev/deployment/abis/contracts/starkludo-GameActions-72b46dc4.json
index 3f673b3..953e1bb 100644
--- a/onchain/manifests/dev/deployment/abis/contracts/starkludo-GameActions-72b46dc4.json
+++ b/onchain/manifests/dev/deployment/abis/contracts/starkludo-GameActions-72b46dc4.json
@@ -153,6 +153,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
diff --git a/onchain/manifests/dev/deployment/abis/models/starkludo-Game-5286f583.json b/onchain/manifests/dev/deployment/abis/models/starkludo-Game-5286f583.json
index 47c12a4..12123d4 100644
--- a/onchain/manifests/dev/deployment/abis/models/starkludo-Game-5286f583.json
+++ b/onchain/manifests/dev/deployment/abis/models/starkludo-Game-5286f583.json
@@ -374,6 +374,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
diff --git a/onchain/manifests/dev/deployment/manifest.json b/onchain/manifests/dev/deployment/manifest.json
index 4b72e05..f4e87a5 100644
--- a/onchain/manifests/dev/deployment/manifest.json
+++ b/onchain/manifests/dev/deployment/manifest.json
@@ -1235,7 +1235,7 @@
}
],
"address": "0x4e4a8cb96198772361acc30c71d81768bccc6c29501f211b0f0ca7045b194a4",
- "transaction_hash": "0x3513bbae0a1a028eca7f1f1accd8a78fc4a101abfecf4d511b9d14573823bb0",
+ "transaction_hash": "0x6c8c96163c93a23251256cedd16c15751b44196a7cff29726198f65aba14f70",
"block_number": 3,
"seed": "starkludo",
"metadata": {
@@ -1256,8 +1256,8 @@
{
"kind": "DojoContract",
"address": "0x7b7ccc529c6d4cd2c857247c9c42ffa098aeb9a3c4718771825e054f98039e3",
- "class_hash": "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b",
- "original_class_hash": "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b",
+ "class_hash": "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5",
+ "original_class_hash": "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5",
"base_class_hash": "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2",
"abi": [
{
@@ -1414,6 +1414,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
@@ -1751,8 +1755,8 @@
{
"kind": "DojoContract",
"address": "0x182a153535285af4bf98b00141f6ffe37edd898947e450b6a2c5d54c3b6e178",
- "class_hash": "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c",
- "original_class_hash": "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c",
+ "class_hash": "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65",
+ "original_class_hash": "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65",
"base_class_hash": "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2",
"abi": [
{
@@ -2231,8 +2235,8 @@
"key": false
}
],
- "class_hash": "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446",
- "original_class_hash": "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446",
+ "class_hash": "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939",
+ "original_class_hash": "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939",
"abi": [
{
"type": "impl",
@@ -2609,6 +2613,10 @@
"name": "Ongoing",
"type": "()"
},
+ {
+ "name": "Waiting",
+ "type": "()"
+ },
{
"name": "Ended",
"type": "()"
diff --git a/onchain/manifests/dev/deployment/manifest.toml b/onchain/manifests/dev/deployment/manifest.toml
index bea0d59..dddbba6 100644
--- a/onchain/manifests/dev/deployment/manifest.toml
+++ b/onchain/manifests/dev/deployment/manifest.toml
@@ -4,7 +4,7 @@ class_hash = "0x5c4271c8cd454ceb8049d2b0724c99d12c2ef8077fc6ad325b18978f614aab0"
original_class_hash = "0x5c4271c8cd454ceb8049d2b0724c99d12c2ef8077fc6ad325b18978f614aab0"
abi = "manifests/dev/deployment/abis/dojo-world.json"
address = "0x4e4a8cb96198772361acc30c71d81768bccc6c29501f211b0f0ca7045b194a4"
-transaction_hash = "0x3513bbae0a1a028eca7f1f1accd8a78fc4a101abfecf4d511b9d14573823bb0"
+transaction_hash = "0x6c8c96163c93a23251256cedd16c15751b44196a7cff29726198f65aba14f70"
block_number = 3
seed = "starkludo"
manifest_name = "dojo-world"
@@ -24,8 +24,8 @@ manifest_name = "dojo-base"
[[contracts]]
kind = "DojoContract"
address = "0x7b7ccc529c6d4cd2c857247c9c42ffa098aeb9a3c4718771825e054f98039e3"
-class_hash = "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b"
-original_class_hash = "0x5cd57a1faec53ae7b0f89465e4c2a1b639fe1ac30fbb46007bd5a3ff4c9fb6b"
+class_hash = "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5"
+original_class_hash = "0x4cecefc87acb36b188cec659cfde8d7cbfafaf8684297f7d66cadd573cbfec5"
base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2"
abi = "manifests/dev/deployment/abis/contracts/starkludo-GameActions-72b46dc4.json"
reads = []
@@ -41,8 +41,8 @@ manifest_name = "starkludo-GameActions-72b46dc4"
[[contracts]]
kind = "DojoContract"
address = "0x182a153535285af4bf98b00141f6ffe37edd898947e450b6a2c5d54c3b6e178"
-class_hash = "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c"
-original_class_hash = "0x4b3c29628dab01e08eba58707af15743108c4e7d2e169555375efc8f1ee6e2c"
+class_hash = "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65"
+original_class_hash = "0x23f585a946c3224f0993e7001e132dfc559a7683e520ef4c5beee9a5bc8dd65"
base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2"
abi = "manifests/dev/deployment/abis/contracts/starkludo-PlayerActions-20dad3ac.json"
reads = []
@@ -57,8 +57,8 @@ manifest_name = "starkludo-PlayerActions-20dad3ac"
[[models]]
kind = "DojoModel"
-class_hash = "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446"
-original_class_hash = "0x142b55dcf7d81397c7c9a4e8d97235f7a441b8ecfbafcaf59d096a87ac7d446"
+class_hash = "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939"
+original_class_hash = "0x6f661d514e79ee250cef7baa203a0b994f3f9e2dd4cf4fa4ba991f43d11d939"
abi = "manifests/dev/deployment/abis/models/starkludo-Game-5286f583.json"
tag = "starkludo-Game"
qualified_path = "starkludo::models::game::game"