File tree 12 files changed +40
-32
lines changed
clients/react/react-app/src 12 files changed +40
-32
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ function App() {
17
17
account,
18
18
} = useDojo ( ) ;
19
19
20
+ // sync entities
20
21
useQuerySync ( toriiClient , contractComponents as any , [ ] ) ;
21
22
22
23
const [ clipboardStatus , setClipboardStatus ] = useState ( {
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { world } from "./world";
7
7
import { setupWorld } from "./typescript/contracts.gen" ;
8
8
import { Account , ArraySignatureType } from "starknet" ;
9
9
import { BurnerManager } from "@dojoengine/create-burner" ;
10
- import { getSyncEvents } from "@dojoengine/state" ;
10
+ import { getSyncEvents , getSyncEntities } from "@dojoengine/state" ;
11
11
12
12
export type SetupResult = Awaited < ReturnType < typeof setup > > ;
13
13
@@ -29,13 +29,21 @@ export async function setup({ ...config }: DojoConfig) {
29
29
// create dojo provider
30
30
const dojoProvider = new DojoProvider ( config . manifest , config . rpcUrl ) ;
31
31
32
+ // Sync all events
32
33
const eventSync = getSyncEvents (
33
34
toriiClient ,
34
35
contractComponents as any ,
35
36
undefined ,
36
37
[ ]
37
38
) ;
38
39
40
+ // Sync all entities
41
+ const sync = await getSyncEntities (
42
+ toriiClient ,
43
+ contractComponents as any ,
44
+ [ ]
45
+ ) ;
46
+
39
47
// setup world
40
48
const client = await setupWorld ( dojoProvider ) ;
41
49
@@ -75,5 +83,6 @@ export async function setup({ ...config }: DojoConfig) {
75
83
burnerManager,
76
84
toriiClient,
77
85
eventSync,
86
+ sync,
78
87
} ;
79
88
}
Original file line number Diff line number Diff line change 10
10
steps :
11
11
- uses : actions/checkout@v3
12
12
- run : curl -L https://install.dojoengine.org | bash
13
- - run : /home/runner/.config/.dojo/bin/dojoup -v v1.0.0-alpha.6
13
+ - run : /home/runner/.config/.dojo/bin/dojoup -v v1.0.0-alpha.9
14
14
- run : |
15
15
/home/runner/.config/.dojo/bin/sozo build
16
16
/home/runner/.config/.dojo/bin/sozo test
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ sozo build
41
41
sozo migrate apply
42
42
43
43
# Start Torii
44
- torii --world 0x403b5f047b8c4797139e30801e310473d99ca6877d19e0f27506f353f8f70f7 --allowed-origins " *"
44
+ torii --world 0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e --allowed-origins " *"
45
45
```
46
46
47
47
---
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ version = 1
4
4
[[package]]
5
5
name = "dojo"
6
6
version = "1.0.0-alpha.4"
7
- source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.6#ede7930735c708572af8a87f81bb76354a401b3a "
7
+ source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.9#e42ce0c220a59d75c5b08e87a81de12cfdc27a55 "
8
8
dependencies = [
9
9
"dojo_plugin",
10
10
]
Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ spawn = "./scripts/spawn.sh"
12
12
move = " ./scripts/move.sh"
13
13
14
14
[dependencies ]
15
- dojo = { git = " https://github.com/dojoengine/dojo" , tag = " v1.0.0-alpha.6 " }
15
+ dojo = { git = " https://github.com/dojoengine/dojo" , tag = " v1.0.0-alpha.9 " }
16
16
17
17
[[target .dojo ]]
Original file line number Diff line number Diff line change @@ -20,4 +20,4 @@ rpc_url = "http://localhost:5050/"
20
20
# Default account for katana with seed = 0
21
21
account_address = " 0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca"
22
22
private_key = " 0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a"
23
- world_address = " 0x403b5f047b8c4797139e30801e310473d99ca6877d19e0f27506f353f8f70f7 "
23
+ world_address = " 0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e "
Original file line number Diff line number Diff line change 1
1
kind = " DojoContract"
2
- class_hash = " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 "
3
- original_class_hash = " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 "
2
+ class_hash = " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 "
3
+ original_class_hash = " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 "
4
4
base_class_hash = " 0x0"
5
5
abi = " manifests/dev/base/abis/contracts/dojo_starter-actions-7a1c7102.json"
6
6
reads = []
Original file line number Diff line number Diff line change 1
1
kind = " Class"
2
- class_hash = " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 "
3
- original_class_hash = " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 "
2
+ class_hash = " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 "
3
+ original_class_hash = " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 "
4
4
abi = " manifests/dev/base/abis/dojo-world.json"
5
5
tag = " dojo-world"
6
6
manifest_name = " dojo-world"
Original file line number Diff line number Diff line change 1
1
{
2
2
"world" : {
3
3
"kind" : " WorldContract" ,
4
- "class_hash" : " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 " ,
5
- "original_class_hash" : " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 " ,
4
+ "class_hash" : " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 " ,
5
+ "original_class_hash" : " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 " ,
6
6
"abi" : [
7
7
{
8
8
"type" : " impl" ,
1229
1229
]
1230
1230
}
1231
1231
],
1232
- "address" : " 0x403b5f047b8c4797139e30801e310473d99ca6877d19e0f27506f353f8f70f7 " ,
1233
- "transaction_hash" : " 0x12df6c5a6c89d2c128c96026395f1f8917c36a7864aca26f0c7b9e2ea152bca " ,
1232
+ "address" : " 0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e " ,
1233
+ "transaction_hash" : " 0x4729b83525f0dddbfce0afd73e0b6a39303de51690efd756691356c21c30067 " ,
1234
1234
"block_number" : 3 ,
1235
1235
"seed" : " dojo_starter" ,
1236
1236
"metadata" : {
1250
1250
"contracts" : [
1251
1251
{
1252
1252
"kind" : " DojoContract" ,
1253
- "address" : " 0x36e4506b35e6dfb301d437c95f74b3e1f4f82da5d8841bec894bb8de29ec13 " ,
1254
- "class_hash" : " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 " ,
1255
- "original_class_hash" : " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 " ,
1253
+ "address" : " 0x5e8df8a235031ba8e66e590a7289d27d7d54c026bcdbda62b791c0a69055225 " ,
1254
+ "class_hash" : " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 " ,
1255
+ "original_class_hash" : " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 " ,
1256
1256
"base_class_hash" : " 0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2" ,
1257
1257
"abi" : [
1258
1258
{
Original file line number Diff line number Diff line change 1
1
[world ]
2
2
kind = " WorldContract"
3
- class_hash = " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 "
4
- original_class_hash = " 0x458d0ce5b14a4844092bdb62050f462d53362304a13febbac6d973691d61be2 "
3
+ class_hash = " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 "
4
+ original_class_hash = " 0xa349b743d361ce4567361475a89b84a386bb383448c6926954e5fe0b525597 "
5
5
abi = " manifests/dev/deployment/abis/dojo-world.json"
6
- address = " 0x403b5f047b8c4797139e30801e310473d99ca6877d19e0f27506f353f8f70f7 "
7
- transaction_hash = " 0x12df6c5a6c89d2c128c96026395f1f8917c36a7864aca26f0c7b9e2ea152bca "
6
+ address = " 0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e "
7
+ transaction_hash = " 0x4729b83525f0dddbfce0afd73e0b6a39303de51690efd756691356c21c30067 "
8
8
block_number = 3
9
9
seed = " dojo_starter"
10
10
manifest_name = " dojo-world"
@@ -23,9 +23,9 @@ manifest_name = "dojo-base"
23
23
24
24
[[contracts ]]
25
25
kind = " DojoContract"
26
- address = " 0x36e4506b35e6dfb301d437c95f74b3e1f4f82da5d8841bec894bb8de29ec13 "
27
- class_hash = " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 "
28
- original_class_hash = " 0x4f10da1ba615523c1a4b9e2ad40df134edbcf2d971a1074efbd9772c86c2173 "
26
+ address = " 0x5e8df8a235031ba8e66e590a7289d27d7d54c026bcdbda62b791c0a69055225 "
27
+ class_hash = " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 "
28
+ original_class_hash = " 0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4 "
29
29
base_class_hash = " 0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2"
30
30
abi = " manifests/dev/deployment/abis/contracts/dojo_starter-actions-7a1c7102.json"
31
31
reads = []
Original file line number Diff line number Diff line change @@ -217,13 +217,13 @@ export const getEntitiesQuery = async <S extends Schema>(
217
217
}
218
218
: null ;
219
219
220
- const fetchedEntities = await client . getEntities ( {
221
- limit,
222
- offset : cursor ,
223
- clause : clause || undefined ,
224
- } ) ;
225
-
226
220
while ( continueFetching ) {
221
+ const fetchedEntities = await client . getEntities ( {
222
+ limit,
223
+ offset : cursor ,
224
+ clause : clause || undefined ,
225
+ } ) ;
226
+
227
227
setEntities ( fetchedEntities , components ) ;
228
228
229
229
if ( Object . keys ( fetchedEntities ) . length < limit ) {
@@ -279,8 +279,6 @@ export const syncEvents = async <S extends Schema>(
279
279
return await client . onEventMessageUpdated (
280
280
entityKeyClause ,
281
281
( fetchedEntities : any , data : any ) => {
282
- // Log the fetched entities and data for debugging purposes
283
- console . log ( "fetchedEntities" , data ) ;
284
282
// Update the local state with the fetched entities and their data
285
283
setEntities ( { [ fetchedEntities ] : data } , components ) ;
286
284
}
You can’t perform that action at this time.
0 commit comments