create-mud 2.2.17-d5f4e1e44bbc260ff21dacdfab0e0f8389e9f304 → 2.2.17-f1d5432fe2c9abb19fa378f790217e67d6dd8504

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 (61) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/react/packages/client/src/mud/Synced.tsx +1 -1
  5. package/templates/react/packages/contracts/.env +1 -1
  6. package/templates/react/packages/contracts/test/MoveTest.t.sol +0 -2
  7. package/templates/react/packages/contracts/test/WorldTest.t.sol +0 -5
  8. package/templates/react-ecs/mprocs.yaml +9 -1
  9. package/templates/react-ecs/package.json +1 -2
  10. package/templates/react-ecs/packages/client/index.html +2 -2
  11. package/templates/react-ecs/packages/client/package.json +16 -9
  12. package/templates/react-ecs/packages/client/postcss.config.cjs +6 -0
  13. package/templates/react-ecs/packages/client/src/App.tsx +66 -21
  14. package/templates/react-ecs/packages/client/src/Providers.tsx +29 -0
  15. package/templates/react-ecs/packages/client/src/common.ts +27 -0
  16. package/templates/react-ecs/packages/client/src/game/GameMap.tsx +112 -0
  17. package/templates/react-ecs/packages/client/src/game/useKeyboardMovement.ts +26 -0
  18. package/templates/react-ecs/packages/client/src/index.tsx +17 -32
  19. package/templates/react-ecs/packages/client/src/mud/Explorer.tsx +32 -0
  20. package/templates/react-ecs/packages/client/src/mud/Synced.tsx +14 -0
  21. package/templates/react-ecs/packages/client/src/mud/recs.ts +6 -0
  22. package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +17 -0
  23. package/templates/react-ecs/packages/client/src/mud/useWorldContract.ts +44 -0
  24. package/templates/react-ecs/packages/client/src/ui/AsyncButton.tsx +41 -0
  25. package/templates/react-ecs/packages/client/src/ui/ErrorFallback.tsx +58 -0
  26. package/templates/react-ecs/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
  27. package/templates/react-ecs/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
  28. package/templates/react-ecs/packages/client/src/wagmiConfig.ts +49 -0
  29. package/templates/react-ecs/packages/client/tailwind.config.ts +10 -0
  30. package/templates/react-ecs/packages/client/tsconfig.json +1 -1
  31. package/templates/react-ecs/packages/client/vite.config.ts +2 -7
  32. package/templates/react-ecs/packages/contracts/.env +1 -1
  33. package/templates/react-ecs/packages/contracts/mud.config.ts +18 -6
  34. package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +2039 -0
  35. package/templates/react-ecs/packages/contracts/package.json +1 -0
  36. package/templates/react-ecs/packages/contracts/script/PostDeploy.s.sol +1 -5
  37. package/templates/react-ecs/packages/contracts/src/Entity.sol +20 -0
  38. package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +30 -0
  39. package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +18 -0
  40. package/templates/react-ecs/packages/contracts/src/codegen/common.sol +11 -0
  41. package/templates/react-ecs/packages/contracts/src/codegen/index.sol +3 -1
  42. package/templates/react-ecs/packages/contracts/src/codegen/tables/{Counter.sol → EntityCount.sol} +35 -35
  43. package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +202 -0
  44. package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +321 -0
  45. package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +16 -0
  46. package/templates/react-ecs/packages/contracts/src/codegen/world/{IIncrementSystem.sol → ISpawnSystem.sol} +5 -3
  47. package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +3 -2
  48. package/templates/react-ecs/packages/contracts/src/createEntity.sol +11 -0
  49. package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +39 -0
  50. package/templates/react-ecs/packages/contracts/test/WorldTest.t.sol +16 -0
  51. package/templates/react-ecs/packages/contracts/worlds.json +1 -1
  52. package/templates/react-ecs/packages/client/src/MUDContext.tsx +0 -21
  53. package/templates/react-ecs/packages/client/src/mud/createClientComponents.ts +0 -21
  54. package/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +0 -51
  55. package/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +0 -77
  56. package/templates/react-ecs/packages/client/src/mud/setup.ts +0 -21
  57. package/templates/react-ecs/packages/client/src/mud/setupNetwork.ts +0 -106
  58. package/templates/react-ecs/packages/client/src/mud/supportedChains.ts +0 -20
  59. package/templates/react-ecs/packages/client/src/mud/world.ts +0 -3
  60. package/templates/react-ecs/packages/contracts/src/systems/IncrementSystem.sol +0 -14
  61. package/templates/react-ecs/packages/contracts/test/CounterTest.t.sol +0 -31
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@latticexyz/cli": "{{mud-version}}",
20
+ "@latticexyz/entrykit": "{{mud-version}}",
20
21
  "@latticexyz/schema-type": "{{mud-version}}",
