File tree 2 files changed +20
-3
lines changed
examples/example-vite-react-sdk
2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ export const dojoConfig = createDojoConfig({
8
8
toriiUrl : "http://localhost:8080" ,
9
9
masterAddress :
10
10
"0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec" ,
11
+ // WARNING: Do not use this private key in production!
12
+ // Use environment variables instead, e.g.: process.env.MASTER_PRIVATE_KEY
11
13
masterPrivateKey :
12
14
"0xc5b2fcab997346f3ea1c00b002ecf6f382c5f9c9659a3894eb783c5320f912" ,
13
15
} ) ;
Original file line number Diff line number Diff line change @@ -35,14 +35,29 @@ export const useSystemCalls = () => {
35
35
await state . waitForEntityChange (
36
36
entityId ,
37
37
( entity ) => {
38
+ // Log the current state of the entity for debugging purposes
38
39
console . log ( "Entity state:" , entity ) ;
40
+
41
+ // Defensive checks to ensure the entity and its structure are valid
42
+ if ( ! entity ) {
43
+ console . warn ( "Entity not found" ) ;
44
+ return false ;
45
+ }
46
+ if ( ! entity . models ?. dojo_starter ?. Moves ) {
47
+ console . warn (
48
+ "Entity does not have the expected model structure"
49
+ ) ;
50
+ return false ;
51
+ }
52
+
53
+ // Check if the remaining moves have been updated as expected
39
54
return (
40
- entity ? .models ? .dojo_starter ? .Moves ? .remaining ===
55
+ entity . models . dojo_starter . Moves . remaining ===
41
56
remainingMoves
42
57
) ;
43
58
} ,
44
- 10000
45
- ) ; // Increased timeout to 10000ms
59
+ 10000 // Increased timeout to 10000ms
60
+ ) ;
46
61
} catch ( error ) {
47
62
state . revertOptimisticUpdate ( transactionId ) ;
48
63
console . error ( "Error executing spawn:" , error ) ;
You can’t perform that action at this time.
0 commit comments