Skip to content

Commit

Permalink
Mancala sepolia alpha (#169)
Browse files Browse the repository at this point in the history
* feat: sepolia switch

* wip

* gameplay

* updates?

* wip

* wip

* wip

---------

Co-authored-by: supreme2580 <[email protected]>
  • Loading branch information
okhaimie-dev and supreme2580 authored Sep 2, 2024
1 parent 5c079a5 commit f172c1b
Show file tree
Hide file tree
Showing 43 changed files with 9,937 additions and 131 deletions.
Binary file modified .DS_Store
Binary file not shown.
10 changes: 5 additions & 5 deletions client/dojoConfig.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import manifest from "../contracts/manifests/dev/deployment/manifest.json";
import manifest from "../contracts/manifests/sepolia/deployment/manifest.json";
import { createDojoConfig } from "@dojoengine/core";

export const dojoConfig = createDojoConfig({
manifest,
rpcUrl: "https://api.cartridge.gg/x/mancala-alpha-v3/katana",
toriiUrl: "https://api.cartridge.gg/x/mancala-alpha-v3/torii",
rpcUrl: "https://starknet-sepolia.public.blastapi.io/rpc/v0_7",
toriiUrl: "https://api.cartridge.gg/x/mancala-alpha-sepolia-v4/torii",
masterAddress:
"0x6d8a4c8c7830004f53371b56773278e0ab107fc10ecffb008a33ad84c5f2175",
"0x02A54eFf65D55a2E7D2fC7E23eF0F0e6030dB0313b16c8F0eaD0b4a83807f6d6",
masterPrivateKey:
"0x5d2e95d7477224d35cd3b1ffe50c1631573e21b71977605177528acfc4b8598",
"0x0396533b7a1182ef03da483eca82e9dd2b17bee9c7fec07ac6cbbeb8bfd573cb",
});
2 changes: 1 addition & 1 deletion client/graphql.config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
schema: https://api.cartridge.gg/x/mancala-alpha-v3/torii/graphql
schema: https://api.cartridge.gg/x/mancala-alpha-sepolia-v4/torii/graphql
documents: "**/*.graphql"
14 changes: 7 additions & 7 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
},
"dependencies": {
"@apollo/client": "^3.11.4",
"@cartridge/connector": "^0.3.40",
"@cartridge/controller": "^0.3.40",
"@dojoengine/core": "1.0.0-alpha.5",
"@dojoengine/create-burner": "1.0.0-alpha.5",
"@dojoengine/react": "1.0.0-alpha.5",
"@cartridge/connector": "^0.3.43",
"@cartridge/controller": "^0.3.43",
"@dojoengine/core": "1.0.0-alpha.8",
"@dojoengine/create-burner": "1.0.0-alpha.8",
"@dojoengine/react": "1.0.0-alpha.8",
"@dojoengine/recs": "^2.0.13",
"@dojoengine/state": "1.0.0-alpha.5",
"@dojoengine/torii-client": "1.0.0-alpha.5",
"@dojoengine/state": "1.0.0-alpha.8",
"@dojoengine/torii-client": "1.0.0-alpha.8",
"@dojoengine/utils": "1.0.0-alpha.5",
"@graphql-codegen/typescript": "^4.0.9",
"@graphql-codegen/typescript-operations": "^4.2.3",
Expand Down
95 changes: 56 additions & 39 deletions client/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Leaderboard from "./pages/Leaderboard";
import Lobby from "./pages/Lobby";

const CONTRACT_ADDRESS =
"0x4c4869d1067625074edd5f2c68774831ee26261423b8a17fc71f533e7b03f5c";
"0x75f40d154faffb3078122f7c018d43e327911cd1dcccc64cbaba2bae7e620ac";

const policies = [
{
Expand Down Expand Up @@ -45,13 +45,18 @@ const policies = [
];

const options: ControllerOptions = {
rpc: "https://api.cartridge.gg/x/mancala-alpha-v3/katana",
rpc: "https://starknet-sepolia.public.blastapi.io/rpc/v0_7",
theme: "realm-of-ra",
};

const connectorOptions = {
policies,
...options,
};

function rpc(_chain: Chain) {
return {
nodeUrl: "https://api.cartridge.gg/x/mancala-alpha-v3/katana",
nodeUrl: "https://starknet-sepolia.public.blastapi.io/rpc/v0_7",
};
}

Expand Down Expand Up @@ -80,7 +85,7 @@ export default function App() {
}, []);

const connectors = [
new CartridgeConnector(policies, options) as never as Connector,
new CartridgeConnector(connectorOptions) as never as Connector,
];

return (
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/lobby/duels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ export default function Duels({ games, transactions, loading }: { games: any, tr
challenger: data.node.player_one,
challenged: data.node.player_two,
winner: data.node.winner,
date: transactions[index].node.executedAt,
date: transactions[index].executedAt,
}
})


if (loading) {
return <DuelsSkeleton />
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/lobby/live-duels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LiveSkeleton } from "./live-skeleton.tsx";
import { Link, useNavigate } from "react-router-dom";
import { UserIcon } from "@heroicons/react/24/solid";

export default function LiveDuels({ games, transactions }: { games: any, transactions: any }) {
export default function LiveDuels({ games }: { games: any }) {
const { provider } = useProvider();
const navigate = useNavigate();
const starknetIdNavigator = useMemo(() => {
Expand Down Expand Up @@ -49,9 +49,9 @@ export default function LiveDuels({ games, transactions }: { games: any, transac
// })
const data = games?.map((data: any, index: number) => {
return {
challenger: data.node.player_one,
challenged: data.node.player_two,
date: transactions[index].node.executedAt,
challenger: data?.node.player_one,
challenged: data?.node.player_two,
date: data?.node.entity?.executedAt,
}
})
const { system } = useDojo()
Expand Down
3 changes: 2 additions & 1 deletion client/src/constants/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const CONFIG = {
GRAPHQL_ENDPOINT: "https://api.cartridge.gg/x/mancala-alpha-v3/torii/graphql",
GRAPHQL_ENDPOINT:
"https://api.cartridge.gg/x/mancala-alpha-sepolia-v4/torii/graphql",
};

export default CONFIG;
37 changes: 17 additions & 20 deletions client/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -938,13 +938,9 @@ export const MancalaModelsFetchDocument = gql`
status
is_private
time_between_move
}
}
}
transactions {
edges {
node {
executedAt
entity {
executedAt
}
}
}
}
Expand Down Expand Up @@ -984,20 +980,21 @@ export type MancalaModelsFetchSuspenseQueryHookResult = ReturnType<typeof useMan
export type MancalaModelsFetchQueryResult = Apollo.QueryResult<MancalaModelsFetchQuery, MancalaModelsFetchQueryVariables>;
export const FetchModelsForLeaderBoardDocument = gql`
query FetchModelsForLeaderBoard {
mancalaAlphaMancalaGameModels {
edges {
node {
game_id
player_one
player_two
current_player
winner
status
is_private
mancalaAlphaMancalaGameModels {
edges {
node {
game_id
player_one
player_two
current_player
winner
status
is_private
time_between_move
}
}
}
}
}
}
}
`;

/**
Expand Down
Loading

0 comments on commit f172c1b

Please sign in to comment.