create-mud 2.0.0-next.8 → 2.0.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/templates/phaser/.vscode/settings.json +2 -1
  3. package/dist/templates/phaser/packages/client/package.json +2 -2
  4. package/dist/templates/phaser/packages/client/src/mud/setupNetwork.ts +3 -3
  5. package/dist/templates/phaser/packages/client/src/ui/App.tsx +1 -1
  6. package/dist/templates/phaser/packages/contracts/.gitignore +0 -2
  7. package/dist/templates/phaser/packages/contracts/foundry.toml +1 -1
  8. package/dist/templates/phaser/packages/contracts/mud.config.ts +1 -1
  9. package/dist/templates/phaser/packages/contracts/package.json +5 -4
  10. package/dist/templates/phaser/packages/contracts/script/PostDeploy.s.sol +1 -1
  11. package/dist/templates/phaser/packages/contracts/src/codegen/{Tables.sol → index.sol} +1 -1
  12. package/dist/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol +126 -30
  13. package/dist/templates/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +1 -1
  14. package/dist/templates/phaser/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  15. package/dist/templates/phaser/packages/contracts/src/systems/IncrementSystem.sol +2 -2
  16. package/dist/templates/phaser/packages/contracts/test/CounterTest.t.sol +4 -4
  17. package/dist/templates/react/.vscode/settings.json +2 -1
  18. package/dist/templates/react/packages/client/package.json +2 -2
  19. package/dist/templates/react/packages/client/src/index.tsx +1 -1
  20. package/dist/templates/react/packages/client/src/mud/setupNetwork.ts +3 -3
  21. package/dist/templates/react/packages/contracts/.gitignore +0 -2
  22. package/dist/templates/react/packages/contracts/foundry.toml +1 -1
  23. package/dist/templates/react/packages/contracts/mud.config.ts +1 -1
  24. package/dist/templates/react/packages/contracts/package.json +5 -4
  25. package/dist/templates/react/packages/contracts/script/PostDeploy.s.sol +1 -1
  26. package/dist/templates/react/packages/contracts/src/codegen/{Tables.sol → index.sol} +1 -1
  27. package/dist/templates/react/packages/contracts/src/codegen/tables/Counter.sol +126 -30
  28. package/dist/templates/react/packages/contracts/src/codegen/world/IIncrementSystem.sol +1 -1
  29. package/dist/templates/react/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  30. package/dist/templates/react/packages/contracts/src/systems/IncrementSystem.sol +2 -2
  31. package/dist/templates/react/packages/contracts/test/CounterTest.t.sol +4 -4
  32. package/dist/templates/threejs/.vscode/settings.json +2 -1
  33. package/dist/templates/threejs/packages/client/package.json +2 -2
  34. package/dist/templates/threejs/packages/client/src/index.tsx +1 -1
  35. package/dist/templates/threejs/packages/client/src/mud/setupNetwork.ts +3 -3
  36. package/dist/templates/threejs/packages/contracts/.gitignore +0 -2
  37. package/dist/templates/threejs/packages/contracts/foundry.toml +1 -1
  38. package/dist/templates/threejs/packages/contracts/mud.config.ts +1 -1
  39. package/dist/templates/threejs/packages/contracts/package.json +3 -3
  40. package/dist/templates/threejs/packages/contracts/src/codegen/{Tables.sol → index.sol} +1 -1
  41. package/dist/templates/threejs/packages/contracts/src/codegen/tables/Position.sol +231 -59
  42. package/dist/templates/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +1 -1
  43. package/dist/templates/threejs/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  44. package/dist/templates/threejs/packages/contracts/src/systems/MoveSystem.sol +2 -2
  45. package/dist/templates/vanilla/.vscode/settings.json +2 -1
  46. package/dist/templates/vanilla/packages/client/src/index.ts +1 -1
  47. package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +3 -3
  48. package/dist/templates/vanilla/packages/contracts/.gitignore +0 -2
  49. package/dist/templates/vanilla/packages/contracts/foundry.toml +1 -1
  50. package/dist/templates/vanilla/packages/contracts/mud.config.ts +1 -1
  51. package/dist/templates/vanilla/packages/contracts/package.json +5 -4
  52. package/dist/templates/vanilla/packages/contracts/script/PostDeploy.s.sol +1 -1
  53. package/dist/templates/vanilla/packages/contracts/src/codegen/{Tables.sol → index.sol} +1 -1
  54. package/dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol +126 -30
  55. package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +1 -1
  56. package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +2 -2
  57. package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +2 -2
  58. package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +4 -4
  59. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var t=require("create-create-app"),s=require("path");var e={name:"create-mud",version:"2.0.0-next.8",description:"Create a new MUD project",license:"MIT",author:"Lattice <mud@lattice.xyz>",bin:"dist/cli.js",files:["dist"],scripts:{build:"pnpm run build:js","build:js":"tsup && ./scripts/copy-templates.sh",clean:"pnpm run clean:js","clean:js":"rimraf dist",dev:"tsup --watch",prepublishOnly:"npm run clean && npm run build",test:"pnpm run test:vanilla && pnpm run test:react && pnpm run test:phaser && pnpm run test:threejs","test:ci":"pnpm run test","test:phaser":"dist/cli.js test-project --template phaser && rimraf test-project","test:react":"dist/cli.js test-project --template react && rimraf test-project","test:threejs":"dist/cli.js test-project --template threejs && rimraf test-project","test:vanilla":"dist/cli.js test-project --template vanilla && rimraf test-project"},dependencies:{"create-create-app":"git+https://github.com/holic/create-create-app#74376c59b48a04aabbe94d9cacfe9cb1cecccd63"},devDependencies:{"@types/node":"^18.15.11",tsup:"^6.7.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},gitHead:"914a1e0ae4a573d685841ca2ea921435057deb8f"};var i=(0,s.resolve)(__dirname,"..","dist","templates");(0,t.create)("create-mud",{templateRoot:i,defaultTemplate:"vanilla",defaultPackageManager:"pnpm",promptForDescription:!1,promptForAuthor:!1,promptForEmail:!1,promptForLicense:!1,promptForTemplate:!0,caveat:({answers:r,packageManager:a})=>`Done! Play in the MUD with \`cd ${r.name}\` and \`${a} run dev\``,extra:{"mud-version":{type:"input",describe:"The version of MUD packages to use, defaults to latest",default:e.version}}});
2
+ "use strict";var t=require("create-create-app"),s=require("path");var e={name:"create-mud",version:"2.0.0-next.9",description:"Create a new MUD project",license:"MIT",author:"Lattice <mud@lattice.xyz>",bin:"dist/cli.js",files:["dist"],scripts:{build:"pnpm run build:js","build:js":"tsup && ./scripts/copy-templates.sh",clean:"pnpm run clean:js","clean:js":"rimraf dist",dev:"tsup --watch",prepublishOnly:"npm run clean && npm run build",test:"pnpm run test:vanilla && pnpm run test:react && pnpm run test:phaser && pnpm run test:threejs","test:ci":"pnpm run test","test:phaser":"dist/cli.js test-project --template phaser && rimraf test-project","test:react":"dist/cli.js test-project --template react && rimraf test-project","test:threejs":"dist/cli.js test-project --template threejs && rimraf test-project","test:vanilla":"dist/cli.js test-project --template vanilla && rimraf test-project"},dependencies:{"create-create-app":"git+https://github.com/holic/create-create-app#74376c59b48a04aabbe94d9cacfe9cb1cecccd63"},devDependencies:{"@types/node":"^18.15.11",tsup:"^6.7.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org"},gitHead:"914a1e0ae4a573d685841ca2ea921435057deb8f"};var i=(0,s.resolve)(__dirname,"..","dist","templates");(0,t.create)("create-mud",{templateRoot:i,defaultTemplate:"vanilla",defaultPackageManager:"pnpm",promptForDescription:!1,promptForAuthor:!1,promptForEmail:!1,promptForLicense:!1,promptForTemplate:!0,caveat:({answers:r,packageManager:a})=>`Done! Play in the MUD with \`cd ${r.name}\` and \`${a} run dev\``,extra:{"mud-version":{type:"input",describe:"The version of MUD packages to use, defaults to latest",default:e.version}}});
@@ -1,3 +1,4 @@
1
1
  {
2
- "solidity.monoRepoSupport": true
2
+ "solidity.monoRepoSupport": true,
3
+ "solidity.compileUsingRemoteVersion": "v0.8.21+commit.d9974bed"
3
4
  }
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/lodash": "^4.14.194",
37
- "@types/react": "^18.2.6",
38
- "@types/react-dom": "^18.2.4",
37
+ "@types/react": "18.2.22",
38
+ "@types/react-dom": "18.2.7",
39
39
  "@types/styled-components": "^5.1.26",
40
40
  "@vitejs/plugin-react": "^3.1.0",
41
41
  "eslint-plugin-react": "7.31.11",
@@ -8,7 +8,7 @@ import { createFaucetService } from "@latticexyz/services/faucet";
8
8
  import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
9
9
  import { getNetworkConfig } from "./getNetworkConfig";
10
10
  import { world } from "./world";
11
- import IWorldAbi from "contracts/abi/IWorld.sol/IWorld.abi.json";
11
+ import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json";
12
12
  import { createBurnerAccount, createContract, transportObserver, ContractWrite } from "@latticexyz/common";
13
13
  import { Subject, share } from "rxjs";
14
14
 
@@ -72,7 +72,7 @@ export async function setupNetwork() {
72
72
  * to the viem publicClient to make RPC calls to fetch MUD
73
73
  * events from the chain.
74
74
  */
75
- const { components, latestBlock$, blockStorageOperations$, waitForTransaction } = await syncToRecs({
75
+ const { components, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToRecs({
76
76
  world,
77
77
  config: mudConfig,
78
78
  address: networkConfig.worldAddress as Hex,
@@ -115,7 +115,7 @@ export async function setupNetwork() {
115
115
  publicClient,
116
116
  walletClient: burnerWalletClient,
117
117
  latestBlock$,
118
- blockStorageOperations$,
118
+ storedBlockLogs$,
119
119
  waitForTransaction,
120
120
  worldContract,
121
121
  write$: write$.asObservable().pipe(share()),
@@ -21,7 +21,7 @@ export const App = () => {
21
21
  publicClient: networkLayer.network.publicClient,
22
22
  walletClient: networkLayer.network.walletClient,
23
23
  latestBlock$: networkLayer.network.latestBlock$,
24
- blockStorageOperations$: networkLayer.network.blockStorageOperations$,
24
+ storedBlockLogs$: networkLayer.network.storedBlockLogs$,
25
25
  worldAddress: networkLayer.network.worldContract.address,
26
26
  worldAbi: networkLayer.network.worldContract.abi,
27
27
  write$: networkLayer.network.write$,
@@ -3,8 +3,6 @@ cache/
3
3
  node_modules/
4
4
  bindings/
5
5
  artifacts/
6
- abi/
7
- types/
8
6
  broadcast/
9
7
 
10
8
  # Ignore MUD deploy artifacts
@@ -1,5 +1,5 @@
1
1
  [profile.default]
2
- solc_version = "0.8.13"
2
+ solc = "0.8.21"
3
3
  ffi = false
4
4
  fuzz_runs = 256
5
5
  optimizer = true
@@ -4,7 +4,7 @@ export default mudConfig({
4
4
  tables: {
5
5
  Counter: {
6
6
  keySchema: {},
7
- schema: "uint32",
7
+ valueSchema: "uint32",
8
8
  },
9
9
  },
10
10
  });
@@ -5,9 +5,9 @@
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts",
8
- "build:abi": "rimraf abi && forge build --extra-output-files abi --out abi --skip test script MudTest.sol",
9
- "build:abi-ts": "mud abi-ts --input 'abi/IWorld.sol/IWorld.abi.json' && prettier --write '**/*.abi.json.d.ts'",
10
- "build:mud": "mud tablegen && mud worldgen",
8
+ "build:abi": "forge clean && forge build --skip test script",
9
+ "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'",
10
+ "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen",
11
11
  "deploy:local": "pnpm run build && mud deploy",
12
12
  "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet",
13
13
  "dev": "pnpm mud dev-contracts",
@@ -20,7 +20,8 @@
20
20
  "@latticexyz/cli": "{{mud-version}}",
21
21
  "@latticexyz/schema-type": "{{mud-version}}",
22
22
  "@latticexyz/store": "{{mud-version}}",
23
- "@latticexyz/world": "{{mud-version}}"
23
+ "@latticexyz/world": "{{mud-version}}",
24
+ "@latticexyz/world-modules": "{{mud-version}}"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/node": "^18.15.11",
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  import { Script } from "forge-std/Script.sol";
5
5
  import { console } from "forge-std/console.sol";
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
@@ -14,26 +14,40 @@ import { Bytes } from "@latticexyz/store/src/Bytes.sol";
14
14
  import { Memory } from "@latticexyz/store/src/Memory.sol";
15
15
  import { SliceLib } from "@latticexyz/store/src/Slice.sol";
16
16
  import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
17
+ import { FieldLayout, FieldLayoutLib } from "@latticexyz/store/src/FieldLayout.sol";
17
18
  import { Schema, SchemaLib } from "@latticexyz/store/src/Schema.sol";
18
19
  import { PackedCounter, PackedCounterLib } from "@latticexyz/store/src/PackedCounter.sol";
20
+ import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
21
+ import { RESOURCE_TABLE, RESOURCE_OFFCHAIN_TABLE } from "@latticexyz/store/src/storeResourceTypes.sol";
19
22
 
20
- bytes32 constant _tableId = bytes32(abi.encodePacked(bytes16(""), bytes16("Counter")));
21
- bytes32 constant CounterTableId = _tableId;
23
+ ResourceId constant _tableId = ResourceId.wrap(
24
+ bytes32(abi.encodePacked(RESOURCE_TABLE, bytes14(""), bytes16("Counter")))
25
+ );
26
+ ResourceId constant CounterTableId = _tableId;
27
+
28
+ FieldLayout constant _fieldLayout = FieldLayout.wrap(
29
+ 0x0004010004000000000000000000000000000000000000000000000000000000
30
+ );
22
31
 
23
32
  library Counter {
33
+ /** Get the table values' field layout */
34
+ function getFieldLayout() internal pure returns (FieldLayout) {
35
+ return _fieldLayout;
36
+ }
37
+
24
38
  /** Get the table's key schema */
25
39
  function getKeySchema() internal pure returns (Schema) {
26
- SchemaType[] memory _schema = new SchemaType[](0);
40
+ SchemaType[] memory _keySchema = new SchemaType[](0);
27
41
 
28
- return SchemaLib.encode(_schema);
42
+ return SchemaLib.encode(_keySchema);
29
43
  }
30
44
 
31
45
  /** Get the table's value schema */
32
46
  function getValueSchema() internal pure returns (Schema) {
33
- SchemaType[] memory _schema = new SchemaType[](1);
34
- _schema[0] = SchemaType.UINT32;
47
+ SchemaType[] memory _valueSchema = new SchemaType[](1);
48
+ _valueSchema[0] = SchemaType.UINT32;
35
49
 
36
- return SchemaLib.encode(_schema);
50
+ return SchemaLib.encode(_valueSchema);
37
51
  }
38
52
 
39
53
  /** Get the table's key names */
@@ -47,69 +61,151 @@ library Counter {
47
61
  fieldNames[0] = "value";
48
62
  }
49
63
 
50
- /** Register the table's key schema, value schema, key names and value names */
64
+ /** Register the table with its config */
51
65
  function register() internal {
52
- StoreSwitch.registerTable(_tableId, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
66
+ StoreSwitch.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
67
+ }
68
+
69
+ /** Register the table with its config */
70
+ function _register() internal {
71
+ StoreCore.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
53
72
  }
54
73
 
55
- /** Register the table's key schema, value schema, key names and value names (using the specified store) */
74
+ /** Register the table with its config (using the specified store) */
56
75
  function register(IStore _store) internal {
57
- _store.registerTable(_tableId, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
76
+ _store.registerTable(_tableId, _fieldLayout, getKeySchema(), getValueSchema(), getKeyNames(), getFieldNames());
77
+ }
78
+
79
+ /** Get value */
80
+ function getValue() internal view returns (uint32 value) {
81
+ bytes32[] memory _keyTuple = new bytes32[](0);
82
+
83
+ bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
84
+ return (uint32(bytes4(_blob)));
85
+ }
86
+
87
+ /** Get value */
88
+ function _getValue() internal view returns (uint32 value) {
89
+ bytes32[] memory _keyTuple = new bytes32[](0);
90
+
91
+ bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
92
+ return (uint32(bytes4(_blob)));
93
+ }
94
+
95
+ /** Get value (using the specified store) */
96
+ function getValue(IStore _store) internal view returns (uint32 value) {
97
+ bytes32[] memory _keyTuple = new bytes32[](0);
98
+
99
+ bytes32 _blob = _store.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
100
+ return (uint32(bytes4(_blob)));
58
101
  }
59
102
 
60
103
  /** Get value */
61
104
  function get() internal view returns (uint32 value) {
62
105
  bytes32[] memory _keyTuple = new bytes32[](0);
63
106
 
64
- bytes memory _blob = StoreSwitch.getField(_tableId, _keyTuple, 0, getValueSchema());
65
- return (uint32(Bytes.slice4(_blob, 0)));
107
+ bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
108
+ return (uint32(bytes4(_blob)));
109
+ }
110
+
111
+ /** Get value */
112
+ function _get() internal view returns (uint32 value) {
113
+ bytes32[] memory _keyTuple = new bytes32[](0);
114
+
115
+ bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
116
+ return (uint32(bytes4(_blob)));
66
117
  }
67
118
 
68
119
  /** Get value (using the specified store) */
69
120
  function get(IStore _store) internal view returns (uint32 value) {
70
121
  bytes32[] memory _keyTuple = new bytes32[](0);
71
122
 
72
- bytes memory _blob = _store.getField(_tableId, _keyTuple, 0, getValueSchema());
73
- return (uint32(Bytes.slice4(_blob, 0)));
123
+ bytes32 _blob = _store.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
124
+ return (uint32(bytes4(_blob)));
74
125
  }
75
126
 
76
127
  /** Set value */
77
- function set(uint32 value) internal {
128
+ function setValue(uint32 value) internal {
129
+ bytes32[] memory _keyTuple = new bytes32[](0);
130
+
131
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
132
+ }
133
+
134
+ /** Set value */
135
+ function _setValue(uint32 value) internal {
78
136
  bytes32[] memory _keyTuple = new bytes32[](0);
79
137
 
80
- StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), getValueSchema());
138
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
81
139
  }
82
140
 
83
141
  /** Set value (using the specified store) */
84
- function set(IStore _store, uint32 value) internal {
142
+ function setValue(IStore _store, uint32 value) internal {
85
143
  bytes32[] memory _keyTuple = new bytes32[](0);
86
144
 
87
- _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), getValueSchema());
145
+ _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
88
146
  }
89
147
 
90
- /** Tightly pack full data using this table's schema */
91
- function encode(uint32 value) internal pure returns (bytes memory) {
92
- return abi.encodePacked(value);
148
+ /** Set value */
149
+ function set(uint32 value) internal {
150
+ bytes32[] memory _keyTuple = new bytes32[](0);
151
+
152
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
93
153
  }
94
154
 
95
- /** Encode keys as a bytes32 array using this table's schema */
96
- function encodeKeyTuple() internal pure returns (bytes32[] memory) {
155
+ /** Set value */
156
+ function _set(uint32 value) internal {
97
157
  bytes32[] memory _keyTuple = new bytes32[](0);
98
158
 
99
- return _keyTuple;
159
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
100
160
  }
101
161
 
102
- /* Delete all data for given keys */
162
+ /** Set value (using the specified store) */
163
+ function set(IStore _store, uint32 value) internal {
164
+ bytes32[] memory _keyTuple = new bytes32[](0);
165
+
166
+ _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
167
+ }
168
+
169
+ /** Delete all data for given keys */
103
170
  function deleteRecord() internal {
104
171
  bytes32[] memory _keyTuple = new bytes32[](0);
105
172
 
106
- StoreSwitch.deleteRecord(_tableId, _keyTuple, getValueSchema());
173
+ StoreSwitch.deleteRecord(_tableId, _keyTuple);
107
174
  }
108
175
 
109
- /* Delete all data for given keys (using the specified store) */
176
+ /** Delete all data for given keys */
177
+ function _deleteRecord() internal {
178
+ bytes32[] memory _keyTuple = new bytes32[](0);
179
+
180
+ StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
181
+ }
182
+
183
+ /** Delete all data for given keys (using the specified store) */
110
184
  function deleteRecord(IStore _store) internal {
111
185
  bytes32[] memory _keyTuple = new bytes32[](0);
112
186
 
113
- _store.deleteRecord(_tableId, _keyTuple, getValueSchema());
187
+ _store.deleteRecord(_tableId, _keyTuple);
188
+ }
189
+
190
+ /** Tightly pack static data using this table's schema */
191
+ function encodeStatic(uint32 value) internal pure returns (bytes memory) {
192
+ return abi.encodePacked(value);
193
+ }
194
+
195
+ /** Tightly pack full data using this table's field layout */
196
+ function encode(uint32 value) internal pure returns (bytes memory, PackedCounter, bytes memory) {
197
+ bytes memory _staticData = encodeStatic(value);
198
+
199
+ PackedCounter _encodedLengths;
200
+ bytes memory _dynamicData;
201
+
202
+ return (_staticData, _encodedLengths, _dynamicData);
203
+ }
204
+
205
+ /** Encode keys as a bytes32 array using this table's field layout */
206
+ function encodeKeyTuple() internal pure returns (bytes32[] memory) {
207
+ bytes32[] memory _keyTuple = new bytes32[](0);
208
+
209
+ return _keyTuple;
114
210
  }
115
211
  }
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
@@ -1,9 +1,9 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
6
- import { IBaseWorld } from "@latticexyz/world/src/interfaces/IBaseWorld.sol";
6
+ import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
7
7
 
8
8
  import { IIncrementSystem } from "./IIncrementSystem.sol";
9
9
 
@@ -1,8 +1,8 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  import { System } from "@latticexyz/world/src/System.sol";
5
- import { Counter } from "../codegen/Tables.sol";
5
+ import { Counter } from "../codegen/index.sol";
6
6
 
7
7
  contract IncrementSystem is System {
8
8
  function increment() public returns (uint32) {
@@ -1,12 +1,12 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  import "forge-std/Test.sol";
5
- import { MudTest } from "@latticexyz/store/src/MudTest.sol";
6
- import { getKeysWithValue } from "@latticexyz/world/src/modules/keyswithvalue/getKeysWithValue.sol";
5
+ import { MudTest } from "@latticexyz/world/test/MudTest.t.sol";
6
+ import { getKeysWithValue } from "@latticexyz/world-modules/src/modules/keyswithvalue/getKeysWithValue.sol";
7
7
 
8
8
  import { IWorld } from "../src/codegen/world/IWorld.sol";
9
- import { Counter, CounterTableId } from "../src/codegen/Tables.sol";
9
+ import { Counter, CounterTableId } from "../src/codegen/index.sol";
10
10
 
11
11
  contract CounterTest is MudTest {
12
12
  IWorld public world;
@@ -1,3 +1,4 @@
1
1
  {
2
- "solidity.monoRepoSupport": true
2
+ "solidity.monoRepoSupport": true,
3
+ "solidity.compileUsingRemoteVersion": "v0.8.21+commit.d9974bed"
3
4
  }
@@ -27,8 +27,8 @@
27
27
  "viem": "1.6.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/react": "^18.2.6",
31
- "@types/react-dom": "^18.2.4",
30
+ "@types/react": "18.2.22",
31
+ "@types/react-dom": "18.2.7",
32
32
  "@vitejs/plugin-react": "^3.1.0",
33
33
  "eslint-plugin-react": "7.31.11",
34
34
  "eslint-plugin-react-hooks": "4.6.0",
@@ -24,7 +24,7 @@ setup().then(async (result) => {
24
24
  publicClient: result.network.publicClient,
25
25
  walletClient: result.network.walletClient,
26
26
  latestBlock$: result.network.latestBlock$,
27
- blockStorageOperations$: result.network.blockStorageOperations$,
27
+ storedBlockLogs$: result.network.storedBlockLogs$,
28
28
  worldAddress: result.network.worldContract.address,
29
29
  worldAbi: result.network.worldContract.abi,
30
30
  write$: result.network.write$,
@@ -9,7 +9,7 @@ import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
9
9
 
10
10
  import { getNetworkConfig } from "./getNetworkConfig";
11
11
  import { world } from "./world";
12
- import IWorldAbi from "contracts/abi/IWorld.sol/IWorld.abi.json";
12
+ import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json";
13
13
  import { createBurnerAccount, createContract, transportObserver, ContractWrite } from "@latticexyz/common";
14
14
 
15
15
  import { Subject, share } from "rxjs";
@@ -74,7 +74,7 @@ export async function setupNetwork() {
74
74
  * to the viem publicClient to make RPC calls to fetch MUD
75
75
  * events from the chain.
76
76
  */
77
- const { components, latestBlock$, blockStorageOperations$, waitForTransaction } = await syncToRecs({
77
+ const { components, latestBlock$, storedBlockLogs$, waitForTransaction } = await syncToRecs({
78
78
  world,
79
79
  config: mudConfig,
80
80
  address: networkConfig.worldAddress as Hex,
@@ -117,7 +117,7 @@ export async function setupNetwork() {
117
117
  publicClient,
118
118
  walletClient: burnerWalletClient,
119
119
  latestBlock$,
120
- blockStorageOperations$,
120
+ storedBlockLogs$,
121
121
  waitForTransaction,
122
122
  worldContract,
123
123
  write$: write$.asObservable().pipe(share()),
@@ -3,8 +3,6 @@ cache/
3
3
  node_modules/
4
4
  bindings/
5
5
  artifacts/
6
- abi/
7
- types/
8
6
  broadcast/
9
7
 
10
8
  # Ignore MUD deploy artifacts
@@ -1,5 +1,5 @@
1
1
  [profile.default]
2
- solc_version = "0.8.13"
2
+ solc = "0.8.21"
3
3
  ffi = false
4
4
  fuzz_runs = 256
5
5
  optimizer = true
@@ -4,7 +4,7 @@ export default mudConfig({
4
4
  tables: {
5
5
  Counter: {
6
6
  keySchema: {},
7
- schema: "uint32",
7
+ valueSchema: "uint32",
8
8
  },
9
9
  },
10
10
  });
@@ -5,9 +5,9 @@
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts",
8
- "build:abi": "rimraf abi && forge build --extra-output-files abi --out abi --skip test script MudTest.sol",
9
- "build:abi-ts": "mud abi-ts --input 'abi/IWorld.sol/IWorld.abi.json' && prettier --write '**/*.abi.json.d.ts'",
10
- "build:mud": "mud tablegen && mud worldgen",
8
+ "build:abi": "forge clean && forge build --skip test script",
9
+ "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'",
10
+ "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen",
11
11
  "deploy:local": "pnpm run build && mud deploy",
12
12
  "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet",
13
13
  "dev": "pnpm mud dev-contracts",
@@ -20,7 +20,8 @@
20
20
  "@latticexyz/cli": "{{mud-version}}",
21
21
  "@latticexyz/schema-type": "{{mud-version}}",
22
22
  "@latticexyz/store": "{{mud-version}}",
23
- "@latticexyz/world": "{{mud-version}}"
23
+ "@latticexyz/world": "{{mud-version}}",
24
+ "@latticexyz/world-modules": "{{mud-version}}"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/node": "^18.15.11",
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  import { Script } from "forge-std/Script.sol";
5
5
  import { console } from "forge-std/console.sol";
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity >=0.8.0;
2
+ pragma solidity >=0.8.21;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5