Skip to content

Commit

Permalink
Merge pull request #220 from dojoengine/fix-recs
Browse files Browse the repository at this point in the history
fix: bump recs, deps
  • Loading branch information
ponderingdemocritus authored Jun 20, 2024
2 parents 5f97b0f + efd6ae3 commit 818461b
Show file tree
Hide file tree
Showing 16 changed files with 13,734 additions and 11,143 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Run tests
run: pnpm run test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions examples/react/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@dojoengine/core": "workspace:*",
"@dojoengine/create-burner": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@dojoengine/state": "workspace:*",
"@dojoengine/torii-client": "workspace:*",
"@dojoengine/utils": "workspace:*",
"@latticexyz/react": "^2.0.0-next.11",
"@latticexyz/utils": "^2.0.0-next.11",
"@latticexyz/react": "^2.0.12",
"@latticexyz/utils": "^2.0.12",
"ethers": "^5.7.2",
"mobx": "^6.9.0",
"proxy-deep": "^3.1.1",
Expand Down
13 changes: 11 additions & 2 deletions examples/react/react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useComponentValue } from "@dojoengine/react";
import { Entity, getComponentValue } from "@dojoengine/recs";
import { Entity } from "@dojoengine/recs";
import { useEffect, useState } from "react";
import "./App.css";
import { Direction } from "./utils";
Expand Down Expand Up @@ -30,7 +30,7 @@ function App() {
const moves = useComponentValue(Moves, entityId);
const directions = useComponentValue(DirectionsAvailable, entityId);

console.log(moves);
console.log("directions", directions);

const handleRestoreBurners = async () => {
try {
Expand Down Expand Up @@ -117,6 +117,15 @@ function App() {
</div>

<div>{moves && moves.last_direction}</div>

<div>
<div>Available Positions</div>
{directions?.directions.map((a: any, index: any) => (
<div key={index} className="">
{a}
</div>
))}
</div>
</div>

<div className="card">
Expand Down
58 changes: 29 additions & 29 deletions examples/react/react-app/src/dojo/createSystemCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ export function createSystemCalls(
BigInt(account.address),
]) as Entity;

const positionId = uuid();
Position.addOverride(positionId, {
entity: entityId,
value: {
player: BigInt(entityId),
vec: updatePositionWithDirection(
direction,
getComponentValue(Position, entityId) as any
).vec,
},
});
// const positionId = uuid();
// Position.addOverride(positionId, {
// entity: entityId,
// value: {
// player: BigInt(entityId),
// vec: updatePositionWithDirection(
// direction,
// getComponentValue(Position, entityId) as any
// ).vec,
// },
// });

const movesId = uuid();
Moves.addOverride(movesId, {
entity: entityId,
value: {
player: BigInt(entityId),
remaining:
(getComponentValue(Moves, entityId)?.remaining || 0) - 1,
},
});
// const movesId = uuid();
// Moves.addOverride(movesId, {
// entity: entityId,
// value: {
// player: BigInt(entityId),
// remaining:
// (getComponentValue(Moves, entityId)?.remaining || 0) - 1,
// },
// });

try {
const { transaction_hash } = await client.actions.move({
Expand All @@ -69,20 +69,20 @@ export function createSystemCalls(
retryInterval: 100,
});

console.log(
await account.waitForTransaction(transaction_hash, {
retryInterval: 100,
})
);
// console.log(
// await account.waitForTransaction(transaction_hash, {
// retryInterval: 100,
// })
// );

await new Promise((resolve) => setTimeout(resolve, 1000));
} catch (e) {
console.log(e);
Position.removeOverride(positionId);
Moves.removeOverride(movesId);
// Position.removeOverride(positionId);
// Moves.removeOverride(movesId);
} finally {
Position.removeOverride(positionId);
Moves.removeOverride(movesId);
// Position.removeOverride(positionId);
// Moves.removeOverride(movesId);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function defineContractComponents(world: World) {
metadata: {
name: "DirectionsAvailable",
types: ["contractaddress"],
customTypes: [],
customTypes: ["Direction"],
},
}
);
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-phaser-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@dojoengine/utils": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/state": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@dojoengine/torii-wasm": "workspace:*",
"@latticexyz/phaserx": "^2.0.0-next.14",
"@latticexyz/utils": "^2.0.0-next.14",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-pwa-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@dojoengine/utils": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/state": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@latticexyz/react": "^2.0.0-next.11",
"@latticexyz/utils": "^2.0.0-next.11",
"@vite-pwa/assets-generator": "^0.2.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-threejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@dojoengine/utils": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/state": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
Expand Down
3 changes: 1 addition & 2 deletions examples/react/starknet-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"@dojoengine/utils": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/state": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@latticexyz/react": "^2.0.0-next.11",
"@dojoengine/recs": "2.0.13",
"@latticexyz/utils": "^2.0.0-next.11",
"@starknet-react/chains": "^0.1.7",
"@starknet-react/core": "^2.2.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/vue-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@dojoengine/core": "workspace:*",
"@dojoengine/create-burner": "workspace:*",
"@dojoengine/react": "workspace:*",
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@dojoengine/state": "workspace:*",
"@dojoengine/torii-client": "workspace:*",
"@dojoengine/utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"vitest": "^1.1.0"
},
"dependencies": {
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"zod": "^3.22.4"
},
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"typescript": "^5.0.3"
},
"dependencies": {
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@dojoengine/state": "workspace:*",
"@dojoengine/torii-client": "workspace:*",
"@dojoengine/utils": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"starknet": "^6.1.5"
},
"dependencies": {
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@dojoengine/torii-client": "workspace:*",
"@latticexyz/utils": "^2.0.0-next.11",
"zustand": "^4.5.2"
Expand Down
6 changes: 1 addition & 5 deletions packages/state/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export function convertValues(schema: Schema, values: any) {

switch (schemaType) {
case RecsType.StringArray:
if (
value.type === "array" &&
value.value.length > 0 &&
value.value[0].type === "enum"
) {
if (value.type === "array" && value.value[0].type === "enum") {
acc[key] = value.value.map(
(item: any) => item.value.option
);
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"starknet": "^6.1.5"
},
"dependencies": {
"@dojoengine/recs": "0.1.35",
"@dojoengine/recs": "2.0.13",
"@latticexyz/utils": "^2.0.0-next.11",
"mathjs": "^12.0.0",
"micro-starknet": "^0.2.3"
Expand Down
Loading

0 comments on commit 818461b

Please sign in to comment.