create-mud 2.0.0-main-e0193e57 → 2.0.0-main-331dbfdc

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.
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-main-e0193e57",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:a,packageManager:r})=>`Done! Play in the MUD with \`cd ${a.name}\` and \`${r} 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-main-331dbfdc",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:a,packageManager:r})=>`Done! Play in the MUD with \`cd ${a.name}\` and \`${r} run dev\``,extra:{"mud-version":{type:"input",describe:"The version of MUD packages to use, defaults to latest",default:e.version}}});
@@ -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$,
@@ -103,9 +103,19 @@ library Counter {
103
103
  _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), getFieldLayout());
104
104
  }
105
105
 
106
+ /** Tightly pack static data using this table's schema */
107
+ function encodeStatic(uint32 value) internal pure returns (bytes memory) {
108
+ return abi.encodePacked(value);
109
+ }
110
+
106
111
  /** Tightly pack full data using this table's field layout */
107
112
  function encode(uint32 value) internal pure returns (bytes memory) {
108
- return abi.encodePacked(value);
113
+ bytes memory _staticData = encodeStatic(value);
114
+
115
+ PackedCounter _encodedLengths;
116
+ bytes memory _dynamicData;
117
+
118
+ return abi.encodePacked(_staticData, _encodedLengths, _dynamicData);
109
119
  }
110
120
 
111
121
  /** Encode keys as a bytes32 array using this table's field layout */
@@ -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$,
@@ -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()),
@@ -103,9 +103,19 @@ library Counter {
103
103
  _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), getFieldLayout());
104
104
  }
105
105
 
106
+ /** Tightly pack static data using this table's schema */
107
+ function encodeStatic(uint32 value) internal pure returns (bytes memory) {
108
+ return abi.encodePacked(value);
109
+ }
110
+
106
111
  /** Tightly pack full data using this table's field layout */
107
112
  function encode(uint32 value) internal pure returns (bytes memory) {
108
- return abi.encodePacked(value);
113
+ bytes memory _staticData = encodeStatic(value);
114
+
115
+ PackedCounter _encodedLengths;
116
+ bytes memory _dynamicData;
117
+
118
+ return abi.encodePacked(_staticData, _encodedLengths, _dynamicData);
109
119
  }
110
120
 
111
121
  /** Encode keys as a bytes32 array using this table's field layout */
@@ -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$,
@@ -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()),
@@ -209,22 +209,28 @@ library Position {
209
209
 
210
210
  /** Set the full data using individual values */
211
211
  function set(bytes32 key, int32 x, int32 y, int32 z) internal {
212
- bytes memory _data = encode(x, y, z);
212
+ bytes memory _staticData = encodeStatic(x, y, z);
213
+
214
+ PackedCounter _encodedLengths;
215
+ bytes memory _dynamicData;
213
216
 
214
217
  bytes32[] memory _keyTuple = new bytes32[](1);
215
218
  _keyTuple[0] = key;
216
219
 
217
- StoreSwitch.setRecord(_tableId, _keyTuple, _data, getFieldLayout());
220
+ StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, getFieldLayout());
218
221
  }
219
222
 
220
223
  /** Set the full data using individual values (using the specified store) */
221
224
  function set(IStore _store, bytes32 key, int32 x, int32 y, int32 z) internal {
222
- bytes memory _data = encode(x, y, z);
225
+ bytes memory _staticData = encodeStatic(x, y, z);
226
+
227
+ PackedCounter _encodedLengths;
228
+ bytes memory _dynamicData;
223
229
 
224
230
  bytes32[] memory _keyTuple = new bytes32[](1);
225
231
  _keyTuple[0] = key;
226
232
 
227
- _store.setRecord(_tableId, _keyTuple, _data, getFieldLayout());
233
+ _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, getFieldLayout());
228
234
  }
229
235
 
230
236
  /** Set the full data using the data struct */
@@ -246,9 +252,19 @@ library Position {
246
252
  _table.z = (int32(uint32(Bytes.slice4(_blob, 8))));
247
253
  }
248
254
 
255
+ /** Tightly pack static data using this table's schema */
256
+ function encodeStatic(int32 x, int32 y, int32 z) internal pure returns (bytes memory) {
257
+ return abi.encodePacked(x, y, z);
258
+ }
259
+
249
260
  /** Tightly pack full data using this table's field layout */
250
261
  function encode(int32 x, int32 y, int32 z) internal pure returns (bytes memory) {
251
- return abi.encodePacked(x, y, z);
262
+ bytes memory _staticData = encodeStatic(x, y, z);
263
+
264
+ PackedCounter _encodedLengths;
265
+ bytes memory _dynamicData;
266
+
267
+ return abi.encodePacked(_staticData, _encodedLengths, _dynamicData);
252
268
  }
253
269
 
254
270
  /** Encode keys as a bytes32 array using this table's field layout */
@@ -28,7 +28,7 @@ if (import.meta.env.DEV) {
28
28
  publicClient: network.publicClient,
29
29
  walletClient: network.walletClient,
30
30
  latestBlock$: network.latestBlock$,
31
- blockStorageOperations$: network.blockStorageOperations$,
31
+ storedBlockLogs$: network.storedBlockLogs$,
32
32
  worldAddress: network.worldContract.address,
33
33
  worldAbi: network.worldContract.abi,
34
34
  write$: network.write$,
@@ -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()),
@@ -103,9 +103,19 @@ library Counter {
103
103
  _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), getFieldLayout());
104
104
  }
105
105
 
106
+ /** Tightly pack static data using this table's schema */
107
+ function encodeStatic(uint32 value) internal pure returns (bytes memory) {
108
+ return abi.encodePacked(value);
109
+ }
110
+
106
111
  /** Tightly pack full data using this table's field layout */
107
112
  function encode(uint32 value) internal pure returns (bytes memory) {
108
- return abi.encodePacked(value);
113
+ bytes memory _staticData = encodeStatic(value);
114
+
115
+ PackedCounter _encodedLengths;
116
+ bytes memory _dynamicData;
117
+
118
+ return abi.encodePacked(_staticData, _encodedLengths, _dynamicData);
109
119
  }
110
120
 
111
121
  /** Encode keys as a bytes32 array using this table's field layout */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mud",
3
- "version": "2.0.0-main-e0193e57",
3
+ "version": "2.0.0-main-331dbfdc",
4
4
  "description": "Create a new MUD project",
5
5
  "license": "MIT",
6
6
  "author": "Lattice <mud@lattice.xyz>",