@latticexyz/world 2.2.22-fb2745a7b2d4735a67adffa69e70ec7d1085f4da → 2.2.22-fdb727e847024560315c10ebf32c1f924755ffe9
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/node.js +14 -3
- package/dist/node.js.map +1 -1
- package/package.json +9 -9
package/dist/node.js
CHANGED
@@ -273,6 +273,9 @@ function renderSystemLibrary(options) {
|
|
273
273
|
} = options;
|
274
274
|
const functions = functionsInput.map((func) => ({
|
275
275
|
...func,
|
276
|
+
// Format parameters (add auxiliary argument names, replace calldata location)
|
277
|
+
parameters: formatParams(func.parameters),
|
278
|
+
// Remove `payable` from stateMutability for library functions
|
276
279
|
stateMutability: func.stateMutability.replace("payable", "")
|
277
280
|
}));
|
278
281
|
const imports = [
|
@@ -394,7 +397,7 @@ function renderErrors(errors) {
|
|
394
397
|
}
|
395
398
|
function renderUserTypeFunction(contractFunction, userTypeName) {
|
396
399
|
const { name, parameters, stateMutability, returnParameters } = contractFunction;
|
397
|
-
const args = [`${userTypeName} self`, ...parameters]
|
400
|
+
const args = [`${userTypeName} self`, ...parameters];
|
398
401
|
const functionSignature = `
|
399
402
|
function ${name}(
|
400
403
|
${renderArguments2(args)}
|
@@ -411,7 +414,7 @@ function renderUserTypeFunction(contractFunction, userTypeName) {
|
|
411
414
|
}
|
412
415
|
function renderCallWrapperFunction(contractFunction, callingFromRootSystemErrorName) {
|
413
416
|
const { name, parameters, stateMutability, returnParameters } = contractFunction;
|
414
|
-
const args = [`CallWrapper memory self`, ...parameters]
|
417
|
+
const args = [`CallWrapper memory self`, ...parameters];
|
415
418
|
const functionSignature = `
|
416
419
|
function ${name}(
|
417
420
|
${renderArguments2(args)}
|
@@ -455,7 +458,7 @@ function renderRootCallWrapperFunction(contractFunction, namespace) {
|
|
455
458
|
if (namespace === "" && stateMutability != "") {
|
456
459
|
return "";
|
457
460
|
}
|
458
|
-
const args = ["RootCallWrapper memory self", ...parameters]
|
461
|
+
const args = ["RootCallWrapper memory self", ...parameters];
|
459
462
|
const functionSignature = `
|
460
463
|
function ${name}(
|
461
464
|
${renderArguments2(args)}
|
@@ -516,6 +519,14 @@ function renderReturnParameters2(returnParameters) {
|
|
516
519
|
if (returnParameters.length == 0) return "";
|
517
520
|
return `returns (${renderArguments2(returnParameters)})`;
|
518
521
|
}
|
522
|
+
function formatParams(params) {
|
523
|
+
let auxCount = 0;
|
524
|
+
return params.map((arg) => arg.replace(/ calldata /, " memory ")).map((arg) => {
|
525
|
+
const items = arg.split(" ");
|
526
|
+
const needsAux = items.length === 1 || items.length === 2 && items[1] === "memory";
|
527
|
+
return needsAux ? `${arg} __aux${auxCount++}` : arg;
|
528
|
+
});
|
529
|
+
}
|
519
530
|
|
520
531
|
// ts/node/render-solidity/renderWorldInterface.ts
|
521
532
|
import { renderArguments as renderArguments3, renderedSolidityHeader as renderedSolidityHeader3, renderImports as renderImports3 } from "@latticexyz/common/codegen";
|