diff --git a/clients/react-client/src/typescript/models.gen.ts b/clients/react-client/src/typescript/models.gen.ts index 55eed71..1d56ed3 100644 --- a/clients/react-client/src/typescript/models.gen.ts +++ b/clients/react-client/src/typescript/models.gen.ts @@ -1,145 +1,149 @@ - // Generated by dojo-bindgen on Wed, 21 Aug 2024 14:15:09 +0000. Do not modify this file manually. // Import the necessary types from the recs SDK -// generate again with `sozo build --typescript` +// generate again with `sozo build --typescript` import { defineComponent, Type as RecsType, World } from "@dojoengine/recs"; -export type ContractComponents = Awaited>; - - +export type ContractComponents = Awaited< + ReturnType +>; // 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 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: RecsType.String, + value: RecsType.String, }; - + // Type definition for `rpg::models::index::Player` struct export interface Player { - id: BigInt; - mode: Number; - role: Number; - damage: Number; - health: Number; - gold: Number; - score: Number; - seed: BigInt; - name: BigInt; - + id: BigInt; + mode: Number; + role: Number; + damage: Number; + health: Number; + gold: Number; + score: Number; + seed: BigInt; + name: BigInt; } export const PlayerDefinition = { - id: RecsType.BigInt, - mode: RecsType.Number, - role: RecsType.Number, - damage: RecsType.Number, - health: RecsType.Number, - gold: RecsType.Number, - score: RecsType.Number, - seed: RecsType.BigInt, - name: RecsType.BigInt, - + id: RecsType.BigInt, + mode: RecsType.Number, + role: RecsType.Number, + damage: RecsType.Number, + health: RecsType.Number, + gold: RecsType.Number, + score: RecsType.Number, + seed: RecsType.BigInt, + name: RecsType.BigInt, }; // Type definition for `dojo::model::layout::FieldLayout` struct export interface FieldLayout { - selector: BigInt; - layout: Layout; - + selector: BigInt; + layout: Layout; } export const FieldLayoutDefinition = { - selector: RecsType.BigInt, - layout: LayoutDefinition, - + selector: RecsType.BigInt, + layout: LayoutDefinition, }; // Type definition for `core::byte_array::ByteArray` struct export interface ByteArray { - data: String[]; - pending_word: BigInt; - pending_word_len: Number; - + data: String[]; + pending_word: BigInt; + pending_word_len: Number; } export const ByteArrayDefinition = { - data: RecsType.StringArray, - pending_word: RecsType.BigInt, - pending_word_len: RecsType.Number, - + data: RecsType.StringArray, + pending_word: RecsType.BigInt, + pending_word_len: RecsType.Number, }; - // Type definition for `rpg::models::index::Dungeon` struct export interface Dungeon { - id: BigInt; - monster: Number; - role: Number; - damage: Number; - health: Number; - reward: Number; - + id: BigInt; + monster: Number; + role: Number; + damage: Number; + health: Number; + reward: Number; } export const DungeonDefinition = { - id: RecsType.BigInt, - monster: RecsType.Number, - role: RecsType.Number, - damage: RecsType.Number, - health: RecsType.Number, - reward: RecsType.Number, - + id: RecsType.BigInt, + monster: RecsType.Number, + role: RecsType.Number, + damage: RecsType.Number, + health: RecsType.Number, + reward: RecsType.Number, }; - export function defineContractComponents(world: World) { - return { - - // Model definition for `rpg::models::index::Player` model - Player: (() => { - return defineComponent( - world, - { - id: RecsType.BigInt, - mode: RecsType.Number, - role: RecsType.Number, - damage: RecsType.Number, - health: RecsType.Number, - gold: RecsType.Number, - score: RecsType.Number, - seed: RecsType.BigInt, - name: RecsType.BigInt, - }, - { - metadata: { - namespace: "dojo_starter_rpg", - name: "Player", - types: ["felt252", "u8", "u8", "u8", "u8", "u16", "u16", "felt252", "felt252"], - customTypes: [], - }, - } - ); - })(), + return { + // Model definition for `rpg::models::index::Player` model + Player: (() => { + return defineComponent( + world, + { + id: RecsType.BigInt, + mode: RecsType.Number, + role: RecsType.Number, + damage: RecsType.Number, + health: RecsType.Number, + gold: RecsType.Number, + score: RecsType.Number, + seed: RecsType.BigInt, + name: RecsType.BigInt, + }, + { + metadata: { + namespace: "dojo_starter_rpg", + name: "Player", + types: [ + "felt252", + "u8", + "u8", + "u8", + "u8", + "u16", + "u16", + "felt252", + "felt252", + ], + customTypes: [], + }, + } + ); + })(), - // Model definition for `rpg::models::index::Dungeon` model - Dungeon: (() => { - return defineComponent( - world, - { - id: RecsType.BigInt, - monster: RecsType.Number, - role: RecsType.Number, - damage: RecsType.Number, - health: RecsType.Number, - reward: RecsType.Number, - }, - { - metadata: { - namespace: "dojo_starter_rpg", - name: "Dungeon", - types: ["felt252", "u8", "u8", "u8", "u8", "u16"], - customTypes: [], - }, - } - ); - })(), - }; + // Model definition for `rpg::models::index::Dungeon` model + Dungeon: (() => { + return defineComponent( + world, + { + id: RecsType.BigInt, + monster: RecsType.Number, + role: RecsType.Number, + damage: RecsType.Number, + health: RecsType.Number, + reward: RecsType.Number, + }, + { + metadata: { + namespace: "dojo_starter_rpg", + name: "Dungeon", + types: ["felt252", "u8", "u8", "u8", "u8", "u16"], + customTypes: [], + }, + } + ); + })(), + }; } diff --git a/clients/react-recs-app/src/App.tsx b/clients/react-recs-app/src/App.tsx index fb0a31f..16ef200 100644 --- a/clients/react-recs-app/src/App.tsx +++ b/clients/react-recs-app/src/App.tsx @@ -21,6 +21,9 @@ function App() { const player = useComponentValue(Player, entityId); const dungeon = useComponentValue(Dungeon, entityId); + console.log("dungeon", dungeon); + console.log("player", player); + return ( <>
@@ -42,7 +45,7 @@ function App() {