21
22
  "@latticexyz/store": "{{mud-version}}",
22
23
  "@latticexyz/world": "{{mud-version}}",
@@ -18,11 +18,7 @@ contract PostDeploy is Script {
18
18
  // Start broadcasting transactions from the deployer account
19
19
  vm.startBroadcast(deployerPrivateKey);
20
20
 
21
- // ------------------ EXAMPLES ------------------
22
-
23
- // Call increment on the world via the registered function selector
24
- uint32 newValue = IWorld(worldAddress).app__increment();
25
- console.log("Increment via IWorld:", newValue);
21
+ // TODO
26
22
 
27
23
  vm.stopBroadcast();
28
24
  }
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.24;
3
+
4
+ type Entity is bytes32;
5
+
6
+ using EntityInstance for Entity global;
7
+
8
+ library EntityInstance {
9
+ function unwrap(Entity entity) internal pure returns (bytes32) {
10
+ return Entity.unwrap(entity);
11
+ }
12
+
13
+ function equals(Entity a, Entity b) internal pure returns (bool) {
14
+ return Entity.unwrap(a) == Entity.unwrap(b);
15
+ }
16
+
17
+ function isEmpty(Entity entity) internal pure returns (bool) {
18
+ return Entity.unwrap(entity) == 0;
19
+ }
20
+ }
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.24;
3
+
4
+ import { System } from "@latticexyz/world/src/System.sol";
5
+
6
+ import { Direction } from "./codegen/common.sol";
7
+ import { Owner } from "./codegen/tables/Owner.sol";
8
+ import { Position, PositionData } from "./codegen/tables/Position.sol";
9
+ import { Entity } from "./Entity.sol";
10
+
11
+ contract MoveSystem is System {
12
+ function move(Entity entity, Direction direction) public {
13
+ address owner = Owner.get(entity);
14
+ require(owner == _msgSender(), "You cannot move this entity.");
15
+
16
+ PositionData memory position = Position.get(entity);
17
+
18
+ if (direction == Direction.North) {
19
+ position.y += 1;
20
+ } else if (direction == Direction.East) {
21
+ position.x += 1;
22
+ } else if (direction == Direction.South) {
23
+ position.y -= 1;
24
+ } else if (direction == Direction.West) {
25
+ position.x -= 1;
26
+ }
27
+
28
+ Position.set(entity, position);
29
+ }
30
+ }
@@ -0,0 +1,18 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.24;
3
+
4
+ import { System } from "@latticexyz/world/src/System.sol";
5
+
6
+ import { Direction } from "./codegen/common.sol";
7
+ import { Owner } from "./codegen/tables/Owner.sol";
8
+ import { Position } from "./codegen/tables/Position.sol";
9
+ import { Entity } from "./Entity.sol";
10
+ import { createEntity } from "./createEntity.sol";
11
+
12
+ contract SpawnSystem is System {
13
+ function spawn() public returns (Entity entity) {
14
+ entity = createEntity();
15
+ Owner.set(entity, _msgSender());
16
+ Position.set(entity, 0, 0);
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.24;
3
+
4
+ /* Autogenerated file. Do not edit manually. */
5
+
6
+ enum Direction {
7
+ North,
8
+ East,
9
+ South,
10
+ West
11
+ }
@@ -3,4 +3,6 @@ pragma solidity >=0.8.24;
3
3
 
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
 
6
- import { Counter } from "./tables/Counter.sol";
6
+ import { EntityCount } from "./tables/EntityCount.sol";
7
+ import { Owner } from "./tables/Owner.sol";
8
+ import { Position, PositionData } from "./tables/Position.sol";
@@ -16,17 +16,17 @@ import { Schema } from "@latticexyz/store/src/Schema.sol";
16
16
  import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
17
17
  import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
18
18
 
19
- library Counter {
20
- // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "Counter", typeId: RESOURCE_TABLE });`
21
- ResourceId constant _tableId = ResourceId.wrap(0x74626170700000000000000000000000436f756e746572000000000000000000);
19
+ library EntityCount {
20
+ // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "EntityCount", typeId: RESOURCE_TABLE });`
21
+ ResourceId constant _tableId = ResourceId.wrap(0x74626170700000000000000000000000456e74697479436f756e740000000000);
22
22
 
23
23
  FieldLayout constant _fieldLayout =
24
- FieldLayout.wrap(0x0004010004000000000000000000000000000000000000000000000000000000);
24
+ FieldLayout.wrap(0x0020010020000000000000000000000000000000000000000000000000000000);
25
25
 
26
26
  // Hex-encoded key schema of ()
27
27
  Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000);
28
- // Hex-encoded value schema of (uint32)
29
- Schema constant _valueSchema = Schema.wrap(0x0004010003000000000000000000000000000000000000000000000000000000);
28
+ // Hex-encoded value schema of (uint256)
29
+ Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000);
30
30
 
31
31
  /**
32
32
  * @notice Get the table's key field names.
@@ -42,7 +42,7 @@ library Counter {
42
42
  */
43
43
  function getFieldNames() internal pure returns (string[] memory fieldNames) {
44
44
  fieldNames = new string[](1);
45
- fieldNames[0] = "value";
45
+ fieldNames[0] = "count";
46
46
  }
47
47
 
48
48
  /**
@@ -60,79 +60,79 @@ library Counter {
60
60
  }
61
61
 
62
62
  /**
63
- * @notice Get value.
63
+ * @notice Get count.
64
64
  */
65
- function getValue() internal view returns (uint32 value) {
65
+ function getCount() internal view returns (uint256 count) {
66
66
  bytes32[] memory _keyTuple = new bytes32[](0);
67
67
 
68
68
  bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
69
- return (uint32(bytes4(_blob)));
69
+ return (uint256(bytes32(_blob)));
70
70
  }
71
71
 
72
72
  /**
73
- * @notice Get value.
73
+ * @notice Get count.
74
74
  */
75
- function _getValue() internal view returns (uint32 value) {
75
+ function _getCount() internal view returns (uint256 count) {
76
76
  bytes32[] memory _keyTuple = new bytes32[](0);
77
77
 
78
78
  bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
79
- return (uint32(bytes4(_blob)));
79
+ return (uint256(bytes32(_blob)));
80
80
  }
81
81
 
82
82
  /**
83
- * @notice Get value.
83
+ * @notice Get count.
84
84
  */
85
- function get() internal view returns (uint32 value) {
85
+ function get() internal view returns (uint256 count) {
86
86
  bytes32[] memory _keyTuple = new bytes32[](0);
87
87
 
88
88
  bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
89
- return (uint32(bytes4(_blob)));
89
+ return (uint256(bytes32(_blob)));
90
90
  }
91
91
 
92
92
  /**
93
- * @notice Get value.
93
+ * @notice Get count.
94
94
  */
95
- function _get() internal view returns (uint32 value) {
95
+ function _get() internal view returns (uint256 count) {
96
96
  bytes32[] memory _keyTuple = new bytes32[](0);
97
97
 
98
98
  bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
99
- return (uint32(bytes4(_blob)));
99
+ return (uint256(bytes32(_blob)));
100
100
  }
101
101
 
102
102
  /**
103
- * @notice Set value.
103
+ * @notice Set count.
104
104
  */
105
- function setValue(uint32 value) internal {
105
+ function setCount(uint256 count) internal {
106
106
  bytes32[] memory _keyTuple = new bytes32[](0);
107
107
 
108
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
108
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
109
109
  }
110
110
 
111
111
  /**
112
- * @notice Set value.
112
+ * @notice Set count.
113
113
  */
114
- function _setValue(uint32 value) internal {
114
+ function _setCount(uint256 count) internal {
115
115
  bytes32[] memory _keyTuple = new bytes32[](0);
116
116
 
117
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
117
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
118
118
  }
119
119
 
120
120
  /**
121
- * @notice Set value.
121
+ * @notice Set count.
122
122
  */
123
- function set(uint32 value) internal {
123
+ function set(uint256 count) internal {
124
124
  bytes32[] memory _keyTuple = new bytes32[](0);
125
125
 
126
- StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
126
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
127
127
  }
128
128
 
129
129
  /**
130
- * @notice Set value.
130
+ * @notice Set count.
131
131
  */
132
- function _set(uint32 value) internal {
132
+ function _set(uint256 count) internal {
133
133
  bytes32[] memory _keyTuple = new bytes32[](0);
134
134
 
135
- StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout);
135
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
136
136
  }
137
137
 
138
138
  /**
@@ -157,8 +157,8 @@ library Counter {
157
157
  * @notice Tightly pack static (fixed length) data using this table's schema.
158
158
  * @return The static data, encoded into a sequence of bytes.
159
159
  */
160
- function encodeStatic(uint32 value) internal pure returns (bytes memory) {
161
- return abi.encodePacked(value);
160
+ function encodeStatic(uint256 count) internal pure returns (bytes memory) {
161
+ return abi.encodePacked(count);
162
162
  }
163
163
 
164
164
  /**
@@ -167,8 +167,8 @@ library Counter {
167
167
  * @return The lengths of the dynamic fields (packed into a single bytes32 value).
168
168
  * @return The dynamic (variable length) data, encoded into a sequence of bytes.
169
169
  */
170
- function encode(uint32 value) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
171
- bytes memory _staticData = encodeStatic(value);
170
+ function encode(uint256 count) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
171
+ bytes memory _staticData = encodeStatic(count);
172
172
 
173
173
  EncodedLengths _encodedLengths;
174
174
  bytes memory _dynamicData;
@@ -0,0 +1,202 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.8.24;
3
+
4
+ /* Autogenerated file. Do not edit manually. */
5
+
6
+ // Import store internals
7
+ import { IStore } from "@latticexyz/store/src/IStore.sol";
8
+ import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
9
+ import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
10
+ import { Bytes } from "@latticexyz/store/src/Bytes.sol";
11
+ import { Memory } from "@latticexyz/store/src/Memory.sol";
12
+ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
13
+ import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
14
+ import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
15
+ import { Schema } from "@latticexyz/store/src/Schema.sol";
16
+ import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
17
+ import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
18
+
19
+ // Import user types
20
+ import { Entity } from "../../Entity.sol";
21
+
22
+ library Owner {
23
+ // Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "Owner", typeId: RESOURCE_TABLE });`
24
+ ResourceId constant _tableId = ResourceId.wrap(0x746261707000000000000000000000004f776e65720000000000000000000000);
25
+
26
+ FieldLayout constant _fieldLayout =
27
+ FieldLayout.wrap(0x0014010014000000000000000000000000000000000000000000000000000000);
28
+
29
+ // Hex-encoded key schema of (bytes32)
30
+ Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000);
31
+ // Hex-encoded value schema of (address)
32
+ Schema constant _valueSchema = Schema.wrap(0x0014010061000000000000000000000000000000000000000000000000000000);
33
+
34
+ /**
35
+ * @notice Get the table's key field names.
36
+ * @return keyNames An array of strings with the names of key fields.
37
+ */
38
+ function getKeyNames() internal pure returns (string[] memory keyNames) {
39
+ keyNames = new string[](1);
40
+ keyNames[0] = "id";
41
+ }
42
+
43
+ /**
44
+ * @notice Get the table's value field names.
45
+ * @return fieldNames An array of strings with the names of value fields.
46
+ */
47
+ function getFieldNames() internal pure returns (string[] memory fieldNames) {
48
+ fieldNames = new string[](1);
49
+ fieldNames[0] = "owner";
50
+ }
51
+
52
+ /**
53
+ * @notice Register the table with its config.
54
+ */
55
+ function register() internal {
56
+ StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
57
+ }
58
+
59
+ /**
60
+ * @notice Register the table with its config.
61
+ */
62
+ function _register() internal {
63
+ StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
64
+ }
65
+
66
+ /**
67
+ * @notice Get owner.
68
+ */
69
+ function getOwner(Entity id) internal view returns (address owner) {
70
+ bytes32[] memory _keyTuple = new bytes32[](1);
71
+ _keyTuple[0] = Entity.unwrap(id);
72
+
73
+ bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
74
+ return (address(bytes20(_blob)));
75
+ }
76
+
77
+ /**
78
+ * @notice Get owner.
79
+ */
80
+ function _getOwner(Entity id) internal view returns (address owner) {
81
+ bytes32[] memory _keyTuple = new bytes32[](1);
82
+ _keyTuple[0] = Entity.unwrap(id);
83
+
84
+ bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
85
+ return (address(bytes20(_blob)));
86
+ }
87
+
88
+ /**
89
+ * @notice Get owner.
90
+ */
91
+ function get(Entity id) internal view returns (address owner) {
92
+ bytes32[] memory _keyTuple = new bytes32[](1);
93
+ _keyTuple[0] = Entity.unwrap(id);
94
+
95
+ bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
96
+ return (address(bytes20(_blob)));
97
+ }
98
+
99
+ /**
100
+ * @notice Get owner.
101
+ */
102
+ function _get(Entity id) internal view returns (address owner) {
103
+ bytes32[] memory _keyTuple = new bytes32[](1);
104
+ _keyTuple[0] = Entity.unwrap(id);
105
+
106
+ bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
107
+ return (address(bytes20(_blob)));
108
+ }
109
+
110
+ /**
111
+ * @notice Set owner.
112
+ */
113
+ function setOwner(Entity id, address owner) internal {
114
+ bytes32[] memory _keyTuple = new bytes32[](1);
115
+ _keyTuple[0] = Entity.unwrap(id);
116
+
117
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
118
+ }
119
+
120
+ /**
121
+ * @notice Set owner.
122
+ */
123
+ function _setOwner(Entity id, address owner) internal {
124
+ bytes32[] memory _keyTuple = new bytes32[](1);
125
+ _keyTuple[0] = Entity.unwrap(id);
126
+
127
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
128
+ }
129
+
130
+ /**
131
+ * @notice Set owner.
132
+ */
133
+ function set(Entity id, address owner) internal {
134
+ bytes32[] memory _keyTuple = new bytes32[](1);
135
+ _keyTuple[0] = Entity.unwrap(id);
136
+
137
+ StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
138
+ }
139
+
140
+ /**
141
+ * @notice Set owner.
142
+ */
143
+ function _set(Entity id, address owner) internal {
144
+ bytes32[] memory _keyTuple = new bytes32[](1);
145
+ _keyTuple[0] = Entity.unwrap(id);
146
+
147
+ StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
148
+ }
149
+
150
+ /**
151
+ * @notice Delete all data for given keys.
152
+ */
153
+ function deleteRecord(Entity id) internal {
154
+ bytes32[] memory _keyTuple = new bytes32[](1);
155
+ _keyTuple[0] = Entity.unwrap(id);
156
+
157
+ StoreSwitch.deleteRecord(_tableId, _keyTuple);
158
+ }
159
+
160
+ /**
161
+ * @notice Delete all data for given keys.
162
+ */
163
+ function _deleteRecord(Entity id) internal {
164
+ bytes32[] memory _keyTuple = new bytes32[](1);
165
+ _keyTuple[0] = Entity.unwrap(id);
166
+
167
+ StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
168
+ }
169
+
170
+ /**
171
+ * @notice Tightly pack static (fixed length) data using this table's schema.
172
+ * @return The static data, encoded into a sequence of bytes.
173
+ */
174
+ function encodeStatic(address owner) internal pure returns (bytes memory) {
175
+ return abi.encodePacked(owner);
176
+ }
177
+
178
+ /**
179
+ * @notice Encode all of a record's fields.
180
+ * @return The static (fixed length) data, encoded into a sequence of bytes.
181
+ * @return The lengths of the dynamic fields (packed into a single bytes32 value).
182
+ * @return The dynamic (variable length) data, encoded into a sequence of bytes.
183
+ */
184
+ function encode(address owner) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
185
+ bytes memory _staticData = encodeStatic(owner);
186
+
187
+ EncodedLengths _encodedLengths;
188
+ bytes memory _dynamicData;
189
+
190
+ return (_staticData, _encodedLengths, _dynamicData);
191
+ }
192
+
193
+ /**
194
+ * @notice Encode keys as a bytes32 array using this table's field layout.
195
+ */
196
+ function encodeKeyTuple(Entity id) internal pure returns (bytes32[] memory) {
197
+ bytes32[] memory _keyTuple = new bytes32[](1);
198
+ _keyTuple[0] = Entity.unwrap(id);
199
+
200
+ return _keyTuple;
201
+ }
202
+ }