@latticexyz/world-modules 2.0.0-main-9e343907 → 2.0.0-main-3e7d83d0
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/mud.config.d.ts +20 -20
- package/dist/mud.config.js +1 -1
- package/dist/mud.config.js.map +1 -1
- package/out/AccessControl.sol/AccessControl.json +1 -1
- package/out/AccessControlLib.sol/AccessControlLib.json +1 -1
- package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
- package/out/AddressArray.sol/AddressArray.json +1 -1
- package/out/Allowances.sol/Allowances.json +1 -1
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
- package/out/Balances.sol/Balances.json +1 -1
- package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
- package/out/Bool.sol/Bool.json +1 -1
- package/out/CallboundDelegationControl.sol/CallboundDelegationControl.json +1 -1
- package/out/CallboundDelegations.sol/CallboundDelegations.json +1 -1
- package/out/DecodeSlice.sol/DecodeSlice.json +1 -1
- package/out/Delegation.sol/Delegation.json +1 -1
- package/out/DelegationControl.sol/DelegationControl.json +1 -1
- package/out/DelegationControlMock.sol/DelegationControlMock.json +1 -1
- package/out/ERC20.t.sol/ERC20Test.json +1 -1
- package/out/ERC20Metadata.sol/ERC20Metadata.json +1 -1
- package/out/ERC20Module.sol/ERC20Module.abi.json +1 -1
- package/out/ERC20Module.sol/ERC20Module.abi.json.d.ts +1 -1
- package/out/ERC20Module.sol/ERC20Module.json +1 -1
- package/out/ERC20Module.sol/ERC20ModuleRegistrationLibrary.abi.json +1 -1
- package/out/ERC20Module.sol/ERC20ModuleRegistrationLibrary.abi.json.d.ts +1 -1
- package/out/ERC20Module.sol/ERC20ModuleRegistrationLibrary.json +1 -1
- package/out/ERC20Registry.sol/ERC20Registry.json +1 -1
- package/out/ERC20System.sol/ERC20System.json +1 -1
- package/out/ERC721.t.sol/ERC721Recipient.json +1 -1
- package/out/ERC721.t.sol/ERC721Test.json +1 -1
- package/out/ERC721.t.sol/ERC721TokenReceiver.json +1 -1
- package/out/ERC721.t.sol/NonERC721Recipient.json +1 -1
- package/out/ERC721.t.sol/RevertingERC721Recipient.json +1 -1
- package/out/ERC721.t.sol/WrongReturnDataERC721Recipient.json +1 -1
- package/out/ERC721Metadata.sol/ERC721Metadata.json +1 -1
- package/out/ERC721Module.sol/ERC721Module.abi.json +1 -1
- package/out/ERC721Module.sol/ERC721Module.abi.json.d.ts +1 -1
- package/out/ERC721Module.sol/ERC721Module.json +1 -1
- package/out/ERC721Module.sol/ERC721ModuleRegistrationLibrary.abi.json +1 -1
- package/out/ERC721Module.sol/ERC721ModuleRegistrationLibrary.abi.json.d.ts +1 -1
- package/out/ERC721Module.sol/ERC721ModuleRegistrationLibrary.json +1 -1
- package/out/ERC721Registry.sol/ERC721Registry.json +1 -1
- package/out/ERC721System.sol/ERC721System.json +1 -1
- package/out/EchoSubscriber.sol/EchoSubscriber.abi.json +4 -4
- package/out/EchoSubscriber.sol/EchoSubscriber.abi.json.d.ts +4 -4
- package/out/EchoSubscriber.sol/EchoSubscriber.json +1 -1
- package/out/EncodeArray.sol/EncodeArray.json +1 -1
- package/out/EncodedLengths.sol/EncodedLengthsInstance.json +1 -0
- package/out/EncodedLengths.sol/EncodedLengthsLib.json +1 -0
- package/out/FieldLayout.sol/FieldLayoutInstance.json +1 -1
- package/out/FieldLayout.sol/FieldLayoutLib.json +1 -1
- package/out/FieldLayoutEncodeHelper.sol/FieldLayoutEncodeHelper.json +1 -1
- package/out/FunctionSelectors.sol/FunctionSelectors.json +1 -1
- package/out/FunctionSignatures.sol/FunctionSignatures.json +1 -1
- package/out/Hook.sol/HookInstance.json +1 -1
- package/out/Hook.sol/HookLib.json +1 -1
- package/out/Hooks.sol/Hooks.json +1 -1
- package/out/IBaseWorld.sol/IBaseWorld.abi.json +16 -16
- package/out/IBaseWorld.sol/IBaseWorld.abi.json.d.ts +16 -16
- package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
- package/out/{IPackedCounterErrors.sol/IPackedCounterErrors.abi.json → IEncodedLengthsErrors.sol/IEncodedLengthsErrors.abi.json} +1 -1
- package/out/{IPackedCounterErrors.sol/IPackedCounterErrors.abi.json.d.ts → IEncodedLengthsErrors.sol/IEncodedLengthsErrors.abi.json.d.ts} +1 -1
- package/out/IEncodedLengthsErrors.sol/IEncodedLengthsErrors.json +1 -0
- package/out/IFieldLayoutErrors.sol/IFieldLayoutErrors.json +1 -1
- package/out/ISchemaErrors.sol/ISchemaErrors.json +1 -1
- package/out/ISliceErrors.sol/ISliceErrors.json +1 -1
- package/out/IStore.sol/IStore.abi.json +16 -16
- package/out/IStore.sol/IStore.abi.json.d.ts +16 -16
- package/out/IStore.sol/IStore.json +1 -1
- package/out/IStoreData.sol/IStoreData.abi.json +5 -5
- package/out/IStoreData.sol/IStoreData.abi.json.d.ts +5 -5
- package/out/IStoreData.sol/IStoreData.json +1 -1
- package/out/IStoreErrors.sol/IStoreErrors.json +1 -1
- package/out/IStoreEvents.sol/IStoreEvents.abi.json +2 -2
- package/out/IStoreEvents.sol/IStoreEvents.abi.json.d.ts +2 -2
- package/out/IStoreEvents.sol/IStoreEvents.json +1 -1
- package/out/IStoreHook.sol/IStoreHook.abi.json +4 -4
- package/out/IStoreHook.sol/IStoreHook.abi.json.d.ts +4 -4
- package/out/IStoreHook.sol/IStoreHook.json +1 -1
- package/out/IStoreRead.sol/IStoreRead.abi.json +2 -2
- package/out/IStoreRead.sol/IStoreRead.abi.json.d.ts +2 -2
- package/out/IStoreRead.sol/IStoreRead.json +1 -1
- package/out/IStoreRegistration.sol/IStoreRegistration.json +1 -1
- package/out/IStoreWrite.sol/IStoreWrite.abi.json +3 -3
- package/out/IStoreWrite.sol/IStoreWrite.abi.json.d.ts +3 -3
- package/out/IStoreWrite.sol/IStoreWrite.json +1 -1
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.json +1 -1
- package/out/InitModule.sol/InitModule.abi.json +1 -1
- package/out/InitModule.sol/InitModule.abi.json.d.ts +1 -1
- package/out/InitModule.sol/InitModule.json +1 -1
- package/out/InitModuleAddress.sol/InitModuleAddress.json +1 -1
- package/out/InstalledModules.sol/InstalledModules.json +1 -1
- package/out/KeysInTable.sol/KeysInTable.json +1 -1
- package/out/KeysInTableHook.sol/KeysInTableHook.abi.json +7 -7
- package/out/KeysInTableHook.sol/KeysInTableHook.abi.json.d.ts +7 -7
- package/out/KeysInTableHook.sol/KeysInTableHook.json +1 -1
- package/out/KeysInTableModule.sol/KeysInTableModule.json +1 -1
- package/out/KeysInTableModule.t.sol/KeysInTableModuleTest.json +1 -1
- package/out/KeysWithValue.sol/KeysWithValue.json +1 -1
- package/out/KeysWithValueHook.sol/KeysWithValueHook.abi.json +6 -6
- package/out/KeysWithValueHook.sol/KeysWithValueHook.abi.json.d.ts +6 -6
- package/out/KeysWithValueHook.sol/KeysWithValueHook.json +1 -1
- package/out/KeysWithValueModule.sol/KeysWithValueModule.json +1 -1
- package/out/KeysWithValueModule.t.sol/KeysWithValueModuleTest.json +1 -1
- package/out/Memory.sol/Memory.json +1 -1
- package/out/Module.sol/Module.json +1 -1
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
- package/out/NamespaceDelegationControl.sol/NamespaceDelegationControl.json +1 -1
- package/out/NamespaceOwner.sol/NamespaceOwner.json +1 -1
- package/out/OperatorApproval.sol/OperatorApproval.json +1 -1
- package/out/Owners.sol/Owners.json +1 -1
- package/out/Puppet.sol/Puppet.json +1 -1
- package/out/PuppetDelegationControl.sol/PuppetDelegationControl.json +1 -1
- package/out/PuppetFactorySystem.sol/PuppetFactorySystem.json +1 -1
- package/out/PuppetMaster.sol/PuppetMaster.json +1 -1
- package/out/PuppetModule.sol/PuppetModule.abi.json +1 -1
- package/out/PuppetModule.sol/PuppetModule.abi.json.d.ts +1 -1
- package/out/PuppetModule.sol/PuppetModule.json +1 -1
- package/out/PuppetModule.t.sol/PuppetModuleTest.json +1 -1
- package/out/PuppetModule.t.sol/PuppetTestSystem.json +1 -1
- package/out/PuppetRegistry.sol/PuppetRegistry.json +1 -1
- package/out/RegistrationSystem.sol/RegistrationSystem.abi.json +13 -13
- package/out/RegistrationSystem.sol/RegistrationSystem.abi.json.d.ts +13 -13
- package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
- package/out/ResourceAccess.sol/ResourceAccess.json +1 -1
- package/out/ResourceIds.sol/ResourceIds.json +1 -1
- package/out/RevertSubscriber.sol/RevertSubscriber.abi.json +4 -4
- package/out/RevertSubscriber.sol/RevertSubscriber.abi.json.d.ts +4 -4
- package/out/RevertSubscriber.sol/RevertSubscriber.json +1 -1
- package/out/Schema.sol/SchemaInstance.json +1 -1
- package/out/Schema.sol/SchemaLib.json +1 -1
- package/out/SchemaEncodeHelper.sol/SchemaEncodeHelper.json +1 -1
- package/out/Slice.sol/SliceInstance.json +1 -1
- package/out/Slice.sol/SliceLib.json +1 -1
- package/out/StandardDelegationsModule.sol/StandardDelegationsModule.abi.json +1 -1
- package/out/StandardDelegationsModule.sol/StandardDelegationsModule.abi.json.d.ts +1 -1
- package/out/StandardDelegationsModule.sol/StandardDelegationsModule.json +1 -1
- package/out/StandardDelegationsModule.t.sol/StandardDelegationsModuleTest.json +1 -1
- package/out/Storage.sol/Storage.json +1 -1
- package/out/StoreCore.sol/StoreCore.json +1 -1
- package/out/StoreCore.sol/StoreCoreInternal.json +1 -1
- package/out/StoreData.sol/StoreData.abi.json +5 -5
- package/out/StoreData.sol/StoreData.abi.json.d.ts +5 -5
- package/out/StoreData.sol/StoreData.json +1 -1
- package/out/StoreHook.sol/StoreHook.abi.json +4 -4
- package/out/StoreHook.sol/StoreHook.abi.json.d.ts +4 -4
- package/out/StoreHook.sol/StoreHook.json +1 -1
- package/out/StoreHooks.sol/StoreHooks.json +1 -1
- package/out/StoreRead.sol/StoreRead.abi.json +2 -2
- package/out/StoreRead.sol/StoreRead.abi.json.d.ts +2 -2
- package/out/StoreRead.sol/StoreRead.json +1 -1
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json +13 -13
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.abi.json.d.ts +13 -13
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
- package/out/StoreSwitch.sol/StoreSwitch.json +1 -1
- package/out/System.sol/System.json +1 -1
- package/out/SystemCall.sol/SystemCall.json +1 -1
- package/out/SystemHooks.sol/SystemHooks.json +1 -1
- package/out/SystemRegistry.sol/SystemRegistry.json +1 -1
- package/out/SystemSwitch.sol/SystemSwitch.json +1 -1
- package/out/SystemSwitch.t.sol/EchoSystem.json +1 -1
- package/out/SystemSwitch.t.sol/SystemSwitchTest.json +1 -1
- package/out/SystemboundDelegationControl.sol/SystemboundDelegationControl.json +1 -1
- package/out/SystemboundDelegations.sol/SystemboundDelegations.json +1 -1
- package/out/Systems.sol/Systems.json +1 -1
- package/out/Tables.sol/Tables.json +1 -1
- package/out/TightCoder.sol/TightCoder.json +1 -1
- package/out/TimeboundDelegationControl.sol/TimeboundDelegationControl.json +1 -1
- package/out/TimeboundDelegations.sol/TimeboundDelegations.json +1 -1
- package/out/TokenApproval.sol/TokenApproval.json +1 -1
- package/out/TokenURI.sol/TokenURI.json +1 -1
- package/out/TotalSupply.sol/TotalSupply.json +1 -1
- package/out/TwoFields.sol/TwoFields.json +1 -1
- package/out/UniqueEntity.sol/UniqueEntity.json +1 -1
- package/out/UniqueEntityModule.sol/UniqueEntityModule.abi.json +1 -1
- package/out/UniqueEntityModule.sol/UniqueEntityModule.abi.json.d.ts +1 -1
- package/out/UniqueEntityModule.sol/UniqueEntityModule.json +1 -1
- package/out/UniqueEntityModule.t.sol/UniqueEntityModuleTest.json +1 -1
- package/out/UniqueEntityModule.t.sol/UniqueEntityTestSystem.json +1 -1
- package/out/UniqueEntitySystem.sol/UniqueEntitySystem.json +1 -1
- package/out/UsedKeysIndex.sol/UsedKeysIndex.json +1 -1
- package/out/UserDelegationControl.sol/UserDelegationControl.json +1 -1
- package/out/World.sol/World.abi.json +16 -16
- package/out/World.sol/World.abi.json.d.ts +16 -16
- package/out/World.sol/World.json +1 -1
- package/out/World.t.sol/EchoSystemHook.json +1 -1
- package/out/World.t.sol/IWorldTestSystem.json +1 -1
- package/out/World.t.sol/PayableFallbackSystem.json +1 -1
- package/out/World.t.sol/RevertSystemHook.json +1 -1
- package/out/World.t.sol/WorldTest.abi.json +1 -1
- package/out/World.t.sol/WorldTest.abi.json.d.ts +1 -1
- package/out/World.t.sol/WorldTest.json +1 -1
- package/out/World.t.sol/WorldTestSystem.abi.json +1 -1
- package/out/World.t.sol/WorldTestSystem.abi.json.d.ts +1 -1
- package/out/World.t.sol/WorldTestSystem.json +1 -1
- package/out/WorldContext.sol/WorldContextConsumer.json +1 -1
- package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -1
- package/out/WorldContext.sol/WorldContextProviderLib.json +1 -1
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json +3 -3
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.abi.json.d.ts +3 -3
- package/out/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
- package/out/constants.sol/LayoutOffsets.json +1 -1
- package/out/interfaces/IBaseWorld.sol/IBaseWorld.abi.json +16 -16
- package/out/interfaces/IBaseWorld.sol/IBaseWorld.abi.json.d.ts +16 -16
- package/out/interfaces/IBaseWorld.sol/IBaseWorld.json +1 -1
- package/out/query.t.sol/QueryTest.json +1 -1
- package/out/src/IERC165.sol/IERC165.json +1 -1
- package/out/tables/Balances.sol/Balances.json +1 -1
- package/package.json +8 -8
- package/src/modules/erc20-puppet/tables/Allowances.sol +3 -3
- package/src/modules/erc20-puppet/tables/ERC20Metadata.sol +13 -13
- package/src/modules/erc20-puppet/tables/ERC20Registry.sol +3 -3
- package/src/modules/erc20-puppet/tables/TotalSupply.sol +3 -3
- package/src/modules/erc721-puppet/tables/ERC721Metadata.sol +13 -13
- package/src/modules/erc721-puppet/tables/ERC721Registry.sol +3 -3
- package/src/modules/erc721-puppet/tables/OperatorApproval.sol +3 -3
- package/src/modules/erc721-puppet/tables/Owners.sol +3 -3
- package/src/modules/erc721-puppet/tables/TokenApproval.sol +3 -3
- package/src/modules/erc721-puppet/tables/TokenURI.sol +5 -5
- package/src/modules/keysintable/KeysInTableHook.sol +3 -3
- package/src/modules/keysintable/query.sol +7 -7
- package/src/modules/keysintable/tables/KeysInTable.sol +34 -16
- package/src/modules/keysintable/tables/UsedKeysIndex.sol +10 -10
- package/src/modules/keyswithvalue/KeysWithValueHook.sol +5 -5
- package/src/modules/keyswithvalue/getKeysWithValue.sol +3 -3
- package/src/modules/keyswithvalue/tables/KeysWithValue.sol +5 -5
- package/src/modules/puppet/tables/PuppetRegistry.sol +3 -3
- package/src/modules/std-delegations/tables/CallboundDelegations.sol +3 -3
- package/src/modules/std-delegations/tables/SystemboundDelegations.sol +3 -3
- package/src/modules/std-delegations/tables/TimeboundDelegations.sol +3 -3
- package/src/modules/tokens/tables/Balances.sol +3 -3
- package/src/modules/uniqueentity/tables/UniqueEntity.sol +3 -3
- package/ts/scripts/worldgen.ts +1 -1
- package/out/IPackedCounterErrors.sol/IPackedCounterErrors.json +0 -1
- package/out/PackedCounter.sol/PackedCounterInstance.json +0 -1
- package/out/PackedCounter.sol/PackedCounterLib.json +0 -1
- /package/out/{PackedCounter.sol/PackedCounterInstance.abi.json → EncodedLengths.sol/EncodedLengthsInstance.abi.json} +0 -0
- /package/out/{PackedCounter.sol/PackedCounterLib.abi.json → EncodedLengths.sol/EncodedLengthsLib.abi.json} +0 -0
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
library TokenURI {
|
@@ -409,10 +409,10 @@ library TokenURI {
|
|
409
409
|
* @notice Tightly pack dynamic data lengths using this table's schema.
|
410
410
|
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
411
411
|
*/
|
412
|
-
function encodeLengths(string memory tokenURI) internal pure returns (
|
412
|
+
function encodeLengths(string memory tokenURI) internal pure returns (EncodedLengths _encodedLengths) {
|
413
413
|
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
414
414
|
unchecked {
|
415
|
-
_encodedLengths =
|
415
|
+
_encodedLengths = EncodedLengthsLib.pack(bytes(tokenURI).length);
|
416
416
|
}
|
417
417
|
}
|
418
418
|
|
@@ -430,9 +430,9 @@ library TokenURI {
|
|
430
430
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
431
431
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
432
432
|
*/
|
433
|
-
function encode(string memory tokenURI) internal pure returns (bytes memory,
|
433
|
+
function encode(string memory tokenURI) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
434
434
|
bytes memory _staticData;
|
435
|
-
|
435
|
+
EncodedLengths _encodedLengths = encodeLengths(tokenURI);
|
436
436
|
bytes memory _dynamicData = encodeDynamic(tokenURI);
|
437
437
|
|
438
438
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
2
2
|
pragma solidity >=0.8.24;
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { EncodedLengths } from "@latticexyz/store/src/EncodedLengths.sol";
|
5
5
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
6
6
|
import { StoreHook } from "@latticexyz/store/src/StoreHook.sol";
|
7
7
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
@@ -46,7 +46,7 @@ contract KeysInTableHook is StoreHook {
|
|
46
46
|
ResourceId tableId,
|
47
47
|
bytes32[] memory keyTuple,
|
48
48
|
bytes memory,
|
49
|
-
|
49
|
+
EncodedLengths,
|
50
50
|
bytes memory,
|
51
51
|
FieldLayout
|
52
52
|
) public override {
|
@@ -68,7 +68,7 @@ contract KeysInTableHook is StoreHook {
|
|
68
68
|
uint8,
|
69
69
|
uint40,
|
70
70
|
uint40,
|
71
|
-
|
71
|
+
EncodedLengths,
|
72
72
|
bytes memory
|
73
73
|
) public override {
|
74
74
|
handleSet(tableId, keyTuple);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
pragma solidity >=0.8.24;
|
3
3
|
|
4
4
|
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
5
|
-
import {
|
5
|
+
import { EncodedLengths } from "@latticexyz/store/src/EncodedLengths.sol";
|
6
6
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
7
7
|
|
8
8
|
import { getKeysInTable } from "./getKeysInTable.sol";
|
@@ -50,7 +50,7 @@ function passesQueryFragment(bytes32[] memory keyTuple, QueryFragment memory fra
|
|
50
50
|
return
|
51
51
|
ArrayLib.includes(
|
52
52
|
valuesToTuples(
|
53
|
-
getKeysWithValue(fragment.tableId, fragment.value,
|
53
|
+
getKeysWithValue(fragment.tableId, fragment.value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
54
54
|
),
|
55
55
|
keyTuple
|
56
56
|
);
|
@@ -66,7 +66,7 @@ function passesQueryFragment(bytes32[] memory keyTuple, QueryFragment memory fra
|
|
66
66
|
return
|
67
67
|
!ArrayLib.includes(
|
68
68
|
valuesToTuples(
|
69
|
-
getKeysWithValue(fragment.tableId, fragment.value,
|
69
|
+
getKeysWithValue(fragment.tableId, fragment.value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
70
70
|
),
|
71
71
|
keyTuple
|
72
72
|
);
|
@@ -95,7 +95,7 @@ function passesQueryFragment(
|
|
95
95
|
return
|
96
96
|
ArrayLib.includes(
|
97
97
|
valuesToTuples(
|
98
|
-
getKeysWithValue(store, fragment.tableId, fragment.value,
|
98
|
+
getKeysWithValue(store, fragment.tableId, fragment.value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
99
99
|
),
|
100
100
|
keyTuple
|
101
101
|
);
|
@@ -111,7 +111,7 @@ function passesQueryFragment(
|
|
111
111
|
return
|
112
112
|
!ArrayLib.includes(
|
113
113
|
valuesToTuples(
|
114
|
-
getKeysWithValue(store, fragment.tableId, fragment.value,
|
114
|
+
getKeysWithValue(store, fragment.tableId, fragment.value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
115
115
|
),
|
116
116
|
keyTuple
|
117
117
|
);
|
@@ -135,7 +135,7 @@ function query(QueryFragment[] memory fragments) view returns (bytes32[][] memor
|
|
135
135
|
keyTuples = fragments[0].queryType == QueryType.Has
|
136
136
|
? getKeysInTable(fragments[0].tableId)
|
137
137
|
: valuesToTuples(
|
138
|
-
getKeysWithValue(fragments[0].tableId, fragments[0].value,
|
138
|
+
getKeysWithValue(fragments[0].tableId, fragments[0].value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
139
139
|
);
|
140
140
|
|
141
141
|
for (uint256 i = 1; i < fragments.length; i++) {
|
@@ -172,7 +172,7 @@ function query(IStore store, QueryFragment[] memory fragments) view returns (byt
|
|
172
172
|
keyTuples = fragments[0].queryType == QueryType.Has
|
173
173
|
? getKeysInTable(store, fragments[0].tableId)
|
174
174
|
: valuesToTuples(
|
175
|
-
getKeysWithValue(store, fragments[0].tableId, fragments[0].value,
|
175
|
+
getKeysWithValue(store, fragments[0].tableId, fragments[0].value, EncodedLengths.wrap(bytes32(0)), new bytes(0))
|
176
176
|
);
|
177
177
|
|
178
178
|
for (uint256 i = 1; i < fragments.length; i++) {
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
// Import user types
|
@@ -1304,7 +1304,7 @@ library KeysInTable {
|
|
1304
1304
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1305
1305
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1306
1306
|
|
1307
|
-
(bytes memory _staticData,
|
1307
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord(
|
1308
1308
|
_tableId,
|
1309
1309
|
_keyTuple,
|
1310
1310
|
_fieldLayout
|
@@ -1319,7 +1319,7 @@ library KeysInTable {
|
|
1319
1319
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1320
1320
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1321
1321
|
|
1322
|
-
(bytes memory _staticData,
|
1322
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord(
|
1323
1323
|
_tableId,
|
1324
1324
|
_keyTuple,
|
1325
1325
|
_fieldLayout
|
@@ -1334,7 +1334,7 @@ library KeysInTable {
|
|
1334
1334
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
1335
1335
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
1336
1336
|
|
1337
|
-
(bytes memory _staticData,
|
1337
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = _store.getRecord(
|
1338
1338
|
_tableId,
|
1339
1339
|
_keyTuple,
|
1340
1340
|
_fieldLayout
|
@@ -1354,7 +1354,7 @@ library KeysInTable {
|
|
1354
1354
|
bytes32[] memory keys4
|
1355
1355
|
) internal {
|
1356
1356
|
bytes memory _staticData;
|
1357
|
-
|
1357
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1358
1358
|
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1359
1359
|
|
1360
1360
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1375,7 +1375,7 @@ library KeysInTable {
|
|
1375
1375
|
bytes32[] memory keys4
|
1376
1376
|
) internal {
|
1377
1377
|
bytes memory _staticData;
|
1378
|
-
|
1378
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1379
1379
|
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1380
1380
|
|
1381
1381
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1397,7 +1397,7 @@ library KeysInTable {
|
|
1397
1397
|
bytes32[] memory keys4
|
1398
1398
|
) internal {
|
1399
1399
|
bytes memory _staticData;
|
1400
|
-
|
1400
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1401
1401
|
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1402
1402
|
|
1403
1403
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1411,7 +1411,13 @@ library KeysInTable {
|
|
1411
1411
|
*/
|
1412
1412
|
function set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1413
1413
|
bytes memory _staticData;
|
1414
|
-
|
1414
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1415
|
+
_table.keys0,
|
1416
|
+
_table.keys1,
|
1417
|
+
_table.keys2,
|
1418
|
+
_table.keys3,
|
1419
|
+
_table.keys4
|
1420
|
+
);
|
1415
1421
|
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1416
1422
|
|
1417
1423
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1425,7 +1431,13 @@ library KeysInTable {
|
|
1425
1431
|
*/
|
1426
1432
|
function _set(ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1427
1433
|
bytes memory _staticData;
|
1428
|
-
|
1434
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1435
|
+
_table.keys0,
|
1436
|
+
_table.keys1,
|
1437
|
+
_table.keys2,
|
1438
|
+
_table.keys3,
|
1439
|
+
_table.keys4
|
1440
|
+
);
|
1429
1441
|
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1430
1442
|
|
1431
1443
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1439,7 +1451,13 @@ library KeysInTable {
|
|
1439
1451
|
*/
|
1440
1452
|
function set(IStore _store, ResourceId sourceTableId, KeysInTableData memory _table) internal {
|
1441
1453
|
bytes memory _staticData;
|
1442
|
-
|
1454
|
+
EncodedLengths _encodedLengths = encodeLengths(
|
1455
|
+
_table.keys0,
|
1456
|
+
_table.keys1,
|
1457
|
+
_table.keys2,
|
1458
|
+
_table.keys3,
|
1459
|
+
_table.keys4
|
1460
|
+
);
|
1443
1461
|
bytes memory _dynamicData = encodeDynamic(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4);
|
1444
1462
|
|
1445
1463
|
bytes32[] memory _keyTuple = new bytes32[](1);
|
@@ -1452,7 +1470,7 @@ library KeysInTable {
|
|
1452
1470
|
* @notice Decode the tightly packed blob of dynamic data using the encoded lengths.
|
1453
1471
|
*/
|
1454
1472
|
function decodeDynamic(
|
1455
|
-
|
1473
|
+
EncodedLengths _encodedLengths,
|
1456
1474
|
bytes memory _blob
|
1457
1475
|
)
|
1458
1476
|
internal
|
@@ -1505,7 +1523,7 @@ library KeysInTable {
|
|
1505
1523
|
*/
|
1506
1524
|
function decode(
|
1507
1525
|
bytes memory,
|
1508
|
-
|
1526
|
+
EncodedLengths _encodedLengths,
|
1509
1527
|
bytes memory _dynamicData
|
1510
1528
|
) internal pure returns (KeysInTableData memory _table) {
|
1511
1529
|
(_table.keys0, _table.keys1, _table.keys2, _table.keys3, _table.keys4) = decodeDynamic(
|
@@ -1554,10 +1572,10 @@ library KeysInTable {
|
|
1554
1572
|
bytes32[] memory keys2,
|
1555
1573
|
bytes32[] memory keys3,
|
1556
1574
|
bytes32[] memory keys4
|
1557
|
-
) internal pure returns (
|
1575
|
+
) internal pure returns (EncodedLengths _encodedLengths) {
|
1558
1576
|
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
1559
1577
|
unchecked {
|
1560
|
-
_encodedLengths =
|
1578
|
+
_encodedLengths = EncodedLengthsLib.pack(
|
1561
1579
|
keys0.length * 32,
|
1562
1580
|
keys1.length * 32,
|
1563
1581
|
keys2.length * 32,
|
@@ -1600,9 +1618,9 @@ library KeysInTable {
|
|
1600
1618
|
bytes32[] memory keys2,
|
1601
1619
|
bytes32[] memory keys3,
|
1602
1620
|
bytes32[] memory keys4
|
1603
|
-
) internal pure returns (bytes memory,
|
1621
|
+
) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
1604
1622
|
bytes memory _staticData;
|
1605
|
-
|
1623
|
+
EncodedLengths _encodedLengths = encodeLengths(keys0, keys1, keys2, keys3, keys4);
|
1606
1624
|
bytes memory _dynamicData = encodeDynamic(keys0, keys1, keys2, keys3, keys4);
|
1607
1625
|
|
1608
1626
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
// Import user types
|
@@ -218,7 +218,7 @@ library UsedKeysIndex {
|
|
218
218
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
219
219
|
_keyTuple[1] = keysHash;
|
220
220
|
|
221
|
-
(bytes memory _staticData,
|
221
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreSwitch.getRecord(
|
222
222
|
_tableId,
|
223
223
|
_keyTuple,
|
224
224
|
_fieldLayout
|
@@ -234,7 +234,7 @@ library UsedKeysIndex {
|
|
234
234
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
235
235
|
_keyTuple[1] = keysHash;
|
236
236
|
|
237
|
-
(bytes memory _staticData,
|
237
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = StoreCore.getRecord(
|
238
238
|
_tableId,
|
239
239
|
_keyTuple,
|
240
240
|
_fieldLayout
|
@@ -254,7 +254,7 @@ library UsedKeysIndex {
|
|
254
254
|
_keyTuple[0] = ResourceId.unwrap(sourceTableId);
|
255
255
|
_keyTuple[1] = keysHash;
|
256
256
|
|
257
|
-
(bytes memory _staticData,
|
257
|
+
(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData) = _store.getRecord(
|
258
258
|
_tableId,
|
259
259
|
_keyTuple,
|
260
260
|
_fieldLayout
|
@@ -268,7 +268,7 @@ library UsedKeysIndex {
|
|
268
268
|
function set(ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
269
269
|
bytes memory _staticData = encodeStatic(has, index);
|
270
270
|
|
271
|
-
|
271
|
+
EncodedLengths _encodedLengths;
|
272
272
|
bytes memory _dynamicData;
|
273
273
|
|
274
274
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
@@ -284,7 +284,7 @@ library UsedKeysIndex {
|
|
284
284
|
function _set(ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
285
285
|
bytes memory _staticData = encodeStatic(has, index);
|
286
286
|
|
287
|
-
|
287
|
+
EncodedLengths _encodedLengths;
|
288
288
|
bytes memory _dynamicData;
|
289
289
|
|
290
290
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
@@ -300,7 +300,7 @@ library UsedKeysIndex {
|
|
300
300
|
function set(IStore _store, ResourceId sourceTableId, bytes32 keysHash, bool has, uint40 index) internal {
|
301
301
|
bytes memory _staticData = encodeStatic(has, index);
|
302
302
|
|
303
|
-
|
303
|
+
EncodedLengths _encodedLengths;
|
304
304
|
bytes memory _dynamicData;
|
305
305
|
|
306
306
|
bytes32[] memory _keyTuple = new bytes32[](2);
|
@@ -327,7 +327,7 @@ library UsedKeysIndex {
|
|
327
327
|
*/
|
328
328
|
function decode(
|
329
329
|
bytes memory _staticData,
|
330
|
-
|
330
|
+
EncodedLengths,
|
331
331
|
bytes memory
|
332
332
|
) internal pure returns (bool has, uint40 index) {
|
333
333
|
(has, index) = decodeStatic(_staticData);
|
@@ -380,10 +380,10 @@ library UsedKeysIndex {
|
|
380
380
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
381
381
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
382
382
|
*/
|
383
|
-
function encode(bool has, uint40 index) internal pure returns (bytes memory,
|
383
|
+
function encode(bool has, uint40 index) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
384
384
|
bytes memory _staticData = encodeStatic(has, index);
|
385
385
|
|
386
|
-
|
386
|
+
EncodedLengths _encodedLengths;
|
387
387
|
bytes memory _dynamicData;
|
388
388
|
|
389
389
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -5,7 +5,7 @@ import { StoreHook } from "@latticexyz/store/src/StoreHook.sol";
|
|
5
5
|
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
6
6
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
7
7
|
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
8
|
-
import {
|
8
|
+
import { EncodedLengths } from "@latticexyz/store/src/EncodedLengths.sol";
|
9
9
|
import { Tables } from "@latticexyz/store/src/codegen/tables/Tables.sol";
|
10
10
|
import { IBaseWorld } from "@latticexyz/world/src/codegen/interfaces/IBaseWorld.sol";
|
11
11
|
|
@@ -35,7 +35,7 @@ contract KeysWithValueHook is StoreHook {
|
|
35
35
|
ResourceId sourceTableId,
|
36
36
|
bytes32[] memory keyTuple,
|
37
37
|
bytes memory staticData,
|
38
|
-
|
38
|
+
EncodedLengths encodedLengths,
|
39
39
|
bytes memory dynamicData,
|
40
40
|
FieldLayout fieldLayout
|
41
41
|
) public override {
|
@@ -89,7 +89,7 @@ contract KeysWithValueHook is StoreHook {
|
|
89
89
|
uint8,
|
90
90
|
uint40,
|
91
91
|
uint40,
|
92
|
-
|
92
|
+
EncodedLengths,
|
93
93
|
bytes memory
|
94
94
|
) public override {
|
95
95
|
// Remove the key from the list of keys with the previous value
|
@@ -105,7 +105,7 @@ contract KeysWithValueHook is StoreHook {
|
|
105
105
|
uint8,
|
106
106
|
uint40,
|
107
107
|
uint40,
|
108
|
-
|
108
|
+
EncodedLengths,
|
109
109
|
bytes memory
|
110
110
|
) public override {
|
111
111
|
// Add the key to the list of keys with the new value
|
@@ -131,7 +131,7 @@ contract KeysWithValueHook is StoreHook {
|
|
131
131
|
bytes32[] memory keyTuple,
|
132
132
|
FieldLayout fieldLayout
|
133
133
|
) internal view returns (bytes32 valueHash) {
|
134
|
-
(bytes memory staticData,
|
134
|
+
(bytes memory staticData, EncodedLengths encodedLengths, bytes memory dynamicData) = _world().getRecord(
|
135
135
|
sourceTableId,
|
136
136
|
keyTuple,
|
137
137
|
fieldLayout
|
@@ -2,7 +2,7 @@
|
|
2
2
|
pragma solidity >=0.8.24;
|
3
3
|
|
4
4
|
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
5
|
-
import {
|
5
|
+
import { EncodedLengths } from "@latticexyz/store/src/EncodedLengths.sol";
|
6
6
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
7
7
|
|
8
8
|
import { MODULE_NAMESPACE } from "./constants.sol";
|
@@ -18,7 +18,7 @@ import { getTargetTableId } from "./getTargetTableId.sol";
|
|
18
18
|
function getKeysWithValue(
|
19
19
|
ResourceId tableId,
|
20
20
|
bytes memory staticData,
|
21
|
-
|
21
|
+
EncodedLengths encodedLengths,
|
22
22
|
bytes memory dynamicData
|
23
23
|
) view returns (bytes32[] memory keysWithValue) {
|
24
24
|
// Get the corresponding reverse mapping table
|
@@ -41,7 +41,7 @@ function getKeysWithValue(
|
|
41
41
|
IStore store,
|
42
42
|
ResourceId tableId,
|
43
43
|
bytes memory staticData,
|
44
|
-
|
44
|
+
EncodedLengths encodedLengths,
|
45
45
|
bytes memory dynamicData
|
46
46
|
) view returns (bytes32[] memory keysWithValue) {
|
47
47
|
// Get the corresponding reverse mapping table
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
library KeysWithValue {
|
@@ -627,10 +627,10 @@ library KeysWithValue {
|
|
627
627
|
* @notice Tightly pack dynamic data lengths using this table's schema.
|
628
628
|
* @return _encodedLengths The lengths of the dynamic fields (packed into a single bytes32 value).
|
629
629
|
*/
|
630
|
-
function encodeLengths(bytes32[] memory keysWithValue) internal pure returns (
|
630
|
+
function encodeLengths(bytes32[] memory keysWithValue) internal pure returns (EncodedLengths _encodedLengths) {
|
631
631
|
// Lengths are effectively checked during copy by 2**40 bytes exceeding gas limits
|
632
632
|
unchecked {
|
633
|
-
_encodedLengths =
|
633
|
+
_encodedLengths = EncodedLengthsLib.pack(keysWithValue.length * 32);
|
634
634
|
}
|
635
635
|
}
|
636
636
|
|
@@ -648,9 +648,9 @@ library KeysWithValue {
|
|
648
648
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
649
649
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
650
650
|
*/
|
651
|
-
function encode(bytes32[] memory keysWithValue) internal pure returns (bytes memory,
|
651
|
+
function encode(bytes32[] memory keysWithValue) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
652
652
|
bytes memory _staticData;
|
653
|
-
|
653
|
+
EncodedLengths _encodedLengths = encodeLengths(keysWithValue);
|
654
654
|
bytes memory _dynamicData = encodeDynamic(keysWithValue);
|
655
655
|
|
656
656
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
// Import user types
|
@@ -178,10 +178,10 @@ library PuppetRegistry {
|
|
178
178
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
179
179
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
180
180
|
*/
|
181
|
-
function encode(address puppet) internal pure returns (bytes memory,
|
181
|
+
function encode(address puppet) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
182
182
|
bytes memory _staticData = encodeStatic(puppet);
|
183
183
|
|
184
|
-
|
184
|
+
EncodedLengths _encodedLengths;
|
185
185
|
bytes memory _dynamicData;
|
186
186
|
|
187
187
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
// Import user types
|
@@ -258,10 +258,10 @@ library CallboundDelegations {
|
|
258
258
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
259
259
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
260
260
|
*/
|
261
|
-
function encode(uint256 availableCalls) internal pure returns (bytes memory,
|
261
|
+
function encode(uint256 availableCalls) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
262
262
|
bytes memory _staticData = encodeStatic(availableCalls);
|
263
263
|
|
264
|
-
|
264
|
+
EncodedLengths _encodedLengths;
|
265
265
|
bytes memory _dynamicData;
|
266
266
|
|
267
267
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
// Import user types
|
@@ -229,10 +229,10 @@ library SystemboundDelegations {
|
|
229
229
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
230
230
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
231
231
|
*/
|
232
|
-
function encode(uint256 availableCalls) internal pure returns (bytes memory,
|
232
|
+
function encode(uint256 availableCalls) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
233
233
|
bytes memory _staticData = encodeStatic(availableCalls);
|
234
234
|
|
235
|
-
|
235
|
+
EncodedLengths _encodedLengths;
|
236
236
|
bytes memory _dynamicData;
|
237
237
|
|
238
238
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
library TimeboundDelegations {
|
@@ -189,10 +189,10 @@ library TimeboundDelegations {
|
|
189
189
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
190
190
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
191
191
|
*/
|
192
|
-
function encode(uint256 maxTimestamp) internal pure returns (bytes memory,
|
192
|
+
function encode(uint256 maxTimestamp) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
193
193
|
bytes memory _staticData = encodeStatic(maxTimestamp);
|
194
194
|
|
195
|
-
|
195
|
+
EncodedLengths _encodedLengths;
|
196
196
|
bytes memory _dynamicData;
|
197
197
|
|
198
198
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
library Balances {
|
@@ -175,10 +175,10 @@ library Balances {
|
|
175
175
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
176
176
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
177
177
|
*/
|
178
|
-
function encode(uint256 value) internal pure returns (bytes memory,
|
178
|
+
function encode(uint256 value) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
179
179
|
bytes memory _staticData = encodeStatic(value);
|
180
180
|
|
181
|
-
|
181
|
+
EncodedLengths _encodedLengths;
|
182
182
|
bytes memory _dynamicData;
|
183
183
|
|
184
184
|
return (_staticData, _encodedLengths, _dynamicData);
|
@@ -13,7 +13,7 @@ import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
13
|
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
14
14
|
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
15
15
|
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
16
|
-
import {
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
18
18
|
|
19
19
|
library UniqueEntity {
|
@@ -218,10 +218,10 @@ library UniqueEntity {
|
|
218
218
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
219
219
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
220
220
|
*/
|
221
|
-
function encode(uint256 value) internal pure returns (bytes memory,
|
221
|
+
function encode(uint256 value) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
222
222
|
bytes memory _staticData = encodeStatic(value);
|
223
223
|
|
224
|
-
|
224
|
+
EncodedLengths _encodedLengths;
|
225
225
|
bytes memory _dynamicData;
|
226
226
|
|
227
227
|
return (_staticData, _encodedLengths, _dynamicData);
|
package/ts/scripts/worldgen.ts
CHANGED
@@ -3,7 +3,7 @@ import path, { basename } from "path";
|
|
3
3
|
import { rmSync } from "fs";
|
4
4
|
import { loadConfig } from "@latticexyz/config/node";
|
5
5
|
import { getSrcDirectory } from "@latticexyz/common/foundry";
|
6
|
-
import { World as WorldConfig } from "@latticexyz/world
|
6
|
+
import { World as WorldConfig } from "@latticexyz/world";
|
7
7
|
import { worldgen } from "@latticexyz/world/node";
|
8
8
|
|
9
9
|
// TODO dedupe this and cli's worldgen command
|
@@ -1 +0,0 @@
|
|
1
|
-
{"abi":[{"type":"error","name":"PackedCounter_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"PackedCounter_InvalidLength\",\"type\":\"error\"}],\"devdoc\":{\"author\":\"MUD (https://mud.dev) by Lattice (https://lattice.xyz)\",\"details\":\"We bundle these errors in an interface (instead of at the file-level or in their corresponding libraries) so they can be inherited by IStore. This ensures that all possible errors are included in the IStore ABI for proper decoding in the frontend.\",\"errors\":{\"PackedCounter_InvalidLength(uint256)\":[{\"params\":{\"length\":\"The length of the packed coutner.\"}}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"IPackedCounterErrors\",\"version\":1},\"userdoc\":{\"errors\":{\"PackedCounter_InvalidLength(uint256)\":[{\"notice\":\"Error raised when the provided packed counter has an invalid length.\"}]},\"kind\":\"user\",\"methods\":{},\"notice\":\"This interface includes errors for the PackedCounter library.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol\":\"IPackedCounterErrors\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\"},\"optimizer\":{\"enabled\":true,\"runs\":3000},\"remappings\":[\":@latticexyz/=node_modules/@latticexyz/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\"]},\"sources\":{\"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol\":{\"keccak256\":\"0xb7fea790ba0b4897d68a6ad1b6272969762acda712f8e465655f0b4ea9d86c03\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4227afe9f8fae6c1e691105afd0cea4a17cfa079f55774547a6ae9bc125b4a37\",\"dweb:/ipfs/QmVA8i35XwNNkS2PCNGTvNSQutwFbVx8qYf5SqsqY9KhaV\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"type":"error","name":"PackedCounter_InvalidLength"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@latticexyz/=node_modules/@latticexyz/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/"],"optimizer":{"enabled":true,"runs":3000},"metadata":{"bytecodeHash":"none"},"compilationTarget":{"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol":"IPackedCounterErrors"},"evmVersion":"paris","libraries":{}},"sources":{"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol":{"keccak256":"0xb7fea790ba0b4897d68a6ad1b6272969762acda712f8e465655f0b4ea9d86c03","urls":["bzz-raw://4227afe9f8fae6c1e691105afd0cea4a17cfa079f55774547a6ae9bc125b4a37","dweb:/ipfs/QmVA8i35XwNNkS2PCNGTvNSQutwFbVx8qYf5SqsqY9KhaV"],"license":"MIT"}},"version":1},"id":7}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"abi":[],"bytecode":{"object":"0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000818000a","sourceMap":"6024:3225:19:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;6024:3225:19;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c6343000818000a","sourceMap":"6024:3225:19:-:0;;;;;;;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"MUD (https://mud.dev) by Lattice (https://lattice.xyz)\",\"details\":\"Offers decoding, extracting, and setting functionalities for a PackedCounter.\",\"kind\":\"dev\",\"methods\":{},\"title\":\"PackedCounter Instance Library\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Instance functions for handling a PackedCounter.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"node_modules/@latticexyz/store/src/PackedCounter.sol\":\"PackedCounterInstance\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\"},\"optimizer\":{\"enabled\":true,\"runs\":3000},\"remappings\":[\":@latticexyz/=node_modules/@latticexyz/\",\":ds-test/=node_modules/ds-test/src/\",\":forge-std/=node_modules/forge-std/src/\"]},\"sources\":{\"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol\":{\"keccak256\":\"0xb7fea790ba0b4897d68a6ad1b6272969762acda712f8e465655f0b4ea9d86c03\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4227afe9f8fae6c1e691105afd0cea4a17cfa079f55774547a6ae9bc125b4a37\",\"dweb:/ipfs/QmVA8i35XwNNkS2PCNGTvNSQutwFbVx8qYf5SqsqY9KhaV\"]},\"node_modules/@latticexyz/store/src/PackedCounter.sol\":{\"keccak256\":\"0xc27fe981ae23ca9a894a1e9081dcbec8f88fd12e741445b989ff9a756b29c4a7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://88dc94ac9c32ed8ac65f6e3e872953be04ce27d1645ba505031b1cd34a99b72a\",\"dweb:/ipfs/QmV8VPFDwm8cA1HFr4Kebgu3YdbqkAwKdrwkHpRP1DBXfv\"]},\"node_modules/@latticexyz/store/src/constants.sol\":{\"keccak256\":\"0x88689af9b661f7eb723123fbe212876c2f342cfdb3a01ea7f4e94e9c8f819877\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f39abf5a2306a4346d9909f98d7808474c85ed46d552a503d2a69f4dccb54289\",\"dweb:/ipfs/QmcBLXR8ckXfoBCntFF8YcoTymKNJv7PkmFpgy4zZtTRUd\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@latticexyz/=node_modules/@latticexyz/","ds-test/=node_modules/ds-test/src/","forge-std/=node_modules/forge-std/src/"],"optimizer":{"enabled":true,"runs":3000},"metadata":{"bytecodeHash":"none"},"compilationTarget":{"node_modules/@latticexyz/store/src/PackedCounter.sol":"PackedCounterInstance"},"evmVersion":"paris","libraries":{}},"sources":{"node_modules/@latticexyz/store/src/IPackedCounterErrors.sol":{"keccak256":"0xb7fea790ba0b4897d68a6ad1b6272969762acda712f8e465655f0b4ea9d86c03","urls":["bzz-raw://4227afe9f8fae6c1e691105afd0cea4a17cfa079f55774547a6ae9bc125b4a37","dweb:/ipfs/QmVA8i35XwNNkS2PCNGTvNSQutwFbVx8qYf5SqsqY9KhaV"],"license":"MIT"},"node_modules/@latticexyz/store/src/PackedCounter.sol":{"keccak256":"0xc27fe981ae23ca9a894a1e9081dcbec8f88fd12e741445b989ff9a756b29c4a7","urls":["bzz-raw://88dc94ac9c32ed8ac65f6e3e872953be04ce27d1645ba505031b1cd34a99b72a","dweb:/ipfs/QmV8VPFDwm8cA1HFr4Kebgu3YdbqkAwKdrwkHpRP1DBXfv"],"license":"MIT"},"node_modules/@latticexyz/store/src/constants.sol":{"keccak256":"0x88689af9b661f7eb723123fbe212876c2f342cfdb3a01ea7f4e94e9c8f819877","urls":["bzz-raw://f39abf5a2306a4346d9909f98d7808474c85ed46d552a503d2a69f4dccb54289","dweb:/ipfs/QmcBLXR8ckXfoBCntFF8YcoTymKNJv7PkmFpgy4zZtTRUd"],"license":"MIT"}},"version":1},"id":19}
|