@latticexyz/world 2.2.23-a7ce36bd855c91c1a0e7a515c6ed7422ef59973d → 2.2.23-ba07cf09273fba0a246eaf341cdb4eec5328f120

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 (25) hide show
  1. package/dist/node.js +10 -6
  2. package/dist/node.js.map +1 -1
  3. package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
  4. package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
  5. package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
  6. package/out/BatchCallSystemLib.sol/BatchCallSystemLib.json +1 -1
  7. package/out/BatchCallSystemLib.sol/_batchCallFrom_SystemCallFromDataArray.json +1 -1
  8. package/out/BatchCallSystemLib.sol/_batchCall_SystemCallDataArray.json +1 -1
  9. package/out/InitModule.sol/InitModule.json +1 -1
  10. package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
  11. package/out/WorldRegistrationSystemLib.sol/WorldRegistrationSystemLib.json +1 -1
  12. package/out/WorldRegistrationSystemLib.sol/_registerDelegation_address_ResourceId_bytes.json +1 -1
  13. package/out/WorldRegistrationSystemLib.sol/_registerFunctionSelector_ResourceId_string.json +1 -1
  14. package/out/WorldRegistrationSystemLib.sol/_registerNamespaceDelegation_ResourceId_ResourceId_bytes.json +1 -1
  15. package/out/WorldRegistrationSystemLib.sol/_registerNamespace_ResourceId.json +1 -1
  16. package/out/WorldRegistrationSystemLib.sol/_registerRootFunctionSelector_ResourceId_string_string.json +1 -1
  17. package/out/WorldRegistrationSystemLib.sol/_registerSystemHook_ResourceId_ISystemHook_uint8.json +1 -1
  18. package/out/WorldRegistrationSystemLib.sol/_registerSystem_ResourceId_System_bool.json +1 -1
  19. package/out/WorldRegistrationSystemLib.sol/_unregisterDelegation_address.json +1 -1
  20. package/out/WorldRegistrationSystemLib.sol/_unregisterNamespaceDelegation_ResourceId.json +1 -1
  21. package/out/WorldRegistrationSystemLib.sol/_unregisterSystemHook_ResourceId_ISystemHook.json +1 -1
  22. package/out/build-info/{bf27acd14b2b959864c0abf4ffaa7965.json → e6f011585aed24d85d685c8bc5326202.json} +1 -1
  23. package/package.json +9 -9
  24. package/src/codegen/experimental/systems/BatchCallSystemLib.sol +16 -4
  25. package/src/codegen/experimental/systems/WorldRegistrationSystemLib.sol +16 -4
package/dist/node.js CHANGED
@@ -275,7 +275,8 @@ function renderSystemLibrary(options) {
275
275
  const functions = functionsInput.map((func) => ({
276
276
  ...func,
277
277
  // Format parameters (add auxiliary argument names, replace calldata location)
278
- parameters: formatParams(func.parameters),
278
+ parameters: formatParams("__auxArg", func.parameters),
279
+ returnParameters: formatParams("__auxRet", func.returnParameters),
279
280
  // Remove `payable` from stateMutability for library functions
280
281
  stateMutability: func.stateMutability.replace("payable", "")
281
282
  }));
@@ -513,19 +514,22 @@ function renderAbiDecode(expression, returnParameters) {
513
514
  const returnTypes = returnParameters.map((param) => param.split(" ")[0]).join(", ");
514
515
  return `
515
516
  bytes memory result = ${expression};
516
- return abi.decode(result, (${returnTypes}));
517
+ // skip decoding an empty result, which can happen after expectRevert
518
+ if (result.length != 0) {
519
+ return abi.decode(result, (${returnTypes}));
520
+ }
517
521
  `;
518
522
  }
519
523
  function renderReturnParameters2(returnParameters) {
520
524
  if (returnParameters.length == 0) return "";
521
525
  return `returns (${renderArguments2(returnParameters)})`;
522
526
  }
523
- function formatParams(params) {
527
+ function formatParams(auxPrefix, params) {
524
528
  let auxCount = 0;
525
- return params.map((arg) => arg.replace(/ calldata /, " memory ")).map((arg) => {
529
+ return params.map((arg) => arg.replace(/ calldata( |$)/, " memory$1")).map((arg) => {
526
530
  const items = arg.split(" ");
527
- const needsAux = items.length === 1 || items.length === 2 && items[1] === "memory";
528
- return needsAux ? `${arg} __aux${auxCount++}` : arg;
531
+ const needsAux = items.length === 1 || items.length === 2 && ["memory", "payable"].includes(items[1]);
532
+ return needsAux ? `${arg} ${auxPrefix}${auxCount++}` : arg;
529
533
  });
530
534
  }
531
535